Re: [PATCH] OMAP1: fix redundant UARTs pin muxing that can break other hardware support

2009-10-22 Thread Tony Lindgren
* Janusz Krzysztofik  [091021 10:11]:
> Wednesday 21 October 2009 02:51:35 Tony Lindgren napisał(a):
> >
> > Let's just remove the omap_cfg_reg() calls from mach-omap1/serial.c, and
> > add them to the board-*.c files like you suggest above. We should be able
> > to find which ports to mux by looking at the enabled_uarts mask in the
> > commit mentioned above.
> 
> Here you are (board-*.c changes limited to those OMAP1510 based).
> Created against linux-2.6.32-rc5.
> Tested on Amsdtrad Delta only.

Thanks, I'll add it to the omap-fixes series for this -rc cycle with
a description on how things broke.

BTW, you might want to also take a look at adding support for powering
down the uarts with an idle timer for mach-omap1/serial.c the same
way as mach-omap2/serial.c does.

Otherwise the enabled serial ports keep the system from hitting
retention during idle.

Regards,

Tony
 
> Signed-off-by: Janusz Krzysztofik 
> 
> ---
> diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-ams-delta.c 
> linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-ams-delta.c
> --- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-ams-delta.c   
> 2009-10-16 02:41:50.0 +0200
> +++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-ams-delta.c  
> 2009-10-21 17:41:29.0 +0200
> @@ -219,6 +219,10 @@ static struct platform_device *ams_delta
>  
>  static void __init ams_delta_init(void)
>  {
> + /* setup mux pins for uarts, removed from serial.c */
> + omap_cfg_reg(UART1_TX);
> + omap_cfg_reg(UART1_RTS);
> +
>   iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
>  
>   omap_board_config = ams_delta_config;
> diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-generic.c 
> linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-generic.c
> --- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-generic.c 2009-10-16 
> 02:41:50.0 +0200
> +++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-generic.c
> 2009-10-21 18:15:37.0 +0200
> @@ -64,6 +64,14 @@ static void __init omap_generic_init(voi
>  {
>  #ifdef CONFIG_ARCH_OMAP15XX
>   if (cpu_is_omap15xx()) {
> + /* setup mux pins for uarts, removed from serial.c */
> + omap_cfg_reg(UART1_TX);
> + omap_cfg_reg(UART1_RTS);
> + omap_cfg_reg(UART2_TX);
> + omap_cfg_reg(UART2_RTS);
> + omap_cfg_reg(UART3_TX);
> + omap_cfg_reg(UART3_RX);
> +
>   omap_usb_init(&generic1510_usb_config);
>   }
>  #endif
> diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-innovator.c 
> linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-innovator.c
> --- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-innovator.c   
> 2009-10-16 02:41:50.0 +0200
> +++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-innovator.c  
> 2009-10-21 18:16:59.0 +0200
> @@ -376,6 +376,24 @@ static void __init innovator_init(void)
>  {
>  #ifdef CONFIG_ARCH_OMAP15XX
>   if (cpu_is_omap1510()) {
> + /* setup mux pins for uarts, removed from serial.c */
> + omap_cfg_reg(UART1_TX);
> + omap_cfg_reg(UART1_RTS);
> + omap_cfg_reg(UART2_TX);
> + omap_cfg_reg(UART2_RTS);
> + omap_cfg_reg(UART3_TX);
> + omap_cfg_reg(UART3_RX);
> +
> + reg = fpga_read(OMAP1510_FPGA_POWER);
> + reg |= OMAP1510_FPGA_PCR_COM1_EN;
> + fpga_write(reg, OMAP1510_FPGA_POWER);
> + udelay(10);
> +
> + reg = fpga_read(OMAP1510_FPGA_POWER);
> + reg |= OMAP1510_FPGA_PCR_COM2_EN;
> + fpga_write(reg, OMAP1510_FPGA_POWER);
> + udelay(10);
> +
>   platform_add_devices(innovator1510_devices, 
> ARRAY_SIZE(innovator1510_devices));
>   spi_register_board_info(innovator1510_boardinfo,
>   ARRAY_SIZE(innovator1510_boardinfo));
> diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-palmte.c 
> linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-palmte.c
> --- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-palmte.c  2009-10-16 
> 02:41:50.0 +0200
> +++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-palmte.c 2009-10-21 
> 17:38:59.0 +0200
> @@ -342,6 +342,14 @@ static void __init palmte_misc_gpio_setu
>  
>  static void __init omap_palmte_init(void)
>  {
> + /* setup mux pins for uarts, removed from serial.c */
> + omap_cfg_reg(UART1_TX);
> + omap_cfg_reg(UART1_RTS);
> + omap_cfg_reg(UART2_TX);
> + omap_cfg_reg(UART2_RTS);
> + omap_cfg_reg(UART3_TX);
> + omap_cfg_reg(UART3_RX);
> +
>   omap_board_config = palmte_config;
>   omap_board_config_size = ARRAY_SIZE(palmte_config);
>  
> diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-palmtt.c 
> linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-palmtt.c
> --- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-palmtt.c  2009-10-16 
> 02:41:50.0 +02

[PATCH] OMAP1: fix redundant UARTs pin muxing that can break other hardware support

2009-10-21 Thread Janusz Krzysztofik
Wednesday 21 October 2009 02:51:35 Tony Lindgren napisał(a):
>
> Let's just remove the omap_cfg_reg() calls from mach-omap1/serial.c, and
> add them to the board-*.c files like you suggest above. We should be able
> to find which ports to mux by looking at the enabled_uarts mask in the
> commit mentioned above.

Here you are (board-*.c changes limited to those OMAP1510 based).
Created against linux-2.6.32-rc5.
Tested on Amsdtrad Delta only.

Signed-off-by: Janusz Krzysztofik 

---
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-ams-delta.c 
linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-ams-delta.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-ams-delta.c 2009-10-16 
02:41:50.0 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-ams-delta.c
2009-10-21 17:41:29.0 +0200
@@ -219,6 +219,10 @@ static struct platform_device *ams_delta
 
 static void __init ams_delta_init(void)
 {
+   /* setup mux pins for uarts, removed from serial.c */
+   omap_cfg_reg(UART1_TX);
+   omap_cfg_reg(UART1_RTS);
+
iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
 
omap_board_config = ams_delta_config;
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-generic.c 
linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-generic.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-generic.c   2009-10-16 
02:41:50.0 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-generic.c  2009-10-21 
18:15:37.0 +0200
@@ -64,6 +64,14 @@ static void __init omap_generic_init(voi
 {
 #ifdef CONFIG_ARCH_OMAP15XX
if (cpu_is_omap15xx()) {
+   /* setup mux pins for uarts, removed from serial.c */
+   omap_cfg_reg(UART1_TX);
+   omap_cfg_reg(UART1_RTS);
+   omap_cfg_reg(UART2_TX);
+   omap_cfg_reg(UART2_RTS);
+   omap_cfg_reg(UART3_TX);
+   omap_cfg_reg(UART3_RX);
+
omap_usb_init(&generic1510_usb_config);
}
 #endif
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-innovator.c 
linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-innovator.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-innovator.c 2009-10-16 
02:41:50.0 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-innovator.c
2009-10-21 18:16:59.0 +0200
@@ -376,6 +376,24 @@ static void __init innovator_init(void)
 {
 #ifdef CONFIG_ARCH_OMAP15XX
if (cpu_is_omap1510()) {
+   /* setup mux pins for uarts, removed from serial.c */
+   omap_cfg_reg(UART1_TX);
+   omap_cfg_reg(UART1_RTS);
+   omap_cfg_reg(UART2_TX);
+   omap_cfg_reg(UART2_RTS);
+   omap_cfg_reg(UART3_TX);
+   omap_cfg_reg(UART3_RX);
+
+   reg = fpga_read(OMAP1510_FPGA_POWER);
+   reg |= OMAP1510_FPGA_PCR_COM1_EN;
+   fpga_write(reg, OMAP1510_FPGA_POWER);
+   udelay(10);
+
+   reg = fpga_read(OMAP1510_FPGA_POWER);
+   reg |= OMAP1510_FPGA_PCR_COM2_EN;
+   fpga_write(reg, OMAP1510_FPGA_POWER);
+   udelay(10);
+
platform_add_devices(innovator1510_devices, 
ARRAY_SIZE(innovator1510_devices));
spi_register_board_info(innovator1510_boardinfo,
ARRAY_SIZE(innovator1510_boardinfo));
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-palmte.c 
linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-palmte.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-palmte.c2009-10-16 
02:41:50.0 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-palmte.c   2009-10-21 
17:38:59.0 +0200
@@ -342,6 +342,14 @@ static void __init palmte_misc_gpio_setu
 
 static void __init omap_palmte_init(void)
 {
+   /* setup mux pins for uarts, removed from serial.c */
+   omap_cfg_reg(UART1_TX);
+   omap_cfg_reg(UART1_RTS);
+   omap_cfg_reg(UART2_TX);
+   omap_cfg_reg(UART2_RTS);
+   omap_cfg_reg(UART3_TX);
+   omap_cfg_reg(UART3_RX);
+
omap_board_config = palmte_config;
omap_board_config_size = ARRAY_SIZE(palmte_config);
 
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-palmtt.c 
linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-palmtt.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap1/board-palmtt.c2009-10-16 
02:41:50.0 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap1/board-palmtt.c   2009-10-21 
17:39:19.0 +0200
@@ -289,6 +289,14 @@ static void __init omap_mpu_wdt_mode(int
 
 static void __init omap_palmtt_init(void)
 {
+   /* setup mux pins for uarts, removed from serial.c */
+   omap_cfg_reg(UART1_TX);
+   omap_cfg_reg(UART1_RTS);
+   omap_cfg_reg(UART2_TX);
+   omap_cfg_reg(UART2_RTS);
+   omap_cfg_reg(UART3_TX);
+   omap_cfg_reg(UART3_RX);
+
omap_mpu_wdt_mode(0);
 
omap_board_config = palmtt_config;
diff -upr