Re: [PATCH 2/2] OMAP: UART: omap_device converions, remove implicit 8520 assumptions

2010-03-01 Thread Kevin Hilman
"Nayak, Rajendra"  writes:

[...]

>> + /*
>> +  * Need to block sleep long enough for interrupt driven
>> +  * driver to start.  Console driver is in polling mode
>> +  * so device needs to be kept enabled while
>> polling driver
>> +  * is in use.
>> +  */
>> + uart->timeout = (30 * HZ);
>> + omap_uart_block_sleep(uart);
>> + uart->timeout = DEFAULT_TIMEOUT;
>> +
>> + if ((cpu_is_omap34xx() && uart->padconf) ||
>> + (uart->wk_en && uart->wk_mask)) {
>> + device_init_wakeup(&od->pdev.dev, true);
>> + DEV_CREATE_FILE(&od->pdev.dev,
>> &dev_attr_sleep_timeout);
>> + }
>> +
>> +#ifdef CONFIG_SERIAL_8250_CONSOLE
>>   /* omap44xx: Never read empty UART fifo
>>* omap3xxx: Never read empty UART fifo on UARTs
>>* with IP rev >=0x52
>>*/
>>   if (cpu_is_omap44xx())
>> - uart->p->serial_in = serial_in_override;
>> - else if ((serial_read_reg(uart->p,
>> UART_OMAP_MVER) & 0xFF)
>> + p->serial_in = serial_in_override;
>> + else if ((serial_read_reg(uart, UART_OMAP_MVER) & 0xFF)
>>   >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV)
>> - uart->p->serial_in = serial_in_override;
>> + p->serial_in = serial_in_override;
>> +#endif
>
> I think this (overriding serial_in) needs to be done sometime before you do a
> omap_device_build() call. Else this has no affect.
>

Thanks Rajendra, you're right, good catch.

Will fix in next spin.

Thanks ,

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2/2] OMAP: UART: omap_device converions, remove implicit 8520 assumptions

2010-01-29 Thread Nayak, Rajendra
Hi Kevin,

