diff options
Diffstat (limited to 'arch/arm')
| -rw-r--r-- | arch/arm/boot/dts/omap3_h1.dts | 8 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3h1-bluetooth.c | 83 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3h1.c | 21 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/board-omap3h1.h | 2 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/serial.c | 3 |
5 files changed, 77 insertions, 40 deletions
diff --git a/arch/arm/boot/dts/omap3_h1.dts b/arch/arm/boot/dts/omap3_h1.dts index ff0ed298de7..b8c949698ae 100644 --- a/arch/arm/boot/dts/omap3_h1.dts +++ b/arch/arm/boot/dts/omap3_h1.dts @@ -75,7 +75,7 @@ /* listed below will be reported as the wakeup reason */ /* */ /* off IRQ handle */ - ti,pad_irq = <0x150 88 1>, /* uart1 - BT input */ + ti,pad_irq = <0x150 88 1>, /* 72 + 16, uart1 - BT input */ <0x9f6 143 1>, /* mpu6515 irq pin - is this offset correct? */ <0x9ea 122 1>, /* bq27400 chg irq8 */ <0x9f4 123 1>, /* BT host wake */ @@ -148,7 +148,7 @@ 0x19c 0x118 /* MCSPI1_SOMI, MODE0 | INPUT_PULLUP */ 0x1a0 0x000 /* MCSPI1_CS1, MODE0 | OUTPUT */ - /* CKE pin for memory */ + /* CKE pin for memory */ 0x232 0x000 /* SDRC_CKE0, MODE0 | OUTPUT */ 0x234 0x000 /* SDRC_CKE1, MODE0 | OUTPUT */ @@ -194,14 +194,14 @@ OMAP_PIN_OFF_WAKEUPENABLE */ 0x14c 0x000 /* UART1, BT, TX */ - 0x14e 0x000 /* UART1, BT, RTS - E00 = output high off */ + 0x14e 0xA00 /* UART1, BT, RTS - A00 = output off high, this one is active low! */ 0x150 0x4100 /* UART1, BT, CTS */ 0x152 0x100 /* UART1, BT, RX */ /* BT_WAKE_GPIO - for waking up BT */ /* OMAP_OFF_ENABLE, OMAP_OFF_PULL_EN, OMAP_OFF_OUTENABLE for sleep modes. */ /* Now set this to regular old output .. also off enable, output low. (0x600) */ - 0x0da 0x604 /* 0x1604 */ /* DSS_DATA23, (IDIS | PI | M4 ) */ + 0x0da 0x004 /* 0x1604 */ /* DSS_DATA23, (IDIS | PI | M4 ) */ >; }; diff --git a/arch/arm/mach-omap2/board-omap3h1-bluetooth.c b/arch/arm/mach-omap2/board-omap3h1-bluetooth.c index a56ae4e4bd5..2d502bab5a6 100644 --- a/arch/arm/mach-omap2/board-omap3h1-bluetooth.c +++ b/arch/arm/mach-omap2/board-omap3h1-bluetooth.c @@ -41,6 +41,10 @@ #include "board-omap3h1.h" #include <linux/regulator/driver.h> +#include "asm/io.h" +#include "mux.h" +#include "iomap.h" + static void set_host_wake_locked(int); #define BT_RESET_GPIO 179 @@ -48,6 +52,7 @@ static void set_host_wake_locked(int); #define BT_WAKE_GPIO 93 #define BT_HOST_WAKE_GPIO 11 #define UART_PORT 0 /* UART 1 = 0 */ +#define BT_RST_PIN 149 #define olio_debug(format, ...) printk ("OLIO %s: ", __FUNCTION__); printk (format, ##__VA_ARGS__) @@ -79,12 +84,49 @@ static struct bcm_bt_lpm { char bcm_wake_lock_name[100]; } bt_lpm; +static int wake_mode_calls = 0; + +/*************************************************************************** + * rts_enter_sleep_mode - set RTS pin to off mode + * + * The RTS pin needs to be kept high while sleeping. + */ + +void rts_enter_sleep_mode() +{ + if (wake_mode_calls == 0) + __raw_writew ((u16) ( 1 << 8 | 1 << 4 | 1 << 3 | 4 ), + (volatile void *) OMAP2_L4_IO_ADDRESS(OMAP3_CONTROL_PADCONF_MUX_PBASE) + + OMAP3_CONTROL_PADCONF_UART1_RTS_OFFSET); + + /* Now this is a GPIO pin. Send to sleep. */ + + return; +} + +/*************************************************************************** + * rts_exit_sleep_mode - set RTS pin to on mode + * + * The RTS pin needs to be kept high while sleeping, otherwise let the + * driver decide. + */ + +void rts_exit_sleep_mode() +{ + if (wake_mode_calls == 0) + __raw_writew ((u16) ( 0x0 ), + (volatile void *) OMAP2_L4_IO_ADDRESS(OMAP3_CONTROL_PADCONF_MUX_PBASE) + + OMAP3_CONTROL_PADCONF_UART1_RTS_OFFSET); + + return; +} + static int bcm20702_bt_rfkill_set_power(void *data, bool blocked) { // rfkill_ops callback. Turn transmitter on when blocked is false if (!blocked) { if (clk32ksys_reg && !bt_enabled) - regulator_enable(clk32ksys_reg); + (void) regulator_enable(clk32ksys_reg); gpio_set_value(BT_RESET_GPIO, 1); gpio_set_value(BT_REG_GPIO, 1); @@ -123,10 +165,6 @@ static void set_wake_locked(int wake) olio_debug ("Now locking wake lock\n"); wake_lock (&bt_lpm.bcm_wake_lock); - /* Does this even make sense here? We've already using the port, - doesn't that mean that we're */ - - if (!wake_uart_enabled) omap_serial_ext_uart_enable(UART_PORT); } @@ -190,11 +228,13 @@ static void set_host_wake_locked(int host_wake) if (host_wake) { olio_debug ("host_wake is set, taking wake lock\n"); wake_lock(&bt_lpm.host_wake_lock); - + if (!host_wake_uart_enabled) { omap_serial_ext_uart_enable(UART_PORT); - } + } + } else { + if (host_wake_uart_enabled) { omap_serial_ext_uart_disable(UART_PORT); } @@ -400,35 +440,6 @@ static int bcm20702_bluetooth_remove(struct platform_device *pdev) return 0; } -int bcm4430_bluetooth_suspend(struct platform_device *pdev, pm_message_t state) -{ - int irq = gpio_to_irq(BT_HOST_WAKE_GPIO); - int host_wake; - - disable_irq(irq); - - host_wake = gpio_get_value(BT_HOST_WAKE_GPIO); - - if (host_wake) { - enable_irq(irq); - return -EBUSY; - } - - return 0; -} - -int bcm4430_bluetooth_resume(struct platform_device *pdev) -{ - int irq = gpio_to_irq(BT_HOST_WAKE_GPIO); - enable_irq(irq); - return 0; -} - -/* - .suspend = bcm4430_bluetooth_suspend, - .resume = bcm4430_bluetooth_resume, -*/ - static struct platform_driver bcm20702_bluetooth_platform_driver = { .probe = bcm20702_bluetooth_probe, .remove = bcm20702_bluetooth_remove, diff --git a/arch/arm/mach-omap2/board-omap3h1.c b/arch/arm/mach-omap2/board-omap3h1.c index c2f3feac561..c1009f3b7e2 100644 --- a/arch/arm/mach-omap2/board-omap3h1.c +++ b/arch/arm/mach-omap2/board-omap3h1.c @@ -319,8 +319,12 @@ static struct i2c_board_info __initdata omap3h1_i2c3_board_info[] = { .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. @@ -333,6 +337,8 @@ static struct i2c_board_info __initdata omap3h1_i2c3_board_info[] = { 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). */ static struct omap_uart_port_info omap_uart_ports[] = { @@ -346,6 +352,12 @@ static struct omap_uart_port_info omap_uart_ports[] = { .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 */ + + .rts_wait = true, + .rts_enable_fn = rts_exit_sleep_mode, + .rts_disable_fn = rts_enter_sleep_mode, }, { .dma_enabled = false, /* To specify DMA Mode */ @@ -354,6 +366,9 @@ static struct omap_uart_port_info omap_uart_ports[] = { .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 */ @@ -362,6 +377,9 @@ static struct omap_uart_port_info omap_uart_ports[] = { .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 */ @@ -370,6 +388,9 @@ static struct omap_uart_port_info omap_uart_ports[] = { .dma_rx_poll_rate = DEFAULT_RXDMA_POLLRATE, .autosuspend_timeout = 0, .wakeup_capable = false, + .rts_wait = false, + .rts_enable_fn = NULL, + .rts_disable_fn = NULL, }, }; diff --git a/arch/arm/mach-omap2/board-omap3h1.h b/arch/arm/mach-omap2/board-omap3h1.h index 343eaeaaf86..ddf95f41fa4 100644 --- a/arch/arm/mach-omap2/board-omap3h1.h +++ b/arch/arm/mach-omap2/board-omap3h1.h @@ -26,5 +26,7 @@ #include <linux/serial_core.h> extern void bcm_bt_lpm_exit_lpm_locked(struct uart_port *uport); +extern void rts_exit_sleep_mode (void); +extern void rts_enter_sleep_mode (void); #endif /* __BOARD_OMAP3H1_H__ */ diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index b1f3fb1d396..a605fe9a9a2 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -305,6 +305,9 @@ void __init omap_serial_init_port(struct omap_board_data *bdata, omap_up.DTR_gpio = info->DTR_gpio; omap_up.DTR_inverted = info->DTR_inverted; omap_up.DTR_present = info->DTR_present; + omap_up.rts_enable_fn = info->rts_enable_fn; + omap_up.rts_disable_fn = info->rts_disable_fn; + omap_up.rts_wait = info->rts_wait; pdata = &omap_up; pdata_size = sizeof(struct omap_uart_port_info); |