Re: regarding arm: update ARM_ERRATA_430973 Kconfig

2013-03-28 Thread Tim Niemeyer
Hi

Am Dienstag, den 26.03.2013, 12:57 +0100 schrieb Peter Meerwald:
> regarding your patch against arch/arm/Kconfig:
> 
> @@ -1215,7 +1215,7 @@  config ARM_ERRATA_430973
>   depends on CPU_V7
>   help
> This option enables the workaround for the 430973 Cortex-A8
> -   (r1p0..r1p2) erratum. If a code sequence containing an ARM/Thumb
> +   (r1p*) erratum. If a code sequence containing an ARM/Thumb
> interworking branch is replaced with another code sequence at the
> same virtual address, whether due to self-modifying code or virtual
> to physical address re-mapping, Cortex-A8 does not recover from the
> 
> 
> I am seeing strange segfault/illegal instructions fixed by enabling 
> ARM_ERRATA_430973 on a TI OMAP3 DM3730, r3p2 IMHO (see below) 
The only information i have is that it was fixed in r2p1. The statement
is from mru on:
http://www.beagleboard.org/irclogs/index.php?date=2013-02-18#T15:00:07

> ARM_ERRATA_430973 is relevant for which processors? have you checked the 
> errata list? I had no luck obtaining it yet
No, i don't have it either.

-- 
Tim Niemeyer

Corscience GmbH & Co. KG
Henkestr. 91
D-91052 Erlangen
Germany

e-mail: tim.nieme...@corscience.de
Internet: www.corscience.de

--
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] gpio: omap-gpio: add support for pm_runtime autosuspend

2012-10-29 Thread Tim Niemeyer
Hello

Am Freitag, den 26.10.2012, 23:01 +0300 schrieb Felipe Balbi:
> Hi,
> 
> On Fri, Oct 26, 2012 at 03:19:13PM +0200, Tim Niemeyer wrote:
> > Adds support for configuring the omap-gpio driver use autosuspend for
> > runtime power management. This can reduce the latency in using it by
> > not suspending the device immediately on idle. If another access takes
> > place before the autosuspend timeout (2 secs), the call to resume the
> > device can return immediately saving some save/ restore cycles.
> > 
> > This removes also the bank->mod_usage counter, because this is already
> > handled in pm_runtime.
> > 
> > I use a gpio to monitor a spi transfer which occurs every 250µs. The
> > suspend overhead is to high, so almost every second transfer is lost.
> > This patch fixes that.
> > 
> > Signed-off-by: Tim Niemeyer 
> > ---
> >  drivers/gpio/gpio-omap.c |   81 
> > -
> >  1 files changed, 43 insertions(+), 38 deletions(-)
> > 
> > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> > index 94cbc84..708d5a9 100644
> > --- a/drivers/gpio/gpio-omap.c
> > +++ b/drivers/gpio/gpio-omap.c
> > @@ -31,6 +31,7 @@
> >  #include 
> >  
> >  #define OFF_MODE   1
> > +#define GPIO_AUTOSUSPEND_TIMEOUT2000
> 
> something just hit me... If you keep timeout at 2000 ms and you hook
> this up to an IRQ line, it's very unlikely GPIO will ever sleep.
> 
> Why did you choose 2000 ms ? Arbitrary value ?
Got it from the spi driver (27b5284cfbe187732ebb184b03ea693f44837f9d).
I have no problem with reducing this. As i don't know how much
power-overhead the suspend needs, what do you think is a good value in
terms of power-saving?

-- 
Tim Niemeyer

Corscience GmbH & Co. KG
Henkestr. 91
D-91052 Erlangen
Germany

e-mail: tim.nieme...@corscience.de
Internet: www.corscience.de

--
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] gpio: omap-gpio: add support for pm_runtime autosuspend

2012-10-29 Thread Tim Niemeyer
Am Montag, den 29.10.2012, 12:17 +0530 schrieb Santosh Shilimkar:
> + Jon,
> 
> On Friday 26 October 2012 06:49 PM, Tim Niemeyer wrote:
> > Adds support for configuring the omap-gpio driver use autosuspend for
> > runtime power management. This can reduce the latency in using it by
> > not suspending the device immediately on idle. If another access takes
> > place before the autosuspend timeout (2 secs), the call to resume the
> > device can return immediately saving some save/ restore cycles.
> >
> > This removes also the bank->mod_usage counter, because this is already
> > handled in pm_runtime.
> >
> > I use a gpio to monitor a spi transfer which occurs every 250µs. The
> > suspend overhead is to high, so almost every second transfer is lost.
> > This patch fixes that.
> >
> > Signed-off-by: Tim Niemeyer 
> > ---
> >   drivers/gpio/gpio-omap.c |   81 
> > -
> >   1 files changed, 43 insertions(+), 38 deletions(-)
> >
>  From patch it appears your main motive is to delay the idle kicking in
> with a timeout to avoid GPIO on cpuidle path. Some comments
cpuidle? I set 'CPU_IDLE=n' in my .config..

> > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> > index 94cbc84..708d5a9 100644
> > --- a/drivers/gpio/gpio-omap.c
> > +++ b/drivers/gpio/gpio-omap.c
> > @@ -31,6 +31,7 @@
> >   #include 
> >
> >   #define OFF_MODE  1
> > +#define GPIO_AUTOSUSPEND_TIMEOUT2000
> >
> >   static LIST_HEAD(omap_gpio_list);
> >
> > @@ -64,7 +65,6 @@ struct gpio_bank {
> > spinlock_t lock;
> > struct gpio_chip chip;
> > struct clk *dbck;
> > -   u32 mod_usage;
> How have you tested 'mod_suage' change ?
Nothing special, just applied the patch to a 3.4.14 kernel and used one
gpio to show the status of my spi communication.

> > u32 dbck_enable_mask;
> > bool dbck_enabled;
> > struct device *dev;
> > @@ -557,10 +557,9 @@ static int omap_gpio_request(struct gpio_chip *chip, 
> > unsigned offset)
> >
> > /*
> >  * If this is the first gpio_request for the bank,
> > -* enable the bank module.
> > +* resume the bank module.
> Since you removing bank notion, "If this is the first gpio_request
> for the bank," becomes irrelevant from code perspective.
Hu, i thought pm_runtime_get_sync(bank->dev) handles the use counting
per bank?

> > @@ -608,28 +594,15 @@ static void omap_gpio_free(struct gpio_chip *chip, 
> > unsigned offset)
> > __raw_readl(bank->base + bank->regs->wkup_en);
> > }
> >
> > -   bank->mod_usage &= ~(1 << offset);
> > -
> > -   if (bank->regs->ctrl && !bank->mod_usage) {
> > -   void __iomem *reg = bank->base + bank->regs->ctrl;
> > -   u32 ctrl;
> > -
> > -   ctrl = __raw_readl(reg);
> > -   /* Module is disabled, clocks are gated */
> > -   ctrl |= GPIO_MOD_CTRL_BIT;
> > -   __raw_writel(ctrl, reg);
> > -   bank->context.ctrl = ctrl;
> > -   }
> > -
> > _reset_gpio(bank, bank->chip.base + offset);
> > spin_unlock_irqrestore(&bank->lock, flags);
> >
> > /*
> >  * If this is the last gpio to be freed in the bank,
> > -* disable the bank module.
> > +* put the bank module into suspend.
> >  */
> > -   if (!bank->mod_usage)
> > -   pm_runtime_put(bank->dev);
> > +   pm_runtime_mark_last_busy(bank->dev);
> > +   pm_runtime_put_autosuspend(bank->dev);
> Waiting for 2 seconds timeout even on GPIO free
> seems to be wrong.
Yes, you are right, if something frees the gpio it should suspend
immediately. 

