public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] at91 pm: Compilation fix for at91sam926x
@ 2007-08-09 12:10 Andy Herzig
  2007-08-09 14:39 ` Andy Herzig
  2007-08-09 14:53 ` Hans-Jürgen Koch
  0 siblings, 2 replies; 12+ messages in thread
From: Andy Herzig @ 2007-08-09 12:10 UTC (permalink / raw)
  To: andrew; +Cc: linux-kernel, trivial

Hello all,

This patch is intended to fix compilation errors when I tried to add in
power management to my Atmel AT91SAM9260 board. First, there is no
separate memory controller in the 9260 as there is in the 9200, so calls
to do anything with it in pm.c fail.

Secondly, at91_suspend_entering_slow_clock() is not declared extern by
drivers that use it. This used to cause only a warning, but in
2.6.23-rc1 and beyond, it is an error.

Signed-off-by: Andrew J. Herzig <andrew.herzig@ngc.com>
---
arch/arm/mach-at91/pm.c       |    5 ++++-
drivers/serial/atmel_serial.c |    2 ++
drivers/usb/gadget/at91_udc.c |    2 ++
drivers/usb/host/ohci-at91.c  |    1 +
4 files changed, 9 insertions(+), 1 deletion(-)

diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
linux-2.6.23-rc2-vanilla/arch/arm/mach-at91/pm.c
linux-2.6.23-rc2/arch/arm/mach-at91/pm.c
--- linux-2.6.23-rc2-vanilla/arch/arm/mach-at91/pm.c    2007-08-08
13:28:37.000000000 -0400
+++ linux-2.6.23-rc2/arch/arm/mach-at91/pm.c    2007-08-08
13:36:43.000000000 -0400
@@ -176,7 +176,9 @@ static int at91_pm_enter(suspend_state_t
                         */
                        asm("b 1f; .align 5; 1:");
                        asm("mcr p15, 0, r0, c7, c10, 4");      /* drain
write buffer */
+#if defined(CONFIG_ARCH_AT91RM9200)
                        at91_sys_write(AT91_SDRAMC_SRR, 1);     /*
self-refresh mode */
+#endif
                        /* fall though to next state */
 
                case PM_SUSPEND_ON:
@@ -218,8 +220,9 @@ static int __init at91_pm_init(void)
 #endif
 
        /* Disable SDRAM low-power mode.  Cannot be used with
self-refresh. */
+#if defined(CONFIG_ARCH_AT91RM9200)
        at91_sys_write(AT91_SDRAMC_LPR, 0);
-
+#endif
        pm_set_ops(&at91_pm_ops);
 
        return 0;
diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
linux-2.6.23-rc2-vanilla/drivers/serial/atmel_serial.c
linux-2.6.23-rc2/drivers/serial/atmel_serial.c
--- linux-2.6.23-rc2-vanilla/drivers/serial/atmel_serial.c
2007-08-08 13:28:33.000000000 -0400
+++ linux-2.6.23-rc2/drivers/serial/atmel_serial.c      2007-08-08
13:32:52.000000000 -0400
@@ -916,6 +916,8 @@ static struct uart_driver atmel_uart = {
 };
 
 #ifdef CONFIG_PM
+extern int at91_suspend_entering_slow_clock(void);
+
 static int atmel_serial_suspend(struct platform_device *pdev,
pm_message_t state)
 {
        struct uart_port *port = platform_get_drvdata(pdev);
diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
linux-2.6.23-rc2-vanilla/drivers/usb/gadget/at91_udc.c
linux-2.6.23-rc2/drivers/usb/gadget/at91_udc.c
--- linux-2.6.23-rc2-vanilla/drivers/usb/gadget/at91_udc.c
2007-08-08 13:28:27.000000000 -0400
+++ linux-2.6.23-rc2/drivers/usb/gadget/at91_udc.c      2007-08-08
13:33:21.000000000 -0400
@@ -1770,6 +1770,8 @@ static int __exit at91udc_remove(struct 
 }
 
 #ifdef CONFIG_PM
+extern int at91_suspend_entering_slow_clock(void);
+
 static int at91udc_suspend(struct platform_device *pdev, pm_message_t
mesg)
 {
        struct at91_udc *udc = platform_get_drvdata(pdev);
diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
linux-2.6.23-rc2-vanilla/drivers/usb/host/ohci-at91.c
linux-2.6.23-rc2/drivers/usb/host/ohci-at91.c
--- linux-2.6.23-rc2-vanilla/drivers/usb/host/ohci-at91.c
2007-08-08 13:28:27.000000000 -0400
+++ linux-2.6.23-rc2/drivers/usb/host/ohci-at91.c       2007-08-08
13:32:45.000000000 -0400
@@ -282,6 +282,7 @@ static int ohci_hcd_at91_drv_remove(stru
 }
 
 #ifdef CONFIG_PM
+extern int at91_suspend_entering_slow_clock(void);
 
 static int
 ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t
mesg)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-09 12:10 [PATCH] at91 pm: Compilation fix for at91sam926x Andy Herzig
@ 2007-08-09 14:39 ` Andy Herzig
  2007-08-09 14:53 ` Hans-Jürgen Koch
  1 sibling, 0 replies; 12+ messages in thread
From: Andy Herzig @ 2007-08-09 14:39 UTC (permalink / raw)
  To: andrew; +Cc: linux-kernel, trivial

On Thu, 2007-08-09 at 08:10 -0400, Andy Herzig wrote:
> Hello all,
> 
> This patch is intended to fix compilation errors when I tried to add in
> power management to my Atmel AT91SAM9260 board. First, there is no
> separate memory controller in the 9260 as there is in the 9200, so calls
> to do anything with it in pm.c fail.
> 
> Secondly, at91_suspend_entering_slow_clock() is not declared extern by
> drivers that use it. This used to cause only a warning, but in
> 2.6.23-rc1 and beyond, it is an error.
Sorry, the previous patch was fouled up.

Signed-off-by: Andrew J. Herzig <andrew.herzig@ngc.com>
---
 arch/arm/mach-at91/pm.c       |    5 ++++-
 drivers/serial/atmel_serial.c |    2 ++
 drivers/usb/gadget/at91_udc.c |    2 ++
 drivers/usb/host/ohci-at91.c  |    1 +
 4 files changed, 9 insertions(+), 1 deletion(-)
diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
linux-2.6.23-rc2-vanilla/arch/arm/mach-at91/pm.c
linux-2.6.23-rc2/arch/arm/mach-at91/pm.c
--- linux-2.6.23-rc2-vanilla/arch/arm/mach-at91/pm.c	2007-08-08
13:28:37.000000000 -0400
+++ linux-2.6.23-rc2/arch/arm/mach-at91/pm.c	2007-08-08
13:36:43.000000000 -0400
@@ -176,7 +176,9 @@ static int at91_pm_enter(suspend_state_t
 			 */
 			asm("b 1f; .align 5; 1:");
 			asm("mcr p15, 0, r0, c7, c10, 4");	/* drain write buffer */
+#if defined(CONFIG_ARCH_AT91RM9200)
 			at91_sys_write(AT91_SDRAMC_SRR, 1);	/* self-refresh mode */
+#endif
 			/* fall though to next state */
 
 		case PM_SUSPEND_ON:
@@ -218,8 +220,9 @@ static int __init at91_pm_init(void)
 #endif
 
 	/* Disable SDRAM low-power mode.  Cannot be used with self-refresh. */
+#if defined(CONFIG_ARCH_AT91RM9200)
 	at91_sys_write(AT91_SDRAMC_LPR, 0);
-
+#endif
 	pm_set_ops(&at91_pm_ops);
 
 	return 0;
diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
linux-2.6.23-rc2-vanilla/drivers/serial/atmel_serial.c
linux-2.6.23-rc2/drivers/serial/atmel_serial.c
--- linux-2.6.23-rc2-vanilla/drivers/serial/atmel_serial.c	2007-08-08
13:28:33.000000000 -0400
+++ linux-2.6.23-rc2/drivers/serial/atmel_serial.c	2007-08-08
13:32:52.000000000 -0400
@@ -916,6 +916,8 @@ static struct uart_driver atmel_uart = {
 };
 
 #ifdef CONFIG_PM
+extern int at91_suspend_entering_slow_clock(void);
+
 static int atmel_serial_suspend(struct platform_device *pdev,
pm_message_t state)
 {
 	struct uart_port *port = platform_get_drvdata(pdev);
diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
linux-2.6.23-rc2-vanilla/drivers/usb/gadget/at91_udc.c
linux-2.6.23-rc2/drivers/usb/gadget/at91_udc.c
--- linux-2.6.23-rc2-vanilla/drivers/usb/gadget/at91_udc.c	2007-08-08
13:28:27.000000000 -0400
+++ linux-2.6.23-rc2/drivers/usb/gadget/at91_udc.c	2007-08-08
13:33:21.000000000 -0400
@@ -1770,6 +1770,8 @@ static int __exit at91udc_remove(struct 
 }
 
 #ifdef CONFIG_PM
+extern int at91_suspend_entering_slow_clock(void);
+
 static int at91udc_suspend(struct platform_device *pdev, pm_message_t
mesg)
 {
 	struct at91_udc *udc = platform_get_drvdata(pdev);
diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
linux-2.6.23-rc2-vanilla/drivers/usb/host/ohci-at91.c
linux-2.6.23-rc2/drivers/usb/host/ohci-at91.c
--- linux-2.6.23-rc2-vanilla/drivers/usb/host/ohci-at91.c	2007-08-08
13:28:27.000000000 -0400
+++ linux-2.6.23-rc2/drivers/usb/host/ohci-at91.c	2007-08-08
13:32:45.000000000 -0400
@@ -282,6 +282,7 @@ static int ohci_hcd_at91_drv_remove(stru
 }
 
 #ifdef CONFIG_PM
+extern int at91_suspend_entering_slow_clock(void);
 
 static int
 ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t
mesg)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-09 12:10 [PATCH] at91 pm: Compilation fix for at91sam926x Andy Herzig
  2007-08-09 14:39 ` Andy Herzig
@ 2007-08-09 14:53 ` Hans-Jürgen Koch
  2007-08-09 16:01   ` Marc Pignat
  1 sibling, 1 reply; 12+ messages in thread
From: Hans-Jürgen Koch @ 2007-08-09 14:53 UTC (permalink / raw)
  To: Andy Herzig; +Cc: andrew, linux-kernel, trivial, linux-arm-kernel

(added linux-arm-kernel to CC)

Am Donnerstag 09 August 2007 14:10 schrieb Andy Herzig:
> Hello all,
> 
> This patch is intended to fix compilation errors when I tried to add in
> power management to my Atmel AT91SAM9260 board. First, there is no
> separate memory controller in the 9260 as there is in the 9200, so calls
> to do anything with it in pm.c fail.

Correct. I made the same discovery with my AT91SAM9263 board.

> 
> Secondly, at91_suspend_entering_slow_clock() is not declared extern by
> drivers that use it. This used to cause only a warning, but in
> 2.6.23-rc1 and beyond, it is an error.

Patch looks good to me. Kernel compiles for my 9263. Didn't test
suspend/resume yet, though.

> 
> Signed-off-by: Andrew J. Herzig <andrew.herzig@ngc.com>

Acked-by: Hans J. Koch <hjk@linutronix.de>


> ---
> arch/arm/mach-at91/pm.c       |    5 ++++-
> drivers/serial/atmel_serial.c |    2 ++
> drivers/usb/gadget/at91_udc.c |    2 ++
> drivers/usb/host/ohci-at91.c  |    1 +
> 4 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
> linux-2.6.23-rc2-vanilla/arch/arm/mach-at91/pm.c
> linux-2.6.23-rc2/arch/arm/mach-at91/pm.c
> --- linux-2.6.23-rc2-vanilla/arch/arm/mach-at91/pm.c    2007-08-08
> 13:28:37.000000000 -0400
> +++ linux-2.6.23-rc2/arch/arm/mach-at91/pm.c    2007-08-08
> 13:36:43.000000000 -0400
> @@ -176,7 +176,9 @@ static int at91_pm_enter(suspend_state_t
>                          */
>                         asm("b 1f; .align 5; 1:");
>                         asm("mcr p15, 0, r0, c7, c10, 4");      /* drain
> write buffer */
> +#if defined(CONFIG_ARCH_AT91RM9200)
>                         at91_sys_write(AT91_SDRAMC_SRR, 1);     /*
> self-refresh mode */
> +#endif
>                         /* fall though to next state */
>  
>                 case PM_SUSPEND_ON:
> @@ -218,8 +220,9 @@ static int __init at91_pm_init(void)
>  #endif
>  
>         /* Disable SDRAM low-power mode.  Cannot be used with
> self-refresh. */
> +#if defined(CONFIG_ARCH_AT91RM9200)
>         at91_sys_write(AT91_SDRAMC_LPR, 0);
> -
> +#endif
>         pm_set_ops(&at91_pm_ops);
>  
>         return 0;
> diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
> linux-2.6.23-rc2-vanilla/drivers/serial/atmel_serial.c
> linux-2.6.23-rc2/drivers/serial/atmel_serial.c
> --- linux-2.6.23-rc2-vanilla/drivers/serial/atmel_serial.c
> 2007-08-08 13:28:33.000000000 -0400
> +++ linux-2.6.23-rc2/drivers/serial/atmel_serial.c      2007-08-08
> 13:32:52.000000000 -0400
> @@ -916,6 +916,8 @@ static struct uart_driver atmel_uart = {
>  };
>  
>  #ifdef CONFIG_PM
> +extern int at91_suspend_entering_slow_clock(void);
> +
>  static int atmel_serial_suspend(struct platform_device *pdev,
> pm_message_t state)
>  {
>         struct uart_port *port = platform_get_drvdata(pdev);
> diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
> linux-2.6.23-rc2-vanilla/drivers/usb/gadget/at91_udc.c
> linux-2.6.23-rc2/drivers/usb/gadget/at91_udc.c 
> --- linux-2.6.23-rc2-vanilla/drivers/usb/gadget/at91_udc.c
> 2007-08-08 13:28:27.000000000 -0400
> +++ linux-2.6.23-rc2/drivers/usb/gadget/at91_udc.c      2007-08-08
> 13:33:21.000000000 -0400
> @@ -1770,6 +1770,8 @@ static int __exit at91udc_remove(struct 
>  }
>  
>  #ifdef CONFIG_PM
> +extern int at91_suspend_entering_slow_clock(void);
> +
>  static int at91udc_suspend(struct platform_device *pdev, pm_message_t
> mesg)
>  {
>         struct at91_udc *udc = platform_get_drvdata(pdev);
> diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
> linux-2.6.23-rc2-vanilla/drivers/usb/host/ohci-at91.c
> linux-2.6.23-rc2/drivers/usb/host/ohci-at91.c
> --- linux-2.6.23-rc2-vanilla/drivers/usb/host/ohci-at91.c
> 2007-08-08 13:28:27.000000000 -0400
> +++ linux-2.6.23-rc2/drivers/usb/host/ohci-at91.c       2007-08-08
> 13:32:45.000000000 -0400
> @@ -282,6 +282,7 @@ static int ohci_hcd_at91_drv_remove(stru
>  }
>  
>  #ifdef CONFIG_PM
> +extern int at91_suspend_entering_slow_clock(void);
>  
>  static int
>  ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t
> mesg)
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-09 14:53 ` Hans-Jürgen Koch
@ 2007-08-09 16:01   ` Marc Pignat
  2007-08-09 17:17     ` Andy Herzig
  2007-08-09 22:15     ` Ulf Samuelsson
  0 siblings, 2 replies; 12+ messages in thread
From: Marc Pignat @ 2007-08-09 16:01 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Hans-Jürgen Koch, Andy Herzig, andrew, trivial, linux-kernel

Hello!

On Thursday 09 August 2007 16:53, Hans-Jürgen Koch wrote:
> (added linux-arm-kernel to CC)
> 
> Am Donnerstag 09 August 2007 14:10 schrieb Andy Herzig:
> > Hello all,
> > 
> > This patch is intended to fix compilation errors when I tried to add in
> > power management to my Atmel AT91SAM9260 board. First, there is no
> > separate memory controller in the 9260 as there is in the 9200, so calls
> > to do anything with it in pm.c fail.
> 
> Correct. I made the same discovery with my AT91SAM9263 board.
> 
> > 
> > Secondly, at91_suspend_entering_slow_clock() is not declared extern by
> > drivers that use it. This used to cause only a warning, but in
> > 2.6.23-rc1 and beyond, it is an error.
> 
> Patch looks good to me. Kernel compiles for my 9263. Didn't test
> suspend/resume yet, though.
> 
> > 
> > Signed-off-by: Andrew J. Herzig <andrew.herzig@ngc.com>
> 
> Acked-by: Hans J. Koch <hjk@linutronix.de>
> 
> 
> > ---
> > arch/arm/mach-at91/pm.c       |    5 ++++-
> > drivers/serial/atmel_serial.c |    2 ++
> > drivers/usb/gadget/at91_udc.c |    2 ++
> > drivers/usb/host/ohci-at91.c  |    1 +
> > 4 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
> > linux-2.6.23-rc2-vanilla/arch/arm/mach-at91/pm.c
> > linux-2.6.23-rc2/arch/arm/mach-at91/pm.c
> > --- linux-2.6.23-rc2-vanilla/arch/arm/mach-at91/pm.c    2007-08-08
> > 13:28:37.000000000 -0400
> > +++ linux-2.6.23-rc2/arch/arm/mach-at91/pm.c    2007-08-08
> > 13:36:43.000000000 -0400
> > @@ -176,7 +176,9 @@ static int at91_pm_enter(suspend_state_t
> >                          */
> >                         asm("b 1f; .align 5; 1:");
> >                         asm("mcr p15, 0, r0, c7, c10, 4");      /* drain
> > write buffer */
> > +#if defined(CONFIG_ARCH_AT91RM9200)
> >                         at91_sys_write(AT91_SDRAMC_SRR, 1);     /*
> > self-refresh mode */
Why don't use:
if (cpu_is_at91rm9200())
	at91_sys_write(AT91_SDRAMC_SRR, 1);

> > +#endif
> >                         /* fall though to next state */
> >  
> >                 case PM_SUSPEND_ON:
> > @@ -218,8 +220,9 @@ static int __init at91_pm_init(void)
> >  #endif
> >  
> >         /* Disable SDRAM low-power mode.  Cannot be used with
> > self-refresh. */
> > +#if defined(CONFIG_ARCH_AT91RM9200)
> >         at91_sys_write(AT91_SDRAMC_LPR, 0);
> > -
> > +#endif
same comment

...
> > --- linux-2.6.23-rc2-vanilla/drivers/serial/atmel_serial.c
> > 2007-08-08 13:28:33.000000000 -0400
> > +++ linux-2.6.23-rc2/drivers/serial/atmel_serial.c      2007-08-08
> > 13:32:52.000000000 -0400
> > @@ -916,6 +916,8 @@ static struct uart_driver atmel_uart = {
> >  };
> >  
> >  #ifdef CONFIG_PM
> > +extern int at91_suspend_entering_slow_clock(void);
> > +
> >  static int atmel_serial_suspend(struct platform_device *pdev,
> > pm_message_t state)
> >  {
> >         struct uart_port *port = platform_get_drvdata(pdev);
> > diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
> > linux-2.6.23-rc2-vanilla/drivers/usb/gadget/at91_udc.c
> > linux-2.6.23-rc2/drivers/usb/gadget/at91_udc.c 
> > --- linux-2.6.23-rc2-vanilla/drivers/usb/gadget/at91_udc.c
> > 2007-08-08 13:28:27.000000000 -0400
> > +++ linux-2.6.23-rc2/drivers/usb/gadget/at91_udc.c      2007-08-08
> > 13:33:21.000000000 -0400
> > @@ -1770,6 +1770,8 @@ static int __exit at91udc_remove(struct 
> >  }
> >  
> >  #ifdef CONFIG_PM
> > +extern int at91_suspend_entering_slow_clock(void);
> > +
> >  static int at91udc_suspend(struct platform_device *pdev, pm_message_t
> > mesg)
> >  {
> >         struct at91_udc *udc = platform_get_drvdata(pdev);
> > diff -uprN -X linux-2.6.23-rc2/Documentation/dontdiff
> > linux-2.6.23-rc2-vanilla/drivers/usb/host/ohci-at91.c
> > linux-2.6.23-rc2/drivers/usb/host/ohci-at91.c
> > --- linux-2.6.23-rc2-vanilla/drivers/usb/host/ohci-at91.c
> > 2007-08-08 13:28:27.000000000 -0400
> > +++ linux-2.6.23-rc2/drivers/usb/host/ohci-at91.c       2007-08-08
> > 13:32:45.000000000 -0400
> > @@ -282,6 +282,7 @@ static int ohci_hcd_at91_drv_remove(stru
> >  }
> >  
> >  #ifdef CONFIG_PM
> > +extern int at91_suspend_entering_slow_clock(void);
Why do you define 3 times this function?
Can't you place it in a .h?

Regards

Marc



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-09 16:01   ` Marc Pignat
@ 2007-08-09 17:17     ` Andy Herzig
  2007-08-09 18:19       ` Hans-Jürgen Koch
  2007-08-09 22:15     ` Ulf Samuelsson
  1 sibling, 1 reply; 12+ messages in thread
From: Andy Herzig @ 2007-08-09 17:17 UTC (permalink / raw)
  To: Marc Pignat
  Cc: linux-arm-kernel, Hans-Jürgen Koch, andrew, trivial,
	linux-kernel

On Thu, 2007-08-09 at 18:01 +0200, Marc Pignat wrote:

> > > +#if defined(CONFIG_ARCH_AT91RM9200)
> > >                         at91_sys_write(AT91_SDRAMC_SRR, 1);     /*
> > > self-refresh mode */
> Why don't use:
> if (cpu_is_at91rm9200())
> 	at91_sys_write(AT91_SDRAMC_SRR, 1);
> 
No reason. That looks good to me.

> > >  #ifdef CONFIG_PM
> > > +extern int at91_suspend_entering_slow_clock(void);
> Why do you define 3 times this function?
> Can't you place it in a .h?
I considered a .h, but I didn't see one that all drivers included. I
declare it in the 3 separate driver .c files that I saw needed it. There
is no pm.h and I didn't see the point in creating one just for that.
That of course will work if everyone likes that better. In either case,
you still have to add something to all three files.

-Andy H.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-09 17:17     ` Andy Herzig
@ 2007-08-09 18:19       ` Hans-Jürgen Koch
  0 siblings, 0 replies; 12+ messages in thread
From: Hans-Jürgen Koch @ 2007-08-09 18:19 UTC (permalink / raw)
  To: Andy Herzig; +Cc: Marc Pignat, linux-arm-kernel, andrew, trivial, linux-kernel

Am Donnerstag 09 August 2007 19:17 schrieb Andy Herzig:
> On Thu, 2007-08-09 at 18:01 +0200, Marc Pignat wrote:
> 
> > > > +#if defined(CONFIG_ARCH_AT91RM9200)
> > > >                         at91_sys_write(AT91_SDRAMC_SRR, 1);     /*
> > > > self-refresh mode */
> > Why don't use:
> > if (cpu_is_at91rm9200())
> > 	at91_sys_write(AT91_SDRAMC_SRR, 1);
> > 
> No reason. That looks good to me.

No, it doesn't look good. It won't compile.

Hans


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-09 16:01   ` Marc Pignat
  2007-08-09 17:17     ` Andy Herzig
@ 2007-08-09 22:15     ` Ulf Samuelsson
  2007-08-10  7:12       ` Hans-Jürgen Koch
  1 sibling, 1 reply; 12+ messages in thread
From: Ulf Samuelsson @ 2007-08-09 22:15 UTC (permalink / raw)
  To: Marc Pignat, linux-arm-kernel; +Cc: andrew, trivial, linux-kernel, Andy Herzig


> > +#if defined(CONFIG_ARCH_AT91RM9200)
> >                         at91_sys_write(AT91_SDRAMC_SRR, 1);     /*
> > self-refresh mode */

> Why don't use:
> if (cpu_is_at91rm9200())
> at91_sys_write(AT91_SDRAMC_SRR, 1);

What is the benefit?
Will the optimizer remove the code if the CPU is not the at91rm9200?

Best Regards
Ulf Samuelsson

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-09 22:15     ` Ulf Samuelsson
@ 2007-08-10  7:12       ` Hans-Jürgen Koch
  2007-08-10  7:33         ` Marc Pignat
  0 siblings, 1 reply; 12+ messages in thread
From: Hans-Jürgen Koch @ 2007-08-10  7:12 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Ulf Samuelsson, Marc Pignat, andrew, trivial, linux-kernel,
	Andy Herzig

Am Freitag 10 August 2007 00:15 schrieb Ulf Samuelsson:
> 
> > > +#if defined(CONFIG_ARCH_AT91RM9200)
> > >                         at91_sys_write(AT91_SDRAMC_SRR, 1);     /*
> > > self-refresh mode */
> 
> > Why don't use:
> > if (cpu_is_at91rm9200())
> > at91_sys_write(AT91_SDRAMC_SRR, 1);
> 
> What is the benefit?
> Will the optimizer remove the code if the CPU is not the at91rm9200?

No, it won't. cpu_is_something() is intended for runtime decisions.
Remember that the purpose of this patch was to solve a compile time
issue (see subject). AT91_SDRAMC_SRR isn't defined properly for
non-9200 processors because they don't have that register. So we need
something like #ifdef to include this line only on 9200.

Hans

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-10  7:12       ` Hans-Jürgen Koch
@ 2007-08-10  7:33         ` Marc Pignat
       [not found]           ` <3858727143598039860@unknownmsgid>
  2007-08-10 13:54           ` Ulf Samuelsson
  0 siblings, 2 replies; 12+ messages in thread
From: Marc Pignat @ 2007-08-10  7:33 UTC (permalink / raw)
  To: Hans-Jürgen Koch
  Cc: linux-arm-kernel, Ulf Samuelsson, andrew, trivial, linux-kernel,
	Andy Herzig

On Friday 10 August 2007 09:12, Hans-Jürgen Koch wrote:
> Am Freitag 10 August 2007 00:15 schrieb Ulf Samuelsson:
> > 
> > > > +#if defined(CONFIG_ARCH_AT91RM9200)
> > > >                         at91_sys_write(AT91_SDRAMC_SRR, 1);     /*
> > > > self-refresh mode */
> > 
> > > Why don't use:
> > > if (cpu_is_at91rm9200())
> > > at91_sys_write(AT91_SDRAMC_SRR, 1);
> > 
> > What is the benefit?
More readable. (see '#ifdefs are ugly' in Documentation/SubmittingPatches)

> > Will the optimizer remove the code if the CPU is not the at91rm9200?
Optimizer will remove that code if at91rm9200 support is not compiled and 
choose at runtime if the cpu support is compiled in.

> 
> No, it won't. cpu_is_something() is intended for runtime decisions.
> Remember that the purpose of this patch was to solve a compile time
> issue (see subject). AT91_SDRAMC_SRR isn't defined properly for
> non-9200 processors because they don't have that register. So we need
> something like #ifdef to include this line only on 9200.
Oops, I missed that problem, sorry...

and what about this:
#ifdef CONFIG_ARCH_AT91RM9200
#define sdram_lowpower_enable() at91_sys_write(AT91_SDRAMC_SRR, 1)
#define sdram_lowpower_disable() at91_sys_write(AT91_SDRAMC_SRR, 0)
#else
#define sdram_lowpower_enable()
#define sdram_lowpower_disable()
#endif

and using sdram_lowpower_{enable,disable}() when requiered?

Regards

Marc

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
       [not found]           ` <3858727143598039860@unknownmsgid>
@ 2007-08-10 10:00             ` Michel Benoit
  2007-08-24  7:11               ` Andrew Victor
  0 siblings, 1 reply; 12+ messages in thread
From: Michel Benoit @ 2007-08-10 10:00 UTC (permalink / raw)
  To: Pierre Savary
  Cc: Marc Pignat, Hans-Jürgen Koch, trivial, linux-kernel,
	Andy Herzig, andrew, linux-arm-kernel

Hi Pierre,

I'm also using power management on the at91sam9260.

> About SDRAm self refresh mode on at91sam926x, in fact AT91_SDRAMC_SRR
> doesn't exist but the new register is AT91_SDRAMC_LPR. So for instance, you
> can replace at91_sys_write(AT91_SDRAMC_SRR, 1) by
> at91_sys_write(AT91_SDRAMC_LPR, AT91_SDRAMC_LPCB_SELF_REFRESH).

I have also made that change in pm.c.  I've tested it with 2.6.20.4
and it seems to work.

> Currently I work on the power management on at91sam9260 so when I will
> finish my work, I could give you my files.

Please post your mods to the list when you are finished.  I will
gladly help you test them.
Are you going to implement slow clock standby mode?

Michel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-10  7:33         ` Marc Pignat
       [not found]           ` <3858727143598039860@unknownmsgid>
@ 2007-08-10 13:54           ` Ulf Samuelsson
  1 sibling, 0 replies; 12+ messages in thread
From: Ulf Samuelsson @ 2007-08-10 13:54 UTC (permalink / raw)
  To: Marc Pignat, Hans-Jürgen Koch
  Cc: linux-arm-kernel, andrew, trivial, linux-kernel, Andy Herzig

----- Original Message ----- 
From: "Marc Pignat" <marc.pignat@hevs.ch>
To: "Hans-Jürgen Koch" <hjk@linutronix.de>
Cc: <linux-arm-kernel@lists.arm.linux.org.uk>; "Ulf Samuelsson" <ulf@atmel.com>; <andrew@sanpeople.com>; <trivial@kernel.org>; <linux-kernel@vger.kernel.org>; "Andy Herzig" <andrew.herzig@ngc.com>
Sent: Friday, August 10, 2007 9:33 AM
Subject: Re: [PATCH] at91 pm: Compilation fix for at91sam926x


On Friday 10 August 2007 09:12, Hans-Jürgen Koch wrote:
> Am Freitag 10 August 2007 00:15 schrieb Ulf Samuelsson:
> > 
> > > > +#if defined(CONFIG_ARCH_AT91RM9200)
> > > >                         at91_sys_write(AT91_SDRAMC_SRR, 1);     /*
> > > > self-refresh mode */
> > 
> > > Why don't use:
> > > if (cpu_is_at91rm9200())
> > > at91_sys_write(AT91_SDRAMC_SRR, 1);
> > 
> > What is the benefit?
More readable. (see '#ifdefs are ugly' in Documentation/SubmittingPatches)

> > Will the optimizer remove the code if the CPU is not the at91rm9200?
Optimizer will remove that code if at91rm9200 support is not compiled and 
choose at runtime if the cpu support is compiled in.

> 
> No, it won't. cpu_is_something() is intended for runtime decisions.
> Remember that the purpose of this patch was to solve a compile time
> issue (see subject). AT91_SDRAMC_SRR isn't defined properly for
> non-9200 processors because they don't have that register. So we need
> something like #ifdef to include this line only on 9200.
Oops, I missed that problem, sorry...

and what about this:
#ifdef CONFIG_ARCH_AT91RM9200
#define sdram_lowpower_enable() at91_sys_write(AT91_SDRAMC_SRR, 1)
#define sdram_lowpower_disable() at91_sys_write(AT91_SDRAMC_SRR, 0)
#else
#define sdram_lowpower_enable()
#define sdram_lowpower_disable()
#endif

and using sdram_lowpower_{enable,disable}() when requiered?

==> That is hiding the fact that the low power is not performed
        when it it not an AT91RM9200.
        I think the original approach is the best.

Best Regards
Ulf Samuelsson


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] at91 pm: Compilation fix for at91sam926x
  2007-08-10 10:00             ` Michel Benoit
@ 2007-08-24  7:11               ` Andrew Victor
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Victor @ 2007-08-24  7:11 UTC (permalink / raw)
  To: Michel Benoit
  Cc: Pierre Savary, Marc Pignat, Hans-Jürgen Koch, trivial,
	linux-kernel, Andy Herzig, ARM Linux Mailing List

hi,

> > About SDRAm self refresh mode on at91sam926x, in fact AT91_SDRAMC_SRR
> > doesn't exist but the new register is AT91_SDRAMC_LPR. So for instance, you
> > can replace at91_sys_write(AT91_SDRAMC_SRR, 1) by
> > at91_sys_write(AT91_SDRAMC_LPR, AT91_SDRAMC_LPCB_SELF_REFRESH).
> 
> I have also made that change in pm.c.

I think we will go with the following change for now.
We need to pull in different header files anyway.

(This file will need to be re-looked at if we ever allow compiling a
single kernel image that supports multiple AT91 processors)


--- pm.c	6 Jul 2007 09:18:01 -0000	1.5
+++ pm.c	24 Aug 2007 07:22:13 -0000
@@ -27,12 +27,24 @@
 #include <asm/mach-types.h>
 
 #include <asm/arch/at91_pmc.h>
-#include <asm/arch/at91rm9200_mc.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/cpu.h>
 
 #include "generic.h"
 
+#ifdef CONFIG_ARCH_AT91RM9200
+#include <asm/arch/at91rm9200_mc.h>
+
+#define sdram_selfrefresh_enable()	at91_sys_write(AT91_SDRAMC_SRR, 1)
+#define sdram_selfrefresh_disable()
+
+#else
+#include <asm/arch/at91sam926x_mc.h>
+
+#define sdram_selfrefresh_enable()	at91_sys_write(AT91_SDRAMC_LPR, AT91_SDRAMC_LPCB_SELF_REFRESH)
+#define sdram_selfrefresh_disable()	at91_sys_write(AT91_SDRAMC_LPR, AT91_SDRAMC_LPCB_DISABLE)
+
+#endif
 
 static int at91_pm_valid_state(suspend_state_t state)
 {
@@ -172,7 +184,7 @@
 			 */
 			asm("b 1f; .align 5; 1:");
 			asm("mcr p15, 0, r0, c7, c10, 4");	/* drain write buffer */
-			at91_sys_write(AT91_SDRAMC_SRR, 1);	/* self-refresh mode */
+			sdram_selfrefresh_enable();		/* self-refresh mode */
 			/* fall though to next state */
 
 		case PM_SUSPEND_ON:
@@ -188,6 +200,7 @@
 			at91_sys_read(AT91_AIC_IPR) & at91_sys_read(AT91_AIC_IMR));
 
 error:
+	sdram_selfrefresh_disable();
 	target_state = PM_SUSPEND_ON;
 	at91_irq_resume();
 	at91_gpio_resume();


Regards,
  Andrew Victor



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2007-08-24  7:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-09 12:10 [PATCH] at91 pm: Compilation fix for at91sam926x Andy Herzig
2007-08-09 14:39 ` Andy Herzig
2007-08-09 14:53 ` Hans-Jürgen Koch
2007-08-09 16:01   ` Marc Pignat
2007-08-09 17:17     ` Andy Herzig
2007-08-09 18:19       ` Hans-Jürgen Koch
2007-08-09 22:15     ` Ulf Samuelsson
2007-08-10  7:12       ` Hans-Jürgen Koch
2007-08-10  7:33         ` Marc Pignat
     [not found]           ` <3858727143598039860@unknownmsgid>
2007-08-10 10:00             ` Michel Benoit
2007-08-24  7:11               ` Andrew Victor
2007-08-10 13:54           ` Ulf Samuelsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox