Re: [PATCH v7 11/21] OMAP2+: UART: Move errata handling from serial.c to omap-serial

2011-11-11 Thread Govindraj
Hi Jon,

On Fri, Nov 11, 2011 at 5:14 AM, Jon Hunter  wrote:
> Hi Govindraj,
>
> On 10/18/2011 10:26, Govindraj.R wrote:
>>
>> Move the errata handling mechanism from serial.c to omap-serial file
>> and utilise the same func in driver file.
>>
>> Errata i202, i291 are moved to be handled with omap-serial
>> Moving the errata macro from serial.c file to driver header file
>> as from on errata will be handled in driver file itself.
>> Corrected errata id from chapter reference 2.15 to errata id i291.
>>
>> Removed errata and dma_enabled feilds from omap_uart_state struct
>> as they are no more needed with errata handling done within omap-serial.
>>
>> Acked-by: Alan Cox
>> Signed-off-by: Govindraj.R
>> ---
>>  arch/arm/mach-omap2/serial.c                  |   97
>> +++--
>>  arch/arm/plat-omap/include/plat/omap-serial.h |    6 ++
>>  drivers/tty/serial/omap-serial.c              |   66 -
>>  3 files changed, 95 insertions(+), 74 deletions(-)
>
> [snip]
>
>> +       /* Enable the MDR1 errata for OMAP3 */
>> +       if (cpu_is_omap34xx()&&  !cpu_is_ti816x())
>> +               omap_up.errata |= UART_ERRATA_i202_MDR1_ACCESS;
>
> This errata (i202) is applicable to all devices from OMAP2430 to OMAP4460
> (apparently this one is not getting fixed). So could you make sure this is
> enabled for 2430, 3430, 3630, 4430 and 4460?
>
> [snip]

Thanks for the info, Have posted a updated the patch [1]

>
>> +/*
>> + * Work Around for Errata i202 (3430 - 1.12, 3630 - 1.6)
>
> We should update the comment to be "Work Around for Errata i202 (2430, 3430,
> 3630, 4430 and 4460)". The "1.12" and "1.6" are just the section references
> in the errata docs, but I think that you can drop these as you can just
> search for the errata ID which is i202.
>

yes corrected [1]

--
Thanks,
Govindraj.R

[1]:
http://www.spinics.net/lists/linux-serial/msg04841.html
--
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 v7 11/21] OMAP2+: UART: Move errata handling from serial.c to omap-serial

2011-11-10 Thread Shubhrajyoti
On Friday 11 November 2011 05:14 AM, Jon Hunter wrote:
> Hi Govindraj,
>
> On 10/18/2011 10:26, Govindraj.R wrote:
>> Move the errata handling mechanism from serial.c to omap-serial file
>> and utilise the same func in driver file.
>>
>> Errata i202, i291 are moved to be handled with omap-serial
>> Moving the errata macro from serial.c file to driver header file
>> as from on errata will be handled in driver file itself.
>> Corrected errata id from chapter reference 2.15 to errata id i291.
>>
>> Removed errata and dma_enabled feilds from omap_uart_state struct
Nitpick.
The field spelling could be corrected.
>> as they are no more needed with errata handling done within omap-serial.
>>
>> Acked-by: Alan Cox
>> Signed-off-by: Govindraj.R
>> ---
>>   arch/arm/mach-omap2/serial.c  |   97
>> +++--
>>   arch/arm/plat-omap/include/plat/omap-serial.h |6 ++
>>   drivers/tty/serial/omap-serial.c  |   66 -
>>   3 files changed, 95 insertions(+), 74 deletions(-)
>
> [snip]
>
>> +/* Enable the MDR1 errata for OMAP3 */
>> +if (cpu_is_omap34xx()&&  !cpu_is_ti816x())
>> +omap_up.errata |= UART_ERRATA_i202_MDR1_ACCESS;
>
> This errata (i202) is applicable to all devices from OMAP2430 to
> OMAP4460 (apparently this one is not getting fixed). So could you make
> sure this is enabled for 2430, 3430, 3630, 4430 and 4460?
>
Yes good point.