> >   }
> >
> >   /*
> > @@ -715,7 +688,8 @@ static void gpio_irq_handler(unsigned int irq, struct 
> > irq_desc *desc)
> >   exit:
> > if (!unmasked)
> > chained_irq_exit(chip, desc);
> > -   pm_runtime_put(bank->dev);
> > +   pm_runtime_mark_last_busy(bank->dev);
> > +   pm_runtime_put_autosuspend(bank->dev);
> This is what is the main change from this patch which helps your
> case.
> >   }
> >
> >   static void gpio_irq_shutdown(struct irq_data *d)
> > @@ -1132,6 +1106,8 @@ static int __devinit omap_gpio_probe(struct 
> > platform_device *pdev)
> >
> > platform_set_drvdata(pdev, bank);
> >
> > +   pm_runtime_use_autosuspend(bank->dev);
> > + 

[PATCH] gpio: omap-gpio: add support for pm_runtime autosuspend

2012-10-26 Thread Tim Niemeyer
Adds support for configuring the omap-gpio driver use autosuspend for
runtime power management. This can reduce the latency in using it by
not suspending the device immediately on idle. If another access takes
place before the autosuspend timeout (2 secs), the call to resume the
device can return immediately saving some save/ restore cycles.

This removes also the bank->mod_usage counter, because this is already
handled in pm_runtime.

I use a gpio to monitor a spi transfer which occurs every 250µs. The
suspend overhead is to high, so almost every second transfer is lost.
This patch fixes that.

Signed-off-by: Tim Niemeyer 
---
 drivers/gpio/gpio-omap.c |   81 -
 1 files changed, 43 insertions(+), 38 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 94cbc84..708d5a9 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -31,6 +31,7 @@
 #include 
 
 #define OFF_MODE   1
+#define GPIO_AUTOSUSPEND_TIMEOUT2000
 
 static LIST_HEAD(omap_gpio_list);
 
@@ -64,7 +65,6 @@ struct gpio_bank {
spinlock_t lock;
struct gpio_chip chip;
struct clk *dbck;
-   u32 mod_usage;
u32 dbck_enable_mask;
bool dbck_enabled;
struct device *dev;
@@ -557,10 +557,9 @@ static int omap_gpio_request(struct gpio_chip *chip, 
unsigned offset)
 
/*
 * If this is the first gpio_request for the bank,
-* enable the bank module.
+* resume the bank module.
 */
-   if (!bank->mod_usage)
-   pm_runtime_get_sync(bank->dev);
+   pm_runtime_get_sync(bank->dev);
 
spin_lock_irqsave(&bank->lock, flags);
/* Set trigger to none. You need to enable the desired trigger with
@@ -575,19 +574,6 @@ static int omap_gpio_request(struct gpio_chip *chip, 
unsigned offset)
__raw_writel(__raw_readl(reg) | (1 << offset), reg);
}
 
-   if (bank->regs->ctrl && !bank->mod_usage) {
-   void __iomem *reg = bank->base + bank->regs->ctrl;
-   u32 ctrl;
-
-   ctrl = __raw_readl(reg);
-   /* Module is enabled, clocks are not gated */
-   ctrl &= ~GPIO_MOD_CTRL_BIT;
-   __raw_writel(ctrl, reg);
-   bank->context.ctrl = ctrl;
-   }
-
-   bank->mod_usage |= 1 << offset;
-
spin_unlock_irqrestore(&bank->lock, flags);
 
return 0;
@@ -608,28 +594,15 @@ static void omap_gpio_free(struct gpio_chip *chip, 
unsigned offset)
__raw_readl(bank->base + bank->regs->wkup_en);
}
 
-   bank->mod_usage &= ~(1 << offset);
-
-   if (bank->regs->ctrl && !bank->mod_usage) {
-   void __iomem *reg = bank->base + bank->regs->ctrl;
-   u32 ctrl;
-
-   ctrl = __raw_readl(reg);
-   /* Module is disabled, clocks are gated */
-   ctrl |= GPIO_MOD_CTRL_BIT;
-   __raw_writel(ctrl, reg);
-   bank->context.ctrl = ctrl;
-   }
-
_reset_gpio(bank, bank->chip.base + offset);
spin_unlock_irqrestore(&bank->lock, flags);
 
/*
 * If this is the last gpio to be freed in the bank,
-* disable the bank module.
+* put the bank module into suspend.
 */
