diff options
Diffstat (limited to 'arch/arm/mach-omap2')
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3h1.c | 300 |
1 files changed, 217 insertions, 83 deletions
diff --git a/arch/arm/mach-omap2/board-omap3h1.c b/arch/arm/mach-omap2/board-omap3h1.c index b3e002c4048..8697bcea5af 100644 --- a/arch/arm/mach-omap2/board-omap3h1.c +++ b/arch/arm/mach-omap2/board-omap3h1.c @@ -33,13 +33,11 @@ #include <linux/i2c/atmel_mxt_ts.h> #include <linux/gpio.h> -#include <linux/gpio_keys.h> #include <linux/regulator/machine.h> #include <linux/regulator/fixed.h> #include <linux/mfd/tps65910.h> -#include <linux/kmod.h> /* for call_usermodehelper - not used, remove? */ #include <linux/wakelock.h> /* used in interrupt, waking up. */ #include <linux/debugfs.h> @@ -54,6 +52,10 @@ #include <video/omap-panel-data.h> #include <linux/platform_data/mtd-nand-omap2.h> +#include <linux/of_irq.h> +#include <linux/of_platform.h> + + #include "common.h" #include "omap_device.h" #include "gpmc.h" @@ -67,8 +69,8 @@ #define NAND_CS 0 #define MPUIRQ_GPIO 31 -#define ON_OFF_BUTTON_GPIO 30 #define ATMEL_MXT_GPIO 105 +#define TPS_SYS_NIRQ 0 #define USB_IRQ 124 #define USB_ON_ETK_D7 21 @@ -178,8 +180,8 @@ static int __init omap3h1_spi_init(void) { static struct mpu_platform_data mpu_data = { .int_config = 0x00, .level_shifter = 1, - .orientation = { 0, -1, 0, - -1, 0, 0, + .orientation = { 0, -1, 0, + -1, 0, 0, 0, 0, 1 }, }; @@ -215,32 +217,6 @@ static struct platform_device omap3h1_dmic_codec = { .id = -1, }; -/* --------------------------------------------------------------------------- */ -/* Keys / buttons settings - */ - -static struct gpio_keys_button gpio_buttons[] = { - { - .code = KEY_POWER, /* 26 */ - .gpio = ON_OFF_BUTTON_GPIO, - .desc = "accelerometer", - .wakeup = 1, - }, -}; - -static struct gpio_keys_platform_data gpio_key_info = { - .buttons = gpio_buttons, - .nbuttons = ARRAY_SIZE(gpio_buttons), -}; - -static struct platform_device omap3h1_keys = { - .name = "gpio-keys", - .id = -1, - .dev = { - .platform_data = &gpio_key_info, - }, -}; - /* --------------------------------------------------------------------------- */ /* USB settings @@ -274,7 +250,7 @@ static struct platform_device nop_phy_device = { /* --------------------------------------------------------------------------- */ -/* REGULATORS +/* REGULATOR - Fixed first */ static struct regulator_init_data omap3h1_vbat_data = { @@ -303,8 +279,8 @@ static struct platform_device omap3h1_vbat = { static struct regulator_init_data tps65910_dummy = { .supply_regulator = "VBAT", - .constraints.always_on = false, - /* .constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS, */ + .constraints.always_on = true, + .constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS, }; /* --------------------------------------------------------------------------- */ @@ -319,16 +295,38 @@ static struct regulator_init_data tps65910_touch3 = { .min_uV = 3300000, .max_uV = 3300000, .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS - | REGULATOR_CHANGE_MODE, + .valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_MODE, .always_on = true, .apply_uV = true, + + .state_mem = { + .uV = 0, + .mode = REGULATOR_MODE_STANDBY, + .disabled = 1, + }, + .state_disk = { + .uV = 0, + .mode = REGULATOR_MODE_STANDBY, + .disabled = 1, + }, + .state_standby = { + .uV = 0, + .mode = REGULATOR_MODE_STANDBY, + .disabled = 1, + }, }, + .num_consumer_supplies = ARRAY_SIZE(tps65910_touch3_supply), .consumer_supplies = tps65910_touch3_supply, }; /* --------------------------------------------------------------------------- */ +/* This regulator is for the vibrator. We currently lack a way of enabling / + * disabling this since we lack a driver for the vibrator (we're just accessing + * it's registers through the i2c bus). + * + * Hence, it's always on. + */ static struct regulator_consumer_supply tps65910_vibrator_supply[] = { REGULATOR_SUPPLY("vaux2", "drv2605"), @@ -340,9 +338,7 @@ static struct regulator_init_data tps65910_vibrator = { .min_uV = 3300000, .max_uV = 3300000, .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | - REGULATOR_CHANGE_MODE | - REGULATOR_CHANGE_STATUS, + .valid_ops_mask = REGULATOR_CHANGE_MODE, .always_on = true, .apply_uV = true, }, @@ -353,7 +349,15 @@ static struct regulator_init_data tps65910_vibrator = { /* --------------------------------------------------------------------------- */ +/* Seems like this one has to be on. It doesn't have any "official" consumers + * ... but it's definitely needed. Bluetooth relies on it. + */ +/* +static struct regulator_consumer_supply tps65910_bluetooth_3v3[] = { + REGULATOR_SUPPLY("clk32ksys", 0), +}; +*/ static struct regulator_init_data tps65910_3v3 = { .supply_regulator = "VBAT", @@ -361,23 +365,35 @@ static struct regulator_init_data tps65910_3v3 = { .min_uV = 3300000, .max_uV = 3300000, .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | - REGULATOR_CHANGE_MODE | + .valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, .always_on = true, .apply_uV = true, + + .state_mem = { + .disabled = 1, + }, + .state_disk = { + .disabled = 1, + }, + .state_standby = { + .disabled = 1, + }, }, + }; /* --------------------------------------------------------------------------- */ -/* This regulator must not be allowed to change status, doing so causes - * reboots to fail. Not sure why that is. --mfj +/* This is the OMAP display subsystem. Part of the OMAP processor OCP stuff. + * USB also depends on this, so if you want to transfer files it has to be + * always on. */ static struct regulator_consumer_supply tps65910_1v8_supply[] = { REGULATOR_SUPPLY("vdds_dsi", "omapdss"), - REGULATOR_SUPPLY("vin", "2-0038"), + /* REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"), */ + /* REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.1"), */ }; static struct regulator_init_data tps65910_1v8 = { @@ -386,27 +402,49 @@ static struct regulator_init_data tps65910_1v8 = { .min_uV = 1800000, .max_uV = 1800000, .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE, - .always_on = false, + .valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, + .always_on = true, .apply_uV = true, + + .state_mem = { + .uV = 0, + .mode = REGULATOR_MODE_STANDBY, + .disabled = 1, + }, + .state_disk = { + .uV = 0, + .mode = REGULATOR_MODE_STANDBY, + .disabled = 1, + }, + .state_standby = { + .uV = 0, + .mode = REGULATOR_MODE_STANDBY, + .disabled = 1, + }, + }, .num_consumer_supplies = ARRAY_SIZE(tps65910_1v8_supply), .consumer_supplies = tps65910_1v8_supply, }; /* --------------------------------------------------------------------------- */ +/* This isn't actually used, but the wires are required by the processor / + * PMIC. I should be able to set it to constant standby mode (and maybe + * also some sort of off setting?). + */ static struct regulator_consumer_supply tps65910_vpll_supply[] = { - }; + +}; static struct regulator_init_data tps65910_vpll = { .supply_regulator = "VBAT", .constraints = { .min_uV = 1800000, .max_uV = 1800000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, - .always_on = false, + .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, + .always_on = true, .apply_uV = true, }, .num_consumer_supplies = ARRAY_SIZE(tps65910_vpll_supply), @@ -418,6 +456,7 @@ static struct regulator_init_data tps65910_vpll = { static struct regulator_consumer_supply tps65910_touch_supply[] = { REGULATOR_SUPPLY("vdd", "2-004a" ), + REGULATOR_SUPPLY("vdd", "spi1.1"), }; static struct regulator_init_data tps65910_touch = { @@ -426,19 +465,35 @@ static struct regulator_init_data tps65910_touch = { .min_uV = 1800000, .max_uV = 1800000, .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, + .valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, .always_on = false, .apply_uV = true, + + .state_mem = { + .uV = 0, + .mode = REGULATOR_MODE_STANDBY, + .disabled = 1, + }, + .state_disk = { + .mode = REGULATOR_MODE_STANDBY, + .disabled = 1, + }, + .state_standby = { + .mode = REGULATOR_MODE_STANDBY, + .disabled = 1, + }, + }, .num_consumer_supplies = ARRAY_SIZE(tps65910_touch_supply), .consumer_supplies = tps65910_touch_supply, }; +/* =========================================================================== */ /* --------------------------------------------------------------------------- */ /* This one only works if 'always_on' is set to true. Do I need to do something - * special otherwise to turn it on? + * special otherwise to turn it on? Maybe the driver doesn't enable it. */ static struct regulator_consumer_supply tps65910_accel_supply[] = { @@ -450,16 +505,29 @@ static struct regulator_init_data tps65910_accel = { .constraints = { .min_uV = 1800000, .max_uV = 1800000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_STATUS, + .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE | REGULATOR_MODE_STANDBY, + .valid_ops_mask = REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, .always_on = true, .apply_uV = true, + + .state_mem = { + .disabled = 1, + }, + .state_disk = { + .disabled = 1, + }, + .state_standby = { + .disabled = 1, + }, }, .num_consumer_supplies = ARRAY_SIZE(tps65910_accel_supply), .consumer_supplies = tps65910_accel_supply, }; /* --------------------------------------------------------------------------- */ +/* This one isn't pulled on by the CPU ... wrong supply name ? + * Also, the TWL code does NOT have always on set. + */ static struct regulator_consumer_supply tps65910_vdd1_supply[] = { REGULATOR_SUPPLY("vcc", "cpu0"), @@ -468,18 +536,21 @@ static struct regulator_consumer_supply tps65910_vdd1_supply[] = { static struct regulator_init_data tps65910_vdd1 = { .supply_regulator = "VBAT", .constraints = { - .name = "vdd_mpu", + .name = "vdd_mpu_iva", .min_uV = 900000, .max_uV = 1350000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, - .always_on = false, + .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE, + .always_on = true, }, + .num_consumer_supplies = ARRAY_SIZE(tps65910_vdd1_supply), .consumer_supplies = tps65910_vdd1_supply, }; /* --------------------------------------------------------------------------- */ +/* I seem to need always on, but the TWL code gets by without it. So... + */ static struct regulator_consumer_supply tps65910_vdd2_supply[] = { REGULATOR_SUPPLY("vcc", "l3_main.0"), @@ -491,19 +562,30 @@ static struct regulator_init_data tps65910_vdd2 = { .name = "vdd_core", .min_uV = 900000, .max_uV = 1200000, - .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_STANDBY, - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE | REGULATOR_CHANGE_STATUS, - .always_on = false, + .valid_modes_mask = REGULATOR_MODE_NORMAL | REGULATOR_MODE_IDLE, + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | REGULATOR_CHANGE_MODE, + .always_on = true, }, + .num_consumer_supplies = ARRAY_SIZE(tps65910_vdd2_supply), .consumer_supplies = tps65910_vdd2_supply, }; /* --------------------------------------------------------------------------- */ +static struct tps65910_sleep_keepon_data olio_slp_keepon = { + .therm_keepon = 0, + .clkout32k_keepon = 1, + .i2chs_keepon = 0, +}; + + static struct tps65910_board omap3h1_tps65910_pdata = { - .irq = 7 + OMAP_INTC_START, + /* .irq = 7 + OMAP_INTC_START, */ /* Getting this at runtime instead. */ .en_ck32k_xtal = true, + /* .en_dev_slp = true, */ + + /* .slp_keepon = &olio_slp_keepon, */ .tps65910_pmic_init_data[TPS65910_REG_VIO] = &tps65910_1v8, .tps65910_pmic_init_data[TPS65910_REG_VDD1] = &tps65910_vdd1, @@ -515,7 +597,7 @@ static struct tps65910_board omap3h1_tps65910_pdata = { .tps65910_pmic_init_data[TPS65910_REG_VMMC] = &tps65910_touch3, .tps65910_pmic_init_data[TPS65910_REG_VAUX2] = &tps65910_vibrator, - /* This one is connected to BT */ + /* This one is connected to BT ... maybe more? */ .tps65910_pmic_init_data[TPS65910_REG_VAUX33] = &tps65910_3v3, @@ -555,7 +637,7 @@ static u8 olio_uv_to_vsel(unsigned long uv) static struct omap_voltdm_pmic omap3_mpu_pmic = { - .slew_rate = 4000, + .slew_rate = 12500, .step_size = 12500, .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, @@ -571,7 +653,7 @@ static struct omap_voltdm_pmic omap3_mpu_pmic = { }; static struct omap_voltdm_pmic omap3_core_pmic = { - .slew_rate = 4000, + .slew_rate = 12500, .step_size = 12500, .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, @@ -812,6 +894,20 @@ static int __init omap3_acc_irq_init (int irq, void * dev_id) { } +/*************************************************************************** + * DEVICE TREE STUFF + * + * Trying to include some DT stuff with our board file. Not sure how this + * will work out... + */ + +static struct of_device_id omap_dt_match_table[] __initdata = { + { .compatible = "olio,omap3-h1", }, + { .compatible = "simple-bus", }, + { .compatible = "ti,omap-infra", }, + { } +}; + /*************************************************************************** * omap3_h1_i2c_init - init the i2c buses @@ -822,12 +918,12 @@ static int __init omap3_h1_i2c_init(void) { int acc_irq; - /* In Linux 3.10 we need to request an IRQ through - * gpio_to_irq. This means it can't be set at compile time, and - * must be done at runtime. In other words, here. - */ - - gpio_request_one(ATMEL_MXT_GPIO, GPIOF_IN, "atmel_mxt_ts CHG"); + /* In Linux 3.10 we need to request an IRQ through + * gpio_to_irq. This means it can't be set at compile time, and + * must be done at runtime. In other words, here. + */ + + gpio_request_one(ATMEL_MXT_GPIO, GPIOF_IN, "atmel_mxt_ts CHG"); gpio_request_one(MPUIRQ_GPIO, GPIOF_IN, "mpu6515 IRQ pin"); acc_irq = gpio_to_irq(MPUIRQ_GPIO); @@ -835,6 +931,9 @@ static int __init omap3_h1_i2c_init(void) #ifdef CONFIG_MACH_OMAP3_H1_DVT2 omap3h1_i2c2_board_info[2].irq = gpio_to_irq(ATMEL_MXT_GPIO); omap3h1_i2c2_board_info[0].irq = acc_irq; + + ((struct tps65910_board *) (omap3h1_i2c1_board_info[0].platform_data))->irq = + gpio_to_irq (TPS_SYS_NIRQ); #else omap3h1_i2c1_board_info[3].irq = gpio_to_irq(ATMEL_MXT_GPIO); omap3h1_i2c1_board_info[1].irq = acc_irq; @@ -863,7 +962,6 @@ static struct platform_device *omap3h1_devices[] __initdata = { &bcm20702_bluetooth_device, &nop_phy_device, &omap3h1_dmic_codec, - &omap3h1_keys, }; #ifdef CONFIG_OMAP_MUX @@ -931,6 +1029,8 @@ static struct omap_board_mux board_mux[] __initdata = { OMAP3_MUX(ETK_D7, (OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT)), + OMAP3_MUX(SYS_NIRQ, (OMAP_MUX_MODE0 | OMAP_PIN_INPUT)), + { .reg_offset = OMAP_MUX_TERMINATOR }, }; #endif @@ -949,29 +1049,41 @@ static int __init omap3_wake_init (void) { static void __init omap3_h1_init(void) { - omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); + /* Read what we can from the device tree */ - omap3_h1_i2c_init(); - - omap_display_init(&omap3h1_dss_data); - omap_serial_init(); - omap_sdrc_init(NULL, NULL); + of_platform_populate(NULL, omap_dt_match_table, 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)); + /* Set up the voltage domains */ - omap3h1_spi_init(); + omap_sdrc_init(NULL, NULL); - usb_bind_phy("musb-hdrc.0.auto", 0, "nop_usb_xceiv"); /* "tusb-usb-h1" */ - usb_musb_init(&musb_board_data); + omap3_mux_init(board_mux, OMAP_PACKAGE_CBP); - /* Set up the voltage domains */ + omap3_h1_i2c_init(); omap3_voltdm_init(); + omap3h1_spi_init(); + + omap_serial_init(); + + platform_add_devices(omap3h1_devices, ARRAY_SIZE(omap3h1_devices)); + + /* TODO: The display only coming on on second boot and on may be + * related to the display init happening before many other things + * on the board. --mfj + */ + + omap_display_init(&omap3h1_dss_data); + + usb_bind_phy("musb-hdrc.0.auto", 0, "nop_usb_xceiv"); /* "tusb-usb-h1" */ + + usb_musb_init(&musb_board_data); + /* For handling interrupts from the accelerometer */ /* previous = jiffies; */ @@ -983,6 +1095,27 @@ static void __init omap3_h1_init(void) /* omap3_acc_irq_init(omap3h1_i2c2_board_info[0].irq, (void *) &omap3h1_devices); */ } +static const char *omap3_h1_boards_compat[] __initdata = { + "olio,omap3-h1", + NULL, +}; + +DT_MACHINE_START(OMAP3_H1, "Olio OMAP3 H1 (Flattened Device Tree)") + .atag_offset = 0x100, + .reserve = omap_reserve, + .map_io = omap3_map_io, + .init_early = omap3630_init_early, + /* .init_irq = omap3_init_irq, */ + .init_irq = omap_intc_of_init, + .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 + +#if 0 /* removing ... for now */ MACHINE_START(OMAP3_H1, "Olio OMAP3 H1 Board") .atag_offset = 0x100, .reserve = omap_reserve, @@ -996,3 +1129,4 @@ MACHINE_START(OMAP3_H1, "Olio OMAP3 H1 Board") /* .dt_compat = omap3_h1_boards_compat, */ .restart = omap3xxx_restart, MACHINE_END +#endif |