summaryrefslogtreecommitdiff
path: root/arch/arm/mach-omap2/board-omap3h1.c
diff options
context:
space:
mode:
authormattis fjallstrom <mattis@acm.org>2015-09-25 16:02:20 -0700
committermattis fjallstrom <mattis@acm.org>2015-09-25 16:02:20 -0700
commitd955f0cd9c528ed33d7da0c760f46572381c2039 (patch)
treef5fadaebd96d1fcc1747e90747db72a8f99e4a5d /arch/arm/mach-omap2/board-omap3h1.c
parent9349b6c5b9f2bbe3cdaace0fc4774dc6baf5f7ba (diff)
downloadolio-linux-3.10-d955f0cd9c528ed33d7da0c760f46572381c2039.tar.xz
olio-linux-3.10-d955f0cd9c528ed33d7da0c760f46572381c2039.zip
Adding support for ts81001, and modifying fuel gauge bq27 to check the status of the ts81001 when deciding if it's charging or not.
Change-Id: Iff0e890eecd86c82889f91075f83073ab2fd3036
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3h1.c')
-rw-r--r--arch/arm/mach-omap2/board-omap3h1.c317
1 files changed, 164 insertions, 153 deletions
diff --git a/arch/arm/mach-omap2/board-omap3h1.c b/arch/arm/mach-omap2/board-omap3h1.c
index 84dde6d63b0..14a0008d0b9 100644
--- a/arch/arm/mach-omap2/board-omap3h1.c
+++ b/arch/arm/mach-omap2/board-omap3h1.c
@@ -56,7 +56,7 @@
#include <linux/of_irq.h>
#include <linux/of_platform.h>
-
+#include <linux/power/bq27x00_battery.h>
#include "common.h"
#include "omap_device.h"
@@ -170,7 +170,7 @@ static struct omap_dss_device omap3h1_lcd_device = {
};
static struct omap_dss_device *omap3h1_dss_devices[] = {
- &omap3h1_lcd_device,
+ &omap3h1_lcd_device,
};
static struct omap_dss_board_info omap3h1_dss_data = {
@@ -191,9 +191,9 @@ static struct spi_board_info omap3h1_spi_board_info[] __initdata = {
};
static int __init omap3h1_spi_init(void) {
- spi_register_board_info(omap3h1_spi_board_info,
- ARRAY_SIZE(omap3h1_spi_board_info));
- return 0;
+ spi_register_board_info(omap3h1_spi_board_info,
+ ARRAY_SIZE(omap3h1_spi_board_info));
+ return 0;
}
@@ -210,11 +210,16 @@ static struct mpu_platform_data mpu_data = {
.int_config = 0x00,
.level_shifter = 1,
.orientation = { 0, -1, 0,
- -1, 0, 0,
- 0, 0, 1 },
+ -1, 0, 0,
+ 0, 0, 1 },
};
#endif
+
+static struct bq27x00_platform_data bq_platform_data = {
+ .charger_name = "3-0049",
+};
+
static struct lm3530_platform_data omap3h1_backlight_platform_data = {
.mode = LM3530_BL_MODE_SIMPLE_MANUAL,
//.als_input_mode = LM3530_INPUT_ALS1,
@@ -232,11 +237,9 @@ static struct lm3530_platform_data omap3h1_backlight_platform_data = {
.pwm_gpio = BACKLIGHT_PWM_GPIO,
};
-
-
static struct mxt_platform_data mxt_data = {
- .irqflags = IRQF_TRIGGER_FALLING,
- .suspend_mode = MXT_SUSPEND_DEEP_SLEEP
+ .irqflags = IRQF_TRIGGER_FALLING,
+ .suspend_mode = MXT_SUSPEND_DEEP_SLEEP
};
@@ -246,10 +249,11 @@ static struct platform_device bcm20702_bluetooth_device = {
};
static struct platform_device omap3h1_dmic_codec = {
- .name = "dmic-codec",
- .id = -1,
+ .name = "dmic-codec",
+ .id = -1,
};
+
/* --------------------------------------------------------------------------- */
/* USB settings
*/
@@ -263,18 +267,18 @@ static struct omap_musb_board_data musb_board_data = {
};
static struct nop_usb_xceiv_platform_data nop_plat_data = {
- .type = USB_PHY_TYPE_USB2,
- .clk_rate = 60000000, /* 60 MHz */
- .needs_vcc = 1,
- .needs_reset = 0,
+ .type = USB_PHY_TYPE_USB2,
+ .clk_rate = 60000000, /* 60 MHz */
+ .needs_vcc = 1,
+ .needs_reset = 0,
};
static struct platform_device nop_phy_device = {
- .name = "nop_usb_xceiv",
- .id = -1,
- .dev = {
- .platform_data = &nop_plat_data,
- },
+ .name = "nop_usb_xceiv",
+ .id = -1,
+ .dev = {
+ .platform_data = &nop_plat_data,
+ },
};
@@ -289,124 +293,132 @@ static struct platform_device nop_phy_device = {
static struct i2c_board_info __initdata omap3h1_i2c1_board_info[] = {
- {
- },
+ {
+ },
#if defined (CONFIG_MACH_OMAP3_H1_DVT2) || defined (CONFIG_MACH_OMAP3_H1_PV)
};
static struct i2c_board_info __initdata omap3h1_i2c2_board_info[] = {
#endif
- {
+ {
#ifdef CONFIG_MACH_OMAP3_H1_PV2
- I2C_BOARD_INFO("lsm6ds3", 0x6a),
+ I2C_BOARD_INFO("lsm6ds3", 0x6a),
#else
- I2C_BOARD_INFO("mpu6515", 0x68),
- .platform_data = &mpu_data,
+ I2C_BOARD_INFO("mpu6515", 0x68),
+ .platform_data = &mpu_data,
#endif
- },
- {
- /* Backlight */
- I2C_BOARD_INFO("lm3530-led", 0x38),
- .platform_data = &omap3h1_backlight_platform_data,
- },
- {
- I2C_BOARD_INFO("mXT224", 0x4a),
- .platform_data = &mxt_data,
- },
- {
- I2C_BOARD_INFO("cm3391", 0x10),
- },
+ },
+ {
+ /* Backlight */
+ I2C_BOARD_INFO("lm3530-led", 0x38),
+ .platform_data = &omap3h1_backlight_platform_data,
+ },
+ {
+ I2C_BOARD_INFO("mXT224", 0x4a),
+ .platform_data = &mxt_data,
+ },
+ {
+ I2C_BOARD_INFO("cm3391", 0x10),
+ },
#ifdef CONFIG_MACH_OMAP3_H1_EVT1
};
static struct i2c_board_info __initdata omap3h1_i2c3_board_info[] = {
#endif
- {
- I2C_BOARD_INFO("bq274xx", 0x55),
- },
+ {
+ I2C_BOARD_INFO("bq274xx", 0x55),
+ .platform_data = &bq_platform_data,
+ },
};
+#ifdef CONFIG_MACH_OMAP3_H1_PV2
+static struct i2c_board_info __initdata omap3h1_i2c3_board_info[] = {
+ {
+ I2C_BOARD_INFO("ts81001", 0x49),
+ },
+};
+#endif
/***************************************************************************
* omap_uart data
*/
/* Some notes:
- .dma_enabled = false,
- .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
- .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
- .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
- This one sets runtime pm autosuspend timeout - -1 disables runtime
- pm (that is, pm that's done while running, not sleeping).
- .autosuspend_timeout = DEFAULT_AUTOSUSPEND_DELAY, ( -1 or X ms. )
+ .dma_enabled = false,
+ .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
+ .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
+ .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
+ This one sets runtime pm autosuspend timeout - -1 disables runtime
+ pm (that is, pm that's done while running, not sleeping).
+ .autosuspend_timeout = DEFAULT_AUTOSUSPEND_DELAY, ( -1 or X ms. )
- Wakelock timeout: If there's an interrupt on the serial port, this is
- how long we expect to wait before the system is functional.
- .wakelock_timeout - for minnow, this is 150 (BT) or 50 (M4 debug).
- Can be left out.
+ Wakelock timeout: If there's an interrupt on the serial port, this is
+ how long we expect to wait before the system is functional.
+ .wakelock_timeout - for minnow, this is 150 (BT) or 50 (M4 debug).
+ Can be left out.
- .DTR_* -> can be left out. I can't find anyone using it.
+ .DTR_* -> can be left out. I can't find anyone using it.
- int DTR_gpio;
- int DTR_inverted;
- int DTR_present;
- bool wakeup_capable;
+ int DTR_gpio;
+ int DTR_inverted;
+ int DTR_present;
+ bool wakeup_capable;
- bool open_close_pm; - Minnow uses this for c55 only
- unsigned int rx_trig; Minnow, BT & debug only
+ bool open_close_pm; - Minnow uses this for c55 only
+ unsigned int rx_trig; Minnow, BT & debug only
- The flags field is not used (it's hardcoded in omap_serial_init_port).
+ The flags field is not used (it's hardcoded in omap_serial_init_port).
*/
static struct omap_uart_port_info omap_uart_ports[] = {
- {
- .dma_enabled = false, /* To specify DMA Mode */
- .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
- .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
- .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
- .autosuspend_timeout = 100,
- .wakelock_timeout = 150,
- .wake_peer = bcm_bt_lpm_exit_lpm_locked,
- .wakeup_capable = true,
- .rx_trig = 32,
+ {
+ .dma_enabled = false, /* To specify DMA Mode */
+ .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
+ .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
+ .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
+ .autosuspend_timeout = 100,
+ .wakelock_timeout = 150,
+ .wake_peer = bcm_bt_lpm_exit_lpm_locked,
+ .wakeup_capable = true,
+ .rx_trig = 32,
- /* OLIO: make sure RTS isn't enabled before we're ready */
+ /* OLIO: make sure RTS isn't enabled before we're ready */
- .rts_wait = true,
- .rts_enable_fn = rts_exit_sleep_mode,
- .rts_disable_fn = rts_enter_sleep_mode,
- },
- {
- .dma_enabled = false, /* To specify DMA Mode */
- .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
- .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
- .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
- .autosuspend_timeout = 0,
- .wakeup_capable = false,
- .rts_wait = false,
- .rts_enable_fn = NULL,
- .rts_disable_fn = NULL,
- },
- {
- .dma_enabled = false, /* To specify DMA Mode */
- .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
- .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
- .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
- .autosuspend_timeout = -1,
- .wakeup_capable = true,
- .rts_wait = false,
- .rts_enable_fn = NULL,
- .rts_disable_fn = NULL,
- },
- {
- .dma_enabled = false, /* To specify DMA Mode */
- .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
- .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
- .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
- .autosuspend_timeout = 0,
- .wakeup_capable = false,
- .rts_wait = false,
- .rts_enable_fn = NULL,
- .rts_disable_fn = NULL,
- },
+ .rts_wait = true,
+ .rts_enable_fn = rts_exit_sleep_mode,
+ .rts_disable_fn = rts_enter_sleep_mode,
+ },
+ {
+ .dma_enabled = false, /* To specify DMA Mode */
+ .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
+ .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
+ .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
+ .autosuspend_timeout = 0,
+ .wakeup_capable = false,
+ .rts_wait = false,
+ .rts_enable_fn = NULL,
+ .rts_disable_fn = NULL,
+ },
+ {
+ .dma_enabled = false, /* To specify DMA Mode */
+ .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
+ .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
+ .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
+ .autosuspend_timeout = -1,
+ .wakeup_capable = true,
+ .rts_wait = false,
+ .rts_enable_fn = NULL,
+ .rts_disable_fn = NULL,
+ },
+ {
+ .dma_enabled = false, /* To specify DMA Mode */
+ .dma_rx_buf_size = DEFAULT_RXDMA_BUFSIZE,
+ .dma_rx_timeout = DEFAULT_RXDMA_TIMEOUT,
+ .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE,
+ .autosuspend_timeout = 0,
+ .wakeup_capable = false,
+ .rts_wait = false,
+ .rts_enable_fn = NULL,
+ .rts_disable_fn = NULL,
+ },
};
@@ -417,76 +429,75 @@ static struct omap_uart_port_info omap_uart_ports[] = {
static int __init omap3_h1_i2c_init(void)
{
- int acc_irq;
+ 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.
- */
+ /* 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(ATMEL_MXT_GPIO, GPIOF_IN, "atmel_mxt_ts CHG");
gpio_request_one(MPUIRQ_GPIO, GPIOF_IN, "Accl IRQ pin");
- acc_irq = gpio_to_irq(MPUIRQ_GPIO);
+ acc_irq = gpio_to_irq(MPUIRQ_GPIO);
#if defined (CONFIG_MACH_OMAP3_H1_DVT2) || defined (CONFIG_MACH_OMAP3_H1_PV)
omap3h1_i2c2_board_info[2].irq = gpio_to_irq(ATMEL_MXT_GPIO);
- omap3h1_i2c2_board_info[0].irq = acc_irq;
+ omap3h1_i2c2_board_info[0].irq = acc_irq;
#else
omap3h1_i2c1_board_info[3].irq = gpio_to_irq(ATMEL_MXT_GPIO);
- omap3h1_i2c1_board_info[1].irq = acc_irq;
+ omap3h1_i2c1_board_info[1].irq = acc_irq;
#endif
#if defined (CONFIG_MACH_OMAP3_H1_PV)
- omap3h1_i2c2_board_info[4].irq = gpio_to_irq(CHG_GPOUT);
+ omap3h1_i2c2_board_info[4].irq = gpio_to_irq(CHG_GPOUT);
#endif
gpio_request_one(USB_CS, GPIOF_OUT_INIT_HIGH, "USB on");
- /* Register buses */
+ /* Register buses */
// omap_register_i2c_bus(1, 400, omap3h1_i2c1_board_info, ARRAY_SIZE(omap3h1_i2c1_board_info));
#if defined (CONFIG_MACH_OMAP3_H1_DVT2) || defined (CONFIG_MACH_OMAP3_H1_PV)
- omap_register_i2c_bus(2, 400, omap3h1_i2c2_board_info, ARRAY_SIZE(omap3h1_i2c2_board_info));
+ omap_register_i2c_bus(2, 400, omap3h1_i2c2_board_info,
+ ARRAY_SIZE(omap3h1_i2c2_board_info));
#else
omap_register_i2c_bus(2, 400, NULL, 0);
#endif
-#ifdef CONFIG_MACH_OMAP3_H1_EVT1
- omap_register_i2c_bus(3, 400, omap3h1_i2c3_board_info, ARRAY_SIZE(omap3h1_i2c3_board_info));
-#else
- omap_register_i2c_bus(3, 100, NULL, 0);
-#endif
+ omap_register_i2c_bus(3, 100, omap3h1_i2c3_board_info,
+ ARRAY_SIZE(omap3h1_i2c3_board_info));
+
return 0;
}
static struct platform_device *omap3h1_devices[] __initdata = {
- &bcm20702_bluetooth_device,
- &nop_phy_device,
- &omap3h1_dmic_codec,
+ &bcm20702_bluetooth_device,
+ &nop_phy_device,
+ &omap3h1_dmic_codec,
};
static void __init omap3_h1_init(void)
{
- /* Read what we can from the device tree */
+ /* Read what we can from the device tree */
- of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
+ of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
#ifdef CONFIG_MACH_OMAP3_H1_PV
- /* The PV units need reversed polarity for the sysclkreq pin. */
+ /* The PV units need reversed polarity for the sysclkreq pin. */
- omap2_prm_rmw_mod_reg_bits(OMAP3430_CLKREQ_POL_MASK,
- 0, OMAP3430_GR_MOD,
- OMAP3_PRM_POLCTRL_OFFSET);
+ omap2_prm_rmw_mod_reg_bits(OMAP3430_CLKREQ_POL_MASK,
+ 0, OMAP3430_GR_MOD,
+ OMAP3_PRM_POLCTRL_OFFSET);
#endif
board_nand_init(omap3h1_nand_partitions,
- ARRAY_SIZE(omap3h1_nand_partitions), NAND_CS,
- NAND_BUSWIDTH_16, NULL);
+ ARRAY_SIZE(omap3h1_nand_partitions), NAND_CS,
+ NAND_BUSWIDTH_16, NULL);
omap_sdrc_init(mt29c8g96_sdrc_params, mt29c8g96_sdrc_params);
-
- omap3_h1_i2c_init();
+
+ omap3_h1_i2c_init();
platform_add_devices(omap3h1_devices, ARRAY_SIZE(omap3h1_devices));
@@ -494,7 +505,7 @@ static void __init omap3_h1_init(void)
omap_serial_board_init(omap_uart_ports);
- omap_display_init(&omap3h1_dss_data);
+ omap_display_init(&omap3h1_dss_data);
usb_bind_phy("musb-hdrc.0.auto", 0, "nop_usb_xceiv"); /* "tusb-usb-h1" */
@@ -507,23 +518,23 @@ static const char *omap3_h1_boards_compat[] __initdata = {
};
DT_MACHINE_START(OMAP3_H1, "Olio OMAP3 H1 (Flattened Device Tree)")
- .atag_offset = 0x100,
+.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,
+/* .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_sync32k_timer_init,
- /* .init_time = omap3_secure_sync32k_timer_init, */
+ .init_time = omap3_sync32k_timer_init,
+/* .init_time = omap3_secure_sync32k_timer_init, */
.dt_compat = omap3_h1_boards_compat,
.restart = omap3xxx_restart,
-MACHINE_END
+ MACHINE_END
#if 0 /* removing ... for now */
-MACHINE_START(OMAP3_H1, "Olio OMAP3 H1 Board")
+ MACHINE_START(OMAP3_H1, "Olio OMAP3 H1 Board")
.atag_offset = 0x100,
.reserve = omap_reserve,
.map_io = omap3_map_io,
@@ -532,9 +543,9 @@ MACHINE_START(OMAP3_H1, "Olio OMAP3 H1 Board")
.handle_irq = omap3_intc_handle_irq,
.init_machine = omap3_h1_init,
.init_late = omap3630_init_late,
- .init_time = omap3_sync32k_timer_init,
- /* .init_time = omap3_secure_sync32k_timer_init, */
- /* .dt_compat = omap3_h1_boards_compat, */
+ .init_time = omap3_sync32k_timer_init,
+/* .init_time = omap3_secure_sync32k_timer_init, */
+/* .dt_compat = omap3_h1_boards_compat, */
.restart = omap3xxx_restart,
-MACHINE_END
+ MACHINE_END
#endif