-   if (!bank->mod_usage)
-   pm_runtime_put(bank->dev);
+   pm_runtime_mark_last_busy(bank->dev);
+   pm_runtime_put_autosuspend(bank->dev);
 }
 
 /*
@@ -715,7 +688,8 @@ static void gpio_irq_handler(unsigned int irq, struct 
irq_desc *desc)
 exit:
if (!unmasked)
chained_irq_exit(chip, desc);
-   pm_runtime_put(bank->dev);
+   pm_runtime_mark_last_busy(bank->dev);
+   pm_runtime_put_autosuspend(bank->dev);
 }
 
 static void gpio_irq_shutdown(struct irq_data *d)
@@ -1132,6 +1106,8 @@ static int __devinit omap_gpio_probe(struct 
platform_device *pdev)
 
platform_set_drvdata(pdev, bank);
 
+   pm_runtime_use_autosuspend(bank->dev);
+   pm_runtime_set_autosuspend_delay(bank->dev, GPIO_AUTOSUSPEND_TIMEOUT);
pm_runtime_enable(bank->dev);
pm_runtime_irq_safe(bank->dev);
pm_runtime_get_sync(bank->dev);
@@ -1146,7 +1122,8 @@ static int __devinit omap_gpio_probe(struct 
platform_device *pdev)
if (bank->loses_context)
bank->get_context_loss_count = pdata->get_context_loss_count;
 
-   pm_runtime_put(bank->dev);
+   pm_runtime_mark_last_busy(bank->dev);
+   pm_runtime_put_autosuspend(bank->dev);
 
list_add_tail(&bank->node, &omap_gpio_list);
 
@@ -1168,6 +1145,17 @@ static int omap_gpio_runtime_suspend(struct device *dev)
 
spin_lock_irqsave(&bank->lock, flags);
 
+   if (bank

Re: [PATCH] gpio: omap-gpio: add support for pm_runtime autosuspend

2012-10-26 Thread Tim Niemeyer
Am Freitag, den 26.10.2012, 11:03 +0300 schrieb Felipe Balbi:
> Hi,
> 
> On Fri, Oct 26, 2012 at 09:55:30AM +0200, Tim Niemeyer wrote:
> > Adds support for configuring the omap-gpio driver use autosuspend for
> > runtime power management. This can reduce the latency in using it by
> > not suspending the device immediately on idle. If another access takes
> > place before the autosuspend timeout (2 secs), the call to resume the
> > device can return immediately saving some save/ restore cycles.
> > 
> > I use a gpio to monitor a spi transfer which occurs every 250µs. The
> > suspend overhead is to high, so almost every second transfer is lost.
> > This patch fixes that.
> > 
> > Signed-off-by: Tim Niemeyer 
> > ---
> >  drivers/gpio/gpio-omap.c |   23 ++-
> >  1 files changed, 18 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> > index 94cbc84..92f48cb 100644
> > --- a/drivers/gpio/gpio-omap.c
> > +++ b/drivers/gpio/gpio-omap.c
> > @@ -31,6 +31,7 @@
> >  #include 
> >  
> >  #define OFF_MODE   1
> > +#define GPIO_AUTOSUSPEND_TIMEOUT2000
> >  
> >  static LIST_HEAD(omap_gpio_list);
> >  
> > @@ -628,8 +629,10 @@ static void omap_gpio_free(struct gpio_chip *chip, 
> > unsigned offset)
> >  * If this is the last gpio to be freed in the bank,
> >  * disable the bank module.
> >  */
> > -   if (!bank->mod_usage)
> > -   pm_runtime_put(bank->dev);
> > +   if (!bank->mod_usage) {
> 
> while at that I would drop this bank->mod_usage nonsense and let
> power core handle reference counting.
I looked at it, but i'm unsure about the GPIO_MOD_CTRL_BIT. The
bank->mod_usage counter prevents omap_gpio_free() to disable the hole
bank while another gpio is still in use.

> > +   pm_runtime_mark_last_busy(bank->dev);
> > +   pm_runtime_put_autosuspend(bank->dev);
> > +   }
> >  }
> >  
> >  /*
> > @@ -715,7 +718,8 @@ static void gpio_irq_handler(unsigned int irq, struct 
> > irq_desc *desc)
> >  exit:
> > if (!unmasked)
> > chained_irq_exit(chip, desc);
> > -   pm_runtime_put(bank->dev);
> > +   pm_runtime_mark_last_busy(bank->dev);
> > +   pm_runtime_put_autosuspend(bank->dev);
> >  }
> >  
> >  static void gpio_irq_shutdown(struct irq_data *d)
> > @@ -1132,6 +1136,8 @@ static int __devinit omap_gpio_probe(struct 
> > platform_device *pdev)
> >  
> > platform_set_drvdata(pdev, bank);
> >  
> > +   pm_runtime_use_autosuspend(bank->dev);
> > +   pm_runtime_set_autosuspend_delay(bank->dev, GPIO_AUTOSUSPEND_TIMEOUT);
> > pm_runtime_enable(bank->dev);
> > pm_runtime_irq_safe(bank->dev);
> > pm_runtime_get_sync(bank->dev);
> > @@ -1146,7 +1152,8 @@ static int __devinit omap_gpio_probe(struct 
> > platform_device *pdev)
> > if (bank->loses_context)
> > bank->get_context_loss_count = pdata->get_context_loss_count;
> >  
> > -   pm_runtime_put(bank->dev);
> > +   pm_runtime_mark_last_busy(bank->dev);
> > +   pm_runtime_put_autosuspend(bank->dev);
> >  
> > list_add_tail(&bank->node, &omap_gpio_list);
> >  
> > @@ -1333,7 +1340,13 @@ void omap2_gpio_prepare_for_idle(int pwr_mode)
> >  
> > bank->power_mode = pwr_mode;
> >  
> > -   pm_runtime_put_sync_suspend(bank->dev);
> > +   /* direct pm_runtime on pwroff */
> > +       if (pwr_mode)
> 
> you also need braces here.
Yes. I resend this later.

> > +   pm_runtime_put_sync_suspend(bank->dev);
> > +   else {
> > +   pm_runtime_mark_last_busy(bank->dev);
> > +   pm_runtime_put_sync_autosuspend(bank->dev);
> > +   }
> > }
> >  }
> >  
> > -- 
> > 1.7.2.5
> > 
> > --
> > 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
> 

-- 
Tim Niemeyer

Corscience GmbH & Co. KG
Henkestr. 91
D-91052 Erlangen
Germany

e-mail: tim.nieme...@corscience.de
Internet: www.corscience.de

--
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] gpio: omap-gpio: add support for pm_runtime autosuspend

2012-10-26 Thread Tim Niemeyer
Adds support for configuring the omap-gpio driver use autosuspend for
runtime power management. This can reduce the latency in using it by
not suspending the device immediately on idle. If another access takes
place before the autosuspend timeout (2 secs), the call to resume the
device can return immediately saving some save/ restore cycles.

I use a gpio to monitor a spi transfer which occurs every 250µs. The
suspend overhead is to high, so almost every second transfer is lost.
This patch fixes that.

Signed-off-by: Tim Niemeyer 
---
 drivers/gpio/gpio-omap.c |   23 ++-
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 94cbc84..92f48cb 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -31,6 +31,7 @@
 #include 
 
 #define OFF_MODE   1
+#define GPIO_AUTOSUSPEND_TIMEOUT2000
 
 static LIST_HEAD(omap_gpio_list);
 
@@ -628,8 +629,10 @@ static void omap_gpio_free(struct gpio_chip *chip, 
unsigned offset)
 * If this is the last gpio to be freed in the bank,
 * disable the bank module.
 */
-   if (!bank->mod_usage)
-   pm_runtime_put(bank->dev);
+   if (!bank->mod_usage) {
+   pm_runtime_mark_last_busy(bank->dev);
+   pm_runtime_put_autosuspend(bank->dev);
+   }
 }
 
 /*
@@ -715,7 +718,8 @@ static void gpio_irq_handler(unsigned int irq, struct 
irq_desc *desc)
 exit:
if (!unmasked)
chained_irq_exit(chip, desc);
-   pm_runtime_put(bank->dev);
+   pm_runtime_mark_last_busy(bank->dev);
+   pm_runtime_put_autosuspend(bank->dev);
 }
 
 static void gpio_irq_shutdown(struct irq_data *d)
@@ -1132,6 +1136,8 @@ static int __devinit omap_gpio_probe(struct 
platform_device *pdev)
 
platform_set_drvdata(pdev, bank);
 
+   pm_runtime_use_autosuspend(bank->dev);
+   pm_runtime_set_autosuspend_delay(bank->dev, GPIO_AUTOSUSPEND_TIMEOUT);
pm_runtime_enable(bank->dev);
pm_runtime_irq_safe(bank->dev);
pm_runtime_get_sync(bank->dev);
@@ -1146,7 +1152,8 @@ static int __devinit omap_gpio_probe(struct 
platform_device *pdev)
if (bank->loses_context)
bank->get_context_loss_count = pdata->get_context_loss_count;
 
-   pm_runtime_put(bank->dev);
+   pm_runtime_mark_last_busy(bank->dev);
+   pm_runtime_put_autosuspend(bank->dev);
 
list_add_tail(&bank->node, &omap_gpio_list);
 
@@ -1333,7 +1340,13 @@ void omap2_gpio_prepare_for_idle(int pwr_mode)
 
bank->power_mode = pwr_mode;
 
-   pm_runtime_put_sync_suspend(bank->dev);
+   /* direct pm_runtime on pwroff */
+   if (pwr_mode)
+   pm_runtime_put_sync_suspend(bank->dev);
+   else {
+   pm_runtime_mark_last_busy(bank->dev);
+   pm_runtime_put_sync_autosuspend(bank->dev);
+   }
}
 }
 
-- 
1.7.2.5

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