Re: [PATCH v6 05/16] OMAP2+: UART: Cleanup part of clock gating mechanism for uart

2011-10-11 Thread Govindraj
On Tue, Oct 11, 2011 at 4:00 AM, Kevin Hilman khil...@ti.com wrote:
 Govindraj.R govindraj.r...@ti.com writes:

 Currently we use a shared irq handler to identify uart activity and then
 trigger a timer.

 OK.

 Based the timeout value set from sysfs the timer used to expire.

 Please re-phrase as I'm not sure what is being said here.

 If no uart-activity was detected timer-expiry func sets can_sleep
 flag. Based on this we will disable the uart clocks in idle path.

 Since the clock gating mechanism is outside the uart driver, we currently
 use this mechanism. In preparation to runtime implementation for omap-serial
 driver we can cleanup this mechanism and use runtime API's to gate uart 
 clocks.

 Also remove timer related info from local uart_state struct and remove
 the code used to set timeout value from sysfs. Remove un-used function
 omap_uart_check_wakeup.

 Signed-off-by: Govindraj.R govindraj.r...@ti.com

 The patch itself fine, and is a well-neede cleanup, but changelog
 (especially the first part) does not read well.


Okay, Will Correct.

--
Thanks.
Govindraj.R
--
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 v6 05/16] OMAP2+: UART: Cleanup part of clock gating mechanism for uart

2011-10-10 Thread Kevin Hilman
Govindraj.R govindraj.r...@ti.com writes:

 Currently we use a shared irq handler to identify uart activity and then
 trigger a timer. 

OK.

 Based the timeout value set from sysfs the timer used to expire.

Please re-phrase as I'm not sure what is being said here.

 If no uart-activity was detected timer-expiry func sets can_sleep
 flag. Based on this we will disable the uart clocks in idle path.

 Since the clock gating mechanism is outside the uart driver, we currently
 use this mechanism. In preparation to runtime implementation for omap-serial
 driver we can cleanup this mechanism and use runtime API's to gate uart 
 clocks.

 Also remove timer related info from local uart_state struct and remove
 the code used to set timeout value from sysfs. Remove un-used function
 omap_uart_check_wakeup.

 Signed-off-by: Govindraj.R govindraj.r...@ti.com

The patch itself fine, and is a well-neede cleanup, but changelog
(especially the first part) does not read well.

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


[PATCH v6 05/16] OMAP2+: UART: Cleanup part of clock gating mechanism for uart

2011-09-30 Thread Govindraj.R
Currently we use a shared irq handler to identify uart activity and then
trigger a timer. Based the timeout value set from sysfs the timer used to
expire. If no uart-activity was detected timer-expiry func sets can_sleep
flag. Based on this we will disable the uart clocks in idle path.

Since the clock gating mechanism is outside the uart driver, we currently
use this mechanism. In preparation to runtime implementation for omap-serial
driver we can cleanup this mechanism and use runtime API's to gate uart clocks.

Also remove timer related info from local uart_state struct and remove
the code used to set timeout value from sysfs. Remove un-used function
omap_uart_check_wakeup.

Signed-off-by: Govindraj.R govindraj.r...@ti.com
---
 arch/arm/mach-omap2/serial.c  |  116 +
 arch/arm/plat-omap/include/plat/omap-serial.h |1 -
 arch/arm/plat-omap/include/plat/serial.h  |1 -
 3 files changed, 1 insertions(+), 117 deletions(-)

diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 4ab90bf..c98b9b4 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -58,8 +58,6 @@
 struct omap_uart_state {
int num;
int can_sleep;
-   struct timer_list timer;
-   u32 timeout;
 
void __iomem *wk_st;
void __iomem *wk_en;
@@ -67,13 +65,9 @@ struct omap_uart_state {
u32 padconf;
u32 dma_enabled;
 
-   struct clk *ick;
-   struct clk *fck;
int clocked;
 
-   int irq;
int regshift;
-   int irqflags;
void __iomem *membase;
resource_size_t mapbase;
 
@@ -340,32 +334,6 @@ static void omap_uart_block_sleep(struct omap_uart_state 
*uart)
 
omap_uart_smart_idle_enable(uart, 0);
uart-can_sleep = 0;
-   if (uart-timeout)
-   mod_timer(uart-timer, jiffies + uart-timeout);
-   else
-   del_timer(uart-timer);
-}
-
-static void omap_uart_allow_sleep(struct omap_uart_state *uart)
-{
-   if (device_may_wakeup(uart-pdev-dev))
-   omap_uart_enable_wakeup(uart);
-   else
-   omap_uart_disable_wakeup(uart);
-
-   if (!uart-clocked)
-   return;
-
-   omap_uart_smart_idle_enable(uart, 1);
-   uart-can_sleep = 1;
-   del_timer(uart-timer);
-}
-
-static void omap_uart_idle_timer(unsigned long data)
-{
-   struct omap_uart_state *uart = (struct omap_uart_state *)data;
-
-   omap_uart_allow_sleep(uart);
 }
 
 int omap_uart_can_sleep(void)
@@ -389,35 +357,11 @@ int omap_uart_can_sleep(void)
return can_sleep;
 }
 
-/**
- * omap_uart_interrupt()
- *
- * This handler is used only to detect that *any* UART interrupt has
- * occurred.  It does _nothing_ to handle the interrupt.  Rather,
- * any UART interrupt will trigger the inactivity timer so the
- * UART will not idle or sleep for its timeout period.
- *
- **/
-/* static int first_interrupt; */
-static irqreturn_t omap_uart_interrupt(int irq, void *dev_id)
-{
-   struct omap_uart_state *uart = dev_id;
-
-   omap_uart_block_sleep(uart);
-
-   return IRQ_NONE;
-}
-
 static void omap_uart_idle_init(struct omap_uart_state *uart)
 {
int ret;
 
uart-can_sleep = 0;
-   uart-timeout = DEFAULT_TIMEOUT;
-   setup_timer(uart-timer, omap_uart_idle_timer,
-   (unsigned long) uart);
-   if (uart-timeout)
-   mod_timer(uart-timer, jiffies + uart-timeout);
omap_uart_smart_idle_enable(uart, 0);
 
if (cpu_is_omap34xx()  !cpu_is_ti816x()) {
@@ -479,51 +423,8 @@ static void omap_uart_idle_init(struct omap_uart_state 
*uart)
uart-wk_mask = 0;
uart-padconf = 0;
}
-
-   uart-irqflags |= IRQF_SHARED;
-   ret = request_threaded_irq(uart-irq, NULL, omap_uart_interrupt,
-  IRQF_SHARED, serial idle, (void *)uart);
-   WARN_ON(ret);
-}
-
-static ssize_t sleep_timeout_show(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
-   struct platform_device *pdev = to_platform_device(dev);
-   struct omap_device *odev = to_omap_device(pdev);
-   struct omap_uart_state *uart = odev-hwmods[0]-dev_attr;
-
-   return sprintf(buf, %u\n, uart-timeout / HZ);
 }
 
-static ssize_t sleep_timeout_store(struct device *dev,
-  struct device_attribute *attr,
-  const char *buf, size_t n)
-{
-   struct platform_device *pdev = to_platform_device(dev);
-   struct omap_device *odev = to_omap_device(pdev);
-   struct omap_uart_state *uart = odev-hwmods[0]-dev_attr;
-   unsigned int value;
-
-   if (sscanf(buf, %u, value) != 1) {
-   dev_err(dev, sleep_timeout_store: Invalid value\n);
-   return -EINVAL;
-   }
-
-   uart-timeout = value * HZ;
-   if (uart-timeout)
-