diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3h1.c')
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3h1.c | 256 | 
1 files changed, 256 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-omap3h1.c b/arch/arm/mach-omap2/board-omap3h1.c new file mode 100644 index 00000000000..a24b1fdda01 --- /dev/null +++ b/arch/arm/mach-omap2/board-omap3h1.c @@ -0,0 +1,256 @@ +/* + * Copyright (C) 2014 Olio Devices, Inc. + * Authors: Evan Wilson <evan@oliodevices.com> + *			Mattis Fjallstrom <mattis@oliodevices.com> + * + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ + * + * Modified from the original mach-omap/omap2/board-generic.c did by Paul + * to support the OMAP2+ device tree boards with an unique board file. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/delay.h> +#include <linux/err.h> +#include <linux/clk.h> +#include <linux/io.h> +#include <linux/opp.h> +#include <linux/cpu.h> +#include <linux/mpu.h> +#include <linux/spi/spi.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/mtd/nand.h> + +#include <linux/regulator/machine.h> + +#include <linux/led-lm3530.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach/flash.h> + +#include <video/omapdss.h> +#include <video/omap-panel-data.h> +#include <linux/platform_data/mtd-nand-omap2.h> + +#include "common.h" +#include "omap_device.h" +#include "gpmc.h" +#include "soc.h" +#include "mux.h" +#include "pm.h" +#include "board-flash.h" +#include "common-board-devices.h" +#include "board-omap3h1.h" + +#define NAND_CS 0 +#define MPUIRQ_GPIO 31 +#define LCD_RESET_GPIO 122 + +static struct mtd_partition omap3h1_nand_partitions[] = { +	/* All the partition sizes are listed in terms of NAND block size */ +	{ +		.name		= "X-Loader", +		.offset		= 0, +		.size		= 4 * NAND_BLOCK_SIZE, +		.mask_flags	= MTD_WRITEABLE,	/* force read-only */ +	}, +	{ +		.name		= "U-Boot", +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */ +		.size		= 15 * NAND_BLOCK_SIZE, +		.mask_flags	= MTD_WRITEABLE,	/* force read-only */ +	}, +	{ +		.name		= "U-Boot Env", +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x260000 */ +		.size		= 1 * NAND_BLOCK_SIZE, +	}, +	{ +		.name		= "kernel", +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x280000 */ +		.size		= 40 * NAND_BLOCK_SIZE, +	}, +	{ +		.name		= "initramfs", +		.offset		= MTDPART_OFS_APPEND, 	/* Offset = 0xC80000 */ +		.size		= 80 * NAND_BLOCK_SIZE, +	}, +	{ +		.name		= "ramdisk", +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x1180000 */ +		.size		= 40 * NAND_BLOCK_SIZE, +	}, +	{ +		.name		= "system", +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x1680000 */ +		.size		= 2000 * NAND_BLOCK_SIZE, +	}, +	{ +		.name		= "userdata", +		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x11180000 */ +		.size		= MTDPART_SIZ_FULL, +	}, +}; + +static struct omap_dss_device omap3h1_lcd_device = { +	.type				= OMAP_DISPLAY_TYPE_DPI, +	.name				= "olio_h1_panel", +	.driver_name 		= "ili9342_panel", +	.phy.dpi.data_lines = 18, +	.reset_gpio			= LCD_RESET_GPIO, +}; + +static struct omap_dss_device *omap3h1_dss_devices[] = { +		&omap3h1_lcd_device, +}; + +static struct omap_dss_board_info omap3h1_dss_data = { +	.num_devices 	= 1, +	.devices = omap3h1_dss_devices, +	.default_device = &omap3h1_lcd_device, +}; + +static struct spi_board_info omap3h1_spi_board_info[] __initdata = { +	{ +		.modalias		= "ili9342-spi", +		.bus_num		= 1, +		.chip_select 	= 1, +		.max_speed_hz 	= 375000, +		.platform_data	= &omap3h1_lcd_device, +		.mode			= SPI_MODE_0, +	} +}; + +static int __init omap3h1_spi_init(void) { +	spi_register_board_info(omap3h1_spi_board_info, +			ARRAY_SIZE(omap3h1_spi_board_info)); +	return 0; +} + +static struct mpu_platform_data mpu_data = { +	.int_config  = 0x00, +	.level_shifter = 0, +	.orientation = {  -1,  0,  0, +					   0,  1,  0, +					   0,  0, -1 }, +}; + +static struct lm3530_platform_data omap3h1_backlight_platform_data = { +	.mode = LM3530_BL_MODE_MANUAL, +	//.als_input_mode = LM3530_INPUT_ALS1, +	.max_current = LM3530_FS_CURR_12mA, +	//.pwm_pol_hi = true, +	//.als_avrg_time = LM3530_ALS_AVRG_TIME_512ms, +	.brt_ramp_law = 0, +	.brt_ramp_fall = LM3530_RAMP_TIME_2s, +	.brt_ramp_rise = LM3530_RAMP_TIME_2s, +	//.als1_resistor_sel = LM3530_ALS_IMPD_13_53kOhm, +	//.als2_resistor_sel = LM3530_ALS_IMPD_Z, +	//.als_vmin = 730,	/* mV */ +	//.als_vmax = 1020,	/* mV */ +	.brt_val = 0x40,	/* Max brightness */ +}; + +static struct platform_device bcm20702_bluetooth_device = { +	.name = "bcm20702_bluetooth", +	.id = -1, + }; + +static struct i2c_board_info __initdata omap3h1_i2c1_board_info[] = { +		{ +			I2C_BOARD_INFO("mpu6515", 0x68), +			// This is needed for the interrupt wake. IH_GPIO_BASE changed in 3.10 kernel +			//.irq = (IH_GPIO_BASE + MPUIRQ_GPIO), +			.platform_data = &mpu_data, +        }, +    	{ +    		/* Backlight */ +    		I2C_BOARD_INFO("lm3530-led", 0x38), +    		.platform_data = &omap3h1_backlight_platform_data, +    	}, +}; + +static int __init omap3_h1_i2c_init(void) +{ +	omap_register_i2c_bus(1, 400, omap3h1_i2c1_board_info, ARRAY_SIZE(omap3h1_i2c1_board_info)); +	return 0; +} + +static struct platform_device *omap3h1_devices[] __initdata = { +        &bcm20702_bluetooth_device, +}; + +#ifdef CONFIG_OMAP_MUX +static struct omap_board_mux board_mux[] __initdata = { +	OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), + +	OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), + +	OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), +	OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), +	OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), + +	{ .reg_offset = OMAP_MUX_TERMINATOR }, +}; +#endif + +static void __init omap3_h1_init(void) +{ +	omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); + +	omap3_h1_i2c_init(); +	omap_display_init(&omap3h1_dss_data); +	omap_serial_init(); +	omap_sdrc_init(NULL, NULL); + +	board_nand_init(omap3h1_nand_partitions, +			ARRAY_SIZE(omap3h1_nand_partitions), NAND_CS, +			NAND_BUSWIDTH_16, NULL); + +	platform_add_devices(omap3h1_devices, ARRAY_SIZE(omap3h1_devices)); +	omap3h1_spi_init(); +	//h1_opp_init(); +} + +MACHINE_START(OMAP3_H1, "Olio OMAP3 H1 Board") +	.atag_offset	= 0x100, +	.reserve		= omap_reserve, +	.map_io			= omap3_map_io, +	.init_early		= omap3630_init_early, +	.init_irq		= omap3_init_irq, +	.handle_irq		= omap3_intc_handle_irq, +	.init_machine	= omap3_h1_init, +	.init_late		= omap3630_init_late, +	.init_time		= omap3_secure_sync32k_timer_init, +	//.dt_compat		= omap3_h1_boards_compat, +	.restart		= omap3xxx_restart, +MACHINE_END  |