* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
@ 2012-03-21 10:02 Govindraj.R
2012-04-03 18:19 ` Tony Lindgren
0 siblings, 1 reply; 10+ messages in thread
From: Govindraj.R @ 2012-03-21 10:02 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 all default pads except uart1/3 as most boards
tend to use either uart1/3 as console port and use only tx/rx
lines, declare only those pads for uart1/3.
If any boards tend to use any other uart other uart1/3
the mux data should to passed from board file and init individual
uart port using omap_serial_init_port api.
These pads are needed not only for muxing but are also used to specify
pad wakeup capability for console uart, prior to commit specified we used
to do raw_write to mux pin to enable wakeup capability to uart1/2/3 now
with runtime changes we are using the hwmod/mux framework.
Cc: Felipe Balbi <balbi@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
---
Based on Linux 3.3
Tested on Beagle XM and Zoom3 board.
arch/arm/mach-omap2/serial.c | 78 ------------------------------------------
1 files changed, 0 insertions(+), 78 deletions(-)
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 83ab5a2..4dccf14 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -124,14 +124,6 @@ static void omap_uart_set_smartidle(struct platform_device *pdev) {}
#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,
},
@@ -143,37 +135,8 @@ static struct omap_device_pad default_uart1_pads[] __initdata = {
},
};
-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,
},
@@ -185,32 +148,6 @@ static struct omap_device_pad default_uart3_pads[] __initdata = {
},
};
-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) {
@@ -218,25 +155,10 @@ static void omap_serial_fill_default_pads(struct omap_board_data *bdata)
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;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
2012-03-21 10:02 [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads Govindraj.R
@ 2012-04-03 18:19 ` Tony Lindgren
2012-04-04 6:14 ` Raja, Govindraj
0 siblings, 1 reply; 10+ messages in thread
From: Tony Lindgren @ 2012-04-03 18:19 UTC (permalink / raw)
To: linux-arm-kernel
* Govindraj.R <govindraj.raja@ti.com> [120321 03:06]:
> 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 all default pads except uart1/3 as most boards
> tend to use either uart1/3 as console port and use only tx/rx
> lines, declare only those pads for uart1/3.
> If any boards tend to use any other uart other uart1/3
> the mux data should to passed from board file and init individual
> uart port using omap_serial_init_port api.
This is still wrong. We can't mux any serial pins unless specifically
requested from the board-*.c files. So please do a fix to get back to
v3.2 behaviour where you basically revert 7496ba3.
Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
2012-04-03 18:19 ` Tony Lindgren
@ 2012-04-04 6:14 ` Raja, Govindraj
2012-04-05 16:58 ` Tony Lindgren
0 siblings, 1 reply; 10+ messages in thread
From: Raja, Govindraj @ 2012-04-04 6:14 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Apr 3, 2012 at 11:49 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Govindraj.R <govindraj.raja@ti.com> [120321 03:06]:
>> 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 all default pads except uart1/3 as most boards
>> tend to use either uart1/3 as console port and use only tx/rx
>> lines, declare only those pads for uart1/3.
>> If any boards tend to use any other uart other uart1/3
>> the mux data should to passed from board file and init individual
>> uart port using omap_serial_init_port api.
>
> This is still wrong. We can't mux any serial pins unless specifically
> requested from the board-*.c files. So please do a fix to get back to
> v3.2 behaviour where you basically revert 7496ba3.
How to do we fix the rx pin wakeup capability?
The mux data has the info about the rx pin wakeup
Without rx pin wakeup PM will be broken.
Fix all board files with duplicated data for uart3 or
uart1 having rx pin marked as wakeup capable?
Behavior in v3.2 was raw_write to all uarts rx_pin to enable wakeup
enable bit.
--
Thanks,
Govindraj.R
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
2012-04-04 6:14 ` Raja, Govindraj
@ 2012-04-05 16:58 ` Tony Lindgren
2012-04-05 17:02 ` Tony Lindgren
2012-04-06 6:05 ` Raja, Govindraj
0 siblings, 2 replies; 10+ messages in thread
From: Tony Lindgren @ 2012-04-05 16:58 UTC (permalink / raw)
To: linux-arm-kernel
* Raja, Govindraj <govindraj.raja@ti.com> [120403 23:18]:
> On Tue, Apr 3, 2012 at 11:49 PM, Tony Lindgren <tony@atomide.com> wrote:
> > * Govindraj.R <govindraj.raja@ti.com> [120321 03:06]:
> >> 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 all default pads except uart1/3 as most boards
> >> tend to use either uart1/3 as console port and use only tx/rx
> >> lines, declare only those pads for uart1/3.
> >> If any boards tend to use any other uart other uart1/3
> >> the mux data should to passed from board file and init individual
> >> uart port using omap_serial_init_port api.
> >
> > This is still wrong. We can't mux any serial pins unless specifically
> > requested from the board-*.c files. So please do a fix to get back to
> > v3.2 behaviour where you basically revert 7496ba3.
>
> How to do we fix the rx pin wakeup capability?
> The mux data has the info about the rx pin wakeup
>
> Without rx pin wakeup PM will be broken.
Let's first make things work reliably before even getting started
about PM being broken.
> Fix all board files with duplicated data for uart3 or
> uart1 having rx pin marked as wakeup capable?
And how do you know which pins to mux? You don't, unless you look
at the schematics for all the boards.
The only safe option without looking at the schematics is to
make omap_serial_init not do any muxing. If you want muxing and
PM wake-up events, then use omap_serial_init_port for those ports
with board specific pins.
> Behavior in v3.2 was raw_write to all uarts rx_pin to enable wakeup
> enable bit.
Hmm I don't think any muxing was done automatically unless
omap_serial_init_port was being called with pins.
Regards,
Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
2012-04-05 16:58 ` Tony Lindgren
@ 2012-04-05 17:02 ` Tony Lindgren
2012-04-06 6:05 ` Raja, Govindraj
1 sibling, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2012-04-05 17:02 UTC (permalink / raw)
To: linux-arm-kernel
* Tony Lindgren <tony@atomide.com> [120405 10:01]:
> * Raja, Govindraj <govindraj.raja@ti.com> [120403 23:18]:
> > On Tue, Apr 3, 2012 at 11:49 PM, Tony Lindgren <tony@atomide.com> wrote:
> > > * Govindraj.R <govindraj.raja@ti.com> [120321 03:06]:
> > >> 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 all default pads except uart1/3 as most boards
> > >> tend to use either uart1/3 as console port and use only tx/rx
> > >> lines, declare only those pads for uart1/3.
> > >> If any boards tend to use any other uart other uart1/3
> > >> the mux data should to passed from board file and init individual
> > >> uart port using omap_serial_init_port api.
> > >
> > > This is still wrong. We can't mux any serial pins unless specifically
> > > requested from the board-*.c files. So please do a fix to get back to
> > > v3.2 behaviour where you basically revert 7496ba3.
> >
> > How to do we fix the rx pin wakeup capability?
> > The mux data has the info about the rx pin wakeup
> >
> > Without rx pin wakeup PM will be broken.
>
> Let's first make things work reliably before even getting started
> about PM being broken.
>
> > Fix all board files with duplicated data for uart3 or
> > uart1 having rx pin marked as wakeup capable?
>
> And how do you know which pins to mux? You don't, unless you look
> at the schematics for all the boards.
>
> The only safe option without looking at the schematics is to
> make omap_serial_init not do any muxing. If you want muxing and
> PM wake-up events, then use omap_serial_init_port for those ports
> with board specific pins.
Something that might be doable is to read the pin settings for the
uart in question in omap_serial_init. And then bail out for that
port if the rx or tx pin is not already muxed to uart in question.
Only if the rx and tx pin is muxed for uart, then you can enable
the wake-up events.
So basically doing remuxing in serial.c is only safe when
omap_serial_init_port with mux data is being used.
Regards,
Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
2012-04-05 16:58 ` Tony Lindgren
2012-04-05 17:02 ` Tony Lindgren
@ 2012-04-06 6:05 ` Raja, Govindraj
2012-04-06 18:15 ` Tony Lindgren
1 sibling, 1 reply; 10+ messages in thread
From: Raja, Govindraj @ 2012-04-06 6:05 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Apr 5, 2012 at 10:28 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Raja, Govindraj <govindraj.raja@ti.com> [120403 23:18]:
>> On Tue, Apr 3, 2012 at 11:49 PM, Tony Lindgren <tony@atomide.com> wrote:
>> > * Govindraj.R <govindraj.raja@ti.com> [120321 03:06]:
>> >> 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 all default pads except uart1/3 as most boards
>> >> tend to use either uart1/3 as console port and use only tx/rx
>> >> lines, declare only those pads for uart1/3.
>> >> If any boards tend to use any other uart other uart1/3
>> >> the mux data should to passed from board file and init individual
>> >> uart port using omap_serial_init_port api.
>> >
>> > This is still wrong. We can't mux any serial pins unless specifically
>> > requested from the board-*.c files. So please do a fix to get back to
>> > v3.2 behaviour where you basically revert 7496ba3.
>>
>> How to do we fix the rx pin wakeup capability?
>> The mux data has the info about the rx pin wakeup
>>
>> Without rx pin wakeup PM will be broken.
>
> Let's first make things work reliably before even getting started
> about PM being broken.
>
okay.
>> Fix all board files with duplicated data for uart3 or
>> uart1 having rx pin marked as wakeup capable?
>
> And how do you know which pins to mux? You don't, unless you look
> at the schematics for all the boards.
>
agree even I am not sure of uarts used for console on all boards
> The only safe option without looking at the schematics is to
> make omap_serial_init not do any muxing. If you want muxing and
> PM wake-up events, then use omap_serial_init_port for those ports
> with board specific pins.
okay.
>
>> Behavior in v3.2 was raw_write to all uarts rx_pin to enable wakeup
>> enable bit.
>
> Hmm I don't think any muxing was done automatically unless
> omap_serial_init_port was being called with pins.
Muxing was happening even if we don't call omap_serial_init_port
rx pin was muxed for wakeup capability for all uart pins
omap_uart_idle_init => was populating padconf offset value for ech uart
which was used in omap_uart_enable/disable_wakeup functions.
This mechanism was keeping PM happening for all boards.
--
Thanks,
Govindraj.R
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
2012-04-06 6:05 ` Raja, Govindraj
@ 2012-04-06 18:15 ` Tony Lindgren
2012-04-09 11:08 ` Raja, Govindraj
0 siblings, 1 reply; 10+ messages in thread
From: Tony Lindgren @ 2012-04-06 18:15 UTC (permalink / raw)
To: linux-arm-kernel
* Raja, Govindraj <govindraj.raja@ti.com> [120405 23:08]:
> On Thu, Apr 5, 2012 at 10:28 PM, Tony Lindgren <tony@atomide.com> wrote:
> >
> > Hmm I don't think any muxing was done automatically unless
> > omap_serial_init_port was being called with pins.
>
> Muxing was happening even if we don't call omap_serial_init_port
> rx pin was muxed for wakeup capability for all uart pins
OK, but that was only for the wake-up muxing? That sounds risky
too for some boards as the board may be using alternative uart
pins instead of the default ones.
> omap_uart_idle_init => was populating padconf offset value for ech uart
> which was used in omap_uart_enable/disable_wakeup functions.
> This mechanism was keeping PM happening for all boards.
OK, that's safe if we also bail out for the cases where the default
uart pins are not muxed to serial functionality to start with.
So to summarize, the right fix is to:
1. Only do muxing of uarts from other modes to uart mode if
omap_serial_init_port is being called with the board specific
mux options for the port in question.
2. Bail out early in omap_serial_init for each port that does not
have it's default uart pins already muxed to uart functionality.
3. For the uart ports configured in #1 or #2 above, allow dynamic
remuxing of the wake-up capability but don't touch the others.
Regards,
Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
2012-04-06 18:15 ` Tony Lindgren
@ 2012-04-09 11:08 ` Raja, Govindraj
2012-04-09 16:56 ` Russ Dill
0 siblings, 1 reply; 10+ messages in thread
From: Raja, Govindraj @ 2012-04-09 11:08 UTC (permalink / raw)
To: linux-arm-kernel
Hi Tony,
On Fri, Apr 6, 2012 at 11:45 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Raja, Govindraj <govindraj.raja@ti.com> [120405 23:08]:
>> On Thu, Apr 5, 2012 at 10:28 PM, Tony Lindgren <tony@atomide.com> wrote:
>> >
>> > Hmm I don't think any muxing was done automatically unless
>> > omap_serial_init_port was being called with pins.
>>
>> Muxing was happening even if we don't call omap_serial_init_port
>> rx pin was muxed for wakeup capability for all uart pins
>
> OK, but that was only for the wake-up muxing? That sounds risky
> too for some boards as the board may be using alternative uart
> pins instead of the default ones.
>
>> omap_uart_idle_init => was populating padconf offset value for ech uart
>> which was used in omap_uart_enable/disable_wakeup functions.
>> This mechanism was keeping PM happening for all boards.
>
> OK, that's safe if we also bail out for the cases where the default
> uart pins are not muxed to serial functionality to start with.
>
> So to summarize, the right fix is to:
>
> 1. Only do muxing of uarts from other modes to uart mode if
> ? omap_serial_init_port is being called with the board specific
> ? mux options for the port in question.
>
> 2. Bail out early in omap_serial_init for each port that does not
> ? have it's default uart pins already muxed to uart functionality.
>
> 3. For the uart ports configured in #1 or #2 above, allow dynamic
> ? remuxing of the wake-up capability but don't touch the others.
>
Thanks for the review and suggestions, here is the patch [1] to do the same.
I tested this patch on beagle-xm where uart pin mux was causing clash
with usb ehci hub gpio nrest pin, now with this patch smsc hub + ethernet
get enumerated.
--
Thanks,
Govindraj.R
[1]:
>From 37850b9e80fc4dac050bff5b6dbb67c245be43cc Mon Sep 17 00:00:00 2001
From: "Govindraj.R" <govindraj.raja@ti.com>
Date: Mon, 9 Apr 2012 15:16:52 +0530
Subject: [PATCH] ARM: OMAP2+: UART: Fix usage of default uart pads.
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 check for the availability of uart pins before filling the pads
if both tx and rx are available as uart pins then use them for
filling as default pads where rx pin is muxed dynamically for
rx wakeup capability.
However the board file owners can use omap_serial_init_port
and pass mux data part of board data for board specific use cases.
Cc: Felipe Balbi <balbi@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
---
arch/arm/mach-omap2/mux.c | 2 +-
arch/arm/mach-omap2/mux.h | 10 +++
arch/arm/mach-omap2/serial.c | 158 ++++++++++++------------------------------
3 files changed, 56 insertions(+), 114 deletions(-)
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index 65c3391..5334914 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -217,7 +217,7 @@ static int __init _omap_mux_get_by_name(struct
omap_mux_partition *partition,
return -ENODEV;
}
-static int __init
+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..461b90d 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 0cdd359..30a0f4e 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -120,127 +120,59 @@ 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,
- },
-};
+#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28
+static char __initdata rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN],
+ tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN];
-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 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;
+ struct omap_device_pad default_omap_uart_pads[2];
+
+ 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);
+ }
-static struct omap_device_pad default_omap4_uart4_pads[] __initdata = {
- {
- .name = "uart4_tx.uart4_tx",
- .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
- },
+ 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)
{
- .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);
+ 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);
+
+ 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);
}
- break;
- default:
- break;
}
}
#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] 10+ messages in thread
* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
2012-04-09 11:08 ` Raja, Govindraj
@ 2012-04-09 16:56 ` Russ Dill
2012-04-09 20:36 ` Tony Lindgren
0 siblings, 1 reply; 10+ messages in thread
From: Russ Dill @ 2012-04-09 16:56 UTC (permalink / raw)
To: linux-arm-kernel
> Thanks for the review and suggestions, here is the patch [1] to do the same.
>
> I tested this patch on beagle-xm where uart pin mux was causing clash
> with usb ehci hub gpio nrest pin, now with this patch smsc hub + ethernet
> get enumerated.
Morning. I tested this patch on both next and master on the xM and it
does work, however, I have some comments.
> From 37850b9e80fc4dac050bff5b6dbb67c245be43cc Mon Sep 17 00:00:00 2001
> From: "Govindraj.R" <govindraj.raja@ti.com>
> Date: Mon, 9 Apr 2012 15:16:52 +0530
> Subject: [PATCH] ARM: OMAP2+: UART: Fix usage of default uart pads.
>
> 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 check for the availability of uart pins before filling the pads
> if both tx and rx are available as uart pins then use them for
> filling as default pads where rx pin is muxed dynamically for
> rx wakeup capability.
>
> However the board file owners can use omap_serial_init_port
> and pass mux data part of board data for board specific use cases.
>
> Cc: Felipe Balbi <balbi@ti.com>
> Cc: Kevin Hilman <khilman@ti.com>
> Reported-by: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
> ---
> ?arch/arm/mach-omap2/mux.c ? ?| ? ?2 +-
> ?arch/arm/mach-omap2/mux.h ? ?| ? 10 +++
> ?arch/arm/mach-omap2/serial.c | ?158 ++++++++++++------------------------------
> ?3 files changed, 56 insertions(+), 114 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
> index 65c3391..5334914 100644
> --- a/arch/arm/mach-omap2/mux.c
> +++ b/arch/arm/mach-omap2/mux.c
> @@ -217,7 +217,7 @@ static int __init _omap_mux_get_by_name(struct
> omap_mux_partition *partition,
It seems your mailer might be eating your patches....What mailer are you using?
> ? ? ? ?return -ENODEV;
> ?}
>
> -static int __init
> +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..461b90d 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 0cdd359..30a0f4e 100644
> --- a/arch/arm/mach-omap2/serial.c
> +++ b/arch/arm/mach-omap2/serial.c
> @@ -120,127 +120,59 @@ 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,
> - ? ? ? },
> -};
> +#define OMAP_UART_DEFAULT_PAD_NAME_LEN 28
> +static char __initdata rx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN],
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? tx_pad_name[OMAP_UART_DEFAULT_PAD_NAME_LEN];
>
> -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 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;
> + ? ? ? struct omap_device_pad default_omap_uart_pads[2];
> +
> + ? ? ? 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);
> + ? ? ? }
>
> -static struct omap_device_pad default_omap4_uart4_pads[] __initdata = {
> - ? ? ? {
> - ? ? ? ? ? ? ? .name ? = "uart4_tx.uart4_tx",
> - ? ? ? ? ? ? ? .enable = OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
> - ? ? ? },
> + ? ? ? 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)
> ? ? ? ?{
> - ? ? ? ? ? ? ? .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);
> + ? ? ? ? ? ? ? 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);
> +
> + ? ? ? ? ? ? ? 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;
You are assigning this variable to a structure on the stack.
> + ? ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads);
> ? ? ? ? ? ? ? ?}
> - ? ? ? ? ? ? ? break;
> - ? ? ? default:
> - ? ? ? ? ? ? ? break;
> ? ? ? ?}
> ?}
> ?#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
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads
2012-04-09 16:56 ` Russ Dill
@ 2012-04-09 20:36 ` Tony Lindgren
0 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2012-04-09 20:36 UTC (permalink / raw)
To: linux-arm-kernel
* Russ Dill <russ.dill@gmail.com> [120409 09:59]:
> > From: "Govindraj.R" <govindraj.raja@ti.com>
> > Date: Mon, 9 Apr 2012 15:16:52 +0530
> > Subject: [PATCH] ARM: OMAP2+: UART: Fix usage of default uart pads.
> > -static int __init
> > +int __init
> > ?omap_mux_get_by_name(const char *muxname,
> > ? ? ? ? ? ? ? ? ? ? ? ?struct omap_mux_partition **found_partition,
> > ? ? ? ? ? ? ? ? ? ? ? ?struct omap_mux **found_mux)
This can now be one one line:
int __init omap_mux_get_by_name(const char *muxname,
...
> > + ? ? ? ? ? ? ? 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);
> > +
> > + ? ? ? ? ? ? ? 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;
>
> You are assigning this variable to a structure on the stack.
>
> > + ? ? ? ? ? ? ? ? ? ? ? bdata->pads_cnt = ARRAY_SIZE(default_omap_uart_pads);
Also, maybe make that into a separate function with comments added that
we check that the default pins are muxed to uart rx and tx mode to start
with. Otherwise it's a bit hard to figure out what's going on here.
Then please split it into two patches: First one removes all the unsafe
muxing, then the second one enables wake-up events for the ports already
in uart rx/tx mode.
Regards,
Tony
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-04-09 20:36 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-21 10:02 [RESEND PATCH] ARM :OMAP2+: UART: Remove some of uart default pads Govindraj.R
2012-04-03 18:19 ` Tony Lindgren
2012-04-04 6:14 ` Raja, Govindraj
2012-04-05 16:58 ` Tony Lindgren
2012-04-05 17:02 ` Tony Lindgren
2012-04-06 6:05 ` Raja, Govindraj
2012-04-06 18:15 ` Tony Lindgren
2012-04-09 11:08 ` Raja, Govindraj
2012-04-09 16:56 ` Russ Dill
2012-04-09 20:36 ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).