* [PATCH 0/2] OMAP2+: UART: Fix usage of default mux pads @ 2012-04-10 13:40 ` Govindraj.R 0 siblings, 0 replies; 38+ messages in thread From: Govindraj.R @ 2012-04-10 13:40 UTC (permalink / raw) To: linux-omap Cc: linux-arm-kernel, Felipe Balbi, Kevin Hilman, Russ Dill, Tony Lindgren, Govindraj.R From: "Govindraj.R" <govindraj.raja@ti.com> We populating default uart mux pins if no mux data is provided by board files. But were not probing the availability of uart pins in tx/rx mode i.e. mux mode0. If particular pin is used for any other purpose then default pads were breaking those peripherals e.g. uart2 pin was used as gpio nreset pin ehci on beagle board. So remove the default adding procedure and probe the pins before using them as uart pins. Determine if uart pins are used in uart mux_mode0 then configure rx pin for wakeup capability. Testing updates: Boot tested on 3430SDP Tested on beagle-xm with ehci module which needs uart pin muxed as gpio line for nreset sequence. RX pad wakeup after enabling off mode in cpu_idle path and suspend path tested - 3430SDP & Beagle-XM Govindraj.R (2): OMAP2+: UART: Fix incorrect population of default uart pads OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup arch/arm/mach-omap2/mux.c | 3 +- arch/arm/mach-omap2/mux.h | 10 +++ arch/arm/mach-omap2/serial.c | 164 +++++++++++++----------------------------- 3 files changed, 61 insertions(+), 116 deletions(-) -- 1.7.9 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 0/2] OMAP2+: UART: Fix usage of default mux pads @ 2012-04-10 13:40 ` Govindraj.R 0 siblings, 0 replies; 38+ messages in thread From: Govindraj.R @ 2012-04-10 13:40 UTC (permalink / raw) To: linux-arm-kernel From: "Govindraj.R" <govindraj.raja@ti.com> We populating default uart mux pins if no mux data is provided by board files. But were not probing the availability of uart pins in tx/rx mode i.e. mux mode0. If particular pin is used for any other purpose then default pads were breaking those peripherals e.g. uart2 pin was used as gpio nreset pin ehci on beagle board. So remove the default adding procedure and probe the pins before using them as uart pins. Determine if uart pins are used in uart mux_mode0 then configure rx pin for wakeup capability. Testing updates: Boot tested on 3430SDP Tested on beagle-xm with ehci module which needs uart pin muxed as gpio line for nreset sequence. RX pad wakeup after enabling off mode in cpu_idle path and suspend path tested - 3430SDP & Beagle-XM Govindraj.R (2): OMAP2+: UART: Fix incorrect population of default uart pads OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup arch/arm/mach-omap2/mux.c | 3 +- arch/arm/mach-omap2/mux.h | 10 +++ arch/arm/mach-omap2/serial.c | 164 +++++++++++++----------------------------- 3 files changed, 61 insertions(+), 116 deletions(-) -- 1.7.9 ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads 2012-04-10 13:40 ` Govindraj.R @ 2012-04-10 13:40 ` Govindraj.R -1 siblings, 0 replies; 38+ messages in thread From: Govindraj.R @ 2012-04-10 13:40 UTC (permalink / raw) To: linux-omap Cc: linux-arm-kernel, Felipe Balbi, Kevin Hilman, Russ Dill, Tony Lindgren, Govindraj.R From: "Govindraj.R" <govindraj.raja@ti.com> The following commit: (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) added default pads for all uarts. But not all boards tend to use all uarts and most of unused uart pins are muxed for other purpose. This commit breaks the modules which where trying to use unused uart pins on their boards. So remove the default pads adding. Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <khilman@ti.com> Cc: Russ Dill <russ.dill@gmail.com> Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> --- arch/arm/mach-omap2/serial.c | 116 ------------------------------------------ 1 files changed, 0 insertions(+), 116 deletions(-) diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index c9503a7..1554233 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} #endif /* CONFIG_PM */ #ifdef CONFIG_OMAP_MUX -static struct omap_device_pad default_uart1_pads[] __initdata = { - { - .name = "uart1_cts.uart1_cts", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart1_rts.uart1_rts", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart1_tx.uart1_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart1_rx.uart1_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_uart2_pads[] __initdata = { - { - .name = "uart2_cts.uart2_cts", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart2_rts.uart2_rts", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart2_tx.uart2_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart2_rx.uart2_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_uart3_pads[] __initdata = { - { - .name = "uart3_cts_rctx.uart3_cts_rctx", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart3_rts_sd.uart3_rts_sd", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart3_tx_irtx.uart3_tx_irtx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart3_rx_irrx.uart3_rx_irrx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { - { - .name = "gpmc_wait2.uart4_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "gpmc_wait3.uart4_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, - }, -}; - -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { - { - .name = "uart4_tx.uart4_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart4_rx.uart4_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - }, -}; - static void omap_serial_fill_default_pads(struct omap_board_data *bdata) { - switch (bdata->id) { - case 0: - bdata->pads = default_uart1_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); - break; - case 1: - bdata->pads = default_uart2_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); - break; - case 2: - bdata->pads = default_uart3_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); - break; - case 3: - if (cpu_is_omap44xx()) { - bdata->pads = default_omap4_uart4_pads; - bdata->pads_cnt = - ARRAY_SIZE(default_omap4_uart4_pads); - } else if (cpu_is_omap3630()) { - bdata->pads = default_omap36xx_uart4_pads; - bdata->pads_cnt = - ARRAY_SIZE(default_omap36xx_uart4_pads); - } - break; - default: - break; - } } #else static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} -- 1.7.9 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads @ 2012-04-10 13:40 ` Govindraj.R 0 siblings, 0 replies; 38+ messages in thread From: Govindraj.R @ 2012-04-10 13:40 UTC (permalink / raw) To: linux-arm-kernel From: "Govindraj.R" <govindraj.raja@ti.com> The following commit: (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) added default pads for all uarts. But not all boards tend to use all uarts and most of unused uart pins are muxed for other purpose. This commit breaks the modules which where trying to use unused uart pins on their boards. So remove the default pads adding. Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <khilman@ti.com> Cc: Russ Dill <russ.dill@gmail.com> Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> --- arch/arm/mach-omap2/serial.c | 116 ------------------------------------------ 1 files changed, 0 insertions(+), 116 deletions(-) diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index c9503a7..1554233 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} #endif /* CONFIG_PM */ #ifdef CONFIG_OMAP_MUX -static struct omap_device_pad default_uart1_pads[] __initdata = { - { - .name = "uart1_cts.uart1_cts", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart1_rts.uart1_rts", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart1_tx.uart1_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart1_rx.uart1_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_uart2_pads[] __initdata = { - { - .name = "uart2_cts.uart2_cts", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart2_rts.uart2_rts", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart2_tx.uart2_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart2_rx.uart2_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_uart3_pads[] __initdata = { - { - .name = "uart3_cts_rctx.uart3_cts_rctx", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart3_rts_sd.uart3_rts_sd", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart3_tx_irtx.uart3_tx_irtx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart3_rx_irrx.uart3_rx_irrx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { - { - .name = "gpmc_wait2.uart4_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "gpmc_wait3.uart4_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, - }, -}; - -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { - { - .name = "uart4_tx.uart4_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart4_rx.uart4_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - }, -}; - static void omap_serial_fill_default_pads(struct omap_board_data *bdata) { - switch (bdata->id) { - case 0: - bdata->pads = default_uart1_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); - break; - case 1: - bdata->pads = default_uart2_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); - break; - case 2: - bdata->pads = default_uart3_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); - break; - case 3: - if (cpu_is_omap44xx()) { - bdata->pads = default_omap4_uart4_pads; - bdata->pads_cnt = - ARRAY_SIZE(default_omap4_uart4_pads); - } else if (cpu_is_omap3630()) { - bdata->pads = default_omap36xx_uart4_pads; - bdata->pads_cnt = - ARRAY_SIZE(default_omap36xx_uart4_pads); - } - break; - default: - break; - } } #else static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} -- 1.7.9 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads 2012-04-10 13:40 ` Govindraj.R @ 2012-04-11 20:14 ` Russ Dill -1 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-11 20:14 UTC (permalink / raw) To: Govindraj.R Cc: linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman, Tony Lindgren On Tue, Apr 10, 2012 at 6:40 AM, Govindraj.R <govindraj.raja@ti.com> wrote: > From: "Govindraj.R" <govindraj.raja@ti.com> > > The following commit: > (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) > added default pads for all uarts. But not all boards tend to > use all uarts and most of unused uart pins are muxed for > other purpose. This commit breaks the modules which where trying > to use unused uart pins on their boards. > > So remove the default pads adding. > > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Signed-off-by: Russ.Dill@ti.com > --- > arch/arm/mach-omap2/serial.c | 116 ------------------------------------------ > 1 files changed, 0 insertions(+), 116 deletions(-) > > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index c9503a7..1554233 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} > #endif /* CONFIG_PM */ > > #ifdef CONFIG_OMAP_MUX > -static struct omap_device_pad default_uart1_pads[] __initdata = { > - { > - .name = "uart1_cts.uart1_cts", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_rts.uart1_rts", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_tx.uart1_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_rx.uart1_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_uart2_pads[] __initdata = { > - { > - .name = "uart2_cts.uart2_cts", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_rts.uart2_rts", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_tx.uart2_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_rx.uart2_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_uart3_pads[] __initdata = { > - { > - .name = "uart3_cts_rctx.uart3_cts_rctx", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_rts_sd.uart3_rts_sd", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_tx_irtx.uart3_tx_irtx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_rx_irrx.uart3_rx_irrx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { > - { > - .name = "gpmc_wait2.uart4_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "gpmc_wait3.uart4_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - }, > -}; > - > -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { > - { > - .name = "uart4_tx.uart4_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart4_rx.uart4_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - }, > -}; > - > static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > { > - switch (bdata->id) { > - case 0: > - bdata->pads = default_uart1_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); > - break; > - case 1: > - bdata->pads = default_uart2_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); > - break; > - case 2: > - bdata->pads = default_uart3_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); > - break; > - case 3: > - if (cpu_is_omap44xx()) { > - bdata->pads = default_omap4_uart4_pads; > - bdata->pads_cnt = > - ARRAY_SIZE(default_omap4_uart4_pads); > - } else if (cpu_is_omap3630()) { > - bdata->pads = default_omap36xx_uart4_pads; > - bdata->pads_cnt = > - ARRAY_SIZE(default_omap36xx_uart4_pads); > - } > - break; > - default: > - break; > - } > } > #else > static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} > -- > 1.7.9 > ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads @ 2012-04-11 20:14 ` Russ Dill 0 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-11 20:14 UTC (permalink / raw) To: linux-arm-kernel On Tue, Apr 10, 2012 at 6:40 AM, Govindraj.R <govindraj.raja@ti.com> wrote: > From: "Govindraj.R" <govindraj.raja@ti.com> > > The following commit: > (7496ba3 ?ARM: OMAP2+: UART: Add default mux for all uarts) > added default pads for all uarts. But not all boards tend to > use all uarts and most of unused uart pins are muxed for > other purpose. This commit breaks the modules which where trying > to use unused uart pins on their boards. > > So remove the default pads adding. > > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Signed-off-by: Russ.Dill at ti.com > --- > ?arch/arm/mach-omap2/serial.c | ?116 ------------------------------------------ > ?1 files changed, 0 insertions(+), 116 deletions(-) > > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index c9503a7..1554233 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} > ?#endif /* CONFIG_PM */ > > ?#ifdef CONFIG_OMAP_MUX > -static struct omap_device_pad default_uart1_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart1_cts.uart1_cts", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart1_rts.uart1_rts", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart1_tx.uart1_tx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart1_rx.uart1_rx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > -}; > - > -static struct omap_device_pad default_uart2_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart2_cts.uart2_cts", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart2_rts.uart2_rts", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart2_tx.uart2_tx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart2_rx.uart2_rx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > -}; > - > -static struct omap_device_pad default_uart3_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart3_cts_rctx.uart3_cts_rctx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart3_rts_sd.uart3_rts_sd", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart3_tx_irtx.uart3_tx_irtx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart3_rx_irrx.uart3_rx_irrx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - ? ? ? }, > -}; > - > -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "gpmc_wait2.uart4_tx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "gpmc_wait3.uart4_rx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - ? ? ? }, > -}; > - > -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart4_tx.uart4_tx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart4_rx.uart4_rx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - ? ? ? }, > -}; > - > ?static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > ?{ > - ? ? ? switch (bdata->id) { > - ? ? ? case 0: > - ? ? ? ? ? ? ? bdata->pads = default_uart1_pads; > - ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); > - ? ? ? ? ? ? ? break; > - ? ? ? case 1: > - ? ? ? ? ? ? ? bdata->pads = default_uart2_pads; > - ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); > - ? ? ? ? ? ? ? break; > - ? ? ? case 2: > - ? ? ? ? ? ? ? bdata->pads = default_uart3_pads; > - ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); > - ? ? ? ? ? ? ? break; > - ? ? ? case 3: > - ? ? ? ? ? ? ? if (cpu_is_omap44xx()) { > - ? ? ? ? ? ? ? ? ? ? ? bdata->pads = default_omap4_uart4_pads; > - ? ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARRAY_SIZE(default_omap4_uart4_pads); > - ? ? ? ? ? ? ? } else if (cpu_is_omap3630()) { > - ? ? ? ? ? ? ? ? ? ? ? bdata->pads = default_omap36xx_uart4_pads; > - ? ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARRAY_SIZE(default_omap36xx_uart4_pads); > - ? ? ? ? ? ? ? } > - ? ? ? ? ? ? ? break; > - ? ? ? default: > - ? ? ? ? ? ? ? break; > - ? ? ? } > ?} > ?#else > ?static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} > -- > 1.7.9 > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads 2012-04-10 13:40 ` Govindraj.R @ 2012-04-13 23:14 ` Russ Dill -1 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-13 23:14 UTC (permalink / raw) To: Govindraj.R Cc: linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman, Tony Lindgren On Tue, Apr 10, 2012 at 6:40 AM, Govindraj.R <govindraj.raja@ti.com> wrote: > From: "Govindraj.R" <govindraj.raja@ti.com> > > The following commit: > (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) > added default pads for all uarts. But not all boards tend to > use all uarts and most of unused uart pins are muxed for > other purpose. This commit breaks the modules which where trying > to use unused uart pins on their boards. > > So remove the default pads adding. > > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Acked-by: Russ Dill <russ.dill@ti.com> > --- > arch/arm/mach-omap2/serial.c | 116 ------------------------------------------ > 1 files changed, 0 insertions(+), 116 deletions(-) > > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index c9503a7..1554233 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} > #endif /* CONFIG_PM */ > > #ifdef CONFIG_OMAP_MUX > -static struct omap_device_pad default_uart1_pads[] __initdata = { > - { > - .name = "uart1_cts.uart1_cts", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_rts.uart1_rts", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_tx.uart1_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_rx.uart1_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_uart2_pads[] __initdata = { > - { > - .name = "uart2_cts.uart2_cts", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_rts.uart2_rts", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_tx.uart2_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_rx.uart2_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_uart3_pads[] __initdata = { > - { > - .name = "uart3_cts_rctx.uart3_cts_rctx", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_rts_sd.uart3_rts_sd", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_tx_irtx.uart3_tx_irtx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_rx_irrx.uart3_rx_irrx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { > - { > - .name = "gpmc_wait2.uart4_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "gpmc_wait3.uart4_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - }, > -}; > - > -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { > - { > - .name = "uart4_tx.uart4_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart4_rx.uart4_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - }, > -}; > - > static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > { > - switch (bdata->id) { > - case 0: > - bdata->pads = default_uart1_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); > - break; > - case 1: > - bdata->pads = default_uart2_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); > - break; > - case 2: > - bdata->pads = default_uart3_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); > - break; > - case 3: > - if (cpu_is_omap44xx()) { > - bdata->pads = default_omap4_uart4_pads; > - bdata->pads_cnt = > - ARRAY_SIZE(default_omap4_uart4_pads); > - } else if (cpu_is_omap3630()) { > - bdata->pads = default_omap36xx_uart4_pads; > - bdata->pads_cnt = > - ARRAY_SIZE(default_omap36xx_uart4_pads); > - } > - break; > - default: > - break; > - } > } > #else > static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} > -- > 1.7.9 > ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads @ 2012-04-13 23:14 ` Russ Dill 0 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-13 23:14 UTC (permalink / raw) To: linux-arm-kernel On Tue, Apr 10, 2012 at 6:40 AM, Govindraj.R <govindraj.raja@ti.com> wrote: > From: "Govindraj.R" <govindraj.raja@ti.com> > > The following commit: > (7496ba3 ?ARM: OMAP2+: UART: Add default mux for all uarts) > added default pads for all uarts. But not all boards tend to > use all uarts and most of unused uart pins are muxed for > other purpose. This commit breaks the modules which where trying > to use unused uart pins on their boards. > > So remove the default pads adding. > > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Acked-by: Russ Dill <russ.dill@ti.com> > --- > ?arch/arm/mach-omap2/serial.c | ?116 ------------------------------------------ > ?1 files changed, 0 insertions(+), 116 deletions(-) > > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index c9503a7..1554233 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} > ?#endif /* CONFIG_PM */ > > ?#ifdef CONFIG_OMAP_MUX > -static struct omap_device_pad default_uart1_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart1_cts.uart1_cts", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart1_rts.uart1_rts", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart1_tx.uart1_tx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart1_rx.uart1_rx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > -}; > - > -static struct omap_device_pad default_uart2_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart2_cts.uart2_cts", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart2_rts.uart2_rts", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart2_tx.uart2_tx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart2_rx.uart2_rx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > -}; > - > -static struct omap_device_pad default_uart3_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart3_cts_rctx.uart3_cts_rctx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart3_rts_sd.uart3_rts_sd", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart3_tx_irtx.uart3_tx_irtx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart3_rx_irrx.uart3_rx_irrx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - ? ? ? }, > -}; > - > -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "gpmc_wait2.uart4_tx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "gpmc_wait3.uart4_rx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - ? ? ? }, > -}; > - > -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart4_tx.uart4_tx", > - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - ? ? ? }, > - ? ? ? { > - ? ? ? ? ? ? ? .name ? = "uart4_rx.uart4_rx", > - ? ? ? ? ? ? ? .flags ?= OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - ? ? ? ? ? ? ? .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - ? ? ? ? ? ? ? .idle ? = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - ? ? ? }, > -}; > - > ?static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > ?{ > - ? ? ? switch (bdata->id) { > - ? ? ? case 0: > - ? ? ? ? ? ? ? bdata->pads = default_uart1_pads; > - ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); > - ? ? ? ? ? ? ? break; > - ? ? ? case 1: > - ? ? ? ? ? ? ? bdata->pads = default_uart2_pads; > - ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); > - ? ? ? ? ? ? ? break; > - ? ? ? case 2: > - ? ? ? ? ? ? ? bdata->pads = default_uart3_pads; > - ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); > - ? ? ? ? ? ? ? break; > - ? ? ? case 3: > - ? ? ? ? ? ? ? if (cpu_is_omap44xx()) { > - ? ? ? ? ? ? ? ? ? ? ? bdata->pads = default_omap4_uart4_pads; > - ? ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARRAY_SIZE(default_omap4_uart4_pads); > - ? ? ? ? ? ? ? } else if (cpu_is_omap3630()) { > - ? ? ? ? ? ? ? ? ? ? ? bdata->pads = default_omap36xx_uart4_pads; > - ? ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ARRAY_SIZE(default_omap36xx_uart4_pads); > - ? ? ? ? ? ? ? } > - ? ? ? ? ? ? ? break; > - ? ? ? default: > - ? ? ? ? ? ? ? break; > - ? ? ? } > ?} > ?#else > ?static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} > -- > 1.7.9 > ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads 2012-04-13 23:14 ` Russ Dill @ 2012-04-17 17:50 ` Tony Lindgren -1 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-04-17 17:50 UTC (permalink / raw) To: Russ Dill Cc: Govindraj.R, linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman * Russ Dill <russ.dill@gmail.com> [120413 16:17]: > On Tue, Apr 10, 2012 at 6:40 AM, Govindraj.R <govindraj.raja@ti.com> wrote: > > From: "Govindraj.R" <govindraj.raja@ti.com> > > > > The following commit: > > (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) > > added default pads for all uarts. But not all boards tend to > > use all uarts and most of unused uart pins are muxed for > > other purpose. This commit breaks the modules which where trying > > to use unused uart pins on their boards. > > > > So remove the default pads adding. > > > > Cc: Felipe Balbi <balbi@ti.com> > > Cc: Kevin Hilman <khilman@ti.com> > > Cc: Russ Dill <russ.dill@gmail.com> > > Reported-by: Tony Lindgren <tony@atomide.com> > > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> > > Acked-by: Russ Dill <russ.dill@ti.com> Applying this into fixes with the updated comments as below. Tony From: "Govindraj.R" <govindraj.raja@ti.com> Date: Tue, 17 Apr 2012 10:35:47 -0700 Subject: [PATCH] ARM: OMAP2+: UART: Fix incorrect population of default uart pads Commit (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) wrongly added muxing of default pads for all uarts. This causes breakage on multiple boards using uart pins for alternate functions. For example, on zoom3 random oopses can be seen with nfsroot as the smsc911x ethernet FIFO timings on GPMC bus are controlled by gpmc_wait2 and gpmc_wait3 pins. This means we can't mux these pads to uart4 functionality as commit 7496ba3 was doing. Not all boards tend to use all uarts and most of unused uart pins are muxed for other purpose. This commit breaks the modules which where trying to use unused uart pins on their boards. So remove the default pad muxing. Note that this is not a complete fix, as we now rely on bootloader set muxing for the uart wake-up events. Further patching is needed to enable wake-up events for uarts that are already muxed to uart mode. Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <khilman@ti.com> Acked-by: Russ Dill <russ.dill@gmail.com> Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> [tony@atomide.com: updated comments to describe oops on zoom3] Signed-off-by: Tony Lindgren <tony@atomide.com> diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 0cdd359..2e351f5 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} #endif /* CONFIG_PM */ #ifdef CONFIG_OMAP_MUX -static struct omap_device_pad default_uart1_pads[] __initdata = { - { - .name = "uart1_cts.uart1_cts", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart1_rts.uart1_rts", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart1_tx.uart1_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart1_rx.uart1_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_uart2_pads[] __initdata = { - { - .name = "uart2_cts.uart2_cts", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart2_rts.uart2_rts", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart2_tx.uart2_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart2_rx.uart2_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_uart3_pads[] __initdata = { - { - .name = "uart3_cts_rctx.uart3_cts_rctx", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart3_rts_sd.uart3_rts_sd", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart3_tx_irtx.uart3_tx_irtx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart3_rx_irrx.uart3_rx_irrx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { - { - .name = "gpmc_wait2.uart4_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "gpmc_wait3.uart4_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, - }, -}; - -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { - { - .name = "uart4_tx.uart4_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart4_rx.uart4_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - }, -}; - static void omap_serial_fill_default_pads(struct omap_board_data *bdata) { - switch (bdata->id) { - case 0: - bdata->pads = default_uart1_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); - break; - case 1: - bdata->pads = default_uart2_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); - break; - case 2: - bdata->pads = default_uart3_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); - break; - case 3: - if (cpu_is_omap44xx()) { - bdata->pads = default_omap4_uart4_pads; - bdata->pads_cnt = - ARRAY_SIZE(default_omap4_uart4_pads); - } else if (cpu_is_omap3630()) { - bdata->pads = default_omap36xx_uart4_pads; - bdata->pads_cnt = - ARRAY_SIZE(default_omap36xx_uart4_pads); - } - break; - default: - break; - } } #else static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads @ 2012-04-17 17:50 ` Tony Lindgren 0 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-04-17 17:50 UTC (permalink / raw) To: linux-arm-kernel * Russ Dill <russ.dill@gmail.com> [120413 16:17]: > On Tue, Apr 10, 2012 at 6:40 AM, Govindraj.R <govindraj.raja@ti.com> wrote: > > From: "Govindraj.R" <govindraj.raja@ti.com> > > > > The following commit: > > (7496ba3 ?ARM: OMAP2+: UART: Add default mux for all uarts) > > added default pads for all uarts. But not all boards tend to > > use all uarts and most of unused uart pins are muxed for > > other purpose. This commit breaks the modules which where trying > > to use unused uart pins on their boards. > > > > So remove the default pads adding. > > > > Cc: Felipe Balbi <balbi@ti.com> > > Cc: Kevin Hilman <khilman@ti.com> > > Cc: Russ Dill <russ.dill@gmail.com> > > Reported-by: Tony Lindgren <tony@atomide.com> > > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> > > Acked-by: Russ Dill <russ.dill@ti.com> Applying this into fixes with the updated comments as below. Tony From: "Govindraj.R" <govindraj.raja@ti.com> Date: Tue, 17 Apr 2012 10:35:47 -0700 Subject: [PATCH] ARM: OMAP2+: UART: Fix incorrect population of default uart pads Commit (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) wrongly added muxing of default pads for all uarts. This causes breakage on multiple boards using uart pins for alternate functions. For example, on zoom3 random oopses can be seen with nfsroot as the smsc911x ethernet FIFO timings on GPMC bus are controlled by gpmc_wait2 and gpmc_wait3 pins. This means we can't mux these pads to uart4 functionality as commit 7496ba3 was doing. Not all boards tend to use all uarts and most of unused uart pins are muxed for other purpose. This commit breaks the modules which where trying to use unused uart pins on their boards. So remove the default pad muxing. Note that this is not a complete fix, as we now rely on bootloader set muxing for the uart wake-up events. Further patching is needed to enable wake-up events for uarts that are already muxed to uart mode. Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <khilman@ti.com> Acked-by: Russ Dill <russ.dill@gmail.com> Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> [tony at atomide.com: updated comments to describe oops on zoom3] Signed-off-by: Tony Lindgren <tony@atomide.com> diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 0cdd359..2e351f5 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} #endif /* CONFIG_PM */ #ifdef CONFIG_OMAP_MUX -static struct omap_device_pad default_uart1_pads[] __initdata = { - { - .name = "uart1_cts.uart1_cts", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart1_rts.uart1_rts", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart1_tx.uart1_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart1_rx.uart1_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_uart2_pads[] __initdata = { - { - .name = "uart2_cts.uart2_cts", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart2_rts.uart2_rts", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart2_tx.uart2_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart2_rx.uart2_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_uart3_pads[] __initdata = { - { - .name = "uart3_cts_rctx.uart3_cts_rctx", - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, - }, - { - .name = "uart3_rts_sd.uart3_rts_sd", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart3_tx_irtx.uart3_tx_irtx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart3_rx_irrx.uart3_rx_irrx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - }, -}; - -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { - { - .name = "gpmc_wait2.uart4_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "gpmc_wait3.uart4_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, - }, -}; - -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { - { - .name = "uart4_tx.uart4_tx", - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, - }, - { - .name = "uart4_rx.uart4_rx", - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, - }, -}; - static void omap_serial_fill_default_pads(struct omap_board_data *bdata) { - switch (bdata->id) { - case 0: - bdata->pads = default_uart1_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); - break; - case 1: - bdata->pads = default_uart2_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); - break; - case 2: - bdata->pads = default_uart3_pads; - bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); - break; - case 3: - if (cpu_is_omap44xx()) { - bdata->pads = default_omap4_uart4_pads; - bdata->pads_cnt = - ARRAY_SIZE(default_omap4_uart4_pads); - } else if (cpu_is_omap3630()) { - bdata->pads = default_omap36xx_uart4_pads; - bdata->pads_cnt = - ARRAY_SIZE(default_omap36xx_uart4_pads); - } - break; - default: - break; - } } #else static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} ^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads 2012-04-10 13:40 ` Govindraj.R @ 2012-04-23 23:45 ` Kevin Hilman -1 siblings, 0 replies; 38+ messages in thread From: Kevin Hilman @ 2012-04-23 23:45 UTC (permalink / raw) To: Govindraj.R Cc: linux-omap, linux-arm-kernel, Felipe Balbi, Russ Dill, Tony Lindgren "Govindraj.R" <govindraj.raja@ti.com> writes: > From: "Govindraj.R" <govindraj.raja@ti.com> > > The following commit: > (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) > added default pads for all uarts. But not all boards tend to > use all uarts and most of unused uart pins are muxed for > other purpose. This commit breaks the modules which where trying > to use unused uart pins on their boards. > > So remove the default pads adding. I just noticed that this patch breaks runtime PM & wakeups for UART console (at least on 3530/Overo with ttyO2 console.) By removing the pads, the initial device_init_wakeup() is not called on port init. Without this call serial_omap_pm() disables runtime PM because it checks device_may_wakeup(). Since runtime PM was disabled, I manually re-enabled it and then enabled wakeups: echo auto > /sys/devices/platform/omap_uart.2/power/control echo enabled > /sys/devices/platform/omap_uart.2/tty/ttyO2/power/wakeup Then, after enabling auto-suspend timeouts, it seems wakeups are still not working since the console hangs. Reverting $SUBJECT patch gets things working again. Kevin > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> > --- > arch/arm/mach-omap2/serial.c | 116 ------------------------------------------ > 1 files changed, 0 insertions(+), 116 deletions(-) > > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index c9503a7..1554233 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} > #endif /* CONFIG_PM */ > > #ifdef CONFIG_OMAP_MUX > -static struct omap_device_pad default_uart1_pads[] __initdata = { > - { > - .name = "uart1_cts.uart1_cts", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_rts.uart1_rts", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_tx.uart1_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_rx.uart1_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_uart2_pads[] __initdata = { > - { > - .name = "uart2_cts.uart2_cts", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_rts.uart2_rts", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_tx.uart2_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_rx.uart2_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_uart3_pads[] __initdata = { > - { > - .name = "uart3_cts_rctx.uart3_cts_rctx", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_rts_sd.uart3_rts_sd", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_tx_irtx.uart3_tx_irtx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_rx_irrx.uart3_rx_irrx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { > - { > - .name = "gpmc_wait2.uart4_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "gpmc_wait3.uart4_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - }, > -}; > - > -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { > - { > - .name = "uart4_tx.uart4_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart4_rx.uart4_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - }, > -}; > - > static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > { > - switch (bdata->id) { > - case 0: > - bdata->pads = default_uart1_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); > - break; > - case 1: > - bdata->pads = default_uart2_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); > - break; > - case 2: > - bdata->pads = default_uart3_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); > - break; > - case 3: > - if (cpu_is_omap44xx()) { > - bdata->pads = default_omap4_uart4_pads; > - bdata->pads_cnt = > - ARRAY_SIZE(default_omap4_uart4_pads); > - } else if (cpu_is_omap3630()) { > - bdata->pads = default_omap36xx_uart4_pads; > - bdata->pads_cnt = > - ARRAY_SIZE(default_omap36xx_uart4_pads); > - } > - break; > - default: > - break; > - } > } > #else > static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads @ 2012-04-23 23:45 ` Kevin Hilman 0 siblings, 0 replies; 38+ messages in thread From: Kevin Hilman @ 2012-04-23 23:45 UTC (permalink / raw) To: linux-arm-kernel "Govindraj.R" <govindraj.raja@ti.com> writes: > From: "Govindraj.R" <govindraj.raja@ti.com> > > The following commit: > (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) > added default pads for all uarts. But not all boards tend to > use all uarts and most of unused uart pins are muxed for > other purpose. This commit breaks the modules which where trying > to use unused uart pins on their boards. > > So remove the default pads adding. I just noticed that this patch breaks runtime PM & wakeups for UART console (at least on 3530/Overo with ttyO2 console.) By removing the pads, the initial device_init_wakeup() is not called on port init. Without this call serial_omap_pm() disables runtime PM because it checks device_may_wakeup(). Since runtime PM was disabled, I manually re-enabled it and then enabled wakeups: echo auto > /sys/devices/platform/omap_uart.2/power/control echo enabled > /sys/devices/platform/omap_uart.2/tty/ttyO2/power/wakeup Then, after enabling auto-suspend timeouts, it seems wakeups are still not working since the console hangs. Reverting $SUBJECT patch gets things working again. Kevin > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> > --- > arch/arm/mach-omap2/serial.c | 116 ------------------------------------------ > 1 files changed, 0 insertions(+), 116 deletions(-) > > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index c9503a7..1554233 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -120,124 +120,8 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} > #endif /* CONFIG_PM */ > > #ifdef CONFIG_OMAP_MUX > -static struct omap_device_pad default_uart1_pads[] __initdata = { > - { > - .name = "uart1_cts.uart1_cts", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_rts.uart1_rts", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_tx.uart1_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart1_rx.uart1_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_uart2_pads[] __initdata = { > - { > - .name = "uart2_cts.uart2_cts", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_rts.uart2_rts", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_tx.uart2_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart2_rx.uart2_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_uart3_pads[] __initdata = { > - { > - .name = "uart3_cts_rctx.uart3_cts_rctx", > - .enable = OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_rts_sd.uart3_rts_sd", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_tx_irtx.uart3_tx_irtx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart3_rx_irrx.uart3_rx_irrx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - }, > -}; > - > -static struct omap_device_pad default_omap36xx_uart4_pads[] __initdata = { > - { > - .name = "gpmc_wait2.uart4_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "gpmc_wait3.uart4_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE2, > - }, > -}; > - > -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = { > - { > - .name = "uart4_tx.uart4_tx", > - .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, > - }, > - { > - .name = "uart4_rx.uart4_rx", > - .flags = OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP, > - .enable = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - .idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0, > - }, > -}; > - > static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > { > - switch (bdata->id) { > - case 0: > - bdata->pads = default_uart1_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart1_pads); > - break; > - case 1: > - bdata->pads = default_uart2_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart2_pads); > - break; > - case 2: > - bdata->pads = default_uart3_pads; > - bdata->pads_cnt = ARRAY_SIZE(default_uart3_pads); > - break; > - case 3: > - if (cpu_is_omap44xx()) { > - bdata->pads = default_omap4_uart4_pads; > - bdata->pads_cnt = > - ARRAY_SIZE(default_omap4_uart4_pads); > - } else if (cpu_is_omap3630()) { > - bdata->pads = default_omap36xx_uart4_pads; > - bdata->pads_cnt = > - ARRAY_SIZE(default_omap36xx_uart4_pads); > - } > - break; > - default: > - break; > - } > } > #else > static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads 2012-04-23 23:45 ` Kevin Hilman @ 2012-04-24 8:38 ` Raja, Govindraj -1 siblings, 0 replies; 38+ messages in thread From: Raja, Govindraj @ 2012-04-24 8:38 UTC (permalink / raw) To: Kevin Hilman, Tony Lindgren Cc: linux-omap, linux-arm-kernel, Felipe Balbi, Russ Dill On Tue, Apr 24, 2012 at 5:15 AM, Kevin Hilman <khilman@ti.com> wrote: > "Govindraj.R" <govindraj.raja@ti.com> writes: > >> From: "Govindraj.R" <govindraj.raja@ti.com> >> >> The following commit: >> (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) >> added default pads for all uarts. But not all boards tend to >> use all uarts and most of unused uart pins are muxed for >> other purpose. This commit breaks the modules which where trying >> to use unused uart pins on their boards. >> >> So remove the default pads adding. > > I just noticed that this patch breaks runtime PM & wakeups for UART > console (at least on 3530/Overo with ttyO2 console.) > > By removing the pads, the initial device_init_wakeup() is not called on > port init. Without this call serial_omap_pm() disables runtime PM > because it checks device_may_wakeup(). > > Since runtime PM was disabled, I manually re-enabled it and then enabled > wakeups: > > echo auto > /sys/devices/platform/omap_uart.2/power/control > echo enabled > /sys/devices/platform/omap_uart.2/tty/ttyO2/power/wakeup > > Then, after enabling auto-suspend timeouts, it seems wakeups are still > not working since the console hangs. > > Reverting $SUBJECT patch gets things working again. This was decided as part of discussion [1] If we are _reconsidering_ taking this patch [2] to dynamically probe uart pins and enable rx wakeup. I can re-work on the patch[2] as per tony's comments[1] and re-post it. -- Thanks, Govindraj.R [1]: http://www.spinics.net/lists/linux-omap/msg68226.html [2]: http://www.spinics.net/lists/linux-omap/msg67822.html -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads @ 2012-04-24 8:38 ` Raja, Govindraj 0 siblings, 0 replies; 38+ messages in thread From: Raja, Govindraj @ 2012-04-24 8:38 UTC (permalink / raw) To: linux-arm-kernel On Tue, Apr 24, 2012 at 5:15 AM, Kevin Hilman <khilman@ti.com> wrote: > "Govindraj.R" <govindraj.raja@ti.com> writes: > >> From: "Govindraj.R" <govindraj.raja@ti.com> >> >> The following commit: >> (7496ba3 ?ARM: OMAP2+: UART: Add default mux for all uarts) >> added default pads for all uarts. But not all boards tend to >> use all uarts and most of unused uart pins are muxed for >> other purpose. This commit breaks the modules which where trying >> to use unused uart pins on their boards. >> >> So remove the default pads adding. > > I just noticed that this patch breaks runtime PM & wakeups for UART > console (at least on 3530/Overo with ttyO2 console.) > > By removing the pads, the initial device_init_wakeup() is not called on > port init. ?Without this call serial_omap_pm() disables runtime PM > because it checks device_may_wakeup(). > > Since runtime PM was disabled, I manually re-enabled it and then enabled > wakeups: > > ?echo auto > /sys/devices/platform/omap_uart.2/power/control > ?echo enabled > /sys/devices/platform/omap_uart.2/tty/ttyO2/power/wakeup > > Then, after enabling auto-suspend timeouts, it seems wakeups are still > not working since the console hangs. > > Reverting $SUBJECT patch gets things working again. This was decided as part of discussion [1] If we are _reconsidering_ taking this patch [2] to dynamically probe uart pins and enable rx wakeup. I can re-work on the patch[2] as per tony's comments[1] and re-post it. -- Thanks, Govindraj.R [1]: http://www.spinics.net/lists/linux-omap/msg68226.html [2]: http://www.spinics.net/lists/linux-omap/msg67822.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads 2012-04-24 8:38 ` Raja, Govindraj @ 2012-05-04 17:24 ` Tony Lindgren -1 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-05-04 17:24 UTC (permalink / raw) To: Raja, Govindraj Cc: Kevin Hilman, linux-omap, linux-arm-kernel, Felipe Balbi, Russ Dill * Raja, Govindraj <govindraj.raja@ti.com> [120424 01:41]: > On Tue, Apr 24, 2012 at 5:15 AM, Kevin Hilman <khilman@ti.com> wrote: > > "Govindraj.R" <govindraj.raja@ti.com> writes: > > > >> From: "Govindraj.R" <govindraj.raja@ti.com> > >> > >> The following commit: > >> (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) > >> added default pads for all uarts. But not all boards tend to > >> use all uarts and most of unused uart pins are muxed for > >> other purpose. This commit breaks the modules which where trying > >> to use unused uart pins on their boards. > >> > >> So remove the default pads adding. > > > > I just noticed that this patch breaks runtime PM & wakeups for UART > > console (at least on 3530/Overo with ttyO2 console.) > > > > By removing the pads, the initial device_init_wakeup() is not called on > > port init. Without this call serial_omap_pm() disables runtime PM > > because it checks device_may_wakeup(). > > > > Since runtime PM was disabled, I manually re-enabled it and then enabled > > wakeups: > > > > echo auto > /sys/devices/platform/omap_uart.2/power/control > > echo enabled > /sys/devices/platform/omap_uart.2/tty/ttyO2/power/wakeup > > > > Then, after enabling auto-suspend timeouts, it seems wakeups are still > > not working since the console hangs. > > > > Reverting $SUBJECT patch gets things working again. > > This was decided as part of discussion [1] > > If we are _reconsidering_ taking this patch [2] > to dynamically probe uart pins and enable rx wakeup. > > I can re-work on the patch[2] as per tony's comments[1] > and re-post it. Just to follow up on this.. Let's first get things working reliably, and only then add more PM support. We absolutely can't revert $SUBJECT because it's known to mess up at least smsc911x and ehci on zoom3, hsi on n900 and probably many other things. For the -rc cycle, it seems that [2] is out of question at this point as too intrusive. If the PM & wakeups are broken in the default cases, then I suggest we just take few steps back and disable any deeper PM states in the -rc series. Regards, Tony > [1]: > http://www.spinics.net/lists/linux-omap/msg68226.html > > [2]: > http://www.spinics.net/lists/linux-omap/msg67822.html -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads @ 2012-05-04 17:24 ` Tony Lindgren 0 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-05-04 17:24 UTC (permalink / raw) To: linux-arm-kernel * Raja, Govindraj <govindraj.raja@ti.com> [120424 01:41]: > On Tue, Apr 24, 2012 at 5:15 AM, Kevin Hilman <khilman@ti.com> wrote: > > "Govindraj.R" <govindraj.raja@ti.com> writes: > > > >> From: "Govindraj.R" <govindraj.raja@ti.com> > >> > >> The following commit: > >> (7496ba3 ?ARM: OMAP2+: UART: Add default mux for all uarts) > >> added default pads for all uarts. But not all boards tend to > >> use all uarts and most of unused uart pins are muxed for > >> other purpose. This commit breaks the modules which where trying > >> to use unused uart pins on their boards. > >> > >> So remove the default pads adding. > > > > I just noticed that this patch breaks runtime PM & wakeups for UART > > console (at least on 3530/Overo with ttyO2 console.) > > > > By removing the pads, the initial device_init_wakeup() is not called on > > port init. ?Without this call serial_omap_pm() disables runtime PM > > because it checks device_may_wakeup(). > > > > Since runtime PM was disabled, I manually re-enabled it and then enabled > > wakeups: > > > > ?echo auto > /sys/devices/platform/omap_uart.2/power/control > > ?echo enabled > /sys/devices/platform/omap_uart.2/tty/ttyO2/power/wakeup > > > > Then, after enabling auto-suspend timeouts, it seems wakeups are still > > not working since the console hangs. > > > > Reverting $SUBJECT patch gets things working again. > > This was decided as part of discussion [1] > > If we are _reconsidering_ taking this patch [2] > to dynamically probe uart pins and enable rx wakeup. > > I can re-work on the patch[2] as per tony's comments[1] > and re-post it. Just to follow up on this.. Let's first get things working reliably, and only then add more PM support. We absolutely can't revert $SUBJECT because it's known to mess up at least smsc911x and ehci on zoom3, hsi on n900 and probably many other things. For the -rc cycle, it seems that [2] is out of question at this point as too intrusive. If the PM & wakeups are broken in the default cases, then I suggest we just take few steps back and disable any deeper PM states in the -rc series. Regards, Tony > [1]: > http://www.spinics.net/lists/linux-omap/msg68226.html > > [2]: > http://www.spinics.net/lists/linux-omap/msg67822.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads 2012-05-04 17:24 ` Tony Lindgren @ 2012-05-07 17:39 ` Kevin Hilman -1 siblings, 0 replies; 38+ messages in thread From: Kevin Hilman @ 2012-05-07 17:39 UTC (permalink / raw) To: Tony Lindgren Cc: Raja, Govindraj, linux-omap, linux-arm-kernel, Felipe Balbi, Russ Dill Tony Lindgren <tony@atomide.com> writes: > * Raja, Govindraj <govindraj.raja@ti.com> [120424 01:41]: >> On Tue, Apr 24, 2012 at 5:15 AM, Kevin Hilman <khilman@ti.com> wrote: >> > "Govindraj.R" <govindraj.raja@ti.com> writes: >> > >> >> From: "Govindraj.R" <govindraj.raja@ti.com> >> >> >> >> The following commit: >> >> (7496ba3 ARM: OMAP2+: UART: Add default mux for all uarts) >> >> added default pads for all uarts. But not all boards tend to >> >> use all uarts and most of unused uart pins are muxed for >> >> other purpose. This commit breaks the modules which where trying >> >> to use unused uart pins on their boards. >> >> >> >> So remove the default pads adding. >> > >> > I just noticed that this patch breaks runtime PM & wakeups for UART >> > console (at least on 3530/Overo with ttyO2 console.) >> > >> > By removing the pads, the initial device_init_wakeup() is not called on >> > port init. Without this call serial_omap_pm() disables runtime PM >> > because it checks device_may_wakeup(). >> > >> > Since runtime PM was disabled, I manually re-enabled it and then enabled >> > wakeups: >> > >> > echo auto > /sys/devices/platform/omap_uart.2/power/control >> > echo enabled > /sys/devices/platform/omap_uart.2/tty/ttyO2/power/wakeup >> > >> > Then, after enabling auto-suspend timeouts, it seems wakeups are still >> > not working since the console hangs. >> > >> > Reverting $SUBJECT patch gets things working again. >> >> This was decided as part of discussion [1] >> >> If we are _reconsidering_ taking this patch [2] >> to dynamically probe uart pins and enable rx wakeup. >> >> I can re-work on the patch[2] as per tony's comments[1] >> and re-post it. > > Just to follow up on this.. Let's first get things working reliably, > and only then add more PM support. > > We absolutely can't revert $SUBJECT because it's known to mess up > at least smsc911x and ehci on zoom3, hsi on n900 and probably > many other things. > > For the -rc cycle, it seems that [2] is out of question at this point > as too intrusive. If the PM & wakeups are broken in the default cases, > then I suggest we just take few steps back and disable any deeper PM > states in the -rc series. Unfortunately, no need to do anything more to disable deeper PM states. Because $SUBJECT disables runtime PM for UART, it keeps both PER and CORE on all the time. :( Kevin -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads @ 2012-05-07 17:39 ` Kevin Hilman 0 siblings, 0 replies; 38+ messages in thread From: Kevin Hilman @ 2012-05-07 17:39 UTC (permalink / raw) To: linux-arm-kernel Tony Lindgren <tony@atomide.com> writes: > * Raja, Govindraj <govindraj.raja@ti.com> [120424 01:41]: >> On Tue, Apr 24, 2012 at 5:15 AM, Kevin Hilman <khilman@ti.com> wrote: >> > "Govindraj.R" <govindraj.raja@ti.com> writes: >> > >> >> From: "Govindraj.R" <govindraj.raja@ti.com> >> >> >> >> The following commit: >> >> (7496ba3 ?ARM: OMAP2+: UART: Add default mux for all uarts) >> >> added default pads for all uarts. But not all boards tend to >> >> use all uarts and most of unused uart pins are muxed for >> >> other purpose. This commit breaks the modules which where trying >> >> to use unused uart pins on their boards. >> >> >> >> So remove the default pads adding. >> > >> > I just noticed that this patch breaks runtime PM & wakeups for UART >> > console (at least on 3530/Overo with ttyO2 console.) >> > >> > By removing the pads, the initial device_init_wakeup() is not called on >> > port init. ?Without this call serial_omap_pm() disables runtime PM >> > because it checks device_may_wakeup(). >> > >> > Since runtime PM was disabled, I manually re-enabled it and then enabled >> > wakeups: >> > >> > ?echo auto > /sys/devices/platform/omap_uart.2/power/control >> > ?echo enabled > /sys/devices/platform/omap_uart.2/tty/ttyO2/power/wakeup >> > >> > Then, after enabling auto-suspend timeouts, it seems wakeups are still >> > not working since the console hangs. >> > >> > Reverting $SUBJECT patch gets things working again. >> >> This was decided as part of discussion [1] >> >> If we are _reconsidering_ taking this patch [2] >> to dynamically probe uart pins and enable rx wakeup. >> >> I can re-work on the patch[2] as per tony's comments[1] >> and re-post it. > > Just to follow up on this.. Let's first get things working reliably, > and only then add more PM support. > > We absolutely can't revert $SUBJECT because it's known to mess up > at least smsc911x and ehci on zoom3, hsi on n900 and probably > many other things. > > For the -rc cycle, it seems that [2] is out of question at this point > as too intrusive. If the PM & wakeups are broken in the default cases, > then I suggest we just take few steps back and disable any deeper PM > states in the -rc series. Unfortunately, no need to do anything more to disable deeper PM states. Because $SUBJECT disables runtime PM for UART, it keeps both PER and CORE on all the time. :( Kevin ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads 2012-05-07 17:39 ` Kevin Hilman @ 2012-05-07 17:54 ` Tony Lindgren -1 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-05-07 17:54 UTC (permalink / raw) To: Kevin Hilman Cc: Raja, Govindraj, linux-omap, linux-arm-kernel, Felipe Balbi, Russ Dill * Kevin Hilman <khilman@ti.com> [120507 10:42]: > Tony Lindgren <tony@atomide.com> writes: > > > > Just to follow up on this.. Let's first get things working reliably, > > and only then add more PM support. > > > > We absolutely can't revert $SUBJECT because it's known to mess up > > at least smsc911x and ehci on zoom3, hsi on n900 and probably > > many other things. > > > > For the -rc cycle, it seems that [2] is out of question at this point > > as too intrusive. If the PM & wakeups are broken in the default cases, > > then I suggest we just take few steps back and disable any deeper PM > > states in the -rc series. > > Unfortunately, no need to do anything more to disable deeper PM states. > > Because $SUBJECT disables runtime PM for UART, it keeps both PER and > CORE on all the time. :( Oh well, it seems that that runtime PM can now be enabled on per-board basis as it gets tested. Regards, Tony ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads @ 2012-05-07 17:54 ` Tony Lindgren 0 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-05-07 17:54 UTC (permalink / raw) To: linux-arm-kernel * Kevin Hilman <khilman@ti.com> [120507 10:42]: > Tony Lindgren <tony@atomide.com> writes: > > > > Just to follow up on this.. Let's first get things working reliably, > > and only then add more PM support. > > > > We absolutely can't revert $SUBJECT because it's known to mess up > > at least smsc911x and ehci on zoom3, hsi on n900 and probably > > many other things. > > > > For the -rc cycle, it seems that [2] is out of question at this point > > as too intrusive. If the PM & wakeups are broken in the default cases, > > then I suggest we just take few steps back and disable any deeper PM > > states in the -rc series. > > Unfortunately, no need to do anything more to disable deeper PM states. > > Because $SUBJECT disables runtime PM for UART, it keeps both PER and > CORE on all the time. :( Oh well, it seems that that runtime PM can now be enabled on per-board basis as it gets tested. Regards, Tony ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup 2012-04-10 13:40 ` Govindraj.R @ 2012-04-10 13:40 ` Govindraj.R -1 siblings, 0 replies; 38+ messages in thread From: Govindraj.R @ 2012-04-10 13:40 UTC (permalink / raw) To: linux-omap Cc: linux-arm-kernel, Felipe Balbi, Kevin Hilman, Russ Dill, Tony Lindgren, Govindraj.R From: "Govindraj.R" <govindraj.raja@ti.com> Default pad populating procedure should first probe whether the uart pins are available as uart tx/rx pins if yes then we can configure them and use rx pin for wakeup capability. Utilise the mux api available to probe the availability of mux pins in uart mode. Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <khilman@ti.com> Cc: Russ Dill <russ.dill@gmail.com> Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> --- arch/arm/mach-omap2/mux.c | 3 +- arch/arm/mach-omap2/mux.h | 10 +++++++ arch/arm/mach-omap2/serial.c | 56 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 65c3391..d937ddd 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -217,8 +217,7 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, return -ENODEV; } -static int __init -omap_mux_get_by_name(const char *muxname, +int __init omap_mux_get_by_name(const char *muxname, struct omap_mux_partition **found_partition, struct omap_mux **found_mux) { diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 69fe060..68927f1 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -225,8 +225,18 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads); */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); +int omap_mux_get_by_name(const char *muxname, + struct omap_mux_partition **found_partition, + struct omap_mux **found_mux); #else +static inline int omap_mux_get_by_name(const char *muxname, + struct omap_mux_partition **found_partition, + struct omap_mux **found_mux) +{ + return 0; +} + static inline int omap_mux_init_gpio(int gpio, int val) { return 0; diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 1554233..7bb971e 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} #endif /* CONFIG_PM */ #ifdef CONFIG_OMAP_MUX -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) + +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; +static struct omap_device_pad default_omap_uart_pads[2] __initdata; + +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) { + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; + + if (bdata->id != 2) { + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, + "uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, + "uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); + } else { + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, + "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, + bdata->id + 1); + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, + "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, + bdata->id + 1); + } + + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && + omap_mux_get_by_name + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { + u16 tx_mode, rx_mode; + + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); + + /* + * Check if uart is used in default tx/rx mode i.e. in mux mode0 + * if yes then configure rx pin for wake up capability + */ + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { + default_omap_uart_pads[0].name = rx_pad_name; + default_omap_uart_pads[0].flags = + OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; + default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | + OMAP_MUX_MODE0; + default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | + OMAP_MUX_MODE0; + + default_omap_uart_pads[1].name = tx_pad_name; + default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | + OMAP_MUX_MODE0; + bdata->pads = default_omap_uart_pads; + bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); + } + } } #else -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) +{} #endif char *cmdline_find_option(char *str) -- 1.7.9 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup @ 2012-04-10 13:40 ` Govindraj.R 0 siblings, 0 replies; 38+ messages in thread From: Govindraj.R @ 2012-04-10 13:40 UTC (permalink / raw) To: linux-arm-kernel From: "Govindraj.R" <govindraj.raja@ti.com> Default pad populating procedure should first probe whether the uart pins are available as uart tx/rx pins if yes then we can configure them and use rx pin for wakeup capability. Utilise the mux api available to probe the availability of mux pins in uart mode. Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <khilman@ti.com> Cc: Russ Dill <russ.dill@gmail.com> Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> --- arch/arm/mach-omap2/mux.c | 3 +- arch/arm/mach-omap2/mux.h | 10 +++++++ arch/arm/mach-omap2/serial.c | 56 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 65 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 65c3391..d937ddd 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -217,8 +217,7 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, return -ENODEV; } -static int __init -omap_mux_get_by_name(const char *muxname, +int __init omap_mux_get_by_name(const char *muxname, struct omap_mux_partition **found_partition, struct omap_mux **found_mux) { diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 69fe060..68927f1 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -225,8 +225,18 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads); */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); +int omap_mux_get_by_name(const char *muxname, + struct omap_mux_partition **found_partition, + struct omap_mux **found_mux); #else +static inline int omap_mux_get_by_name(const char *muxname, + struct omap_mux_partition **found_partition, + struct omap_mux **found_mux) +{ + return 0; +} + static inline int omap_mux_init_gpio(int gpio, int val) { return 0; diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 1554233..7bb971e 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} #endif /* CONFIG_PM */ #ifdef CONFIG_OMAP_MUX -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) + +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; +static struct omap_device_pad default_omap_uart_pads[2] __initdata; + +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) { + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; + + if (bdata->id != 2) { + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, + "uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, + "uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); + } else { + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, + "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, + bdata->id + 1); + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, + "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, + bdata->id + 1); + } + + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && + omap_mux_get_by_name + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { + u16 tx_mode, rx_mode; + + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); + + /* + * Check if uart is used in default tx/rx mode i.e. in mux mode0 + * if yes then configure rx pin for wake up capability + */ + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { + default_omap_uart_pads[0].name = rx_pad_name; + default_omap_uart_pads[0].flags = + OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; + default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | + OMAP_MUX_MODE0; + default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | + OMAP_MUX_MODE0; + + default_omap_uart_pads[1].name = tx_pad_name; + default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | + OMAP_MUX_MODE0; + bdata->pads = default_omap_uart_pads; + bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); + } + } } #else -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) +{} #endif char *cmdline_find_option(char *str) -- 1.7.9 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup 2012-04-10 13:40 ` Govindraj.R @ 2012-04-10 16:11 ` Tony Lindgren -1 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-04-10 16:11 UTC (permalink / raw) To: Govindraj.R Cc: linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman, Russ Dill * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} > #endif /* CONFIG_PM */ > > #ifdef CONFIG_OMAP_MUX > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > + > +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 > +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], > + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; > +static struct omap_device_pad default_omap_uart_pads[2] __initdata; Won't the default_omap_uart_pads get overwritten for each port? We need that information in the driver too for each port? Why don't you just allocate bdata.pads in omap_serial_board_init as we now assume it's needed for each port? > +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) > { > + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > + > + if (bdata->id != 2) { > + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, > + "uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); > + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, > + "uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); > + } else { > + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, > + "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, > + bdata->id + 1); > + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, > + "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, > + bdata->id + 1); > + } This would be simpler with something like this (untested): char *rx_fmt, *tx_fmt; int uart_nr = bdata->id + 1; if (bdata->id == 2) { rx_fmt = "uart%d_rx.uart%d_rx"; tx_fmt = "uart%d_tx.uart%d_tx"; } else { rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; } snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, uart_nr, uart_nr); snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, uart_nr, uart_nr); > + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && > + omap_mux_get_by_name > + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { > + u16 tx_mode, rx_mode; > + > + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); > + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); > + > + /* > + * Check if uart is used in default tx/rx mode i.e. in mux mode0 > + * if yes then configure rx pin for wake up capability > + */ > + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { > + default_omap_uart_pads[0].name = rx_pad_name; > + default_omap_uart_pads[0].flags = > + OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; > + default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | > + OMAP_MUX_MODE0; > + default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | > + OMAP_MUX_MODE0; > + > + default_omap_uart_pads[1].name = tx_pad_name; > + default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | > + OMAP_MUX_MODE0; > + bdata->pads = default_omap_uart_pads; > + bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); > + } > + } > } Then looking at omap_serial_board_init, it still looks wrong: void __init omap_serial_board_init(struct omap_uart_port_info *info) { struct omap_uart_state *uart; struct omap_board_data bdata; list_for_each_entry(uart, &uart_list, node) { bdata.id = uart->num; bdata.flags = 0; bdata.pads = NULL; bdata.pads_cnt = 0; if (cpu_is_omap44xx() || cpu_is_omap34xx()) omap_serial_fill_default_pads(&bdata); Why don't you fill the pads for omap2? It has the same pads, although it does not have the serial wake-up events working. And why don't you exit if omap_serial_fill_default_pads fails for the no info case? Shouldn't it be something like: if (!info) { res = omap_serial_fill_default_pads(&bdata); if (!res) return; port = NULL; } else { port = &info[uart->num]; } omap_serial_init_port(&bdata, port); Regards, Tony ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup @ 2012-04-10 16:11 ` Tony Lindgren 0 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-04-10 16:11 UTC (permalink / raw) To: linux-arm-kernel * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} > #endif /* CONFIG_PM */ > > #ifdef CONFIG_OMAP_MUX > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > + > +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 > +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], > + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; > +static struct omap_device_pad default_omap_uart_pads[2] __initdata; Won't the default_omap_uart_pads get overwritten for each port? We need that information in the driver too for each port? Why don't you just allocate bdata.pads in omap_serial_board_init as we now assume it's needed for each port? > +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) > { > + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > + > + if (bdata->id != 2) { > + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, > + "uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); > + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, > + "uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); > + } else { > + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, > + "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, > + bdata->id + 1); > + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, > + "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, > + bdata->id + 1); > + } This would be simpler with something like this (untested): char *rx_fmt, *tx_fmt; int uart_nr = bdata->id + 1; if (bdata->id == 2) { rx_fmt = "uart%d_rx.uart%d_rx"; tx_fmt = "uart%d_tx.uart%d_tx"; } else { rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; } snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, uart_nr, uart_nr); snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, uart_nr, uart_nr); > + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && > + omap_mux_get_by_name > + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { > + u16 tx_mode, rx_mode; > + > + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); > + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); > + > + /* > + * Check if uart is used in default tx/rx mode i.e. in mux mode0 > + * if yes then configure rx pin for wake up capability > + */ > + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { > + default_omap_uart_pads[0].name = rx_pad_name; > + default_omap_uart_pads[0].flags = > + OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; > + default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | > + OMAP_MUX_MODE0; > + default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | > + OMAP_MUX_MODE0; > + > + default_omap_uart_pads[1].name = tx_pad_name; > + default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | > + OMAP_MUX_MODE0; > + bdata->pads = default_omap_uart_pads; > + bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); > + } > + } > } Then looking at omap_serial_board_init, it still looks wrong: void __init omap_serial_board_init(struct omap_uart_port_info *info) { struct omap_uart_state *uart; struct omap_board_data bdata; list_for_each_entry(uart, &uart_list, node) { bdata.id = uart->num; bdata.flags = 0; bdata.pads = NULL; bdata.pads_cnt = 0; if (cpu_is_omap44xx() || cpu_is_omap34xx()) omap_serial_fill_default_pads(&bdata); Why don't you fill the pads for omap2? It has the same pads, although it does not have the serial wake-up events working. And why don't you exit if omap_serial_fill_default_pads fails for the no info case? Shouldn't it be something like: if (!info) { res = omap_serial_fill_default_pads(&bdata); if (!res) return; port = NULL; } else { port = &info[uart->num]; } omap_serial_init_port(&bdata, port); Regards, Tony ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup 2012-04-10 16:11 ` Tony Lindgren @ 2012-04-10 16:40 ` Russ Dill -1 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-10 16:40 UTC (permalink / raw) To: Tony Lindgren Cc: Govindraj.R, linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman On Tue, Apr 10, 2012 at 9:11 AM, Tony Lindgren <tony@atomide.com> wrote: > * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: >> --- a/arch/arm/mach-omap2/serial.c >> +++ b/arch/arm/mach-omap2/serial.c >> @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} >> #endif /* CONFIG_PM */ >> >> #ifdef CONFIG_OMAP_MUX >> -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) >> + >> +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 >> +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], >> + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; >> +static struct omap_device_pad default_omap_uart_pads[2] __initdata; > > Won't the default_omap_uart_pads get overwritten for each port? > We need that information in the driver too for each port? Why don't you > just allocate bdata.pads in omap_serial_board_init as we now assume it's > needed for each port? Because of the way the function is used, it doesn't. It does seem somewhat fragile though, with non-obvious breakage possible in the future if someone changes the way omap_serial_fill_default_pads is called. >> +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) >> { >> + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >> + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >> + >> + if (bdata->id != 2) { >> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + "uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); >> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + "uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); >> + } else { >> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, >> + bdata->id + 1); >> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, >> + bdata->id + 1); >> + } > > This would be simpler with something like this (untested): > > char *rx_fmt, *tx_fmt; > int uart_nr = bdata->id + 1; > > if (bdata->id == 2) { > rx_fmt = "uart%d_rx.uart%d_rx"; > tx_fmt = "uart%d_tx.uart%d_tx"; > } else { > rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > } > > snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > uart_nr, uart_nr); > snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > uart_nr, uart_nr); > >> + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && >> + omap_mux_get_by_name >> + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { >> + u16 tx_mode, rx_mode; >> + >> + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); >> + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); >> + >> + /* >> + * Check if uart is used in default tx/rx mode i.e. in mux mode0 >> + * if yes then configure rx pin for wake up capability >> + */ >> + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { >> + default_omap_uart_pads[0].name = rx_pad_name; >> + default_omap_uart_pads[0].flags = >> + OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; >> + default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | >> + OMAP_MUX_MODE0; >> + default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | >> + OMAP_MUX_MODE0; >> + >> + default_omap_uart_pads[1].name = tx_pad_name; >> + default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | >> + OMAP_MUX_MODE0; >> + bdata->pads = default_omap_uart_pads; >> + bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); >> + } >> + } >> } > > Then looking at omap_serial_board_init, it still looks wrong: > > void __init omap_serial_board_init(struct omap_uart_port_info *info) > { > struct omap_uart_state *uart; > struct omap_board_data bdata; > > list_for_each_entry(uart, &uart_list, node) { > bdata.id = uart->num; > bdata.flags = 0; > bdata.pads = NULL; > bdata.pads_cnt = 0; > > if (cpu_is_omap44xx() || cpu_is_omap34xx()) > omap_serial_fill_default_pads(&bdata); > > Why don't you fill the pads for omap2? It has the same pads, although > it does not have the serial wake-up events working. > > And why don't you exit if omap_serial_fill_default_pads fails for the > no info case? > > Shouldn't it be something like: > > if (!info) { > res = omap_serial_fill_default_pads(&bdata); > if (!res) > return; > port = NULL; > } else { > port = &info[uart->num]; > } > omap_serial_init_port(&bdata, port); > > Regards, > > Tony ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup @ 2012-04-10 16:40 ` Russ Dill 0 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-10 16:40 UTC (permalink / raw) To: linux-arm-kernel On Tue, Apr 10, 2012 at 9:11 AM, Tony Lindgren <tony@atomide.com> wrote: > * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: >> --- a/arch/arm/mach-omap2/serial.c >> +++ b/arch/arm/mach-omap2/serial.c >> @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} >> ?#endif /* CONFIG_PM */ >> >> ?#ifdef CONFIG_OMAP_MUX >> -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) >> + >> +#define OMAP_UART_DEFAULT_PAD_NAME_LEN ? ? ? 28 >> +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], >> + ? ? ? ? ? ? tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; >> +static struct omap_device_pad default_omap_uart_pads[2] __initdata; > > Won't the default_omap_uart_pads get overwritten for each port? > We need that information in the driver too for each port? Why don't you > just allocate bdata.pads in omap_serial_board_init as we now assume it's > needed for each port? Because of the way the function is used, it doesn't. It does seem somewhat fragile though, with non-obvious breakage possible in the future if someone changes the way omap_serial_fill_default_pads is called. >> +static void ?__init omap_serial_fill_default_pads(struct omap_board_data *bdata) >> ?{ >> + ? ? struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >> + ? ? struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >> + >> + ? ? if (bdata->id != 2) { >> + ? ? ? ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + ? ? ? ? ? ? ? ? ? ? ?"uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); >> + ? ? ? ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + ? ? ? ? ? ? ? ? ? ? ?"uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); >> + ? ? } else { >> + ? ? ? ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + ? ? ? ? ? ? ? ? ? ? "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, >> + ? ? ? ? ? ? ? ? ? ? bdata->id + 1); >> + ? ? ? ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + ? ? ? ? ? ? ? ? ? ? "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, >> + ? ? ? ? ? ? ? ? ? ? bdata->id + 1); >> + ? ? } > > This would be simpler with something like this (untested): > > ? ? ? ?char *rx_fmt, *tx_fmt; > ? ? ? ?int uart_nr = bdata->id + 1; > > ? ? ? ?if (bdata->id == 2) { > ? ? ? ? ? ? ? ?rx_fmt = "uart%d_rx.uart%d_rx"; > ? ? ? ? ? ? ? ?tx_fmt = "uart%d_tx.uart%d_tx"; > ? ? ? ?} else { > ? ? ? ? ? ? ? ?rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > ? ? ? ? ? ? ? ?tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > ? ? ? ?} > > ? ? ? ?snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > ? ? ? ? ? ? ? ? ? ? ? ?uart_nr, uart_nr); > ? ? ? ?snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > ? ? ? ? ? ? ? ? ? ? ? ?uart_nr, uart_nr); > >> + ? ? if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && >> + ? ? ? ? ? ? ? ? ? ? omap_mux_get_by_name >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? (tx_pad_name, &tx_partition, &tx_mux) >= 0) { >> + ? ? ? ? ? ? u16 tx_mode, rx_mode; >> + >> + ? ? ? ? ? ? tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); >> + ? ? ? ? ? ? rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); >> + >> + ? ? ? ? ? ? /* >> + ? ? ? ? ? ? ?* Check if uart is used in default tx/rx mode i.e. in mux mode0 >> + ? ? ? ? ? ? ?* if yes then configure rx pin for wake up capability >> + ? ? ? ? ? ? ?*/ >> + ? ? ? ? ? ? if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].name = rx_pad_name; >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].flags ?= >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >> + >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[1].name = tx_pad_name; >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >> + ? ? ? ? ? ? ? ? ? ? bdata->pads = default_omap_uart_pads; >> + ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); >> + ? ? ? ? ? ? } >> + ? ? } >> ?} > > Then looking at omap_serial_board_init, it still looks wrong: > > void __init omap_serial_board_init(struct omap_uart_port_info *info) > { > ? ? ? ?struct omap_uart_state *uart; > ? ? ? ?struct omap_board_data bdata; > > ? ? ? ?list_for_each_entry(uart, &uart_list, node) { > ? ? ? ? ? ? ? ?bdata.id = uart->num; > ? ? ? ? ? ? ? ?bdata.flags = 0; > ? ? ? ? ? ? ? ?bdata.pads = NULL; > ? ? ? ? ? ? ? ?bdata.pads_cnt = 0; > > ? ? ? ? ? ? ? ?if (cpu_is_omap44xx() || cpu_is_omap34xx()) > ? ? ? ? ? ? ? ? ? ? ? ?omap_serial_fill_default_pads(&bdata); > > Why don't you fill the pads for omap2? It has the same pads, although > it does not have the serial wake-up events working. > > And why don't you exit if omap_serial_fill_default_pads fails for the > no info case? > > Shouldn't it be something like: > > ? ? ? ? ? ? ? ?if (!info) { > ? ? ? ? ? ? ? ? ? ? ? ?res = omap_serial_fill_default_pads(&bdata); > ? ? ? ? ? ? ? ? ? ? ? ?if (!res) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return; > ? ? ? ? ? ? ? ? ? ? ? ?port = NULL; > ? ? ? ? ? ? ? ?} else { > ? ? ? ? ? ? ? ? ? ? ? ?port = &info[uart->num]; > ? ? ? ? ? ? ? ?} > ? ? ? ? ? ? ? ?omap_serial_init_port(&bdata, port); > > Regards, > > Tony ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup 2012-04-10 16:11 ` Tony Lindgren @ 2012-04-11 11:50 ` Raja, Govindraj -1 siblings, 0 replies; 38+ messages in thread From: Raja, Govindraj @ 2012-04-11 11:50 UTC (permalink / raw) To: Tony Lindgren Cc: linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman, Russ Dill On Tue, Apr 10, 2012 at 9:41 PM, Tony Lindgren <tony@atomide.com> wrote: > * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: >> --- a/arch/arm/mach-omap2/serial.c >> +++ b/arch/arm/mach-omap2/serial.c >> @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} >> #endif /* CONFIG_PM */ >> >> #ifdef CONFIG_OMAP_MUX >> -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) >> + >> +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 >> +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], >> + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; >> +static struct omap_device_pad default_omap_uart_pads[2] __initdata; > > Won't the default_omap_uart_pads get overwritten for each port? > We need that information in the driver too for each port? Why don't you > just allocate bdata.pads in omap_serial_board_init as we now assume it's > needed for each port? > Yes can be part of omap_uart_state structure. >> +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) >> { >> + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >> + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >> + >> + if (bdata->id != 2) { >> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + "uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); >> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + "uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); >> + } else { >> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, >> + bdata->id + 1); >> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, >> + bdata->id + 1); >> + } > > This would be simpler with something like this (untested): > > char *rx_fmt, *tx_fmt; > int uart_nr = bdata->id + 1; > > if (bdata->id == 2) { > rx_fmt = "uart%d_rx.uart%d_rx"; > tx_fmt = "uart%d_tx.uart%d_tx"; > } else { > rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > } > > snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > uart_nr, uart_nr); > snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > uart_nr, uart_nr); > okay fine. >> + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && >> + omap_mux_get_by_name >> + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { >> + u16 tx_mode, rx_mode; >> + >> + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); >> + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); >> + >> + /* >> + * Check if uart is used in default tx/rx mode i.e. in mux mode0 >> + * if yes then configure rx pin for wake up capability >> + */ >> + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { >> + default_omap_uart_pads[0].name = rx_pad_name; >> + default_omap_uart_pads[0].flags = >> + OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; >> + default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | >> + OMAP_MUX_MODE0; >> + default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | >> + OMAP_MUX_MODE0; >> + >> + default_omap_uart_pads[1].name = tx_pad_name; >> + default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | >> + OMAP_MUX_MODE0; >> + bdata->pads = default_omap_uart_pads; >> + bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); >> + } >> + } >> } > > Then looking at omap_serial_board_init, it still looks wrong: > > void __init omap_serial_board_init(struct omap_uart_port_info *info) > { > struct omap_uart_state *uart; > struct omap_board_data bdata; > > list_for_each_entry(uart, &uart_list, node) { > bdata.id = uart->num; > bdata.flags = 0; > bdata.pads = NULL; > bdata.pads_cnt = 0; > > if (cpu_is_omap44xx() || cpu_is_omap34xx()) > omap_serial_fill_default_pads(&bdata); > > Why don't you fill the pads for omap2? It has the same pads, although > it does not have the serial wake-up events working. > > And why don't you exit if omap_serial_fill_default_pads fails for the > no info case? > > Shouldn't it be something like: > > if (!info) { > res = omap_serial_fill_default_pads(&bdata); > if (!res) > return; > port = NULL; > } else { > port = &info[uart->num]; > } > omap_serial_init_port(&bdata, port); > Yes if filling of default pads fails we can avoid registering that port however I think that should not depend on availability of port info. Here [1] is the updated patch. -- Thanks, Govindraj.R [1]: From ea06c7d5014b68f622b3e2ca226e5a5194d48e9a Mon Sep 17 00:00:00 2001 From: "Govindraj.R" <govindraj.raja@ti.com> Date: Tue, 10 Apr 2012 18:21:52 +0530 Subject: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup Default pad populating procedure should first probe whether the uart pins are available as uart tx/rx pins if yes then we can configure them and use rx pin for wakeup capability. Utilise the mux api available to probe the availability of mux pins in uart mode. Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <khilman@ti.com> Cc: Russ Dill <russ.dill@gmail.com> Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> --- arch/arm/mach-omap2/mux.c | 3 +- arch/arm/mach-omap2/mux.h | 10 ++++++ arch/arm/mach-omap2/serial.c | 73 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 65c3391..d937ddd 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -217,8 +217,7 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, return -ENODEV; } -static int __init -omap_mux_get_by_name(const char *muxname, +int __init omap_mux_get_by_name(const char *muxname, struct omap_mux_partition **found_partition, struct omap_mux **found_mux) { diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 69fe060..68927f1 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -225,8 +225,18 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads); */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); +int omap_mux_get_by_name(const char *muxname, + struct omap_mux_partition **found_partition, + struct omap_mux **found_mux); #else +static inline int omap_mux_get_by_name(const char *muxname, + struct omap_mux_partition **found_partition, + struct omap_mux **found_mux) +{ + return 0; +} + static inline int omap_mux_init_gpio(int gpio, int val) { return 0; diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 2e351f5..9d62cae 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -57,6 +57,7 @@ struct omap_uart_state { struct list_head node; struct omap_hwmod *oh; + struct omap_device_pad default_omap_uart_pads[2]; }; static LIST_HEAD(uart_list); @@ -120,11 +121,75 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} #endif /* CONFIG_PM */ #ifdef CONFIG_OMAP_MUX -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) + +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; + +static void __init +omap_serial_fill_uart_tx_rx_pads(struct omap_board_data *bdata, + struct omap_uart_state *uart) { + uart->default_omap_uart_pads[0].name = rx_pad_name; + uart->default_omap_uart_pads[0].flags = OMAP_DEVICE_PAD_REMUX | + OMAP_DEVICE_PAD_WAKEUP; + uart->default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | + OMAP_MUX_MODE0; + uart->default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0; + uart->default_omap_uart_pads[1].name = tx_pad_name; + uart->default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | + OMAP_MUX_MODE0; + bdata->pads = uart->default_omap_uart_pads; + bdata->pads_cnt = ARRAY_SIZE(uart->default_omap_uart_pads); +} + +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata, + struct omap_uart_state *uart) +{ + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; + char *rx_fmt, *tx_fmt; + int uart_nr = bdata->id + 1; + + if (bdata->id != 2) { + rx_fmt = "uart%d_rx.uart%d_rx"; + tx_fmt = "uart%d_tx.uart%d_tx"; + } else { + rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; + tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; + } + + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, + uart_nr, uart_nr); + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, + uart_nr, uart_nr); + + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && + omap_mux_get_by_name + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { + u16 tx_mode, rx_mode; + + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); + + /* + * Check if uart is used in default tx/rx mode i.e. in mux mode0 + * if yes then configure rx pin for wake up capability + */ + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { + omap_serial_fill_uart_tx_rx_pads(bdata, uart); + return 0; + } + } + + return -ENODEV; } #else -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata + struct omap_uart_state *uart) +{ + return 0; +} #endif char *cmdline_find_option(char *str) @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct omap_uart_port_info *info) bdata.pads = NULL; bdata.pads_cnt = 0; - if (cpu_is_omap44xx() || cpu_is_omap34xx()) - omap_serial_fill_default_pads(&bdata); + if (omap_serial_fill_default_pads(&bdata, uart)) + continue; if (!info) omap_serial_init_port(&bdata, NULL); -- 1.7.9 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup @ 2012-04-11 11:50 ` Raja, Govindraj 0 siblings, 0 replies; 38+ messages in thread From: Raja, Govindraj @ 2012-04-11 11:50 UTC (permalink / raw) To: linux-arm-kernel On Tue, Apr 10, 2012 at 9:41 PM, Tony Lindgren <tony@atomide.com> wrote: > * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: >> --- a/arch/arm/mach-omap2/serial.c >> +++ b/arch/arm/mach-omap2/serial.c >> @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} >> ?#endif /* CONFIG_PM */ >> >> ?#ifdef CONFIG_OMAP_MUX >> -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) >> + >> +#define OMAP_UART_DEFAULT_PAD_NAME_LEN ? ? ? 28 >> +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], >> + ? ? ? ? ? ? tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; >> +static struct omap_device_pad default_omap_uart_pads[2] __initdata; > > Won't the default_omap_uart_pads get overwritten for each port? > We need that information in the driver too for each port? Why don't you > just allocate bdata.pads in omap_serial_board_init as we now assume it's > needed for each port? > Yes can be part of omap_uart_state structure. >> +static void ?__init omap_serial_fill_default_pads(struct omap_board_data *bdata) >> ?{ >> + ? ? struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >> + ? ? struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >> + >> + ? ? if (bdata->id != 2) { >> + ? ? ? ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + ? ? ? ? ? ? ? ? ? ? ?"uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); >> + ? ? ? ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + ? ? ? ? ? ? ? ? ? ? ?"uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); >> + ? ? } else { >> + ? ? ? ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + ? ? ? ? ? ? ? ? ? ? "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, >> + ? ? ? ? ? ? ? ? ? ? bdata->id + 1); >> + ? ? ? ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >> + ? ? ? ? ? ? ? ? ? ? "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, >> + ? ? ? ? ? ? ? ? ? ? bdata->id + 1); >> + ? ? } > > This would be simpler with something like this (untested): > > ? ? ? ?char *rx_fmt, *tx_fmt; > ? ? ? ?int uart_nr = bdata->id + 1; > > ? ? ? ?if (bdata->id == 2) { > ? ? ? ? ? ? ? ?rx_fmt = "uart%d_rx.uart%d_rx"; > ? ? ? ? ? ? ? ?tx_fmt = "uart%d_tx.uart%d_tx"; > ? ? ? ?} else { > ? ? ? ? ? ? ? ?rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > ? ? ? ? ? ? ? ?tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > ? ? ? ?} > > ? ? ? ?snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > ? ? ? ? ? ? ? ? ? ? ? ?uart_nr, uart_nr); > ? ? ? ?snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > ? ? ? ? ? ? ? ? ? ? ? ?uart_nr, uart_nr); > okay fine. >> + ? ? if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && >> + ? ? ? ? ? ? ? ? ? ? omap_mux_get_by_name >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? (tx_pad_name, &tx_partition, &tx_mux) >= 0) { >> + ? ? ? ? ? ? u16 tx_mode, rx_mode; >> + >> + ? ? ? ? ? ? tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); >> + ? ? ? ? ? ? rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); >> + >> + ? ? ? ? ? ? /* >> + ? ? ? ? ? ? ?* Check if uart is used in default tx/rx mode i.e. in mux mode0 >> + ? ? ? ? ? ? ?* if yes then configure rx pin for wake up capability >> + ? ? ? ? ? ? ?*/ >> + ? ? ? ? ? ? if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].name = rx_pad_name; >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].flags ?= >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >> + >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[1].name = tx_pad_name; >> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >> + ? ? ? ? ? ? ? ? ? ? bdata->pads = default_omap_uart_pads; >> + ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); >> + ? ? ? ? ? ? } >> + ? ? } >> ?} > > Then looking at omap_serial_board_init, it still looks wrong: > > void __init omap_serial_board_init(struct omap_uart_port_info *info) > { > ? ? ? ?struct omap_uart_state *uart; > ? ? ? ?struct omap_board_data bdata; > > ? ? ? ?list_for_each_entry(uart, &uart_list, node) { > ? ? ? ? ? ? ? ?bdata.id = uart->num; > ? ? ? ? ? ? ? ?bdata.flags = 0; > ? ? ? ? ? ? ? ?bdata.pads = NULL; > ? ? ? ? ? ? ? ?bdata.pads_cnt = 0; > > ? ? ? ? ? ? ? ?if (cpu_is_omap44xx() || cpu_is_omap34xx()) > ? ? ? ? ? ? ? ? ? ? ? ?omap_serial_fill_default_pads(&bdata); > > Why don't you fill the pads for omap2? It has the same pads, although > it does not have the serial wake-up events working. > > And why don't you exit if omap_serial_fill_default_pads fails for the > no info case? > > Shouldn't it be something like: > > ? ? ? ? ? ? ? ?if (!info) { > ? ? ? ? ? ? ? ? ? ? ? ?res = omap_serial_fill_default_pads(&bdata); > ? ? ? ? ? ? ? ? ? ? ? ?if (!res) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return; > ? ? ? ? ? ? ? ? ? ? ? ?port = NULL; > ? ? ? ? ? ? ? ?} else { > ? ? ? ? ? ? ? ? ? ? ? ?port = &info[uart->num]; > ? ? ? ? ? ? ? ?} > ? ? ? ? ? ? ? ?omap_serial_init_port(&bdata, port); > Yes if filling of default pads fails we can avoid registering that port however I think that should not depend on availability of port info. Here [1] is the updated patch. -- Thanks, Govindraj.R [1]: >From ea06c7d5014b68f622b3e2ca226e5a5194d48e9a Mon Sep 17 00:00:00 2001 From: "Govindraj.R" <govindraj.raja@ti.com> Date: Tue, 10 Apr 2012 18:21:52 +0530 Subject: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup Default pad populating procedure should first probe whether the uart pins are available as uart tx/rx pins if yes then we can configure them and use rx pin for wakeup capability. Utilise the mux api available to probe the availability of mux pins in uart mode. Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <khilman@ti.com> Cc: Russ Dill <russ.dill@gmail.com> Reported-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Govindraj.R <govindraj.raja@ti.com> --- arch/arm/mach-omap2/mux.c | 3 +- arch/arm/mach-omap2/mux.h | 10 ++++++ arch/arm/mach-omap2/serial.c | 73 +++++++++++++++++++++++++++++++++++++++-- 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 65c3391..d937ddd 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c @@ -217,8 +217,7 @@ static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition, return -ENODEV; } -static int __init -omap_mux_get_by_name(const char *muxname, +int __init omap_mux_get_by_name(const char *muxname, struct omap_mux_partition **found_partition, struct omap_mux **found_mux) { diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h index 69fe060..68927f1 100644 --- a/arch/arm/mach-omap2/mux.h +++ b/arch/arm/mach-omap2/mux.h @@ -225,8 +225,18 @@ omap_hwmod_mux_init(struct omap_device_pad *bpads, int nr_pads); */ void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); +int omap_mux_get_by_name(const char *muxname, + struct omap_mux_partition **found_partition, + struct omap_mux **found_mux); #else +static inline int omap_mux_get_by_name(const char *muxname, + struct omap_mux_partition **found_partition, + struct omap_mux **found_mux) +{ + return 0; +} + static inline int omap_mux_init_gpio(int gpio, int val) { return 0; diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c index 2e351f5..9d62cae 100644 --- a/arch/arm/mach-omap2/serial.c +++ b/arch/arm/mach-omap2/serial.c @@ -57,6 +57,7 @@ struct omap_uart_state { struct list_head node; struct omap_hwmod *oh; + struct omap_device_pad default_omap_uart_pads[2]; }; static LIST_HEAD(uart_list); @@ -120,11 +121,75 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} #endif /* CONFIG_PM */ #ifdef CONFIG_OMAP_MUX -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) + +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; + +static void __init +omap_serial_fill_uart_tx_rx_pads(struct omap_board_data *bdata, + struct omap_uart_state *uart) { + uart->default_omap_uart_pads[0].name = rx_pad_name; + uart->default_omap_uart_pads[0].flags = OMAP_DEVICE_PAD_REMUX | + OMAP_DEVICE_PAD_WAKEUP; + uart->default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | + OMAP_MUX_MODE0; + uart->default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0; + uart->default_omap_uart_pads[1].name = tx_pad_name; + uart->default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | + OMAP_MUX_MODE0; + bdata->pads = uart->default_omap_uart_pads; + bdata->pads_cnt = ARRAY_SIZE(uart->default_omap_uart_pads); +} + +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata, + struct omap_uart_state *uart) +{ + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; + char *rx_fmt, *tx_fmt; + int uart_nr = bdata->id + 1; + + if (bdata->id != 2) { + rx_fmt = "uart%d_rx.uart%d_rx"; + tx_fmt = "uart%d_tx.uart%d_tx"; + } else { + rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; + tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; + } + + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, + uart_nr, uart_nr); + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, + uart_nr, uart_nr); + + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && + omap_mux_get_by_name + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { + u16 tx_mode, rx_mode; + + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); + + /* + * Check if uart is used in default tx/rx mode i.e. in mux mode0 + * if yes then configure rx pin for wake up capability + */ + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { + omap_serial_fill_uart_tx_rx_pads(bdata, uart); + return 0; + } + } + + return -ENODEV; } #else -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata + struct omap_uart_state *uart) +{ + return 0; +} #endif char *cmdline_find_option(char *str) @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct omap_uart_port_info *info) bdata.pads = NULL; bdata.pads_cnt = 0; - if (cpu_is_omap44xx() || cpu_is_omap34xx()) - omap_serial_fill_default_pads(&bdata); + if (omap_serial_fill_default_pads(&bdata, uart)) + continue; if (!info) omap_serial_init_port(&bdata, NULL); -- 1.7.9 ^ permalink raw reply related [flat|nested] 38+ messages in thread
* Re: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup 2012-04-11 11:50 ` Raja, Govindraj @ 2012-04-11 20:16 ` Russ Dill -1 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-11 20:16 UTC (permalink / raw) To: Raja, Govindraj Cc: Tony Lindgren, linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman On Wed, Apr 11, 2012 at 4:50 AM, Raja, Govindraj <govindraj.raja@ti.com> wrote: > On Tue, Apr 10, 2012 at 9:41 PM, Tony Lindgren <tony@atomide.com> wrote: >> * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: >>> --- a/arch/arm/mach-omap2/serial.c >>> +++ b/arch/arm/mach-omap2/serial.c >>> @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} >>> #endif /* CONFIG_PM */ >>> >>> #ifdef CONFIG_OMAP_MUX >>> -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) >>> + >>> +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 >>> +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], >>> + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; >>> +static struct omap_device_pad default_omap_uart_pads[2] __initdata; >> >> Won't the default_omap_uart_pads get overwritten for each port? >> We need that information in the driver too for each port? Why don't you >> just allocate bdata.pads in omap_serial_board_init as we now assume it's >> needed for each port? >> > > Yes can be part of omap_uart_state structure. > >>> +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) >>> { >>> + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >>> + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >>> + >>> + if (bdata->id != 2) { >>> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + "uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); >>> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + "uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); >>> + } else { >>> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, >>> + bdata->id + 1); >>> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, >>> + bdata->id + 1); >>> + } >> >> This would be simpler with something like this (untested): >> >> char *rx_fmt, *tx_fmt; >> int uart_nr = bdata->id + 1; >> >> if (bdata->id == 2) { >> rx_fmt = "uart%d_rx.uart%d_rx"; >> tx_fmt = "uart%d_tx.uart%d_tx"; >> } else { >> rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; >> tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; >> } >> >> snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, >> uart_nr, uart_nr); >> snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, >> uart_nr, uart_nr); >> > > okay fine. > >>> + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && >>> + omap_mux_get_by_name >>> + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { >>> + u16 tx_mode, rx_mode; >>> + >>> + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); >>> + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); >>> + >>> + /* >>> + * Check if uart is used in default tx/rx mode i.e. in mux mode0 >>> + * if yes then configure rx pin for wake up capability >>> + */ >>> + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { >>> + default_omap_uart_pads[0].name = rx_pad_name; >>> + default_omap_uart_pads[0].flags = >>> + OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; >>> + default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | >>> + OMAP_MUX_MODE0; >>> + default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | >>> + OMAP_MUX_MODE0; >>> + >>> + default_omap_uart_pads[1].name = tx_pad_name; >>> + default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | >>> + OMAP_MUX_MODE0; >>> + bdata->pads = default_omap_uart_pads; >>> + bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); >>> + } >>> + } >>> } >> >> Then looking at omap_serial_board_init, it still looks wrong: >> >> void __init omap_serial_board_init(struct omap_uart_port_info *info) >> { >> struct omap_uart_state *uart; >> struct omap_board_data bdata; >> >> list_for_each_entry(uart, &uart_list, node) { >> bdata.id = uart->num; >> bdata.flags = 0; >> bdata.pads = NULL; >> bdata.pads_cnt = 0; >> >> if (cpu_is_omap44xx() || cpu_is_omap34xx()) >> omap_serial_fill_default_pads(&bdata); >> >> Why don't you fill the pads for omap2? It has the same pads, although >> it does not have the serial wake-up events working. >> >> And why don't you exit if omap_serial_fill_default_pads fails for the >> no info case? >> >> Shouldn't it be something like: >> >> if (!info) { >> res = omap_serial_fill_default_pads(&bdata); >> if (!res) >> return; >> port = NULL; >> } else { >> port = &info[uart->num]; >> } >> omap_serial_init_port(&bdata, port); >> > > Yes if filling of default pads fails we can avoid registering that port > however I think that should not depend on availability of port info. > > Here [1] is the updated patch. > > -- > Thanks, > Govindraj.R > > > [1]: > > > From ea06c7d5014b68f622b3e2ca226e5a5194d48e9a Mon Sep 17 00:00:00 2001 > From: "Govindraj.R" <govindraj.raja@ti.com> > Date: Tue, 10 Apr 2012 18:21:52 +0530 > Subject: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and > configure rx wakeup > > Default pad populating procedure should first probe whether the uart > pins are available as uart tx/rx pins if yes then we can configure them > and use rx pin for wakeup capability. > > Utilise the mux api available to probe the availability of mux pins > in uart mode. > > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> This patch has been seriously damaged by your mailer. What mailer are you using? Tested against master on xM for USB and NFS boot. Signed-off-by: Russ.Dill@ti.com > --- > arch/arm/mach-omap2/mux.c | 3 +- > arch/arm/mach-omap2/mux.h | 10 ++++++ > arch/arm/mach-omap2/serial.c | 73 +++++++++++++++++++++++++++++++++++++++-- > 3 files changed, 80 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c > index 65c3391..d937ddd 100644 > --- a/arch/arm/mach-omap2/mux.c > +++ b/arch/arm/mach-omap2/mux.c > @@ -217,8 +217,7 @@ static int __init _omap_mux_get_by_name(struct > omap_mux_partition *partition, > return -ENODEV; > } > > -static int __init > -omap_mux_get_by_name(const char *muxname, > +int __init omap_mux_get_by_name(const char *muxname, > struct omap_mux_partition **found_partition, > struct omap_mux **found_mux) > { > diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h > index 69fe060..68927f1 100644 > --- a/arch/arm/mach-omap2/mux.h > +++ b/arch/arm/mach-omap2/mux.h > @@ -225,8 +225,18 @@ omap_hwmod_mux_init(struct omap_device_pad > *bpads, int nr_pads); > */ > void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); > > +int omap_mux_get_by_name(const char *muxname, > + struct omap_mux_partition **found_partition, > + struct omap_mux **found_mux); > #else > > +static inline int omap_mux_get_by_name(const char *muxname, > + struct omap_mux_partition **found_partition, > + struct omap_mux **found_mux) > +{ > + return 0; > +} > + > static inline int omap_mux_init_gpio(int gpio, int val) > { > return 0; > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index 2e351f5..9d62cae 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -57,6 +57,7 @@ struct omap_uart_state { > > struct list_head node; > struct omap_hwmod *oh; > + struct omap_device_pad default_omap_uart_pads[2]; > }; > > static LIST_HEAD(uart_list); > @@ -120,11 +121,75 @@ static void omap_uart_set_smartidle(struct > platform_device *pdev) {} > #endif /* CONFIG_PM */ > > #ifdef CONFIG_OMAP_MUX > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > + > +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 > +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], > + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; > + > +static void __init > +omap_serial_fill_uart_tx_rx_pads(struct omap_board_data *bdata, > + struct omap_uart_state *uart) > { > + uart->default_omap_uart_pads[0].name = rx_pad_name; > + uart->default_omap_uart_pads[0].flags = OMAP_DEVICE_PAD_REMUX | > + OMAP_DEVICE_PAD_WAKEUP; > + uart->default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | > + OMAP_MUX_MODE0; > + uart->default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0; > + uart->default_omap_uart_pads[1].name = tx_pad_name; > + uart->default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | > + OMAP_MUX_MODE0; > + bdata->pads = uart->default_omap_uart_pads; > + bdata->pads_cnt = ARRAY_SIZE(uart->default_omap_uart_pads); > +} > + > +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata, > + struct omap_uart_state *uart) > +{ > + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > + char *rx_fmt, *tx_fmt; > + int uart_nr = bdata->id + 1; > + > + if (bdata->id != 2) { > + rx_fmt = "uart%d_rx.uart%d_rx"; > + tx_fmt = "uart%d_tx.uart%d_tx"; > + } else { > + rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > + tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > + } > + > + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > + uart_nr, uart_nr); > + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > + uart_nr, uart_nr); > + > + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && > + omap_mux_get_by_name > + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { > + u16 tx_mode, rx_mode; > + > + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); > + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); > + > + /* > + * Check if uart is used in default tx/rx mode i.e. in mux mode0 > + * if yes then configure rx pin for wake up capability > + */ > + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { > + omap_serial_fill_uart_tx_rx_pads(bdata, uart); > + return 0; > + } > + } > + > + return -ENODEV; > } > #else > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} > +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata > + struct omap_uart_state *uart) > +{ > + return 0; > +} > #endif > > char *cmdline_find_option(char *str) > @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct > omap_uart_port_info *info) > bdata.pads = NULL; > bdata.pads_cnt = 0; > > - if (cpu_is_omap44xx() || cpu_is_omap34xx()) > - omap_serial_fill_default_pads(&bdata); > + if (omap_serial_fill_default_pads(&bdata, uart)) > + continue; > > if (!info) > omap_serial_init_port(&bdata, NULL); > -- > 1.7.9 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup @ 2012-04-11 20:16 ` Russ Dill 0 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-11 20:16 UTC (permalink / raw) To: linux-arm-kernel On Wed, Apr 11, 2012 at 4:50 AM, Raja, Govindraj <govindraj.raja@ti.com> wrote: > On Tue, Apr 10, 2012 at 9:41 PM, Tony Lindgren <tony@atomide.com> wrote: >> * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: >>> --- a/arch/arm/mach-omap2/serial.c >>> +++ b/arch/arm/mach-omap2/serial.c >>> @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} >>> ?#endif /* CONFIG_PM */ >>> >>> ?#ifdef CONFIG_OMAP_MUX >>> -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) >>> + >>> +#define OMAP_UART_DEFAULT_PAD_NAME_LEN ? ? ? 28 >>> +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], >>> + ? ? ? ? ? ? tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; >>> +static struct omap_device_pad default_omap_uart_pads[2] __initdata; >> >> Won't the default_omap_uart_pads get overwritten for each port? >> We need that information in the driver too for each port? Why don't you >> just allocate bdata.pads in omap_serial_board_init as we now assume it's >> needed for each port? >> > > Yes can be part of omap_uart_state structure. > >>> +static void ?__init omap_serial_fill_default_pads(struct omap_board_data *bdata) >>> ?{ >>> + ? ? struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >>> + ? ? struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >>> + >>> + ? ? if (bdata->id != 2) { >>> + ? ? ? ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + ? ? ? ? ? ? ? ? ? ? ?"uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); >>> + ? ? ? ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + ? ? ? ? ? ? ? ? ? ? ?"uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); >>> + ? ? } else { >>> + ? ? ? ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + ? ? ? ? ? ? ? ? ? ? "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, >>> + ? ? ? ? ? ? ? ? ? ? bdata->id + 1); >>> + ? ? ? ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + ? ? ? ? ? ? ? ? ? ? "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, >>> + ? ? ? ? ? ? ? ? ? ? bdata->id + 1); >>> + ? ? } >> >> This would be simpler with something like this (untested): >> >> ? ? ? ?char *rx_fmt, *tx_fmt; >> ? ? ? ?int uart_nr = bdata->id + 1; >> >> ? ? ? ?if (bdata->id == 2) { >> ? ? ? ? ? ? ? ?rx_fmt = "uart%d_rx.uart%d_rx"; >> ? ? ? ? ? ? ? ?tx_fmt = "uart%d_tx.uart%d_tx"; >> ? ? ? ?} else { >> ? ? ? ? ? ? ? ?rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; >> ? ? ? ? ? ? ? ?tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; >> ? ? ? ?} >> >> ? ? ? ?snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, >> ? ? ? ? ? ? ? ? ? ? ? ?uart_nr, uart_nr); >> ? ? ? ?snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, >> ? ? ? ? ? ? ? ? ? ? ? ?uart_nr, uart_nr); >> > > okay fine. > >>> + ? ? if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && >>> + ? ? ? ? ? ? ? ? ? ? omap_mux_get_by_name >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? (tx_pad_name, &tx_partition, &tx_mux) >= 0) { >>> + ? ? ? ? ? ? u16 tx_mode, rx_mode; >>> + >>> + ? ? ? ? ? ? tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); >>> + ? ? ? ? ? ? rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); >>> + >>> + ? ? ? ? ? ? /* >>> + ? ? ? ? ? ? ?* Check if uart is used in default tx/rx mode i.e. in mux mode0 >>> + ? ? ? ? ? ? ?* if yes then configure rx pin for wake up capability >>> + ? ? ? ? ? ? ?*/ >>> + ? ? ? ? ? ? if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].name = rx_pad_name; >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].flags ?= >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >>> + >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[1].name = tx_pad_name; >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >>> + ? ? ? ? ? ? ? ? ? ? bdata->pads = default_omap_uart_pads; >>> + ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); >>> + ? ? ? ? ? ? } >>> + ? ? } >>> ?} >> >> Then looking at omap_serial_board_init, it still looks wrong: >> >> void __init omap_serial_board_init(struct omap_uart_port_info *info) >> { >> ? ? ? ?struct omap_uart_state *uart; >> ? ? ? ?struct omap_board_data bdata; >> >> ? ? ? ?list_for_each_entry(uart, &uart_list, node) { >> ? ? ? ? ? ? ? ?bdata.id = uart->num; >> ? ? ? ? ? ? ? ?bdata.flags = 0; >> ? ? ? ? ? ? ? ?bdata.pads = NULL; >> ? ? ? ? ? ? ? ?bdata.pads_cnt = 0; >> >> ? ? ? ? ? ? ? ?if (cpu_is_omap44xx() || cpu_is_omap34xx()) >> ? ? ? ? ? ? ? ? ? ? ? ?omap_serial_fill_default_pads(&bdata); >> >> Why don't you fill the pads for omap2? It has the same pads, although >> it does not have the serial wake-up events working. >> >> And why don't you exit if omap_serial_fill_default_pads fails for the >> no info case? >> >> Shouldn't it be something like: >> >> ? ? ? ? ? ? ? ?if (!info) { >> ? ? ? ? ? ? ? ? ? ? ? ?res = omap_serial_fill_default_pads(&bdata); >> ? ? ? ? ? ? ? ? ? ? ? ?if (!res) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return; >> ? ? ? ? ? ? ? ? ? ? ? ?port = NULL; >> ? ? ? ? ? ? ? ?} else { >> ? ? ? ? ? ? ? ? ? ? ? ?port = &info[uart->num]; >> ? ? ? ? ? ? ? ?} >> ? ? ? ? ? ? ? ?omap_serial_init_port(&bdata, port); >> > > Yes if filling of default pads fails we can avoid registering that port > however I think that should not depend on availability of port info. > > Here [1] is the updated patch. > > -- > Thanks, > Govindraj.R > > > [1]: > > > From ea06c7d5014b68f622b3e2ca226e5a5194d48e9a Mon Sep 17 00:00:00 2001 > From: "Govindraj.R" <govindraj.raja@ti.com> > Date: Tue, 10 Apr 2012 18:21:52 +0530 > Subject: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and > ?configure rx wakeup > > Default pad populating procedure should first probe whether the uart > pins are available as uart tx/rx pins if yes then we can configure them > and use rx pin for wakeup capability. > > Utilise the mux api available to probe the availability of mux pins > in uart mode. > > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> This patch has been seriously damaged by your mailer. What mailer are you using? Tested against master on xM for USB and NFS boot. Signed-off-by: Russ.Dill at ti.com > --- > ?arch/arm/mach-omap2/mux.c ? ?| ? ?3 +- > ?arch/arm/mach-omap2/mux.h ? ?| ? 10 ++++++ > ?arch/arm/mach-omap2/serial.c | ? 73 +++++++++++++++++++++++++++++++++++++++-- > ?3 files changed, 80 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c > index 65c3391..d937ddd 100644 > --- a/arch/arm/mach-omap2/mux.c > +++ b/arch/arm/mach-omap2/mux.c > @@ -217,8 +217,7 @@ static int __init _omap_mux_get_by_name(struct > omap_mux_partition *partition, > ? ? ? ?return -ENODEV; > ?} > > -static int __init > -omap_mux_get_by_name(const char *muxname, > +int __init omap_mux_get_by_name(const char *muxname, > ? ? ? ? ? ? ? ? ? ? ? ?struct omap_mux_partition **found_partition, > ? ? ? ? ? ? ? ? ? ? ? ?struct omap_mux **found_mux) > ?{ > diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h > index 69fe060..68927f1 100644 > --- a/arch/arm/mach-omap2/mux.h > +++ b/arch/arm/mach-omap2/mux.h > @@ -225,8 +225,18 @@ omap_hwmod_mux_init(struct omap_device_pad > *bpads, int nr_pads); > ?*/ > ?void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); > > +int omap_mux_get_by_name(const char *muxname, > + ? ? ? ? ? ? ? struct omap_mux_partition **found_partition, > + ? ? ? ? ? ? ? struct omap_mux **found_mux); > ?#else > > +static inline int omap_mux_get_by_name(const char *muxname, > + ? ? ? ? ? ? ? struct omap_mux_partition **found_partition, > + ? ? ? ? ? ? ? struct omap_mux **found_mux) > +{ > + ? ? ? return 0; > +} > + > ?static inline int omap_mux_init_gpio(int gpio, int val) > ?{ > ? ? ? ?return 0; > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index 2e351f5..9d62cae 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -57,6 +57,7 @@ struct omap_uart_state { > > ? ? ? ?struct list_head node; > ? ? ? ?struct omap_hwmod *oh; > + ? ? ? struct omap_device_pad default_omap_uart_pads[2]; > ?}; > > ?static LIST_HEAD(uart_list); > @@ -120,11 +121,75 @@ static void omap_uart_set_smartidle(struct > platform_device *pdev) {} > ?#endif /* CONFIG_PM */ > > ?#ifdef CONFIG_OMAP_MUX > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > + > +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 > +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], > + ? ? ? ? ? ? ? tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; > + > +static void ?__init > +omap_serial_fill_uart_tx_rx_pads(struct omap_board_data *bdata, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct omap_uart_state *uart) > ?{ > + ? ? ? uart->default_omap_uart_pads[0].name = rx_pad_name; > + ? ? ? uart->default_omap_uart_pads[0].flags = OMAP_DEVICE_PAD_REMUX | > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_DEVICE_PAD_WAKEUP; > + ? ? ? uart->default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; > + ? ? ? uart->default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0; > + ? ? ? uart->default_omap_uart_pads[1].name = tx_pad_name; > + ? ? ? uart->default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; > + ? ? ? bdata->pads = uart->default_omap_uart_pads; > + ? ? ? bdata->pads_cnt = ARRAY_SIZE(uart->default_omap_uart_pads); > +} > + > +static int ?__init omap_serial_fill_default_pads(struct omap_board_data *bdata, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct omap_uart_state *uart) > +{ > + ? ? ? struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > + ? ? ? struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > + ? ? ? char *rx_fmt, *tx_fmt; > + ? ? ? int uart_nr = bdata->id + 1; > + > + ? ? ? if (bdata->id != 2) { > + ? ? ? ? ? ? ? rx_fmt = "uart%d_rx.uart%d_rx"; > + ? ? ? ? ? ? ? tx_fmt = "uart%d_tx.uart%d_tx"; > + ? ? ? } else { > + ? ? ? ? ? ? ? rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > + ? ? ? ? ? ? ? tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > + ? ? ? } > + > + ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > + ? ? ? ? ? ? ? ? ? ? ? uart_nr, uart_nr); > + ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > + ? ? ? ? ? ? ? ? ? ? ? uart_nr, uart_nr); > + > + ? ? ? if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && > + ? ? ? ? ? ? ? ? ? ? ? omap_mux_get_by_name > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (tx_pad_name, &tx_partition, &tx_mux) >= 0) { > + ? ? ? ? ? ? ? u16 tx_mode, rx_mode; > + > + ? ? ? ? ? ? ? tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); > + ? ? ? ? ? ? ? rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); > + > + ? ? ? ? ? ? ? /* > + ? ? ? ? ? ? ? ?* Check if uart is used in default tx/rx mode i.e. in mux mode0 > + ? ? ? ? ? ? ? ?* if yes then configure rx pin for wake up capability > + ? ? ? ? ? ? ? ?*/ > + ? ? ? ? ? ? ? if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { > + ? ? ? ? ? ? ? ? ? ? ? omap_serial_fill_uart_tx_rx_pads(bdata, uart); > + ? ? ? ? ? ? ? ? ? ? ? return 0; > + ? ? ? ? ? ? ? } > + ? ? ? } > + > + ? ? ? return -ENODEV; > ?} > ?#else > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} > +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct omap_uart_state *uart) > +{ > + ? ? ? return 0; > +} > ?#endif > > ?char *cmdline_find_option(char *str) > @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct > omap_uart_port_info *info) > ? ? ? ? ? ? ? ?bdata.pads = NULL; > ? ? ? ? ? ? ? ?bdata.pads_cnt = 0; > > - ? ? ? ? ? ? ? if (cpu_is_omap44xx() || cpu_is_omap34xx()) > - ? ? ? ? ? ? ? ? ? ? ? omap_serial_fill_default_pads(&bdata); > + ? ? ? ? ? ? ? if (omap_serial_fill_default_pads(&bdata, uart)) > + ? ? ? ? ? ? ? ? ? ? ? continue; > > ? ? ? ? ? ? ? ?if (!info) > ? ? ? ? ? ? ? ? ? ? ? ?omap_serial_init_port(&bdata, NULL); > -- > 1.7.9 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup 2012-04-11 11:50 ` Raja, Govindraj @ 2012-04-13 23:39 ` Russ Dill -1 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-13 23:39 UTC (permalink / raw) To: Raja, Govindraj Cc: Tony Lindgren, linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman On Wed, Apr 11, 2012 at 4:50 AM, Raja, Govindraj <govindraj.raja@ti.com> wrote: > On Tue, Apr 10, 2012 at 9:41 PM, Tony Lindgren <tony@atomide.com> wrote: >> * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: >>> --- a/arch/arm/mach-omap2/serial.c >>> +++ b/arch/arm/mach-omap2/serial.c >>> @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} >>> #endif /* CONFIG_PM */ >>> >>> #ifdef CONFIG_OMAP_MUX >>> -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) >>> + >>> +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 >>> +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], >>> + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; >>> +static struct omap_device_pad default_omap_uart_pads[2] __initdata; >> >> Won't the default_omap_uart_pads get overwritten for each port? >> We need that information in the driver too for each port? Why don't you >> just allocate bdata.pads in omap_serial_board_init as we now assume it's >> needed for each port? >> > > Yes can be part of omap_uart_state structure. > >>> +static void __init omap_serial_fill_default_pads(struct omap_board_data *bdata) >>> { >>> + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >>> + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >>> + >>> + if (bdata->id != 2) { >>> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + "uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); >>> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + "uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); >>> + } else { >>> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, >>> + bdata->id + 1); >>> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, >>> + bdata->id + 1); >>> + } >> >> This would be simpler with something like this (untested): >> >> char *rx_fmt, *tx_fmt; >> int uart_nr = bdata->id + 1; >> >> if (bdata->id == 2) { >> rx_fmt = "uart%d_rx.uart%d_rx"; >> tx_fmt = "uart%d_tx.uart%d_tx"; >> } else { >> rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; >> tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; >> } >> >> snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, >> uart_nr, uart_nr); >> snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, >> uart_nr, uart_nr); >> > > okay fine. > >>> + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && >>> + omap_mux_get_by_name >>> + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { >>> + u16 tx_mode, rx_mode; >>> + >>> + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); >>> + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); >>> + >>> + /* >>> + * Check if uart is used in default tx/rx mode i.e. in mux mode0 >>> + * if yes then configure rx pin for wake up capability >>> + */ >>> + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { >>> + default_omap_uart_pads[0].name = rx_pad_name; >>> + default_omap_uart_pads[0].flags = >>> + OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; >>> + default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | >>> + OMAP_MUX_MODE0; >>> + default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | >>> + OMAP_MUX_MODE0; >>> + >>> + default_omap_uart_pads[1].name = tx_pad_name; >>> + default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | >>> + OMAP_MUX_MODE0; >>> + bdata->pads = default_omap_uart_pads; >>> + bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); >>> + } >>> + } >>> } >> >> Then looking at omap_serial_board_init, it still looks wrong: >> >> void __init omap_serial_board_init(struct omap_uart_port_info *info) >> { >> struct omap_uart_state *uart; >> struct omap_board_data bdata; >> >> list_for_each_entry(uart, &uart_list, node) { >> bdata.id = uart->num; >> bdata.flags = 0; >> bdata.pads = NULL; >> bdata.pads_cnt = 0; >> >> if (cpu_is_omap44xx() || cpu_is_omap34xx()) >> omap_serial_fill_default_pads(&bdata); >> >> Why don't you fill the pads for omap2? It has the same pads, although >> it does not have the serial wake-up events working. >> >> And why don't you exit if omap_serial_fill_default_pads fails for the >> no info case? >> >> Shouldn't it be something like: >> >> if (!info) { >> res = omap_serial_fill_default_pads(&bdata); >> if (!res) >> return; >> port = NULL; >> } else { >> port = &info[uart->num]; >> } >> omap_serial_init_port(&bdata, port); >> > > Yes if filling of default pads fails we can avoid registering that port > however I think that should not depend on availability of port info. > > Here [1] is the updated patch. > > -- > Thanks, > Govindraj.R > > > [1]: > > > From ea06c7d5014b68f622b3e2ca226e5a5194d48e9a Mon Sep 17 00:00:00 2001 > From: "Govindraj.R" <govindraj.raja@ti.com> > Date: Tue, 10 Apr 2012 18:21:52 +0530 > Subject: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and > configure rx wakeup > > Default pad populating procedure should first probe whether the uart > pins are available as uart tx/rx pins if yes then we can configure them > and use rx pin for wakeup capability. > > Utilise the mux api available to probe the availability of mux pins > in uart mode. > > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Reviewed-by: Russ Dill <russ.dill@ti.com> Tested-by: Russ Dill <russ.dill@ti.com> > --- > arch/arm/mach-omap2/mux.c | 3 +- > arch/arm/mach-omap2/mux.h | 10 ++++++ > arch/arm/mach-omap2/serial.c | 73 +++++++++++++++++++++++++++++++++++++++-- > 3 files changed, 80 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c > index 65c3391..d937ddd 100644 > --- a/arch/arm/mach-omap2/mux.c > +++ b/arch/arm/mach-omap2/mux.c > @@ -217,8 +217,7 @@ static int __init _omap_mux_get_by_name(struct > omap_mux_partition *partition, > return -ENODEV; > } > > -static int __init > -omap_mux_get_by_name(const char *muxname, > +int __init omap_mux_get_by_name(const char *muxname, > struct omap_mux_partition **found_partition, > struct omap_mux **found_mux) > { > diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h > index 69fe060..68927f1 100644 > --- a/arch/arm/mach-omap2/mux.h > +++ b/arch/arm/mach-omap2/mux.h > @@ -225,8 +225,18 @@ omap_hwmod_mux_init(struct omap_device_pad > *bpads, int nr_pads); > */ > void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); > > +int omap_mux_get_by_name(const char *muxname, > + struct omap_mux_partition **found_partition, > + struct omap_mux **found_mux); > #else > > +static inline int omap_mux_get_by_name(const char *muxname, > + struct omap_mux_partition **found_partition, > + struct omap_mux **found_mux) > +{ > + return 0; > +} > + > static inline int omap_mux_init_gpio(int gpio, int val) > { > return 0; > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index 2e351f5..9d62cae 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -57,6 +57,7 @@ struct omap_uart_state { > > struct list_head node; > struct omap_hwmod *oh; > + struct omap_device_pad default_omap_uart_pads[2]; > }; > > static LIST_HEAD(uart_list); > @@ -120,11 +121,75 @@ static void omap_uart_set_smartidle(struct > platform_device *pdev) {} > #endif /* CONFIG_PM */ > > #ifdef CONFIG_OMAP_MUX > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > + > +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 > +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], > + tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; > + > +static void __init > +omap_serial_fill_uart_tx_rx_pads(struct omap_board_data *bdata, > + struct omap_uart_state *uart) > { > + uart->default_omap_uart_pads[0].name = rx_pad_name; > + uart->default_omap_uart_pads[0].flags = OMAP_DEVICE_PAD_REMUX | > + OMAP_DEVICE_PAD_WAKEUP; > + uart->default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | > + OMAP_MUX_MODE0; > + uart->default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0; > + uart->default_omap_uart_pads[1].name = tx_pad_name; > + uart->default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | > + OMAP_MUX_MODE0; > + bdata->pads = uart->default_omap_uart_pads; > + bdata->pads_cnt = ARRAY_SIZE(uart->default_omap_uart_pads); > +} > + > +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata, > + struct omap_uart_state *uart) > +{ > + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > + char *rx_fmt, *tx_fmt; > + int uart_nr = bdata->id + 1; > + > + if (bdata->id != 2) { > + rx_fmt = "uart%d_rx.uart%d_rx"; > + tx_fmt = "uart%d_tx.uart%d_tx"; > + } else { > + rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > + tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > + } > + > + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > + uart_nr, uart_nr); > + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > + uart_nr, uart_nr); > + > + if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && > + omap_mux_get_by_name > + (tx_pad_name, &tx_partition, &tx_mux) >= 0) { > + u16 tx_mode, rx_mode; > + > + tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); > + rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); > + > + /* > + * Check if uart is used in default tx/rx mode i.e. in mux mode0 > + * if yes then configure rx pin for wake up capability > + */ > + if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { > + omap_serial_fill_uart_tx_rx_pads(bdata, uart); > + return 0; > + } > + } > + > + return -ENODEV; > } > #else > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} > +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata > + struct omap_uart_state *uart) > +{ > + return 0; > +} > #endif > > char *cmdline_find_option(char *str) > @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct > omap_uart_port_info *info) > bdata.pads = NULL; > bdata.pads_cnt = 0; > > - if (cpu_is_omap44xx() || cpu_is_omap34xx()) > - omap_serial_fill_default_pads(&bdata); > + if (omap_serial_fill_default_pads(&bdata, uart)) > + continue; > > if (!info) > omap_serial_init_port(&bdata, NULL); > -- > 1.7.9 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup @ 2012-04-13 23:39 ` Russ Dill 0 siblings, 0 replies; 38+ messages in thread From: Russ Dill @ 2012-04-13 23:39 UTC (permalink / raw) To: linux-arm-kernel On Wed, Apr 11, 2012 at 4:50 AM, Raja, Govindraj <govindraj.raja@ti.com> wrote: > On Tue, Apr 10, 2012 at 9:41 PM, Tony Lindgren <tony@atomide.com> wrote: >> * Govindraj.R <govindraj.raja@ti.com> [120410 06:44]: >>> --- a/arch/arm/mach-omap2/serial.c >>> +++ b/arch/arm/mach-omap2/serial.c >>> @@ -120,11 +120,63 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {} >>> ?#endif /* CONFIG_PM */ >>> >>> ?#ifdef CONFIG_OMAP_MUX >>> -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) >>> + >>> +#define OMAP_UART_DEFAULT_PAD_NAME_LEN ? ? ? 28 >>> +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], >>> + ? ? ? ? ? ? tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; >>> +static struct omap_device_pad default_omap_uart_pads[2] __initdata; >> >> Won't the default_omap_uart_pads get overwritten for each port? >> We need that information in the driver too for each port? Why don't you >> just allocate bdata.pads in omap_serial_board_init as we now assume it's >> needed for each port? >> > > Yes can be part of omap_uart_state structure. > >>> +static void ?__init omap_serial_fill_default_pads(struct omap_board_data *bdata) >>> ?{ >>> + ? ? struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >>> + ? ? struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >>> + >>> + ? ? if (bdata->id != 2) { >>> + ? ? ? ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + ? ? ? ? ? ? ? ? ? ? ?"uart%d_rx.uart%d_rx", bdata->id + 1, bdata->id + 1); >>> + ? ? ? ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + ? ? ? ? ? ? ? ? ? ? ?"uart%d_tx.uart%d_tx", bdata->id + 1, bdata->id + 1); >>> + ? ? } else { >>> + ? ? ? ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + ? ? ? ? ? ? ? ? ? ? "uart%d_rx_irrx.uart%d_rx_irrx", bdata->id + 1, >>> + ? ? ? ? ? ? ? ? ? ? bdata->id + 1); >>> + ? ? ? ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, >>> + ? ? ? ? ? ? ? ? ? ? "uart%d_tx_irtx.uart%d_tx_irtx", bdata->id + 1, >>> + ? ? ? ? ? ? ? ? ? ? bdata->id + 1); >>> + ? ? } >> >> This would be simpler with something like this (untested): >> >> ? ? ? ?char *rx_fmt, *tx_fmt; >> ? ? ? ?int uart_nr = bdata->id + 1; >> >> ? ? ? ?if (bdata->id == 2) { >> ? ? ? ? ? ? ? ?rx_fmt = "uart%d_rx.uart%d_rx"; >> ? ? ? ? ? ? ? ?tx_fmt = "uart%d_tx.uart%d_tx"; >> ? ? ? ?} else { >> ? ? ? ? ? ? ? ?rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; >> ? ? ? ? ? ? ? ?tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; >> ? ? ? ?} >> >> ? ? ? ?snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, >> ? ? ? ? ? ? ? ? ? ? ? ?uart_nr, uart_nr); >> ? ? ? ?snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, >> ? ? ? ? ? ? ? ? ? ? ? ?uart_nr, uart_nr); >> > > okay fine. > >>> + ? ? if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && >>> + ? ? ? ? ? ? ? ? ? ? omap_mux_get_by_name >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? (tx_pad_name, &tx_partition, &tx_mux) >= 0) { >>> + ? ? ? ? ? ? u16 tx_mode, rx_mode; >>> + >>> + ? ? ? ? ? ? tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); >>> + ? ? ? ? ? ? rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); >>> + >>> + ? ? ? ? ? ? /* >>> + ? ? ? ? ? ? ?* Check if uart is used in default tx/rx mode i.e. in mux mode0 >>> + ? ? ? ? ? ? ?* if yes then configure rx pin for wake up capability >>> + ? ? ? ? ? ? ?*/ >>> + ? ? ? ? ? ? if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].name = rx_pad_name; >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].flags ?= >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_DEVICE_PAD_REMUX | OMAP_DEVICE_PAD_WAKEUP; >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >>> + >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[1].name = tx_pad_name; >>> + ? ? ? ? ? ? ? ? ? ? default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; >>> + ? ? ? ? ? ? ? ? ? ? bdata->pads = default_omap_uart_pads; >>> + ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads); >>> + ? ? ? ? ? ? } >>> + ? ? } >>> ?} >> >> Then looking at omap_serial_board_init, it still looks wrong: >> >> void __init omap_serial_board_init(struct omap_uart_port_info *info) >> { >> ? ? ? ?struct omap_uart_state *uart; >> ? ? ? ?struct omap_board_data bdata; >> >> ? ? ? ?list_for_each_entry(uart, &uart_list, node) { >> ? ? ? ? ? ? ? ?bdata.id = uart->num; >> ? ? ? ? ? ? ? ?bdata.flags = 0; >> ? ? ? ? ? ? ? ?bdata.pads = NULL; >> ? ? ? ? ? ? ? ?bdata.pads_cnt = 0; >> >> ? ? ? ? ? ? ? ?if (cpu_is_omap44xx() || cpu_is_omap34xx()) >> ? ? ? ? ? ? ? ? ? ? ? ?omap_serial_fill_default_pads(&bdata); >> >> Why don't you fill the pads for omap2? It has the same pads, although >> it does not have the serial wake-up events working. >> >> And why don't you exit if omap_serial_fill_default_pads fails for the >> no info case? >> >> Shouldn't it be something like: >> >> ? ? ? ? ? ? ? ?if (!info) { >> ? ? ? ? ? ? ? ? ? ? ? ?res = omap_serial_fill_default_pads(&bdata); >> ? ? ? ? ? ? ? ? ? ? ? ?if (!res) >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return; >> ? ? ? ? ? ? ? ? ? ? ? ?port = NULL; >> ? ? ? ? ? ? ? ?} else { >> ? ? ? ? ? ? ? ? ? ? ? ?port = &info[uart->num]; >> ? ? ? ? ? ? ? ?} >> ? ? ? ? ? ? ? ?omap_serial_init_port(&bdata, port); >> > > Yes if filling of default pads fails we can avoid registering that port > however I think that should not depend on availability of port info. > > Here [1] is the updated patch. > > -- > Thanks, > Govindraj.R > > > [1]: > > > From ea06c7d5014b68f622b3e2ca226e5a5194d48e9a Mon Sep 17 00:00:00 2001 > From: "Govindraj.R" <govindraj.raja@ti.com> > Date: Tue, 10 Apr 2012 18:21:52 +0530 > Subject: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and > ?configure rx wakeup > > Default pad populating procedure should first probe whether the uart > pins are available as uart tx/rx pins if yes then we can configure them > and use rx pin for wakeup capability. > > Utilise the mux api available to probe the availability of mux pins > in uart mode. > > Cc: Felipe Balbi <balbi@ti.com> > Cc: Kevin Hilman <khilman@ti.com> > Cc: Russ Dill <russ.dill@gmail.com> > Reported-by: Tony Lindgren <tony@atomide.com> > Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Reviewed-by: Russ Dill <russ.dill@ti.com> Tested-by: Russ Dill <russ.dill@ti.com> > --- > ?arch/arm/mach-omap2/mux.c ? ?| ? ?3 +- > ?arch/arm/mach-omap2/mux.h ? ?| ? 10 ++++++ > ?arch/arm/mach-omap2/serial.c | ? 73 +++++++++++++++++++++++++++++++++++++++-- > ?3 files changed, 80 insertions(+), 6 deletions(-) > > diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c > index 65c3391..d937ddd 100644 > --- a/arch/arm/mach-omap2/mux.c > +++ b/arch/arm/mach-omap2/mux.c > @@ -217,8 +217,7 @@ static int __init _omap_mux_get_by_name(struct > omap_mux_partition *partition, > ? ? ? ?return -ENODEV; > ?} > > -static int __init > -omap_mux_get_by_name(const char *muxname, > +int __init omap_mux_get_by_name(const char *muxname, > ? ? ? ? ? ? ? ? ? ? ? ?struct omap_mux_partition **found_partition, > ? ? ? ? ? ? ? ? ? ? ? ?struct omap_mux **found_mux) > ?{ > diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h > index 69fe060..68927f1 100644 > --- a/arch/arm/mach-omap2/mux.h > +++ b/arch/arm/mach-omap2/mux.h > @@ -225,8 +225,18 @@ omap_hwmod_mux_init(struct omap_device_pad > *bpads, int nr_pads); > ?*/ > ?void omap_hwmod_mux(struct omap_hwmod_mux_info *hmux, u8 state); > > +int omap_mux_get_by_name(const char *muxname, > + ? ? ? ? ? ? ? struct omap_mux_partition **found_partition, > + ? ? ? ? ? ? ? struct omap_mux **found_mux); > ?#else > > +static inline int omap_mux_get_by_name(const char *muxname, > + ? ? ? ? ? ? ? struct omap_mux_partition **found_partition, > + ? ? ? ? ? ? ? struct omap_mux **found_mux) > +{ > + ? ? ? return 0; > +} > + > ?static inline int omap_mux_init_gpio(int gpio, int val) > ?{ > ? ? ? ?return 0; > diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c > index 2e351f5..9d62cae 100644 > --- a/arch/arm/mach-omap2/serial.c > +++ b/arch/arm/mach-omap2/serial.c > @@ -57,6 +57,7 @@ struct omap_uart_state { > > ? ? ? ?struct list_head node; > ? ? ? ?struct omap_hwmod *oh; > + ? ? ? struct omap_device_pad default_omap_uart_pads[2]; > ?}; > > ?static LIST_HEAD(uart_list); > @@ -120,11 +121,75 @@ static void omap_uart_set_smartidle(struct > platform_device *pdev) {} > ?#endif /* CONFIG_PM */ > > ?#ifdef CONFIG_OMAP_MUX > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) > + > +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28 > +static char rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN], > + ? ? ? ? ? ? ? tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN] __initdata; > + > +static void ?__init > +omap_serial_fill_uart_tx_rx_pads(struct omap_board_data *bdata, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct omap_uart_state *uart) > ?{ > + ? ? ? uart->default_omap_uart_pads[0].name = rx_pad_name; > + ? ? ? uart->default_omap_uart_pads[0].flags = OMAP_DEVICE_PAD_REMUX | > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_DEVICE_PAD_WAKEUP; > + ? ? ? uart->default_omap_uart_pads[0].enable = OMAP_PIN_INPUT | > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; > + ? ? ? uart->default_omap_uart_pads[0].idle = OMAP_PIN_INPUT | OMAP_MUX_MODE0; > + ? ? ? uart->default_omap_uart_pads[1].name = tx_pad_name; > + ? ? ? uart->default_omap_uart_pads[1].enable = OMAP_PIN_OUTPUT | > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? OMAP_MUX_MODE0; > + ? ? ? bdata->pads = uart->default_omap_uart_pads; > + ? ? ? bdata->pads_cnt = ARRAY_SIZE(uart->default_omap_uart_pads); > +} > + > +static int ?__init omap_serial_fill_default_pads(struct omap_board_data *bdata, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct omap_uart_state *uart) > +{ > + ? ? ? struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > + ? ? ? struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > + ? ? ? char *rx_fmt, *tx_fmt; > + ? ? ? int uart_nr = bdata->id + 1; > + > + ? ? ? if (bdata->id != 2) { > + ? ? ? ? ? ? ? rx_fmt = "uart%d_rx.uart%d_rx"; > + ? ? ? ? ? ? ? tx_fmt = "uart%d_tx.uart%d_tx"; > + ? ? ? } else { > + ? ? ? ? ? ? ? rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > + ? ? ? ? ? ? ? tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > + ? ? ? } > + > + ? ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > + ? ? ? ? ? ? ? ? ? ? ? uart_nr, uart_nr); > + ? ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > + ? ? ? ? ? ? ? ? ? ? ? uart_nr, uart_nr); > + > + ? ? ? if (omap_mux_get_by_name(rx_pad_name, &rx_partition, &rx_mux) >= 0 && > + ? ? ? ? ? ? ? ? ? ? ? omap_mux_get_by_name > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (tx_pad_name, &tx_partition, &tx_mux) >= 0) { > + ? ? ? ? ? ? ? u16 tx_mode, rx_mode; > + > + ? ? ? ? ? ? ? tx_mode = omap_mux_read(tx_partition, tx_mux->reg_offset); > + ? ? ? ? ? ? ? rx_mode = omap_mux_read(rx_partition, rx_mux->reg_offset); > + > + ? ? ? ? ? ? ? /* > + ? ? ? ? ? ? ? ?* Check if uart is used in default tx/rx mode i.e. in mux mode0 > + ? ? ? ? ? ? ? ?* if yes then configure rx pin for wake up capability > + ? ? ? ? ? ? ? ?*/ > + ? ? ? ? ? ? ? if (!(rx_mode & 0x07) && !(tx_mode & 0x07)) { > + ? ? ? ? ? ? ? ? ? ? ? omap_serial_fill_uart_tx_rx_pads(bdata, uart); > + ? ? ? ? ? ? ? ? ? ? ? return 0; > + ? ? ? ? ? ? ? } > + ? ? ? } > + > + ? ? ? return -ENODEV; > ?} > ?#else > -static void omap_serial_fill_default_pads(struct omap_board_data *bdata) {} > +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct omap_uart_state *uart) > +{ > + ? ? ? return 0; > +} > ?#endif > > ?char *cmdline_find_option(char *str) > @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct > omap_uart_port_info *info) > ? ? ? ? ? ? ? ?bdata.pads = NULL; > ? ? ? ? ? ? ? ?bdata.pads_cnt = 0; > > - ? ? ? ? ? ? ? if (cpu_is_omap44xx() || cpu_is_omap34xx()) > - ? ? ? ? ? ? ? ? ? ? ? omap_serial_fill_default_pads(&bdata); > + ? ? ? ? ? ? ? if (omap_serial_fill_default_pads(&bdata, uart)) > + ? ? ? ? ? ? ? ? ? ? ? continue; > > ? ? ? ? ? ? ? ?if (!info) > ? ? ? ? ? ? ? ? ? ? ? ?omap_serial_init_port(&bdata, NULL); > -- > 1.7.9 ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup 2012-04-11 11:50 ` Raja, Govindraj @ 2012-04-17 1:41 ` Tony Lindgren -1 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-04-17 1:41 UTC (permalink / raw) To: Raja, Govindraj Cc: linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman, Russ Dill Hi, Few more comments below. * Raja, Govindraj <govindraj.raja@ti.com> [120411 04:53]: ... > +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata, > + struct omap_uart_state *uart) > +{ > + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > + char *rx_fmt, *tx_fmt; > + int uart_nr = bdata->id + 1; > + > + if (bdata->id != 2) { > + rx_fmt = "uart%d_rx.uart%d_rx"; > + tx_fmt = "uart%d_tx.uart%d_tx"; > + } else { > + rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > + tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > + } > + > + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > + uart_nr, uart_nr); > + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > + uart_nr, uart_nr); This naming won't work for the fourth port on 3630 as there are no "uart4_rx" or "uart4_tx" mux entries, they are "gpmc_wait2.uart4_tx" and "gpmc_wait3.uart4_tx". > @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct > omap_uart_port_info *info) > bdata.pads = NULL; > bdata.pads_cnt = 0; > > - if (cpu_is_omap44xx() || cpu_is_omap34xx()) > - omap_serial_fill_default_pads(&bdata); > + if (omap_serial_fill_default_pads(&bdata, uart)) > + continue; > > if (!info) > omap_serial_init_port(&bdata, NULL); Can't the omap_serial_board_init() now be just be omap_serial_init(void) as it's not used anywhere else? Anyways, this is getting too complex for the -rc series as at least 2430sdp is using alternative pins for the first uart. Let's patch to remove just the uart4 entry for 3630 for the -rc and then we can properly fix this for the next merge window. Regards, Tony ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup @ 2012-04-17 1:41 ` Tony Lindgren 0 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-04-17 1:41 UTC (permalink / raw) To: linux-arm-kernel Hi, Few more comments below. * Raja, Govindraj <govindraj.raja@ti.com> [120411 04:53]: ... > +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata, > + struct omap_uart_state *uart) > +{ > + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > + char *rx_fmt, *tx_fmt; > + int uart_nr = bdata->id + 1; > + > + if (bdata->id != 2) { > + rx_fmt = "uart%d_rx.uart%d_rx"; > + tx_fmt = "uart%d_tx.uart%d_tx"; > + } else { > + rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > + tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > + } > + > + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > + uart_nr, uart_nr); > + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > + uart_nr, uart_nr); This naming won't work for the fourth port on 3630 as there are no "uart4_rx" or "uart4_tx" mux entries, they are "gpmc_wait2.uart4_tx" and "gpmc_wait3.uart4_tx". > @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct > omap_uart_port_info *info) > bdata.pads = NULL; > bdata.pads_cnt = 0; > > - if (cpu_is_omap44xx() || cpu_is_omap34xx()) > - omap_serial_fill_default_pads(&bdata); > + if (omap_serial_fill_default_pads(&bdata, uart)) > + continue; > > if (!info) > omap_serial_init_port(&bdata, NULL); Can't the omap_serial_board_init() now be just be omap_serial_init(void) as it's not used anywhere else? Anyways, this is getting too complex for the -rc series as at least 2430sdp is using alternative pins for the first uart. Let's patch to remove just the uart4 entry for 3630 for the -rc and then we can properly fix this for the next merge window. Regards, Tony ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup 2012-04-17 1:41 ` Tony Lindgren @ 2012-04-17 12:47 ` Raja, Govindraj -1 siblings, 0 replies; 38+ messages in thread From: Raja, Govindraj @ 2012-04-17 12:47 UTC (permalink / raw) To: Tony Lindgren Cc: linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman, Russ Dill On Tue, Apr 17, 2012 at 7:11 AM, Tony Lindgren <tony@atomide.com> wrote: > Hi, > > Few more comments below. > > * Raja, Govindraj <govindraj.raja@ti.com> [120411 04:53]: > ... > >> +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata, >> + struct omap_uart_state *uart) >> +{ >> + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >> + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >> + char *rx_fmt, *tx_fmt; >> + int uart_nr = bdata->id + 1; >> + >> + if (bdata->id != 2) { >> + rx_fmt = "uart%d_rx.uart%d_rx"; >> + tx_fmt = "uart%d_tx.uart%d_tx"; >> + } else { >> + rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; >> + tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; >> + } >> + >> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, >> + uart_nr, uart_nr); >> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, >> + uart_nr, uart_nr); > > This naming won't work for the fourth port on 3630 as there are no "uart4_rx" > or "uart4_tx" mux entries, they are "gpmc_wait2.uart4_tx" and > "gpmc_wait3.uart4_tx". But uart4 is unused on 3630 boards and boards trying to use them should configure them from board file. (I thought we agreed on this approach where only if uarts are available in mux mode0 those ports will be dynamically muxed for wakeup others should use omap_serial_init_port) > >> @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct >> omap_uart_port_info *info) >> bdata.pads = NULL; >> bdata.pads_cnt = 0; >> >> - if (cpu_is_omap44xx() || cpu_is_omap34xx()) >> - omap_serial_fill_default_pads(&bdata); >> + if (omap_serial_fill_default_pads(&bdata, uart)) >> + continue; >> >> if (!info) >> omap_serial_init_port(&bdata, NULL); > > Can't the omap_serial_board_init() now be just be omap_serial_init(void) > as it's not used anywhere else? Yes sure we can remove that. > > Anyways, this is getting too complex for the -rc series as at least 2430sdp > is using alternative pins for the first uart. Let's patch to remove just > the uart4 entry for 3630 for the -rc and then we can properly fix this > for the next merge window. Okay. in that case the earlier patch [1] should be fine to solve the gpmc issue observed and ehci issue on beagle-xm. -- Thanks, Govindraj.R [1]: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/090961.html -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup @ 2012-04-17 12:47 ` Raja, Govindraj 0 siblings, 0 replies; 38+ messages in thread From: Raja, Govindraj @ 2012-04-17 12:47 UTC (permalink / raw) To: linux-arm-kernel On Tue, Apr 17, 2012 at 7:11 AM, Tony Lindgren <tony@atomide.com> wrote: > Hi, > > Few more comments below. > > * Raja, Govindraj <govindraj.raja@ti.com> [120411 04:53]: > ... > >> +static int ?__init omap_serial_fill_default_pads(struct omap_board_data *bdata, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct omap_uart_state *uart) >> +{ >> + ? ? struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; >> + ? ? struct omap_mux *rx_mux = NULL, *tx_mux = NULL; >> + ? ? char *rx_fmt, *tx_fmt; >> + ? ? int uart_nr = bdata->id + 1; >> + >> + ? ? if (bdata->id != 2) { >> + ? ? ? ? ? ? rx_fmt = "uart%d_rx.uart%d_rx"; >> + ? ? ? ? ? ? tx_fmt = "uart%d_tx.uart%d_tx"; >> + ? ? } else { >> + ? ? ? ? ? ? rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; >> + ? ? ? ? ? ? tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; >> + ? ? } >> + >> + ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, >> + ? ? ? ? ? ? ? ? ? ? uart_nr, uart_nr); >> + ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, >> + ? ? ? ? ? ? ? ? ? ? uart_nr, uart_nr); > > This naming won't work for the fourth port on 3630 as there are no "uart4_rx" > or "uart4_tx" mux entries, they are "gpmc_wait2.uart4_tx" and > "gpmc_wait3.uart4_tx". But uart4 is unused on 3630 boards and boards trying to use them should configure them from board file. (I thought we agreed on this approach where only if uarts are available in mux mode0 those ports will be dynamically muxed for wakeup others should use omap_serial_init_port) > >> @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct >> omap_uart_port_info *info) >> ? ? ? ? ? ? ? bdata.pads = NULL; >> ? ? ? ? ? ? ? bdata.pads_cnt = 0; >> >> - ? ? ? ? ? ? if (cpu_is_omap44xx() || cpu_is_omap34xx()) >> - ? ? ? ? ? ? ? ? ? ? omap_serial_fill_default_pads(&bdata); >> + ? ? ? ? ? ? if (omap_serial_fill_default_pads(&bdata, uart)) >> + ? ? ? ? ? ? ? ? ? ? continue; >> >> ? ? ? ? ? ? ? if (!info) >> ? ? ? ? ? ? ? ? ? ? ? omap_serial_init_port(&bdata, NULL); > > Can't the omap_serial_board_init() now be just be omap_serial_init(void) > as it's not used anywhere else? Yes sure we can remove that. > > Anyways, this is getting too complex for the -rc series as at least 2430sdp > is using alternative pins for the first uart. Let's patch to remove just > the uart4 entry for 3630 for the -rc and then we can properly fix this > for the next merge window. Okay. in that case the earlier patch [1] should be fine to solve the gpmc issue observed and ehci issue on beagle-xm. -- Thanks, Govindraj.R [1]: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-March/090961.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup 2012-04-17 12:47 ` Raja, Govindraj @ 2012-04-17 17:47 ` Tony Lindgren -1 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-04-17 17:47 UTC (permalink / raw) To: Raja, Govindraj Cc: linux-omap, linux-arm-kernel, Felipe Balbi, Kevin Hilman, Russ Dill * Raja, Govindraj <govindraj.raja@ti.com> [120417 05:51]: > On Tue, Apr 17, 2012 at 7:11 AM, Tony Lindgren <tony@atomide.com> wrote: > > Hi, > > > > Few more comments below. > > > > * Raja, Govindraj <govindraj.raja@ti.com> [120411 04:53]: > > ... > > > >> +static int __init omap_serial_fill_default_pads(struct omap_board_data *bdata, > >> + struct omap_uart_state *uart) > >> +{ > >> + struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > >> + struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > >> + char *rx_fmt, *tx_fmt; > >> + int uart_nr = bdata->id + 1; > >> + > >> + if (bdata->id != 2) { > >> + rx_fmt = "uart%d_rx.uart%d_rx"; > >> + tx_fmt = "uart%d_tx.uart%d_tx"; > >> + } else { > >> + rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > >> + tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > >> + } > >> + > >> + snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > >> + uart_nr, uart_nr); > >> + snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > >> + uart_nr, uart_nr); > > > > This naming won't work for the fourth port on 3630 as there are no "uart4_rx" > > or "uart4_tx" mux entries, they are "gpmc_wait2.uart4_tx" and > > "gpmc_wait3.uart4_tx". > > But uart4 is unused on 3630 boards and boards trying to use them > should configure them from board file. > (I thought we agreed on this approach where only if uarts are > available in mux mode0 those ports will be dynamically muxed for wakeup > others should use omap_serial_init_port) Right, but you're still trying to do mux_get_by_name on it to check the pads, which will produce a warning on 3630. > >> @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct > >> omap_uart_port_info *info) > >> bdata.pads = NULL; > >> bdata.pads_cnt = 0; > >> > >> - if (cpu_is_omap44xx() || cpu_is_omap34xx()) > >> - omap_serial_fill_default_pads(&bdata); > >> + if (omap_serial_fill_default_pads(&bdata, uart)) > >> + continue; > >> > >> if (!info) > >> omap_serial_init_port(&bdata, NULL); > > > > Can't the omap_serial_board_init() now be just be omap_serial_init(void) > > as it's not used anywhere else? > > Yes sure we can remove that. OK > > Anyways, this is getting too complex for the -rc series as at least 2430sdp > > is using alternative pins for the first uart. Let's patch to remove just > > the uart4 entry for 3630 for the -rc and then we can properly fix this > > for the next merge window. > > Okay. in that case the earlier patch [1] should be fine to solve the > gpmc issue observed and ehci issue on beagle-xm. I'll just use your first patch to remove _all_ the muxing for omap_serial_init(). That's really the only safe thing we can do for the -rc cycle. This means we rely on bootloader settings for console muxing and wake-up bits, but that's just what we need to live with until next merge window. And for the next merge window, I think we should only automatically enable the wake-up event bits if the port is in serial mode, and not do any other muxing. Something like: void __init omap_serial_init(void) { struct omap_uart_state *uart; struct omap_board_data bdata; list_for_each_entry(uart, &uart_list, node) { bdata.id = uart->num; bdata.flags = 0; bdata.pads = NULL; bdata.pads_cnt = 0; omap_serial_check_wakeup(&bdata); omap_serial_init_port(&bdata, NULL); } omap_serial_board_init(NULL); } Where omap_serial_check_wakeup() just enables the wake-up if the port is already muxed to uart mode. So it turns out we can't bail out for unmuxed uarts because some boards use alternative pads like 2430sdp does for the first uart. Regards, Tony -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup @ 2012-04-17 17:47 ` Tony Lindgren 0 siblings, 0 replies; 38+ messages in thread From: Tony Lindgren @ 2012-04-17 17:47 UTC (permalink / raw) To: linux-arm-kernel * Raja, Govindraj <govindraj.raja@ti.com> [120417 05:51]: > On Tue, Apr 17, 2012 at 7:11 AM, Tony Lindgren <tony@atomide.com> wrote: > > Hi, > > > > Few more comments below. > > > > * Raja, Govindraj <govindraj.raja@ti.com> [120411 04:53]: > > ... > > > >> +static int ?__init omap_serial_fill_default_pads(struct omap_board_data *bdata, > >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct omap_uart_state *uart) > >> +{ > >> + ? ? struct omap_mux_partition *tx_partition = NULL, *rx_partition = NULL; > >> + ? ? struct omap_mux *rx_mux = NULL, *tx_mux = NULL; > >> + ? ? char *rx_fmt, *tx_fmt; > >> + ? ? int uart_nr = bdata->id + 1; > >> + > >> + ? ? if (bdata->id != 2) { > >> + ? ? ? ? ? ? rx_fmt = "uart%d_rx.uart%d_rx"; > >> + ? ? ? ? ? ? tx_fmt = "uart%d_tx.uart%d_tx"; > >> + ? ? } else { > >> + ? ? ? ? ? ? rx_fmt = "uart%d_rx_irrx.uart%d_rx_irrx"; > >> + ? ? ? ? ? ? tx_fmt = "uart%d_tx_irtx.uart%d_tx_irtx"; > >> + ? ? } > >> + > >> + ? ? snprintf(rx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, rx_fmt, > >> + ? ? ? ? ? ? ? ? ? ? uart_nr, uart_nr); > >> + ? ? snprintf(tx_pad_name, OMAP_UART_DEFAULT_PAD_NAME_LEN, tx_fmt, > >> + ? ? ? ? ? ? ? ? ? ? uart_nr, uart_nr); > > > > This naming won't work for the fourth port on 3630 as there are no "uart4_rx" > > or "uart4_tx" mux entries, they are "gpmc_wait2.uart4_tx" and > > "gpmc_wait3.uart4_tx". > > But uart4 is unused on 3630 boards and boards trying to use them > should configure them from board file. > (I thought we agreed on this approach where only if uarts are > available in mux mode0 those ports will be dynamically muxed for wakeup > others should use omap_serial_init_port) Right, but you're still trying to do mux_get_by_name on it to check the pads, which will produce a warning on 3630. > >> @@ -289,8 +354,8 @@ void __init omap_serial_board_init(struct > >> omap_uart_port_info *info) > >> ? ? ? ? ? ? ? bdata.pads = NULL; > >> ? ? ? ? ? ? ? bdata.pads_cnt = 0; > >> > >> - ? ? ? ? ? ? if (cpu_is_omap44xx() || cpu_is_omap34xx()) > >> - ? ? ? ? ? ? ? ? ? ? omap_serial_fill_default_pads(&bdata); > >> + ? ? ? ? ? ? if (omap_serial_fill_default_pads(&bdata, uart)) > >> + ? ? ? ? ? ? ? ? ? ? continue; > >> > >> ? ? ? ? ? ? ? if (!info) > >> ? ? ? ? ? ? ? ? ? ? ? omap_serial_init_port(&bdata, NULL); > > > > Can't the omap_serial_board_init() now be just be omap_serial_init(void) > > as it's not used anywhere else? > > Yes sure we can remove that. OK > > Anyways, this is getting too complex for the -rc series as at least 2430sdp > > is using alternative pins for the first uart. Let's patch to remove just > > the uart4 entry for 3630 for the -rc and then we can properly fix this > > for the next merge window. > > Okay. in that case the earlier patch [1] should be fine to solve the > gpmc issue observed and ehci issue on beagle-xm. I'll just use your first patch to remove _all_ the muxing for omap_serial_init(). That's really the only safe thing we can do for the -rc cycle. This means we rely on bootloader settings for console muxing and wake-up bits, but that's just what we need to live with until next merge window. And for the next merge window, I think we should only automatically enable the wake-up event bits if the port is in serial mode, and not do any other muxing. Something like: void __init omap_serial_init(void) { struct omap_uart_state *uart; struct omap_board_data bdata; list_for_each_entry(uart, &uart_list, node) { bdata.id = uart->num; bdata.flags = 0; bdata.pads = NULL; bdata.pads_cnt = 0; omap_serial_check_wakeup(&bdata); omap_serial_init_port(&bdata, NULL); } omap_serial_board_init(NULL); } Where omap_serial_check_wakeup() just enables the wake-up if the port is already muxed to uart mode. So it turns out we can't bail out for unmuxed uarts because some boards use alternative pads like 2430sdp does for the first uart. Regards, Tony ^ permalink raw reply [flat|nested] 38+ messages in thread
end of thread, other threads:[~2012-05-07 17:54 UTC | newest] Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-04-10 13:40 [PATCH 0/2] OMAP2+: UART: Fix usage of default mux pads Govindraj.R 2012-04-10 13:40 ` Govindraj.R 2012-04-10 13:40 ` [PATCH 1/2] OMAP2+: UART: Fix incorrect population of default uart pads Govindraj.R 2012-04-10 13:40 ` Govindraj.R 2012-04-11 20:14 ` Russ Dill 2012-04-11 20:14 ` Russ Dill 2012-04-13 23:14 ` Russ Dill 2012-04-13 23:14 ` Russ Dill 2012-04-17 17:50 ` Tony Lindgren 2012-04-17 17:50 ` Tony Lindgren 2012-04-23 23:45 ` Kevin Hilman 2012-04-23 23:45 ` Kevin Hilman 2012-04-24 8:38 ` Raja, Govindraj 2012-04-24 8:38 ` Raja, Govindraj 2012-05-04 17:24 ` Tony Lindgren 2012-05-04 17:24 ` Tony Lindgren 2012-05-07 17:39 ` Kevin Hilman 2012-05-07 17:39 ` Kevin Hilman 2012-05-07 17:54 ` Tony Lindgren 2012-05-07 17:54 ` Tony Lindgren 2012-04-10 13:40 ` [PATCH 2/2] OMAP2+: UART: Add mechanism to probe uart pins and configure rx wakeup Govindraj.R 2012-04-10 13:40 ` Govindraj.R 2012-04-10 16:11 ` Tony Lindgren 2012-04-10 16:11 ` Tony Lindgren 2012-04-10 16:40 ` Russ Dill 2012-04-10 16:40 ` Russ Dill 2012-04-11 11:50 ` Raja, Govindraj 2012-04-11 11:50 ` Raja, Govindraj 2012-04-11 20:16 ` Russ Dill 2012-04-11 20:16 ` Russ Dill 2012-04-13 23:39 ` Russ Dill 2012-04-13 23:39 ` Russ Dill 2012-04-17 1:41 ` Tony Lindgren 2012-04-17 1:41 ` Tony Lindgren 2012-04-17 12:47 ` Raja, Govindraj 2012-04-17 12:47 ` Raja, Govindraj 2012-04-17 17:47 ` Tony Lindgren 2012-04-17 17:47 ` Tony Lindgren
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.