> -Original Message-
> From: linux-omap-ow...@vger.kernel.org
> [mailto:linux-omap-ow...@vger.kernel.org] On Behalf Of Kevin Hilman
> Sent: Wednesday, January 13, 2010 5:29 AM
> To: linux-omap@vger.kernel.org
> Cc: Raja, Govindraj
> Subject: [PATCH 2/2] OMAP: UART: omap_device converions,
> remove implicit 8520 assumptions
>
> Major rework of OMAP UART init for omap_device conversion as well as
> use with either 8250 driver or new omap-serial driver.
>
> Signifcant contributions and testing from Govindraj R
> .
>
> In preparation for a new omap-serial driver, remove 8250 assumptions
> and dependencies from the serial core.
>
> Convert UART core and PM support to use omap_device layer.  Also add
> support for both console on 8250 or omap-serial driver.
>
> omap_device conversion:
> - Convert clock API calls to omap_device calls
> - Remove all static platform_data setup and configuration.  This is
>   all done by the omap_device build phase.
>
> Known issues:
> - broken on OMAP4 until OMAP4 UART hwmods are available
>
> Cc: Govindraj R 
> Signed-off-by: Kevin Hilman 
> ---
>  arch/arm/mach-omap2/serial.c |  474
> +-
>  1 files changed, 242 insertions(+), 232 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/serial.c
> b/arch/arm/mach-omap2/serial.c
> index 8c964be..9060fb8 100644
> --- a/arch/arm/mach-omap2/serial.c
> +++ b/arch/arm/mach-omap2/serial.c
> @@ -19,18 +19,30 @@
>   */
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> +#include 
> +
> +#ifdef CONFIG_SERIAL_8250_CONSOLE
> +#include 
> +#endif
> +
> +#ifdef CONFIG_SERIAL_OMAP_CONSOLE
> +#include 
> +#endif
>
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> +#include 
>
>  #include "prm.h"
>  #include "pm.h"
> +#include "cm.h"
>  #include "prm-regbits-34xx.h"
>
>  #define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV  0x52
> @@ -38,6 +50,8 @@
>
>  #define DEFAULT_TIMEOUT (5 * HZ)
>
> +#define MAX_UART_HWMOD_NAME_LEN  16
> +
>  struct omap_uart_state {
>   int num;
>   int can_sleep;
> @@ -48,14 +62,21 @@ struct omap_uart_state {
>   void __iomem *wk_en;
>   u32 wk_mask;
>   u32 padconf;
> + u32 dma_enabled;
>
>   struct clk *ick;
>   struct clk *fck;
>   int clocked;
>
> - struct plat_serial8250_port *p;
> + int irq;
> + int regshift;
> + int irqflags;
> + void __iomem *membase;
> + resource_size_t mapbase;
> +
>   struct list_head node;
> - struct platform_device pdev;
> + struct omap_hwmod *oh;
> + struct platform_device *pdev;
>
>  #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
>   int context_valid;
> @@ -71,60 +92,16 @@ struct omap_uart_state {
>  };
>
>  static LIST_HEAD(uart_list);
> +static u8 num_uarts;
>
> -static struct plat_serial8250_port serial_platform_data0[] = {
> +static struct omap_device_pm_latency omap_uart_latency[] = {
>   {
> - .mapbase= OMAP_UART1_BASE,
> - .irq= 72,
> - .flags  = UPF_BOOT_AUTOCONF,
> - .iotype = UPIO_MEM,
> - .regshift   = 2,
> - .uartclk= OMAP24XX_BASE_BAUD * 16,
> - }, {
> - .flags  = 0
> - }
> -};
> -
> -static struct plat_serial8250_port serial_platform_data1[] = {
> - {
> - .mapbase= OMAP_UART2_BASE,
> - .irq= 73,
> - .flags  = UPF_BOOT_AUTOCONF,
> - .iotype = UPIO_MEM,
> - .regshift   = 2,
> - .uartclk= OMAP24XX_BASE_BAUD * 16,
> - }, {
> - .flags  = 0
> - }
> -};
> -
> -static struct plat_serial8250_port serial_platform_data2[] = {
> - {
> - .mapbase= OMAP_UART3_BASE,
> - .irq= 74,
> - .flags  = UPF_BOOT_AUTOCONF,
> - .iotype = UPIO_MEM,
> - .regshift   = 2,
> - .uartclk= OMAP24XX_BASE_BAUD * 16,
> - }, {
> - .flags  = 0
> - }
> + .deactivate_func = omap_device_idle_hwmods,
> + .activate_func   = omap_device_enable_hwmods,
> + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
> + },
>  };
>
> -#ifdef CONFIG_ARCH_OMAP4
> -static struct plat_serial8250_port serial_platform_data3[] = {
> - {
> -  

[PATCH 2/2] OMAP: UART: omap_device converions, remove implicit 8520 assumptions

2010-01-12 Thread Kevin Hilman
Major rework of OMAP UART init for omap_device conversion as well as
use with either 8250 driver or new omap-serial driver.

Signifcant contributions and testing from Govindraj R .

In preparation for a new omap-serial driver, remove 8250 assumptions
and dependencies from the serial core.

Convert UART core and PM support to use omap_device layer.  Also add
support for both console on 8250 or omap-serial driver.

omap_device conversion:
- Convert clock API calls to omap_device calls
- Remove all static platform_data setup and configuration.  This is
  all done by the omap_device build phase.

Known issues:
- broken on OMAP4 until OMAP4 UART hwmods are available

Cc: Govindraj R 
Signed-off-by: Kevin Hilman 
---
 arch/arm/mach-omap2/serial.c |  474 +-
 1 files changed, 242 insertions(+), 232 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 8c964be..9060fb8 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -19,18 +19,30 @@
  */
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
+
+#ifdef CONFIG_SERIAL_8250_CONSOLE
+#include 
+#endif
+
+#ifdef CONFIG_SERIAL_OMAP_CONSOLE
+#include 
+#endif
 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include "prm.h"
 #include "pm.h"
+#include "cm.h"
 #include "prm-regbits-34xx.h"
 
 #define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV0x52
@@ -38,6 +50,8 @@
 
 #define DEFAULT_TIMEOUT (5 * HZ)
 
+#define MAX_UART_HWMOD_NAME_LEN16
+
 struct omap_uart_state {
int num;
int can_sleep;
@@ -48,14 +62,21 @@ struct omap_uart_state {
void __iomem *wk_en;
u32 wk_mask;
u32 padconf;
+   u32 dma_enabled;
 
struct clk *ick;
struct clk *fck;
int clocked;
 
-   struct plat_serial8250_port *p;
+   int irq;
+   int regshift;
+   int irqflags;
+   void __iomem *membase;
+   resource_size_t mapbase;
+
struct list_head node;
-   struct platform_device pdev;
+   struct omap_hwmod *oh;
+   struct platform_device *pdev;
 
 #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
int context_valid;
@@ -71,60 +92,16 @@ struct omap_uart_state {
 };
 
 static LIST_HEAD(uart_list);
+static u8 num_uarts;
 
-static struct plat_serial8250_port serial_platform_data0[] = {
+static struct omap_device_pm_latency omap_uart_latency[] = {
{
-   .mapbase= OMAP_UART1_BASE,
-   .irq= 72,
-   .flags  = UPF_BOOT_AUTOCONF,
-   .iotype = UPIO_MEM,
-   .regshift   = 2,
-   .uartclk= OMAP24XX_BASE_BAUD * 16,
-   }, {
-   .flags  = 0
-   }
-};
-
-static struct plat_serial8250_port serial_platform_data1[] = {
-   {
-   .mapbase= OMAP_UART2_BASE,
-   .irq= 73,
-   .flags  = UPF_BOOT_AUTOCONF,
-   .iotype = UPIO_MEM,
-   .regshift   = 2,
-   .uartclk= OMAP24XX_BASE_BAUD * 16,
-   }, {
-   .flags  = 0
-   }
-};
-
-static struct plat_serial8250_port serial_platform_data2[] = {
-   {
-   .mapbase= OMAP_UART3_BASE,
-   .irq= 74,
-   .flags  = UPF_BOOT_AUTOCONF,
-   .iotype = UPIO_MEM,
-   .regshift   = 2,
-   .uartclk= OMAP24XX_BASE_BAUD * 16,
-   }, {
-   .flags  = 0
-   }
+   .deactivate_func = omap_device_idle_hwmods,
+   .activate_func   = omap_device_enable_hwmods,
+   .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+   },
 };
 
-#ifdef CONFIG_ARCH_OMAP4
-static struct plat_serial8250_port serial_platform_data3[] = {
-   {
-   .mapbase= OMAP_UART4_BASE,
-   .irq= 70,
-   .flags  = UPF_BOOT_AUTOCONF,
-   .iotype = UPIO_MEM,
-   .regshift   = 2,
-   .uartclk= OMAP24XX_BASE_BAUD * 16,
-   }, {
-   .flags  = 0
-   }
-};
-#endif
 static inline unsigned int __serial_read_reg(struct uart_port *up,
   int offset)
 {
@@ -132,18 +109,18 @@ static inline unsigned int __serial_read_reg(struct 
uart_port *up,
return (unsigned int)__raw_readb(up->membase + offset);
 }
 
-static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
+static inline unsigned int serial_read_reg(struct omap_uart_state *up,
   int offset)
 {
offset <<= up->regshift;
return (unsigned int)__raw_readb(up->membase + offset);
 }
 
-static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
+static in