> [snip]
>
>> +/*
>> + * Work Around for Errata i202 (3430 - 1.12, 3630 - 1.6)
>
> We should update the comment to be "Work Around for Errata i202 (2430,
> 3430, 3630, 4430 and 4460)". The "1.12" and "1.6" are just the section
> references in the errata docs, but I think that you can drop these as
> you can just search for the errata ID which is i202.
>
> Cheers
> Jon
>
>
>
> -- 
> 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

--
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 v7 11/21] OMAP2+: UART: Move errata handling from serial.c to omap-serial

2011-11-10 Thread Jon Hunter

Hi Govindraj,

On 10/18/2011 10:26, Govindraj.R wrote:

Move the errata handling mechanism from serial.c to omap-serial file
and utilise the same func in driver file.

Errata i202, i291 are moved to be handled with omap-serial
Moving the errata macro from serial.c file to driver header file
as from on errata will be handled in driver file itself.
Corrected errata id from chapter reference 2.15 to errata id i291.

Removed errata and dma_enabled feilds from omap_uart_state struct
as they are no more needed with errata handling done within omap-serial.

Acked-by: Alan Cox
Signed-off-by: Govindraj.R
---
  arch/arm/mach-omap2/serial.c  |   97 +++--
  arch/arm/plat-omap/include/plat/omap-serial.h |6 ++
  drivers/tty/serial/omap-serial.c  |   66 -
  3 files changed, 95 insertions(+), 74 deletions(-)


[snip]


+   /* Enable the MDR1 errata for OMAP3 */
+   if (cpu_is_omap34xx()&&  !cpu_is_ti816x())
+   omap_up.errata |= UART_ERRATA_i202_MDR1_ACCESS;


This errata (i202) is applicable to all devices from OMAP2430 to 
OMAP4460 (apparently this one is not getting fixed). So could you make 
sure this is enabled for 2430, 3430, 3630, 4430 and 4460?


[snip]


+/*
+ * Work Around for Errata i202 (3430 - 1.12, 3630 - 1.6)


We should update the comment to be "Work Around for Errata i202 (2430, 
3430, 3630, 4430 and 4460)". The "1.12" and "1.6" are just the section 
references in the errata docs, but I think that you can drop these as 
you can just search for the errata ID which is i202.


Cheers
Jon



--
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


[PATCH v7 11/21] OMAP2+: UART: Move errata handling from serial.c to omap-serial

2011-10-18 Thread Govindraj.R
Move the errata handling mechanism from serial.c to omap-serial file
and utilise the same func in driver file.

Errata i202, i291 are moved to be handled with omap-serial
Moving the errata macro from serial.c file to driver header file
as from on errata will be handled in driver file itself.
Corrected errata id from chapter reference 2.15 to errata id i291.

Removed errata and dma_enabled feilds from omap_uart_state struct
as they are no more needed with errata handling done within omap-serial.

Acked-by: Alan Cox 
Signed-off-by: Govindraj.R 
---
 arch/arm/mach-omap2/serial.c  |   97 +++--
 arch/arm/plat-omap/include/plat/omap-serial.h |6 ++
 drivers/tty/serial/omap-serial.c  |   66 -
 3 files changed, 95 insertions(+), 74 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index f220c84..8c6dc85 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -42,8 +42,6 @@
 #include "control.h"
 #include "mux.h"
 
-#define UART_ERRATA_i202_MDR1_ACCESS   (0x1 << 1)
-
 /*
  * NOTE: By default the serial timeout is disabled as it causes lost characters
  * over the serial ports. This means that the UART clocks will stay on until
@@ -61,15 +59,12 @@ struct omap_uart_state {
void __iomem *wk_st;
void __iomem *wk_en;
u32 wk_mask;
-   u32 dma_enabled;
 
int clocked;
 
struct list_head node;
struct omap_hwmod *oh;
struct platform_device *pdev;
-
-   u32 errata;
 };
 
 static LIST_HEAD(uart_list);
@@ -97,45 +92,6 @@ static struct omap_device_pm_latency omap_uart_latency[] = {
},
 };
 
-#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
-
-/*
- * Work Around for Errata i202 (3430 - 1.12, 3630 - 1.6)
- * The access to uart register after MDR1 Access
- * causes UART to corrupt data.
- *
- * Need a delay =
- * 5 L4 clock cycles + 5 UART functional clock cycle (@48MHz = ~0.2uS)
- * give 10 times as much
- */
-static void omap_uart_mdr1_errataset(struct omap_uart_state *uart, u8 mdr1_val,
-   u8 fcr_val)
-{
-   u8 timeout = 255;
-
-   serial_write_reg(uart, UART_OMAP_MDR1, mdr1_val);
-   udelay(2);
-   serial_write_reg(uart, UART_FCR, fcr_val | UART_FCR_CLEAR_XMIT |
-   UART_FCR_CLEAR_RCVR);
-   /*
-* Wait for FIFO to empty: when empty, RX_FIFO_E bit is 0 and
-* TX_FIFO_E bit is 1.
-*/
-   while (UART_LSR_THRE != (serial_read_reg(uart, UART_LSR) &
-   (UART_LSR_THRE | UART_LSR_DR))) {
-   timeout--;
-   if (!timeout) {
-   /* Should *never* happen. we warn and carry on */
-   dev_crit(&uart->pdev->dev, "Errata i202: timedout %x\n",
-   serial_read_reg(uart, UART_LSR));
-   break;
-   }
-   udelay(1);
-   }
-}
-
-#endif /* CONFIG_PM && CONFIG_ARCH_OMAP3 */
-
 static inline void omap_uart_enable_clocks(struct omap_uart_state *uart)
 {
if (uart->clocked)
@@ -178,27 +134,6 @@ static void omap_uart_disable_wakeup(struct 
omap_uart_state *uart)
}
 }
 
-static void omap_uart_smart_idle_enable(struct omap_uart_state *uart,
-  int enable)
-{
-   u8 idlemode;
-
-   if (enable) {
-   /**
-* Errata 2.15: [UART]:Cannot Acknowledge Idle Requests
-* in Smartidle Mode When Configured for DMA Operations.
-*/
-   if (uart->dma_enabled)
-   idlemode = HWMOD_IDLEMODE_FORCE;
-   else
-   idlemode = HWMOD_IDLEMODE_SMART;
-   } else {
-   idlemode = HWMOD_IDLEMODE_NO;
-   }
-
-   omap_hwmod_set_slave_idlemode(uart->oh, idlemode);
-}
-
 static void omap_uart_block_sleep(struct omap_uart_state *uart)
 {
omap_uart_enable_clocks(uart);
@@ -289,7 +224,28 @@ static void omap_uart_idle_init(struct omap_uart_state 
*uart)
}
 }
 
+/*
+ * Errata i291: [UART]:Cannot Acknowledge Idle Requests
+ * in Smartidle Mode When Configured for DMA Operations.
+ * WA: configure uart in force idle mode.
+ */
+static void omap_uart_set_noidle(struct platform_device *pdev)
+{
+   struct omap_device *od = to_omap_device(pdev);
+
+   omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_NO);
+}
+
+static void omap_uart_set_forceidle(struct platform_device *pdev)
+{
+   struct omap_device *od = to_omap_device(pdev);
+
+   omap_hwmod_set_slave_idlemode(od->hwmods[0], HWMOD_IDLEMODE_FORCE);
+}
+
 #else
+static void omap_uart_set_noidle(struct platform_device *pdev) {}
+static void omap_uart_set_forceidle(struct platform_device *pdev) {}
 static void omap_uart_block_sleep(struct omap_uart_state *uart)
 {
/* Needed to enable UART clocks when built without CONFIG_PM */
@@ -495,13 +451,18 @@ voi