Message ID | 20111113180954.GD15318@game.jcrosoft.org |
---|---|
State | New |
Headers | show |
Hi Jean-Christophe, > switch the watchdog drivers to resource and pass it via platform_device > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> > Cc: linux-watchdog@vger.kernel.org > --- > HI Wim, > > this is part of a at91 cleanup > if you don't mind I'll apply via at91 tree > You have my signed-off-by for the watchdog part. This should indeed go via the at91 tree. Kind regards, Wim.
On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > arch/arm/mach-at91/at91cap9_devices.c | 4 ++-- > arch/arm/mach-at91/at91sam9260_devices.c | 4 ++-- > arch/arm/mach-at91/at91sam9263_devices.c | 4 ++-- > arch/arm/mach-at91/at91sam9g45_devices.c | 4 ++-- > arch/arm/mach-at91/at91sam9rl_devices.c | 4 ++-- > arch/arm/mach-at91/include/mach/at91cap9.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9263.h | 4 ++-- > arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 +- > 10 files changed, 16 insertions(+), 16 deletions(-) > > diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c > index adad70d..fb525f4 100644 > --- a/arch/arm/mach-at91/at91cap9_devices.c > +++ b/arch/arm/mach-at91/at91cap9_devices.c > @@ -398,8 +398,8 @@ static struct resource nand_resources[] = { > .flags = IORESOURCE_MEM, > }, > [1] = { > - .start = AT91_BASE_SYS + AT91_ECC, > - .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, > + .start = AT91CAP9_BASE_ECC, > + .end = AT91CAP9_BASE_ECC + SZ_512 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c > index 25e3464..067c168 100644 > --- a/arch/arm/mach-at91/at91sam9260_devices.c > +++ b/arch/arm/mach-at91/at91sam9260_devices.c > @@ -399,8 +399,8 @@ static struct resource nand_resources[] = { > .flags = IORESOURCE_MEM, > }, > [1] = { > - .start = AT91_BASE_SYS + AT91_ECC, > - .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, > + .start = AT91SAM9260_BASE_ECC, > + .end = AT91SAM9260_BASE_ECC + SZ_512 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c > index ad017eb..0b1a28e 100644 > --- a/arch/arm/mach-at91/at91sam9263_devices.c > +++ b/arch/arm/mach-at91/at91sam9263_devices.c > @@ -473,8 +473,8 @@ static struct resource nand_resources[] = { > .flags = IORESOURCE_MEM, > }, > [1] = { > - .start = AT91_BASE_SYS + AT91_ECC0, > - .end = AT91_BASE_SYS + AT91_ECC0 + SZ_512 - 1, > + .start = AT91SAM9263_BASE_ECC0, > + .end = AT91SAM9263_BASE_ECC0 + SZ_512 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c > index 09a16d6..d19d720 100644 > --- a/arch/arm/mach-at91/at91sam9g45_devices.c > +++ b/arch/arm/mach-at91/at91sam9g45_devices.c > @@ -529,8 +529,8 @@ static struct resource nand_resources[] = { > .flags = IORESOURCE_MEM, > }, > [1] = { > - .start = AT91_BASE_SYS + AT91_ECC, > - .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, > + .start = AT91SAM9G45_BASE_ECC, > + .end = AT91SAM9G45_BASE_ECC + SZ_512 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c > index 628eb56..e63ab90 100644 > --- a/arch/arm/mach-at91/at91sam9rl_devices.c > +++ b/arch/arm/mach-at91/at91sam9rl_devices.c > @@ -248,8 +248,8 @@ static struct resource nand_resources[] = { > .flags = IORESOURCE_MEM, > }, > [1] = { > - .start = AT91_BASE_SYS + AT91_ECC, > - .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, > + .start = AT91SAM9RL_BASE_ECC, > + .end = AT91SAM9RL_BASE_ECC + SZ_512 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h > index f65d083..5fd105d 100644 > --- a/arch/arm/mach-at91/include/mach/at91cap9.h > +++ b/arch/arm/mach-at91/include/mach/at91cap9.h > @@ -79,7 +79,6 @@ > /* > * System Peripherals (offset from AT91_BASE_SYS) > */ > -#define AT91_ECC (0xffffe200 - AT91_BASE_SYS) > #define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS) > #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) > #define AT91_SMC (0xffffe800 - AT91_BASE_SYS) > @@ -98,6 +97,7 @@ > (0xfffffd50 - AT91_BASE_SYS) : \ > (0xfffffd60 - AT91_BASE_SYS)) > > +#define AT91CAP9_BASE_ECC 0xffffe200 > #define AT91CAP9_BASE_PIOA 0xfffff200 > #define AT91CAP9_BASE_PIOB 0xfffff400 > #define AT91CAP9_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h > index 1bea3dc..6974656 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9260.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h > @@ -80,7 +80,6 @@ > /* > * System Peripherals (offset from AT91_BASE_SYS) > */ > -#define AT91_ECC (0xffffe800 - AT91_BASE_SYS) > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > #define AT91_SMC (0xffffec00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > @@ -95,6 +94,7 @@ > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > +#define AT91SAM9260_BASE_ECC 0xffffe800 > #define AT91SAM9260_BASE_PIOA 0xfffff400 > #define AT91SAM9260_BASE_PIOB 0xfffff600 > #define AT91SAM9260_BASE_PIOC 0xfffff800 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h > index dd54079..a668538 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9263.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h > @@ -74,10 +74,8 @@ > /* > * System Peripherals (offset from AT91_BASE_SYS) > */ > -#define AT91_ECC0 (0xffffe000 - AT91_BASE_SYS) > #define AT91_SDRAMC0 (0xffffe200 - AT91_BASE_SYS) > #define AT91_SMC0 (0xffffe400 - AT91_BASE_SYS) > -#define AT91_ECC1 (0xffffe600 - AT91_BASE_SYS) > #define AT91_SDRAMC1 (0xffffe800 - AT91_BASE_SYS) > #define AT91_SMC1 (0xffffea00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffec00 - AT91_BASE_SYS) > @@ -93,6 +91,8 @@ > #define AT91_RTT1 (0xfffffd50 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > > +#define AT91SAM9263_BASE_ECC0 0xffffe000 > +#define AT91SAM9263_BASE_ECC1 0xffffe600 > #define AT91SAM9263_BASE_PIOA 0xfffff200 > #define AT91SAM9263_BASE_PIOB 0xfffff400 > #define AT91SAM9263_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h > index a487af5..3c0b7c1 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h > @@ -86,7 +86,6 @@ > /* > * System Peripherals (offset from AT91_BASE_SYS) > */ > -#define AT91_ECC (0xffffe200 - AT91_BASE_SYS) > #define AT91_DDRSDRC1 (0xffffe400 - AT91_BASE_SYS) > #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) > #define AT91_SMC (0xffffe800 - AT91_BASE_SYS) > @@ -103,6 +102,7 @@ > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > #define AT91_RTC (0xfffffdb0 - AT91_BASE_SYS) > > +#define AT91SAM9G45_BASE_ECC 0xffffe200 > #define AT91SAM9G45_BASE_PIOA 0xfffff200 > #define AT91SAM9G45_BASE_PIOB 0xfffff400 > #define AT91SAM9G45_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h > index d3ef11a..d9efe5a 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h > @@ -70,7 +70,6 @@ > * System Peripherals (offset from AT91_BASE_SYS) > */ > #define AT91_DMA (0xffffe600 - AT91_BASE_SYS) > -#define AT91_ECC (0xffffe800 - AT91_BASE_SYS) > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > #define AT91_SMC (0xffffec00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > @@ -87,6 +86,7 @@ > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) > > +#define AT91SAM9RL_BASE_ECC 0xffffe800 > #define AT91SAM9RL_BASE_PIOA 0xfffff400 > #define AT91SAM9RL_BASE_PIOB 0xfffff600 > #define AT91SAM9RL_BASE_PIOC 0xfffff800
On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > arch/arm/mach-at91/at91sam9g45_devices.c | 4 ++-- > arch/arm/mach-at91/at91sam9rl_devices.c | 4 ++-- > arch/arm/mach-at91/include/mach/at91cap9.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 +- > 5 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c > index d19d720..42bf770 100644 > --- a/arch/arm/mach-at91/at91sam9g45_devices.c > +++ b/arch/arm/mach-at91/at91sam9g45_devices.c > @@ -44,8 +44,8 @@ static struct at_dma_platform_data atdma_pdata = { > > static struct resource hdmac_resources[] = { > [0] = { > - .start = AT91_BASE_SYS + AT91_DMA, > - .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, > + .start = AT91SAM9G45_BASE_DMA, > + .end = AT91SAM9G45_BASE_DMA + SZ_512 - 1, > .flags = IORESOURCE_MEM, > }, > [1] = { > diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c > index e63ab90..34fe5dd 100644 > --- a/arch/arm/mach-at91/at91sam9rl_devices.c > +++ b/arch/arm/mach-at91/at91sam9rl_devices.c > @@ -39,8 +39,8 @@ static struct at_dma_platform_data atdma_pdata = { > > static struct resource hdmac_resources[] = { > [0] = { > - .start = AT91_BASE_SYS + AT91_DMA, > - .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, > + .start = AT91SAM9RL_BASE_DMA, > + .end = AT91SAM9RL_BASE_DMA + SZ_512 - 1, > .flags = IORESOURCE_MEM, > }, > [2] = { > diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h > index 5fd105d..a2eccb9 100644 > --- a/arch/arm/mach-at91/include/mach/at91cap9.h > +++ b/arch/arm/mach-at91/include/mach/at91cap9.h > @@ -84,7 +84,6 @@ > #define AT91_SMC (0xffffe800 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) > #define AT91_CCFG (0xffffeb10 - AT91_BASE_SYS) > -#define AT91_DMA (0xffffec00 - AT91_BASE_SYS) > #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > @@ -98,6 +97,7 @@ > (0xfffffd60 - AT91_BASE_SYS)) > > #define AT91CAP9_BASE_ECC 0xffffe200 > +#define AT91CAP9_BASE_DMA 0xffffec00 > #define AT91CAP9_BASE_PIOA 0xfffff200 > #define AT91CAP9_BASE_PIOB 0xfffff400 > #define AT91CAP9_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h > index 3c0b7c1..29e577f 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h > @@ -90,7 +90,6 @@ > #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) > #define AT91_SMC (0xffffe800 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) > -#define AT91_DMA (0xffffec00 - AT91_BASE_SYS) > #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > @@ -103,6 +102,7 @@ > #define AT91_RTC (0xfffffdb0 - AT91_BASE_SYS) > > #define AT91SAM9G45_BASE_ECC 0xffffe200 > +#define AT91SAM9G45_BASE_DMA 0xffffec00 > #define AT91SAM9G45_BASE_PIOA 0xfffff200 > #define AT91SAM9G45_BASE_PIOB 0xfffff400 > #define AT91SAM9G45_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h > index d9efe5a..e564650 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h > @@ -69,7 +69,6 @@ > /* > * System Peripherals (offset from AT91_BASE_SYS) > */ > -#define AT91_DMA (0xffffe600 - AT91_BASE_SYS) > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > #define AT91_SMC (0xffffec00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > @@ -86,6 +85,7 @@ > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) > > +#define AT91SAM9RL_BASE_DMA 0xffffe600 > #define AT91SAM9RL_BASE_ECC 0xffffe800 > #define AT91SAM9RL_BASE_PIOA 0xfffff400 > #define AT91SAM9RL_BASE_PIOB 0xfffff600
On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > arch/arm/mach-at91/at91cap9_devices.c | 4 ++-- > arch/arm/mach-at91/at91sam9260_devices.c | 4 ++-- > arch/arm/mach-at91/at91sam9261_devices.c | 4 ++-- > arch/arm/mach-at91/at91sam9263_devices.c | 8 ++++---- > arch/arm/mach-at91/at91sam9g45_devices.c | 4 ++-- > arch/arm/mach-at91/at91sam9rl_devices.c | 4 ++-- > arch/arm/mach-at91/include/mach/at91cap9.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9261.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9263.h | 4 ++-- > arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 +- > 12 files changed, 21 insertions(+), 21 deletions(-) > > diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c > index fb525f4..3262a7e 100644 > --- a/arch/arm/mach-at91/at91cap9_devices.c > +++ b/arch/arm/mach-at91/at91cap9_devices.c > @@ -670,8 +670,8 @@ static void __init at91_add_device_tc(void) { } > > static struct resource rtt_resources[] = { > { > - .start = AT91_BASE_SYS + AT91_RTT, > - .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, > + .start = AT91CAP9_BASE_RTT, > + .end = AT91CAP9_BASE_RTT + SZ_16 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c > index 067c168..63cbfb8 100644 > --- a/arch/arm/mach-at91/at91sam9260_devices.c > +++ b/arch/arm/mach-at91/at91sam9260_devices.c > @@ -714,8 +714,8 @@ static void __init at91_add_device_tc(void) { } > > static struct resource rtt_resources[] = { > { > - .start = AT91_BASE_SYS + AT91_RTT, > - .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, > + .start = AT91SAM9260_BASE_RTT, > + .end = AT91SAM9260_BASE_RTT + SZ_16 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c > index ae78f4d..d5bd1e7 100644 > --- a/arch/arm/mach-at91/at91sam9261_devices.c > +++ b/arch/arm/mach-at91/at91sam9261_devices.c > @@ -600,8 +600,8 @@ static void __init at91_add_device_tc(void) { } > > static struct resource rtt_resources[] = { > { > - .start = AT91_BASE_SYS + AT91_RTT, > - .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, > + .start = AT91SAM9261_BASE_RTT, > + .end = AT91SAM9261_BASE_RTT + SZ_16 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c > index 0b1a28e..5d2b061 100644 > --- a/arch/arm/mach-at91/at91sam9263_devices.c > +++ b/arch/arm/mach-at91/at91sam9263_devices.c > @@ -956,8 +956,8 @@ static void __init at91_add_device_tc(void) { } > > static struct resource rtt0_resources[] = { > { > - .start = AT91_BASE_SYS + AT91_RTT0, > - .end = AT91_BASE_SYS + AT91_RTT0 + SZ_16 - 1, > + .start = AT91SAM9263_BASE_RTT0, > + .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1, > .flags = IORESOURCE_MEM, > } > }; > @@ -971,8 +971,8 @@ static struct platform_device at91sam9263_rtt0_device = { > > static struct resource rtt1_resources[] = { > { > - .start = AT91_BASE_SYS + AT91_RTT1, > - .end = AT91_BASE_SYS + AT91_RTT1 + SZ_16 - 1, > + .start = AT91SAM9263_BASE_RTT1, > + .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c > index 42bf770..bb2ba0c 100644 > --- a/arch/arm/mach-at91/at91sam9g45_devices.c > +++ b/arch/arm/mach-at91/at91sam9g45_devices.c > @@ -1081,8 +1081,8 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {} > > static struct resource rtt_resources[] = { > { > - .start = AT91_BASE_SYS + AT91_RTT, > - .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, > + .start = AT91SAM9G45_BASE_RTT, > + .end = AT91SAM9G45_BASE_RTT + SZ_16 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c > index 34fe5dd..f9b423b 100644 > --- a/arch/arm/mach-at91/at91sam9rl_devices.c > +++ b/arch/arm/mach-at91/at91sam9rl_devices.c > @@ -685,8 +685,8 @@ static void __init at91_add_device_rtc(void) {} > > static struct resource rtt_resources[] = { > { > - .start = AT91_BASE_SYS + AT91_RTT, > - .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, > + .start = AT91SAM9RL_BASE_RTT, > + .end = AT91SAM9RL_BASE_RTT + SZ_16 - 1, > .flags = IORESOURCE_MEM, > } > }; > diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h > index a2eccb9..1cb42a6 100644 > --- a/arch/arm/mach-at91/include/mach/at91cap9.h > +++ b/arch/arm/mach-at91/include/mach/at91cap9.h > @@ -89,7 +89,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) > #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (cpu_is_at91cap9_revB() ? \ > @@ -102,6 +101,7 @@ > #define AT91CAP9_BASE_PIOB 0xfffff400 > #define AT91CAP9_BASE_PIOC 0xfffff600 > #define AT91CAP9_BASE_PIOD 0xfffff800 > +#define AT91CAP9_BASE_RTT 0xfffffd20 > > #define AT91_USART0 AT91CAP9_BASE_US0 > #define AT91_USART1 AT91CAP9_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h > index 6974656..6aa7ca9 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9260.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h > @@ -89,7 +89,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) > #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > @@ -98,6 +97,7 @@ > #define AT91SAM9260_BASE_PIOA 0xfffff400 > #define AT91SAM9260_BASE_PIOB 0xfffff600 > #define AT91SAM9260_BASE_PIOC 0xfffff800 > +#define AT91SAM9260_BASE_RTT 0xfffffd20 > > #define AT91_USART0 AT91SAM9260_BASE_US0 > #define AT91_USART1 AT91SAM9260_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h > index 17ae9c7..f84b713 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9261.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h > @@ -73,7 +73,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) > #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > @@ -81,6 +80,7 @@ > #define AT91SAM9261_BASE_PIOA 0xfffff400 > #define AT91SAM9261_BASE_PIOB 0xfffff600 > #define AT91SAM9261_BASE_PIOC 0xfffff800 > +#define AT91SAM9261_BASE_RTT 0xfffffd20 > > #define AT91_USART0 AT91SAM9261_BASE_US0 > #define AT91_USART1 AT91SAM9261_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h > index a668538..938965e 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9263.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h > @@ -85,10 +85,8 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_RTT0 (0xfffffd20 - AT91_BASE_SYS) > #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > -#define AT91_RTT1 (0xfffffd50 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > > #define AT91SAM9263_BASE_ECC0 0xffffe000 > @@ -98,6 +96,8 @@ > #define AT91SAM9263_BASE_PIOC 0xfffff600 > #define AT91SAM9263_BASE_PIOD 0xfffff800 > #define AT91SAM9263_BASE_PIOE 0xfffffa00 > +#define AT91SAM9263_BASE_RTT0 0xfffffd20 > +#define AT91SAM9263_BASE_RTT1 0xfffffd50 > > #define AT91_USART0 AT91SAM9263_BASE_US0 > #define AT91_USART1 AT91SAM9263_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h > index 29e577f..00638c6 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h > @@ -95,7 +95,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) > #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > @@ -108,6 +107,7 @@ > #define AT91SAM9G45_BASE_PIOC 0xfffff600 > #define AT91SAM9G45_BASE_PIOD 0xfffff800 > #define AT91SAM9G45_BASE_PIOE 0xfffffa00 > +#define AT91SAM9G45_BASE_RTT 0xfffffd20 > > #define AT91_USART0 AT91SAM9G45_BASE_US0 > #define AT91_USART1 AT91SAM9G45_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h > index e564650..099cefc 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h > @@ -78,7 +78,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_RTT (0xfffffd20 - AT91_BASE_SYS) > #define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) > @@ -91,6 +90,7 @@ > #define AT91SAM9RL_BASE_PIOB 0xfffff600 > #define AT91SAM9RL_BASE_PIOC 0xfffff800 > #define AT91SAM9RL_BASE_PIOD 0xfffffa00 > +#define AT91SAM9RL_BASE_RTT 0xfffffd20 > > #define AT91_USART0 AT91SAM9RL_BASE_US0 > #define AT91_USART1 AT91SAM9RL_BASE_US1
On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > this will allow to ioremap the register of the PIT, PMC and others > and make the code soc independent > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > arch/arm/mach-at91/at91cap9.c | 5 +++++ > arch/arm/mach-at91/at91rm9200.c | 5 +++++ > arch/arm/mach-at91/at91sam9260.c | 5 +++++ > arch/arm/mach-at91/at91sam9261.c | 5 +++++ > arch/arm/mach-at91/at91sam9263.c | 5 +++++ > arch/arm/mach-at91/at91sam9g45.c | 5 +++++ > arch/arm/mach-at91/at91sam9rl.c | 5 +++++ > arch/arm/mach-at91/setup.c | 2 ++ > arch/arm/mach-at91/soc.h | 1 + > 9 files changed, 38 insertions(+), 0 deletions(-) > > diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c > index fe00dce..3687207 100644 > --- a/arch/arm/mach-at91/at91cap9.c > +++ b/arch/arm/mach-at91/at91cap9.c > @@ -333,6 +333,10 @@ static void __init at91cap9_map_io(void) > at91_init_sram(0, AT91CAP9_SRAM_BASE, AT91CAP9_SRAM_SIZE); > } > > +static void __init at91cap9_ioremap_registers(void) > +{ > +} > + > static void __init at91cap9_initialize(void) > { > at91_arch_reset = at91cap9_reset; > @@ -394,6 +398,7 @@ static unsigned int at91cap9_default_irq_priority[NR_AIC_IRQS] __initdata = { > struct at91_init_soc __initdata at91cap9_soc = { > .map_io = at91cap9_map_io, > .default_irq_priority = at91cap9_default_irq_priority, > + .ioremap_registers = at91cap9_ioremap_registers, > .register_clocks = at91cap9_register_clocks, > .init = at91cap9_initialize, > }; > diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c > index 8ce8675..c67d50c 100644 > --- a/arch/arm/mach-at91/at91rm9200.c > +++ b/arch/arm/mach-at91/at91rm9200.c > @@ -307,6 +307,10 @@ static void __init at91rm9200_map_io(void) > iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc)); > } > > +static void __init at91rm9200_ioremap_registers(void) > +{ > +} > + > static void __init at91rm9200_initialize(void) > { > at91_arch_reset = at91rm9200_reset; > @@ -366,6 +370,7 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = { > struct at91_init_soc __initdata at91rm9200_soc = { > .map_io = at91rm9200_map_io, > .default_irq_priority = at91rm9200_default_irq_priority, > + .ioremap_registers = at91rm9200_ioremap_registers, > .register_clocks = at91rm9200_register_clocks, > .init = at91rm9200_initialize, > }; > diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c > index 1e9c79f..0e54928 100644 > --- a/arch/arm/mach-at91/at91sam9260.c > +++ b/arch/arm/mach-at91/at91sam9260.c > @@ -325,6 +325,10 @@ static void __init at91sam9260_map_io(void) > } > } > > +static void __init at91sam9260_ioremap_registers(void) > +{ > +} > + > static void __init at91sam9260_initialize(void) > { > at91_arch_reset = at91sam9_alt_reset; > @@ -381,6 +385,7 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = { > struct at91_init_soc __initdata at91sam9260_soc = { > .map_io = at91sam9260_map_io, > .default_irq_priority = at91sam9260_default_irq_priority, > + .ioremap_registers = at91sam9260_ioremap_registers, > .register_clocks = at91sam9260_register_clocks, > .init = at91sam9260_initialize, > }; > diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c > index 574aa6b..dde8318 100644 > --- a/arch/arm/mach-at91/at91sam9261.c > +++ b/arch/arm/mach-at91/at91sam9261.c > @@ -285,6 +285,10 @@ static void __init at91sam9261_map_io(void) > at91_init_sram(0, AT91SAM9261_SRAM_BASE, AT91SAM9261_SRAM_SIZE); > } > > +static void __init at91sam9261_ioremap_registers(void) > +{ > +} > + > static void __init at91sam9261_initialize(void) > { > at91_arch_reset = at91sam9_alt_reset; > @@ -341,6 +345,7 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = { > struct at91_init_soc __initdata at91sam9261_soc = { > .map_io = at91sam9261_map_io, > .default_irq_priority = at91sam9261_default_irq_priority, > + .ioremap_registers = at91sam9261_ioremap_registers, > .register_clocks = at91sam9261_register_clocks, > .init = at91sam9261_initialize, > }; > diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c > index dee0ed7..fc442dd 100644 > --- a/arch/arm/mach-at91/at91sam9263.c > +++ b/arch/arm/mach-at91/at91sam9263.c > @@ -303,6 +303,10 @@ static void __init at91sam9263_map_io(void) > at91_init_sram(1, AT91SAM9263_SRAM1_BASE, AT91SAM9263_SRAM1_SIZE); > } > > +static void __init at91sam9263_ioremap_registers(void) > +{ > +} > + > static void __init at91sam9263_initialize(void) > { > at91_arch_reset = at91sam9_alt_reset; > @@ -358,6 +362,7 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = { > struct at91_init_soc __initdata at91sam9263_soc = { > .map_io = at91sam9263_map_io, > .default_irq_priority = at91sam9263_default_irq_priority, > + .ioremap_registers = at91sam9263_ioremap_registers, > .register_clocks = at91sam9263_register_clocks, > .init = at91sam9263_initialize, > }; > diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c > index 404d70c..56282b2 100644 > --- a/arch/arm/mach-at91/at91sam9g45.c > +++ b/arch/arm/mach-at91/at91sam9g45.c > @@ -338,6 +338,10 @@ static void __init at91sam9g45_map_io(void) > init_consistent_dma_size(SZ_4M); > } > > +static void __init at91sam9g45_ioremap_registers(void) > +{ > +} > + > static void __init at91sam9g45_initialize(void) > { > at91_arch_reset = at91sam9g45_reset; > @@ -393,6 +397,7 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = { > struct at91_init_soc __initdata at91sam9g45_soc = { > .map_io = at91sam9g45_map_io, > .default_irq_priority = at91sam9g45_default_irq_priority, > + .ioremap_registers = at91sam9g45_ioremap_registers, > .register_clocks = at91sam9g45_register_clocks, > .init = at91sam9g45_initialize, > }; > diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c > index c4004e2..29dae9b 100644 > --- a/arch/arm/mach-at91/at91sam9rl.c > +++ b/arch/arm/mach-at91/at91sam9rl.c > @@ -290,6 +290,10 @@ static void __init at91sam9rl_map_io(void) > at91_init_sram(0, AT91SAM9RL_SRAM_BASE, sram_size); > } > > +static void __init at91sam9rl_ioremap_registers(void) > +{ > +} > + > static void __init at91sam9rl_initialize(void) > { > at91_arch_reset = at91sam9_alt_reset; > @@ -345,6 +349,7 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = { > struct at91_init_soc __initdata at91sam9rl_soc = { > .map_io = at91sam9rl_map_io, > .default_irq_priority = at91sam9rl_default_irq_priority, > + .ioremap_registers = at91sam9rl_ioremap_registers, > .register_clocks = at91sam9rl_register_clocks, > .init = at91sam9rl_initialize, > }; > diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c > index aa64294..63b3ac2 100644 > --- a/arch/arm/mach-at91/setup.c > +++ b/arch/arm/mach-at91/setup.c > @@ -287,6 +287,8 @@ void __init at91_map_io(void) > > void __init at91_initialize(unsigned long main_clock) > { > + at91_boot_soc.ioremap_registers(); > + > /* Init clock subsystem */ > at91_clock_init(main_clock); > > diff --git a/arch/arm/mach-at91/soc.h b/arch/arm/mach-at91/soc.h > index cdf6ccf..f860a2e 100644 > --- a/arch/arm/mach-at91/soc.h > +++ b/arch/arm/mach-at91/soc.h > @@ -7,6 +7,7 @@ > struct at91_init_soc { > unsigned int *default_irq_priority; > void (*map_io)(void); > + void (*ioremap_registers)(void); > void (*register_clocks)(void); > void (*init)(void); > };
On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Seems good if you can address the error path comment on ioremap. You can add my "Acked-by" to your next patch series: Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > arch/arm/mach-at91/at91cap9.c | 1 + > arch/arm/mach-at91/at91sam9260.c | 1 + > arch/arm/mach-at91/at91sam9261.c | 1 + > arch/arm/mach-at91/at91sam9263.c | 1 + > arch/arm/mach-at91/at91sam926x_time.c | 35 +++++++++++++++++------- > arch/arm/mach-at91/at91sam9g45.c | 1 + > arch/arm/mach-at91/at91sam9rl.c | 1 + > arch/arm/mach-at91/generic.h | 1 + > arch/arm/mach-at91/include/mach/at91_pit.h | 8 +++--- > arch/arm/mach-at91/include/mach/at91cap9.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9261.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9263.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 +- > 15 files changed, 42 insertions(+), 20 deletions(-) > > diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c > index 3687207..abfe368 100644 > --- a/arch/arm/mach-at91/at91cap9.c > +++ b/arch/arm/mach-at91/at91cap9.c > @@ -335,6 +335,7 @@ static void __init at91cap9_map_io(void) > > static void __init at91cap9_ioremap_registers(void) > { > + at91sam926x_ioremap_pit(AT91CAP9_BASE_PIT); > } > > static void __init at91cap9_initialize(void) > diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c > index 0e54928..0030d5f 100644 > --- a/arch/arm/mach-at91/at91sam9260.c > +++ b/arch/arm/mach-at91/at91sam9260.c > @@ -327,6 +327,7 @@ static void __init at91sam9260_map_io(void) > > static void __init at91sam9260_ioremap_registers(void) > { > + at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT); > } > > static void __init at91sam9260_initialize(void) > diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c > index dde8318..348d5ae 100644 > --- a/arch/arm/mach-at91/at91sam9261.c > +++ b/arch/arm/mach-at91/at91sam9261.c > @@ -287,6 +287,7 @@ static void __init at91sam9261_map_io(void) > > static void __init at91sam9261_ioremap_registers(void) > { > + at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT); > } > > static void __init at91sam9261_initialize(void) > diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c > index fc442dd..09ccf73 100644 > --- a/arch/arm/mach-at91/at91sam9263.c > +++ b/arch/arm/mach-at91/at91sam9263.c > @@ -305,6 +305,7 @@ static void __init at91sam9263_map_io(void) > > static void __init at91sam9263_ioremap_registers(void) > { > + at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT); > } > > static void __init at91sam9263_initialize(void) > diff --git a/arch/arm/mach-at91/at91sam926x_time.c b/arch/arm/mach-at91/at91sam926x_time.c > index 4ba8549..05ba3f6 100644 > --- a/arch/arm/mach-at91/at91sam926x_time.c > +++ b/arch/arm/mach-at91/at91sam926x_time.c > @@ -25,7 +25,17 @@ > > static u32 pit_cycle; /* write-once */ > static u32 pit_cnt; /* access only w/system irq blocked */ > +static void __iomem *pit_base_addr __read_mostly; > > +static inline unsigned int pit_read(unsigned int reg_offset) > +{ > + return __raw_readl(pit_base_addr + reg_offset); > +} > + > +static inline void pit_write(unsigned int reg_offset, unsigned long value) > +{ > + __raw_writel(value, pit_base_addr + reg_offset); > +} > > /* > * Clocksource: just a monotonic counter of MCK/16 cycles. > @@ -39,7 +49,7 @@ static cycle_t read_pit_clk(struct clocksource *cs) > > raw_local_irq_save(flags); > elapsed = pit_cnt; > - t = at91_sys_read(AT91_PIT_PIIR); > + t = pit_read(AT91_PIT_PIIR); > raw_local_irq_restore(flags); > > elapsed += PIT_PICNT(t) * pit_cycle; > @@ -64,8 +74,8 @@ pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev) > switch (mode) { > case CLOCK_EVT_MODE_PERIODIC: > /* update clocksource counter */ > - pit_cnt += pit_cycle * PIT_PICNT(at91_sys_read(AT91_PIT_PIVR)); > - at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN > + pit_cnt += pit_cycle * PIT_PICNT(pit_read(AT91_PIT_PIVR)); > + pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN > | AT91_PIT_PITIEN); > break; > case CLOCK_EVT_MODE_ONESHOT: > @@ -74,7 +84,7 @@ pit_clkevt_mode(enum clock_event_mode mode, struct clock_event_device *dev) > case CLOCK_EVT_MODE_SHUTDOWN: > case CLOCK_EVT_MODE_UNUSED: > /* disable irq, leaving the clocksource active */ > - at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); > + pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); > break; > case CLOCK_EVT_MODE_RESUME: > break; > @@ -103,11 +113,11 @@ static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id) > > /* The PIT interrupt may be disabled, and is shared */ > if ((pit_clkevt.mode == CLOCK_EVT_MODE_PERIODIC) > - && (at91_sys_read(AT91_PIT_SR) & AT91_PIT_PITS)) { > + && (pit_read(AT91_PIT_SR) & AT91_PIT_PITS)) { > unsigned nr_ticks; > > /* Get number of ticks performed before irq, and ack it */ > - nr_ticks = PIT_PICNT(at91_sys_read(AT91_PIT_PIVR)); > + nr_ticks = PIT_PICNT(pit_read(AT91_PIT_PIVR)); > do { > pit_cnt += pit_cycle; > pit_clkevt.event_handler(&pit_clkevt); > @@ -129,14 +139,14 @@ static struct irqaction at91sam926x_pit_irq = { > static void at91sam926x_pit_reset(void) > { > /* Disable timer and irqs */ > - at91_sys_write(AT91_PIT_MR, 0); > + pit_write(AT91_PIT_MR, 0); > > /* Clear any pending interrupts, wait for PIT to stop counting */ > - while (PIT_CPIV(at91_sys_read(AT91_PIT_PIVR)) != 0) > + while (PIT_CPIV(pit_read(AT91_PIT_PIVR)) != 0) > cpu_relax(); > > /* Start PIT but don't enable IRQ */ > - at91_sys_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); > + pit_write(AT91_PIT_MR, (pit_cycle - 1) | AT91_PIT_PITEN); > } > > /* > @@ -178,7 +188,12 @@ static void __init at91sam926x_pit_init(void) > static void at91sam926x_pit_suspend(void) > { > /* Disable timer */ > - at91_sys_write(AT91_PIT_MR, 0); > + pit_write(AT91_PIT_MR, 0); > +} > + > +void at91sam926x_ioremap_pit(u32 addr) > +{ > + pit_base_addr = ioremap(addr, 16); I would prefer that you could add an error message here. I know that the address that is passed to this function should come from a verified source. But an error message could help for debugging purpose (think creating a new SoC). > } > > struct sys_timer at91sam926x_timer = { > diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c > index 56282b2..aa8b441 100644 > --- a/arch/arm/mach-at91/at91sam9g45.c > +++ b/arch/arm/mach-at91/at91sam9g45.c > @@ -340,6 +340,7 @@ static void __init at91sam9g45_map_io(void) > > static void __init at91sam9g45_ioremap_registers(void) > { > + at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT); > } > > static void __init at91sam9g45_initialize(void) > diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c > index 29dae9b..291fc99 100644 > --- a/arch/arm/mach-at91/at91sam9rl.c > +++ b/arch/arm/mach-at91/at91sam9rl.c > @@ -292,6 +292,7 @@ static void __init at91sam9rl_map_io(void) > > static void __init at91sam9rl_ioremap_registers(void) > { > + at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT); > } > > static void __init at91sam9rl_initialize(void) > diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h > index 11d7297..8196ecc 100644 > --- a/arch/arm/mach-at91/generic.h > +++ b/arch/arm/mach-at91/generic.h > @@ -29,6 +29,7 @@ extern void __init at91_aic_init(unsigned int priority[]); > /* Timer */ > struct sys_timer; > extern struct sys_timer at91rm9200_timer; > +extern void at91sam926x_ioremap_pit(u32 addr); > extern struct sys_timer at91sam926x_timer; > extern struct sys_timer at91x40_timer; > > diff --git a/arch/arm/mach-at91/include/mach/at91_pit.h b/arch/arm/mach-at91/include/mach/at91_pit.h > index 974d0bd..d1f80ad 100644 > --- a/arch/arm/mach-at91/include/mach/at91_pit.h > +++ b/arch/arm/mach-at91/include/mach/at91_pit.h > @@ -16,16 +16,16 @@ > #ifndef AT91_PIT_H > #define AT91_PIT_H > > -#define AT91_PIT_MR (AT91_PIT + 0x00) /* Mode Register */ > +#define AT91_PIT_MR 0x00 /* Mode Register */ > #define AT91_PIT_PITIEN (1 << 25) /* Timer Interrupt Enable */ > #define AT91_PIT_PITEN (1 << 24) /* Timer Enabled */ > #define AT91_PIT_PIV (0xfffff) /* Periodic Interval Value */ > > -#define AT91_PIT_SR (AT91_PIT + 0x04) /* Status Register */ > +#define AT91_PIT_SR 0x04 /* Status Register */ > #define AT91_PIT_PITS (1 << 0) /* Timer Status */ > > -#define AT91_PIT_PIVR (AT91_PIT + 0x08) /* Periodic Interval Value Register */ > -#define AT91_PIT_PIIR (AT91_PIT + 0x0c) /* Periodic Interval Image Register */ > +#define AT91_PIT_PIVR 0x08 /* Periodic Interval Value Register */ > +#define AT91_PIT_PIIR 0x0c /* Periodic Interval Image Register */ > #define AT91_PIT_PICNT (0xfff << 20) /* Interval Counter */ > #define AT91_PIT_CPIV (0xfffff) /* Inverval Value */ > > diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h > index 1cb42a6..ad8d298 100644 > --- a/arch/arm/mach-at91/include/mach/at91cap9.h > +++ b/arch/arm/mach-at91/include/mach/at91cap9.h > @@ -89,7 +89,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (cpu_is_at91cap9_revB() ? \ > (0xfffffd50 - AT91_BASE_SYS) : \ > @@ -102,6 +101,7 @@ > #define AT91CAP9_BASE_PIOC 0xfffff600 > #define AT91CAP9_BASE_PIOD 0xfffff800 > #define AT91CAP9_BASE_RTT 0xfffffd20 > +#define AT91CAP9_BASE_PIT 0xfffffd30 > > #define AT91_USART0 AT91CAP9_BASE_US0 > #define AT91_USART1 AT91CAP9_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h > index 6aa7ca9..b8c85dc 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9260.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h > @@ -89,7 +89,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > @@ -98,6 +97,7 @@ > #define AT91SAM9260_BASE_PIOB 0xfffff600 > #define AT91SAM9260_BASE_PIOC 0xfffff800 > #define AT91SAM9260_BASE_RTT 0xfffffd20 > +#define AT91SAM9260_BASE_PIT 0xfffffd30 > > #define AT91_USART0 AT91SAM9260_BASE_US0 > #define AT91_USART1 AT91SAM9260_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h > index f84b713..0dccaff 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9261.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h > @@ -73,7 +73,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > @@ -81,6 +80,7 @@ > #define AT91SAM9261_BASE_PIOB 0xfffff600 > #define AT91SAM9261_BASE_PIOC 0xfffff800 > #define AT91SAM9261_BASE_RTT 0xfffffd20 > +#define AT91SAM9261_BASE_PIT 0xfffffd30 > > #define AT91_USART0 AT91SAM9261_BASE_US0 > #define AT91_USART1 AT91SAM9261_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h > index 938965e..735408e 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9263.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h > @@ -85,7 +85,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > > @@ -97,6 +96,7 @@ > #define AT91SAM9263_BASE_PIOD 0xfffff800 > #define AT91SAM9263_BASE_PIOE 0xfffffa00 > #define AT91SAM9263_BASE_RTT0 0xfffffd20 > +#define AT91SAM9263_BASE_PIT 0xfffffd30 > #define AT91SAM9263_BASE_RTT1 0xfffffd50 > > #define AT91_USART0 AT91SAM9263_BASE_US0 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h > index 00638c6..ba609f3 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h > @@ -95,7 +95,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > #define AT91_RTC (0xfffffdb0 - AT91_BASE_SYS) > @@ -108,6 +107,7 @@ > #define AT91SAM9G45_BASE_PIOD 0xfffff800 > #define AT91SAM9G45_BASE_PIOE 0xfffffa00 > #define AT91SAM9G45_BASE_RTT 0xfffffd20 > +#define AT91SAM9G45_BASE_PIT 0xfffffd30 > > #define AT91_USART0 AT91SAM9G45_BASE_US0 > #define AT91_USART1 AT91SAM9G45_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h > index 099cefc..bab09a7 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h > @@ -78,7 +78,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > -#define AT91_PIT (0xfffffd30 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > @@ -91,6 +90,7 @@ > #define AT91SAM9RL_BASE_PIOC 0xfffff800 > #define AT91SAM9RL_BASE_PIOD 0xfffffa00 > #define AT91SAM9RL_BASE_RTT 0xfffffd20 > +#define AT91SAM9RL_BASE_PIT 0xfffffd30 > > #define AT91_USART0 AT91SAM9RL_BASE_US0 > #define AT91_USART1 AT91SAM9RL_BASE_US1
Jean-Christophe, Please, add more comments here. You add a new parameter to *_smc_configure(), it can be good to say something about it... On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> With my little comments addressed: Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > arch/arm/mach-at91/at91cap9.c | 2 + > arch/arm/mach-at91/at91rm9200.c | 1 + > arch/arm/mach-at91/at91sam9260.c | 2 + > arch/arm/mach-at91/at91sam9261.c | 2 + > arch/arm/mach-at91/at91sam9263.c | 3 + > arch/arm/mach-at91/at91sam9g45.c | 2 + > arch/arm/mach-at91/at91sam9rl.c | 2 + > arch/arm/mach-at91/board-cam60.c | 2 +- > arch/arm/mach-at91/board-cap9adk.c | 4 +- > arch/arm/mach-at91/board-cpu9krea.c | 4 +- > arch/arm/mach-at91/board-dt.c | 2 +- > arch/arm/mach-at91/board-neocore926.c | 2 +- > arch/arm/mach-at91/board-pcontrol-g20.c | 4 +- > arch/arm/mach-at91/board-qil-a9260.c | 2 +- > arch/arm/mach-at91/board-sam9-l9260.c | 2 +- > arch/arm/mach-at91/board-sam9260ek.c | 2 +- > arch/arm/mach-at91/board-sam9261ek.c | 4 +- > arch/arm/mach-at91/board-sam9263ek.c | 2 +- > arch/arm/mach-at91/board-sam9g20ek.c | 2 +- > arch/arm/mach-at91/board-sam9m10g45ek.c | 2 +- > arch/arm/mach-at91/board-sam9rlek.c | 2 +- > arch/arm/mach-at91/board-snapper9260.c | 2 +- > arch/arm/mach-at91/board-stamp9g20.c | 2 +- > arch/arm/mach-at91/board-usb-a926x.c | 4 +- > arch/arm/mach-at91/include/mach/at91cap9.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9261.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9263.h | 4 +- > arch/arm/mach-at91/include/mach/at91sam9_smc.h | 17 ++--- > arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 +- > arch/arm/mach-at91/sam9_smc.c | 110 ++++++++++++++---------- > arch/arm/mach-at91/sam9_smc.h | 3 +- > 33 files changed, 114 insertions(+), 88 deletions(-) > rewrite arch/arm/mach-at91/sam9_smc.c (61%) > > diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c > index abfe368..1ea9312 100644 > --- a/arch/arm/mach-at91/at91cap9.c > +++ b/arch/arm/mach-at91/at91cap9.c > @@ -28,6 +28,7 @@ > #include "soc.h" > #include "generic.h" > #include "clock.h" > +#include "sam9_smc.h" > > /* -------------------------------------------------------------------- > * Clocks > @@ -336,6 +337,7 @@ static void __init at91cap9_map_io(void) > static void __init at91cap9_ioremap_registers(void) > { > at91sam926x_ioremap_pit(AT91CAP9_BASE_PIT); > + at91sam9_ioremap_smc(0, AT91CAP9_BASE_SMC); > } > > static void __init at91cap9_initialize(void) > diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c > index c67d50c..c06c14f 100644 > --- a/arch/arm/mach-at91/at91rm9200.c > +++ b/arch/arm/mach-at91/at91rm9200.c > @@ -23,6 +23,7 @@ > #include "soc.h" > #include "generic.h" > #include "clock.h" > +#include "sam9_smc.h" > > static struct map_desc at91rm9200_io_desc[] __initdata = { > { > diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c > index 0030d5f..fc1f734 100644 > --- a/arch/arm/mach-at91/at91sam9260.c > +++ b/arch/arm/mach-at91/at91sam9260.c > @@ -26,6 +26,7 @@ > #include "soc.h" > #include "generic.h" > #include "clock.h" > +#include "sam9_smc.h" > > /* -------------------------------------------------------------------- > * Clocks > @@ -328,6 +329,7 @@ static void __init at91sam9260_map_io(void) > static void __init at91sam9260_ioremap_registers(void) > { > at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT); > + at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC); > } > > static void __init at91sam9260_initialize(void) > diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c > index 348d5ae..804181a 100644 > --- a/arch/arm/mach-at91/at91sam9261.c > +++ b/arch/arm/mach-at91/at91sam9261.c > @@ -25,6 +25,7 @@ > #include "soc.h" > #include "generic.h" > #include "clock.h" > +#include "sam9_smc.h" > > /* -------------------------------------------------------------------- > * Clocks > @@ -288,6 +289,7 @@ static void __init at91sam9261_map_io(void) > static void __init at91sam9261_ioremap_registers(void) > { > at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT); > + at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC); > } > > static void __init at91sam9261_initialize(void) > diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c > index 09ccf73..b8f4996 100644 > --- a/arch/arm/mach-at91/at91sam9263.c > +++ b/arch/arm/mach-at91/at91sam9263.c > @@ -24,6 +24,7 @@ > #include "soc.h" > #include "generic.h" > #include "clock.h" > +#include "sam9_smc.h" > > /* -------------------------------------------------------------------- > * Clocks > @@ -306,6 +307,8 @@ static void __init at91sam9263_map_io(void) > static void __init at91sam9263_ioremap_registers(void) > { > at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT); > + at91sam9_ioremap_smc(0, AT91SAM9263_BASE_SMC0); > + at91sam9_ioremap_smc(1, AT91SAM9263_BASE_SMC1); > } > > static void __init at91sam9263_initialize(void) > diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c > index aa8b441..ce3233f 100644 > --- a/arch/arm/mach-at91/at91sam9g45.c > +++ b/arch/arm/mach-at91/at91sam9g45.c > @@ -26,6 +26,7 @@ > #include "soc.h" > #include "generic.h" > #include "clock.h" > +#include "sam9_smc.h" > > /* -------------------------------------------------------------------- > * Clocks > @@ -341,6 +342,7 @@ static void __init at91sam9g45_map_io(void) > static void __init at91sam9g45_ioremap_registers(void) > { > at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT); > + at91sam9_ioremap_smc(0, AT91SAM9G45_BASE_SMC); > } > > static void __init at91sam9g45_initialize(void) > diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c > index 291fc99..1bcccd7 100644 > --- a/arch/arm/mach-at91/at91sam9rl.c > +++ b/arch/arm/mach-at91/at91sam9rl.c > @@ -25,6 +25,7 @@ > #include "soc.h" > #include "generic.h" > #include "clock.h" > +#include "sam9_smc.h" > > /* -------------------------------------------------------------------- > * Clocks > @@ -293,6 +294,7 @@ static void __init at91sam9rl_map_io(void) > static void __init at91sam9rl_ioremap_registers(void) > { > at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT); > + at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC); > } > > static void __init at91sam9rl_initialize(void) > diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c > index f90cfb3..02ded92 100644 > --- a/arch/arm/mach-at91/board-cam60.c > +++ b/arch/arm/mach-at91/board-cam60.c > @@ -163,7 +163,7 @@ static struct sam9_smc_config __initdata cam60_nand_smc_config = { > static void __init cam60_add_device_nand(void) > { > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &cam60_nand_smc_config); > + sam9_smc_configure(0, 3, &cam60_nand_smc_config); > > at91_add_device_nand(&cam60_nand_data); > } > diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c > index 5dffd3b..da2616f 100644 > --- a/arch/arm/mach-at91/board-cap9adk.c > +++ b/arch/arm/mach-at91/board-cap9adk.c > @@ -212,7 +212,7 @@ static void __init cap9adk_add_device_nand(void) > cap9adk_nand_smc_config.mode |= AT91_SMC_DBW_8; > > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &cap9adk_nand_smc_config); > + sam9_smc_configure(0, 3, &cap9adk_nand_smc_config); > > at91_add_device_nand(&cap9adk_nand_data); > } > @@ -282,7 +282,7 @@ static __init void cap9adk_add_device_nor(void) > at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_EBI_VDDIOMSEL_3_3V); > > /* configure chip-select 0 (NOR) */ > - sam9_smc_configure(0, &cap9adk_nor_smc_config); > + sam9_smc_configure(0, 0, &cap9adk_nor_smc_config); > > platform_device_register(&cap9adk_nor_flash); > } > diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c > index fc885a4..7dd752e 100644 > --- a/arch/arm/mach-at91/board-cpu9krea.c > +++ b/arch/arm/mach-at91/board-cpu9krea.c > @@ -156,7 +156,7 @@ static struct sam9_smc_config __initdata cpu9krea_nand_smc_config = { > > static void __init cpu9krea_add_device_nand(void) > { > - sam9_smc_configure(3, &cpu9krea_nand_smc_config); > + sam9_smc_configure(0, 3, &cpu9krea_nand_smc_config); > at91_add_device_nand(&cpu9krea_nand_data); > } > > @@ -238,7 +238,7 @@ static __init void cpu9krea_add_device_nor(void) > at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_VDDIOMSEL_3_3V); > > /* configure chip-select 0 (NOR) */ > - sam9_smc_configure(0, &cpu9krea_nor_smc_config); > + sam9_smc_configure(0, 0, &cpu9krea_nor_smc_config); > > platform_device_register(&cpu9krea_nor_flash); > } > diff --git a/arch/arm/mach-at91/board-dt.c b/arch/arm/mach-at91/board-dt.c > index 0b7d327..41d84d9 100644 > --- a/arch/arm/mach-at91/board-dt.c > +++ b/arch/arm/mach-at91/board-dt.c > @@ -82,7 +82,7 @@ static void __init ek_add_device_nand(void) > ek_nand_smc_config.mode |= AT91_SMC_DBW_8; > > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &ek_nand_smc_config); > + sam9_smc_configure(0, 3, &ek_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c > index ef816c1..a9b9adc 100644 > --- a/arch/arm/mach-at91/board-neocore926.c > +++ b/arch/arm/mach-at91/board-neocore926.c > @@ -213,7 +213,7 @@ static struct sam9_smc_config __initdata neocore926_nand_smc_config = { > static void __init neocore926_add_device_nand(void) > { > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &neocore926_nand_smc_config); > + sam9_smc_configure(0, 3, &neocore926_nand_smc_config); > > at91_add_device_nand(&neocore926_nand_data); > } > diff --git a/arch/arm/mach-at91/board-pcontrol-g20.c b/arch/arm/mach-at91/board-pcontrol-g20.c > index 49e3f69..0e3c632 100644 > --- a/arch/arm/mach-at91/board-pcontrol-g20.c > +++ b/arch/arm/mach-at91/board-pcontrol-g20.c > @@ -96,9 +96,9 @@ static struct sam9_smc_config __initdata pcontrol_smc_config[2] = { { > static void __init add_device_pcontrol(void) > { > /* configure chip-select 4 (IO compatible to 8051 X4 ) */ > - sam9_smc_configure(4, &pcontrol_smc_config[0]); > + sam9_smc_configure(0, 4, &pcontrol_smc_config[0]); > /* configure chip-select 7 (FerroRAM 256KiBx16bit MR2A16A D4 ) */ > - sam9_smc_configure(7, &pcontrol_smc_config[1]); > + sam9_smc_configure(0, 7, &pcontrol_smc_config[1]); > } > > > diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c > index 07421bd..89d44c0 100644 > --- a/arch/arm/mach-at91/board-qil-a9260.c > +++ b/arch/arm/mach-at91/board-qil-a9260.c > @@ -161,7 +161,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = { > static void __init ek_add_device_nand(void) > { > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &ek_nand_smc_config); > + sam9_smc_configure(0, 3, &ek_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c > index 072d53a..e0283c5 100644 > --- a/arch/arm/mach-at91/board-sam9-l9260.c > +++ b/arch/arm/mach-at91/board-sam9-l9260.c > @@ -162,7 +162,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = { > static void __init ek_add_device_nand(void) > { > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &ek_nand_smc_config); > + sam9_smc_configure(0, 3, &ek_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c > index 4f10181..00db0f8 100644 > --- a/arch/arm/mach-at91/board-sam9260ek.c > +++ b/arch/arm/mach-at91/board-sam9260ek.c > @@ -211,7 +211,7 @@ static void __init ek_add_device_nand(void) > ek_nand_smc_config.mode |= AT91_SMC_DBW_8; > > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &ek_nand_smc_config); > + sam9_smc_configure(0, 3, &ek_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c > index b005b73..a879b33 100644 > --- a/arch/arm/mach-at91/board-sam9261ek.c > +++ b/arch/arm/mach-at91/board-sam9261ek.c > @@ -131,7 +131,7 @@ static struct sam9_smc_config __initdata dm9000_smc_config = { > static void __init ek_add_device_dm9000(void) > { > /* Configure chip-select 2 (DM9000) */ > - sam9_smc_configure(2, &dm9000_smc_config); > + sam9_smc_configure(0, 2, &dm9000_smc_config); > > /* Configure Reset signal as output */ > at91_set_gpio_output(AT91_PIN_PC10, 0); > @@ -217,7 +217,7 @@ static void __init ek_add_device_nand(void) > ek_nand_smc_config.mode |= AT91_SMC_DBW_8; > > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &ek_nand_smc_config); > + sam9_smc_configure(0, 3, &ek_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c > index bccdcf2..7b25ca1 100644 > --- a/arch/arm/mach-at91/board-sam9263ek.c > +++ b/arch/arm/mach-at91/board-sam9263ek.c > @@ -218,7 +218,7 @@ static void __init ek_add_device_nand(void) > ek_nand_smc_config.mode |= AT91_SMC_DBW_8; > > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &ek_nand_smc_config); > + sam9_smc_configure(0, 3, &ek_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c > index 64fc75c..0579f06 100644 > --- a/arch/arm/mach-at91/board-sam9g20ek.c > +++ b/arch/arm/mach-at91/board-sam9g20ek.c > @@ -195,7 +195,7 @@ static void __init ek_add_device_nand(void) > ek_nand_smc_config.mode |= AT91_SMC_DBW_8; > > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &ek_nand_smc_config); > + sam9_smc_configure(0, 3, &ek_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c > index 92de9127..3e0d5a9 100644 > --- a/arch/arm/mach-at91/board-sam9m10g45ek.c > +++ b/arch/arm/mach-at91/board-sam9m10g45ek.c > @@ -175,7 +175,7 @@ static void __init ek_add_device_nand(void) > ek_nand_smc_config.mode |= AT91_SMC_DBW_8; > > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &ek_nand_smc_config); > + sam9_smc_configure(0, 3, &ek_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c > index b2b7482..c561eda 100644 > --- a/arch/arm/mach-at91/board-sam9rlek.c > +++ b/arch/arm/mach-at91/board-sam9rlek.c > @@ -119,7 +119,7 @@ static struct sam9_smc_config __initdata ek_nand_smc_config = { > static void __init ek_add_device_nand(void) > { > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &ek_nand_smc_config); > + sam9_smc_configure(0, 3, &ek_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c > index 0df01c6..645d833 100644 > --- a/arch/arm/mach-at91/board-snapper9260.c > +++ b/arch/arm/mach-at91/board-snapper9260.c > @@ -149,7 +149,7 @@ static struct i2c_board_info __initdata snapper9260_i2c_devices[] = { > static void __init snapper9260_add_device_nand(void) > { > at91_set_A_periph(AT91_PIN_PC14, 0); > - sam9_smc_configure(3, &snapper9260_nand_smc_config); > + sam9_smc_configure(0, 3, &snapper9260_nand_smc_config); > at91_add_device_nand(&snapper9260_nand_data); > } > > diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c > index 936e5fd..f94ac86 100644 > --- a/arch/arm/mach-at91/board-stamp9g20.c > +++ b/arch/arm/mach-at91/board-stamp9g20.c > @@ -108,7 +108,7 @@ static struct sam9_smc_config __initdata nand_smc_config = { > static void __init add_device_nand(void) > { > /* configure chip-select 3 (NAND) */ > - sam9_smc_configure(3, &nand_smc_config); > + sam9_smc_configure(0, 3, &nand_smc_config); > > at91_add_device_nand(&nand_data); > } > diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c > index 0a20bab..6f893cf 100644 > --- a/arch/arm/mach-at91/board-usb-a926x.c > +++ b/arch/arm/mach-at91/board-usb-a926x.c > @@ -245,9 +245,9 @@ static void __init ek_add_device_nand(void) > > /* configure chip-select 3 (NAND) */ > if (machine_is_usb_a9g20()) > - sam9_smc_configure(3, &usb_a9g20_nand_smc_config); > + sam9_smc_configure(0, 3, &usb_a9g20_nand_smc_config); > else > - sam9_smc_configure(3, &usb_a9260_nand_smc_config); > + sam9_smc_configure(0, 3, &usb_a9260_nand_smc_config); > > at91_add_device_nand(&ek_nand_data); > } > diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h > index ad8d298..d7d0b68 100644 > --- a/arch/arm/mach-at91/include/mach/at91cap9.h > +++ b/arch/arm/mach-at91/include/mach/at91cap9.h > @@ -81,7 +81,6 @@ > */ > #define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS) > #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) > -#define AT91_SMC (0xffffe800 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) > #define AT91_CCFG (0xffffeb10 - AT91_BASE_SYS) > #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > @@ -96,6 +95,7 @@ > > #define AT91CAP9_BASE_ECC 0xffffe200 > #define AT91CAP9_BASE_DMA 0xffffec00 > +#define AT91CAP9_BASE_SMC 0xffffe800 > #define AT91CAP9_BASE_PIOA 0xfffff200 > #define AT91CAP9_BASE_PIOB 0xfffff400 > #define AT91CAP9_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h > index b8c85dc..e55ab6a 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9260.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h > @@ -81,7 +81,6 @@ > * System Peripherals (offset from AT91_BASE_SYS) > */ > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > -#define AT91_SMC (0xffffec00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > #define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > @@ -93,6 +92,7 @@ > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > #define AT91SAM9260_BASE_ECC 0xffffe800 > +#define AT91SAM9260_BASE_SMC 0xffffec00 > #define AT91SAM9260_BASE_PIOA 0xfffff400 > #define AT91SAM9260_BASE_PIOB 0xfffff600 > #define AT91SAM9260_BASE_PIOC 0xfffff800 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h > index 0dccaff..1ea2d6b 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9261.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h > @@ -66,7 +66,6 @@ > * System Peripherals (offset from AT91_BASE_SYS) > */ > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > -#define AT91_SMC (0xffffec00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > @@ -76,6 +75,7 @@ > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > +#define AT91SAM9261_BASE_SMC 0xffffec00 > #define AT91SAM9261_BASE_PIOA 0xfffff400 > #define AT91SAM9261_BASE_PIOB 0xfffff600 > #define AT91SAM9261_BASE_PIOC 0xfffff800 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h > index 735408e..b827ff7 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9263.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h > @@ -75,9 +75,7 @@ > * System Peripherals (offset from AT91_BASE_SYS) > */ > #define AT91_SDRAMC0 (0xffffe200 - AT91_BASE_SYS) > -#define AT91_SMC0 (0xffffe400 - AT91_BASE_SYS) > #define AT91_SDRAMC1 (0xffffe800 - AT91_BASE_SYS) > -#define AT91_SMC1 (0xffffea00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffec00 - AT91_BASE_SYS) > #define AT91_CCFG (0xffffed10 - AT91_BASE_SYS) > #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > @@ -89,7 +87,9 @@ > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > > #define AT91SAM9263_BASE_ECC0 0xffffe000 > +#define AT91SAM9263_BASE_SMC0 0xffffe400 > #define AT91SAM9263_BASE_ECC1 0xffffe600 > +#define AT91SAM9263_BASE_SMC1 0xffffea00 > #define AT91SAM9263_BASE_PIOA 0xfffff200 > #define AT91SAM9263_BASE_PIOB 0xfffff400 > #define AT91SAM9263_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9_smc.h b/arch/arm/mach-at91/include/mach/at91sam9_smc.h > index 57de620..eb18a70 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9_smc.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9_smc.h > @@ -16,7 +16,9 @@ > #ifndef AT91SAM9_SMC_H > #define AT91SAM9_SMC_H > > -#define AT91_SMC_SETUP(n) (AT91_SMC + 0x00 + ((n)*0x10)) /* Setup Register for CS n */ > +#include <mach/cpu.h> > + > +#define AT91_SMC_SETUP 0x00 /* Setup Register for CS n */ > #define AT91_SMC_NWESETUP (0x3f << 0) /* NWE Setup Length */ > #define AT91_SMC_NWESETUP_(x) ((x) << 0) > #define AT91_SMC_NCS_WRSETUP (0x3f << 8) /* NCS Setup Length in Write Access */ > @@ -26,7 +28,7 @@ > #define AT91_SMC_NCS_RDSETUP (0x3f << 24) /* NCS Setup Length in Read Access */ > #define AT91_SMC_NCS_RDSETUP_(x) ((x) << 24) > > -#define AT91_SMC_PULSE(n) (AT91_SMC + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */ > +#define AT91_SMC_PULSE 0x04 /* Pulse Register for CS n */ > #define AT91_SMC_NWEPULSE (0x7f << 0) /* NWE Pulse Length */ > #define AT91_SMC_NWEPULSE_(x) ((x) << 0) > #define AT91_SMC_NCS_WRPULSE (0x7f << 8) /* NCS Pulse Length in Write Access */ > @@ -36,13 +38,13 @@ > #define AT91_SMC_NCS_RDPULSE (0x7f << 24) /* NCS Pulse Length in Read Access */ > #define AT91_SMC_NCS_RDPULSE_(x)((x) << 24) > > -#define AT91_SMC_CYCLE(n) (AT91_SMC + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */ > +#define AT91_SMC_CYCLE 0x08 /* Cycle Register for CS n */ > #define AT91_SMC_NWECYCLE (0x1ff << 0 ) /* Total Write Cycle Length */ > #define AT91_SMC_NWECYCLE_(x) ((x) << 0) > #define AT91_SMC_NRDCYCLE (0x1ff << 16) /* Total Read Cycle Length */ > #define AT91_SMC_NRDCYCLE_(x) ((x) << 16) > > -#define AT91_SMC_MODE(n) (AT91_SMC + 0x0c + ((n)*0x10)) /* Mode Register for CS n */ > +#define AT91_SMC_MODE 0x0c /* Mode Register for CS n */ > #define AT91_SMC_READMODE (1 << 0) /* Read Mode */ > #define AT91_SMC_WRITEMODE (1 << 1) /* Write Mode */ > #define AT91_SMC_EXNWMODE (3 << 4) /* NWAIT Mode */ > @@ -66,11 +68,4 @@ > #define AT91_SMC_PS_16 (2 << 28) > #define AT91_SMC_PS_32 (3 << 28) > > -#if defined(AT91_SMC1) /* The AT91SAM9263 has 2 Static Memory contollers */ > -#define AT91_SMC1_SETUP(n) (AT91_SMC1 + 0x00 + ((n)*0x10)) /* Setup Register for CS n */ > -#define AT91_SMC1_PULSE(n) (AT91_SMC1 + 0x04 + ((n)*0x10)) /* Pulse Register for CS n */ > -#define AT91_SMC1_CYCLE(n) (AT91_SMC1 + 0x08 + ((n)*0x10)) /* Cycle Register for CS n */ > -#define AT91_SMC1_MODE(n) (AT91_SMC1 + 0x0c + ((n)*0x10)) /* Mode Register for CS n */ > -#endif > - > #endif > diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h > index ba609f3..ac051d4 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h > @@ -88,7 +88,6 @@ > */ > #define AT91_DDRSDRC1 (0xffffe400 - AT91_BASE_SYS) > #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) > -#define AT91_SMC (0xffffe800 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) > #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > @@ -101,6 +100,7 @@ > > #define AT91SAM9G45_BASE_ECC 0xffffe200 > #define AT91SAM9G45_BASE_DMA 0xffffec00 > +#define AT91SAM9G45_BASE_SMC 0xffffe800 > #define AT91SAM9G45_BASE_PIOA 0xfffff200 > #define AT91SAM9G45_BASE_PIOB 0xfffff400 > #define AT91SAM9G45_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h > index bab09a7..846139d 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h > @@ -70,7 +70,6 @@ > * System Peripherals (offset from AT91_BASE_SYS) > */ > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > -#define AT91_SMC (0xffffec00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > #define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > @@ -85,6 +84,7 @@ > > #define AT91SAM9RL_BASE_DMA 0xffffe600 > #define AT91SAM9RL_BASE_ECC 0xffffe800 > +#define AT91SAM9RL_BASE_SMC 0xffffec00 > #define AT91SAM9RL_BASE_PIOA 0xfffff400 > #define AT91SAM9RL_BASE_PIOB 0xfffff600 > #define AT91SAM9RL_BASE_PIOC 0xfffff800 > diff --git a/arch/arm/mach-at91/sam9_smc.c b/arch/arm/mach-at91/sam9_smc.c > dissimilarity index 61% > index 5eab6aa6..7604ccc 100644 > --- a/arch/arm/mach-at91/sam9_smc.c > +++ b/arch/arm/mach-at91/sam9_smc.c > @@ -1,47 +1,63 @@ > -/* > - * linux/arch/arm/mach-at91/sam9_smc.c > - * > - * Copyright (C) 2008 Andrew Victor > - * > - * This program is free software; you can redistribute it and/or modify > - * it under the terms of the GNU General Public License version 2 as > - * published by the Free Software Foundation. > - */ > - > -#include <linux/module.h> > -#include <linux/io.h> > - > -#include <mach/at91sam9_smc.h> > - > -#include "sam9_smc.h" > - > -void __init sam9_smc_configure(int cs, struct sam9_smc_config* config) > -{ > - /* Setup register */ > - at91_sys_write(AT91_SMC_SETUP(cs), > - AT91_SMC_NWESETUP_(config->nwe_setup) > - | AT91_SMC_NCS_WRSETUP_(config->ncs_write_setup) > - | AT91_SMC_NRDSETUP_(config->nrd_setup) > - | AT91_SMC_NCS_RDSETUP_(config->ncs_read_setup) > - ); > - > - /* Pulse register */ > - at91_sys_write(AT91_SMC_PULSE(cs), > - AT91_SMC_NWEPULSE_(config->nwe_pulse) > - | AT91_SMC_NCS_WRPULSE_(config->ncs_write_pulse) > - | AT91_SMC_NRDPULSE_(config->nrd_pulse) > - | AT91_SMC_NCS_RDPULSE_(config->ncs_read_pulse) > - ); > - > - /* Cycle register */ > - at91_sys_write(AT91_SMC_CYCLE(cs), > - AT91_SMC_NWECYCLE_(config->write_cycle) > - | AT91_SMC_NRDCYCLE_(config->read_cycle) > - ); > - > - /* Mode register */ > - at91_sys_write(AT91_SMC_MODE(cs), > - config->mode > - | AT91_SMC_TDF_(config->tdf_cycles) > - ); > -} > +/* > + * linux/arch/arm/mach-at91/sam9_smc.c > + * > + * Copyright (C) 2008 Andrew Victor > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + */ > + > +#include <linux/module.h> > +#include <linux/io.h> > +#include <linux/of.h> > +#include <linux/of_address.h> > + > +#include <mach/at91sam9_smc.h> > + > +#include "sam9_smc.h" > + > + > +#define AT91_SMC_CS(id, n) (smc_base_addr[id] + ((n) * 0x10)) > + > +static void __iomem *smc_base_addr[2]; > + > +static void __init sam9_smc_cs_configure(void __iomem *base, struct sam9_smc_config* config) > +{ > + > + /* Setup register */ > + __raw_writel(AT91_SMC_NWESETUP_(config->nwe_setup) > + | AT91_SMC_NCS_WRSETUP_(config->ncs_write_setup) > + | AT91_SMC_NRDSETUP_(config->nrd_setup) > + | AT91_SMC_NCS_RDSETUP_(config->ncs_read_setup), > + base + AT91_SMC_SETUP); > + > + /* Pulse register */ > + __raw_writel(AT91_SMC_NWEPULSE_(config->nwe_pulse) > + | AT91_SMC_NCS_WRPULSE_(config->ncs_write_pulse) > + | AT91_SMC_NRDPULSE_(config->nrd_pulse) > + | AT91_SMC_NCS_RDPULSE_(config->ncs_read_pulse), > + base + AT91_SMC_PULSE); > + > + /* Cycle register */ > + __raw_writel(AT91_SMC_NWECYCLE_(config->write_cycle) > + | AT91_SMC_NRDCYCLE_(config->read_cycle), > + base + AT91_SMC_CYCLE); > + > + /* Mode register */ > + __raw_writel(config->mode > + | AT91_SMC_TDF_(config->tdf_cycles), > + base + AT91_SMC_MODE); > +} > + > +void __init sam9_smc_configure(int id, int cs, struct sam9_smc_config* config) > +{ > + sam9_smc_cs_configure(AT91_SMC_CS(id, cs), config); > +} > + > +void __init at91sam9_ioremap_smc(int id, u32 addr) > +{ > + if (id > 1) > + return; Blank line here > + smc_base_addr[id] = ioremap(addr, 512); Ditto: error path to ease debugging... > +} > diff --git a/arch/arm/mach-at91/sam9_smc.h b/arch/arm/mach-at91/sam9_smc.h > index bf72cfb..039c5ce 100644 > --- a/arch/arm/mach-at91/sam9_smc.h > +++ b/arch/arm/mach-at91/sam9_smc.h > @@ -30,4 +30,5 @@ struct sam9_smc_config { > u8 tdf_cycles:4; > }; > > -extern void __init sam9_smc_configure(int cs, struct sam9_smc_config* config); > +extern void __init sam9_smc_configure(int id, int cs, struct sam9_smc_config* config); > +extern void __init at91sam9_ioremap_smc(int id, u32 addr);
Maybe we can rid of this value... On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > arch/arm/mach-at91/include/mach/at91cap9.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9263.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 +- > 4 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h > index d7d0b68..cf8cd56 100644 > --- a/arch/arm/mach-at91/include/mach/at91cap9.h > +++ b/arch/arm/mach-at91/include/mach/at91cap9.h > @@ -82,7 +82,6 @@ > #define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS) > #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) > -#define AT91_CCFG (0xffffeb10 - AT91_BASE_SYS) > #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > @@ -96,6 +95,7 @@ > #define AT91CAP9_BASE_ECC 0xffffe200 > #define AT91CAP9_BASE_DMA 0xffffec00 > #define AT91CAP9_BASE_SMC 0xffffe800 > +#define AT91CAP9_BASE_CCFG 0xffffeb10 > #define AT91CAP9_BASE_PIOA 0xfffff200 > #define AT91CAP9_BASE_PIOB 0xfffff400 > #define AT91CAP9_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h > index e55ab6a..930a7a8 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9260.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h > @@ -82,7 +82,6 @@ > */ > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > -#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > @@ -93,6 +92,7 @@ > > #define AT91SAM9260_BASE_ECC 0xffffe800 > #define AT91SAM9260_BASE_SMC 0xffffec00 > +#define AT91SAM9260_BASE_CCFG 0xffffef10 > #define AT91SAM9260_BASE_PIOA 0xfffff400 > #define AT91SAM9260_BASE_PIOB 0xfffff600 > #define AT91SAM9260_BASE_PIOC 0xfffff800 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h > index b827ff7..5b6b2b1 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9263.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h > @@ -77,7 +77,6 @@ > #define AT91_SDRAMC0 (0xffffe200 - AT91_BASE_SYS) > #define AT91_SDRAMC1 (0xffffe800 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffec00 - AT91_BASE_SYS) > -#define AT91_CCFG (0xffffed10 - AT91_BASE_SYS) > #define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > @@ -90,6 +89,7 @@ > #define AT91SAM9263_BASE_SMC0 0xffffe400 > #define AT91SAM9263_BASE_ECC1 0xffffe600 > #define AT91SAM9263_BASE_SMC1 0xffffea00 > +#define AT91SAM9263_BASE_CCFG 0xffffed10 > #define AT91SAM9263_BASE_PIOA 0xfffff200 > #define AT91SAM9263_BASE_PIOB 0xfffff400 > #define AT91SAM9263_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h > index 846139d..c94e691 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h > @@ -71,7 +71,6 @@ > */ > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > -#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > @@ -85,6 +84,7 @@ > #define AT91SAM9RL_BASE_DMA 0xffffe600 > #define AT91SAM9RL_BASE_ECC 0xffffe800 > #define AT91SAM9RL_BASE_SMC 0xffffec00 > +#define AT91SAM9RL_BASE_CCFG 0xffffef10 > #define AT91SAM9RL_BASE_PIOA 0xfffff400 > #define AT91SAM9RL_BASE_PIOB 0xfffff600 > #define AT91SAM9RL_BASE_PIOC 0xfffff800
Beware, this patch can conflict with current initiative to rework the reboot code. On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Check my comment below, otherwise: Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > arch/arm/mach-at91/at91cap9.c | 10 +--------- > arch/arm/mach-at91/at91sam9260.c | 10 +--------- > arch/arm/mach-at91/at91sam9261.c | 10 +--------- > arch/arm/mach-at91/at91sam9263.c | 10 +--------- > arch/arm/mach-at91/at91sam9g45.c | 10 +--------- > arch/arm/mach-at91/at91sam9rl.c | 10 +--------- > arch/arm/mach-at91/generic.h | 3 +++ > arch/arm/mach-at91/include/mach/at91_shdwc.h | 6 +++--- > arch/arm/mach-at91/include/mach/at91cap9.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9261.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9263.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 +- > arch/arm/mach-at91/setup.c | 15 +++++++++++++++ > 15 files changed, 33 insertions(+), 63 deletions(-) > > diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c > index 1ea9312..652dbe1 100644 > --- a/arch/arm/mach-at91/at91cap9.c > +++ b/arch/arm/mach-at91/at91cap9.c > @@ -13,7 +13,6 @@ > */ > > #include <linux/module.h> > -#include <linux/pm.h> > > #include <asm/irq.h> > #include <asm/mach/arch.h> > @@ -23,7 +22,6 @@ > #include <mach/at91cap9.h> > #include <mach/at91_pmc.h> > #include <mach/at91_rstc.h> > -#include <mach/at91_shdwc.h> > > #include "soc.h" > #include "generic.h" > @@ -319,12 +317,6 @@ static void at91cap9_reset(void) > at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST); > } > > -static void at91cap9_poweroff(void) > -{ > - at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); > -} > - > - > /* -------------------------------------------------------------------- > * AT91CAP9 processor initialization > * -------------------------------------------------------------------- */ > @@ -336,6 +328,7 @@ static void __init at91cap9_map_io(void) > > static void __init at91cap9_ioremap_registers(void) > { > + at91_ioremap_shdwc(AT91CAP9_BASE_SHDWC); > at91sam926x_ioremap_pit(AT91CAP9_BASE_PIT); > at91sam9_ioremap_smc(0, AT91CAP9_BASE_SMC); > } > @@ -343,7 +336,6 @@ static void __init at91cap9_ioremap_registers(void) > static void __init at91cap9_initialize(void) > { > at91_arch_reset = at91cap9_reset; > - pm_power_off = at91cap9_poweroff; > at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1); > > /* Register GPIO subsystem */ > diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c > index fc1f734..5a17a23 100644 > --- a/arch/arm/mach-at91/at91sam9260.c > +++ b/arch/arm/mach-at91/at91sam9260.c > @@ -11,7 +11,6 @@ > */ > > #include <linux/module.h> > -#include <linux/pm.h> > > #include <asm/irq.h> > #include <asm/mach/arch.h> > @@ -21,7 +20,6 @@ > #include <mach/at91sam9260.h> > #include <mach/at91_pmc.h> > #include <mach/at91_rstc.h> > -#include <mach/at91_shdwc.h> > > #include "soc.h" > #include "generic.h" > @@ -287,12 +285,6 @@ static struct at91_gpio_bank at91sam9260_gpio[] = { > } > }; > > -static void at91sam9260_poweroff(void) > -{ > - at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); > -} > - > - > /* -------------------------------------------------------------------- > * AT91SAM9260 processor initialization > * -------------------------------------------------------------------- */ > @@ -328,6 +320,7 @@ static void __init at91sam9260_map_io(void) > > static void __init at91sam9260_ioremap_registers(void) > { > + at91_ioremap_shdwc(AT91SAM9260_BASE_SHDWC); > at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT); > at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC); > } > @@ -335,7 +328,6 @@ static void __init at91sam9260_ioremap_registers(void) > static void __init at91sam9260_initialize(void) > { > at91_arch_reset = at91sam9_alt_reset; > - pm_power_off = at91sam9260_poweroff; > at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1) > | (1 << AT91SAM9260_ID_IRQ2); > > diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c > index 804181a..80e3e0f 100644 > --- a/arch/arm/mach-at91/at91sam9261.c > +++ b/arch/arm/mach-at91/at91sam9261.c > @@ -11,7 +11,6 @@ > */ > > #include <linux/module.h> > -#include <linux/pm.h> > > #include <asm/irq.h> > #include <asm/mach/arch.h> > @@ -20,7 +19,6 @@ > #include <mach/at91sam9261.h> > #include <mach/at91_pmc.h> > #include <mach/at91_rstc.h> > -#include <mach/at91_shdwc.h> > > #include "soc.h" > #include "generic.h" > @@ -268,12 +266,6 @@ static struct at91_gpio_bank at91sam9261_gpio[] = { > } > }; > > -static void at91sam9261_poweroff(void) > -{ > - at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); > -} > - > - > /* -------------------------------------------------------------------- > * AT91SAM9261 processor initialization > * -------------------------------------------------------------------- */ > @@ -288,6 +280,7 @@ static void __init at91sam9261_map_io(void) > > static void __init at91sam9261_ioremap_registers(void) > { > + at91_ioremap_shdwc(AT91SAM9261_BASE_SHDWC); > at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT); > at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC); > } > @@ -295,7 +288,6 @@ static void __init at91sam9261_ioremap_registers(void) > static void __init at91sam9261_initialize(void) > { > at91_arch_reset = at91sam9_alt_reset; > - pm_power_off = at91sam9261_poweroff; > at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1) > | (1 << AT91SAM9261_ID_IRQ2); > > diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c > index b8f4996..2a42b99 100644 > --- a/arch/arm/mach-at91/at91sam9263.c > +++ b/arch/arm/mach-at91/at91sam9263.c > @@ -11,7 +11,6 @@ > */ > > #include <linux/module.h> > -#include <linux/pm.h> > > #include <asm/irq.h> > #include <asm/mach/arch.h> > @@ -19,7 +18,6 @@ > #include <mach/at91sam9263.h> > #include <mach/at91_pmc.h> > #include <mach/at91_rstc.h> > -#include <mach/at91_shdwc.h> > > #include "soc.h" > #include "generic.h" > @@ -288,12 +286,6 @@ static struct at91_gpio_bank at91sam9263_gpio[] = { > } > }; > > -static void at91sam9263_poweroff(void) > -{ > - at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); > -} > - > - > /* -------------------------------------------------------------------- > * AT91SAM9263 processor initialization > * -------------------------------------------------------------------- */ > @@ -306,6 +298,7 @@ static void __init at91sam9263_map_io(void) > > static void __init at91sam9263_ioremap_registers(void) > { > + at91_ioremap_shdwc(AT91SAM9263_BASE_SHDWC); > at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT); > at91sam9_ioremap_smc(0, AT91SAM9263_BASE_SMC0); > at91sam9_ioremap_smc(1, AT91SAM9263_BASE_SMC1); > @@ -314,7 +307,6 @@ static void __init at91sam9263_ioremap_registers(void) > static void __init at91sam9263_initialize(void) > { > at91_arch_reset = at91sam9_alt_reset; > - pm_power_off = at91sam9263_poweroff; > at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1); > > /* Register GPIO subsystem */ > diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c > index ce3233f..7fdf964 100644 > --- a/arch/arm/mach-at91/at91sam9g45.c > +++ b/arch/arm/mach-at91/at91sam9g45.c > @@ -11,7 +11,6 @@ > */ > > #include <linux/module.h> > -#include <linux/pm.h> > #include <linux/dma-mapping.h> > > #include <asm/irq.h> > @@ -20,7 +19,6 @@ > #include <mach/at91sam9g45.h> > #include <mach/at91_pmc.h> > #include <mach/at91_rstc.h> > -#include <mach/at91_shdwc.h> > #include <mach/cpu.h> > > #include "soc.h" > @@ -323,12 +321,6 @@ static void at91sam9g45_reset(void) > at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST); > } > > -static void at91sam9g45_poweroff(void) > -{ > - at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); > -} > - > - > /* -------------------------------------------------------------------- > * AT91SAM9G45 processor initialization > * -------------------------------------------------------------------- */ > @@ -341,6 +333,7 @@ static void __init at91sam9g45_map_io(void) > > static void __init at91sam9g45_ioremap_registers(void) > { > + at91_ioremap_shdwc(AT91SAM9G45_BASE_SHDWC); > at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT); > at91sam9_ioremap_smc(0, AT91SAM9G45_BASE_SMC); > } > @@ -348,7 +341,6 @@ static void __init at91sam9g45_ioremap_registers(void) > static void __init at91sam9g45_initialize(void) > { > at91_arch_reset = at91sam9g45_reset; > - pm_power_off = at91sam9g45_poweroff; > at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0); > > /* Register GPIO subsystem */ > diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c > index 1bcccd7..6856bad 100644 > --- a/arch/arm/mach-at91/at91sam9rl.c > +++ b/arch/arm/mach-at91/at91sam9rl.c > @@ -10,7 +10,6 @@ > */ > > #include <linux/module.h> > -#include <linux/pm.h> > > #include <asm/irq.h> > #include <asm/mach/arch.h> > @@ -20,7 +19,6 @@ > #include <mach/at91sam9rl.h> > #include <mach/at91_pmc.h> > #include <mach/at91_rstc.h> > -#include <mach/at91_shdwc.h> > > #include "soc.h" > #include "generic.h" > @@ -264,12 +262,6 @@ static struct at91_gpio_bank at91sam9rl_gpio[] = { > } > }; > > -static void at91sam9rl_poweroff(void) > -{ > - at91_sys_write(AT91_SHDW_CR, AT91_SHDW_KEY | AT91_SHDW_SHDW); > -} > - > - > /* -------------------------------------------------------------------- > * AT91SAM9RL processor initialization > * -------------------------------------------------------------------- */ > @@ -293,6 +285,7 @@ static void __init at91sam9rl_map_io(void) > > static void __init at91sam9rl_ioremap_registers(void) > { > + at91_ioremap_shdwc(AT91SAM9RL_BASE_SHDWC); > at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT); > at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC); > } > @@ -300,7 +293,6 @@ static void __init at91sam9rl_ioremap_registers(void) > static void __init at91sam9rl_initialize(void) > { > at91_arch_reset = at91sam9_alt_reset; > - pm_power_off = at91sam9rl_poweroff; > at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0); > > /* Register GPIO subsystem */ > diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h > index 8196ecc..bc17764 100644 > --- a/arch/arm/mach-at91/generic.h > +++ b/arch/arm/mach-at91/generic.h > @@ -60,6 +60,9 @@ extern void at91_irq_resume(void); > /* reset */ > extern void at91sam9_alt_reset(void); > > +/* shutdown */ > +extern void at91_ioremap_shdwc(u32 base_addr); > + > /* GPIO */ > #define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */ > #define AT91RM9200_BGA 4 /* AT91RM9200 BGA package has 4 banks */ > diff --git a/arch/arm/mach-at91/include/mach/at91_shdwc.h b/arch/arm/mach-at91/include/mach/at91_shdwc.h > index c4ce07e..e434bd0 100644 > --- a/arch/arm/mach-at91/include/mach/at91_shdwc.h > +++ b/arch/arm/mach-at91/include/mach/at91_shdwc.h > @@ -16,11 +16,11 @@ > #ifndef AT91_SHDWC_H > #define AT91_SHDWC_H > > -#define AT91_SHDW_CR (AT91_SHDWC + 0x00) /* Shut Down Control Register */ > +#define AT91_SHDW_CR 0x00 /* Shut Down Control Register */ > #define AT91_SHDW_SHDW (1 << 0) /* Shut Down command */ > #define AT91_SHDW_KEY (0xa5 << 24) /* KEY Password */ > > -#define AT91_SHDW_MR (AT91_SHDWC + 0x04) /* Shut Down Mode Register */ > +#define AT91_SHDW_MR 0x04 /* Shut Down Mode Register */ > #define AT91_SHDW_WKMODE0 (3 << 0) /* Wake-up 0 Mode Selection */ > #define AT91_SHDW_WKMODE0_NONE 0 > #define AT91_SHDW_WKMODE0_HIGH 1 > @@ -30,7 +30,7 @@ > #define AT91_SHDW_CPTWK0_(x) ((x) << 4) > #define AT91_SHDW_RTTWKEN (1 << 16) /* Real Time Timer Wake-up Enable */ > > -#define AT91_SHDW_SR (AT91_SHDWC + 0x08) /* Shut Down Status Register */ > +#define AT91_SHDW_SR 0x08 /* Shut Down Status Register */ > #define AT91_SHDW_WAKEUP0 (1 << 0) /* Wake-up 0 Status */ > #define AT91_SHDW_RTTWK (1 << 16) /* Real-time Timer Wake-up */ > #define AT91_SHDW_RTCWK (1 << 17) /* Real-time Clock Wake-up [SAM9RL] */ > diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h > index cf8cd56..f2e7c34 100644 > --- a/arch/arm/mach-at91/include/mach/at91cap9.h > +++ b/arch/arm/mach-at91/include/mach/at91cap9.h > @@ -86,7 +86,6 @@ > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (cpu_is_at91cap9_revB() ? \ > (0xfffffd50 - AT91_BASE_SYS) : \ > @@ -100,6 +99,7 @@ > #define AT91CAP9_BASE_PIOB 0xfffff400 > #define AT91CAP9_BASE_PIOC 0xfffff600 > #define AT91CAP9_BASE_PIOD 0xfffff800 > +#define AT91CAP9_BASE_SHDWC 0xfffffd10 > #define AT91CAP9_BASE_RTT 0xfffffd20 > #define AT91CAP9_BASE_PIT 0xfffffd30 > > diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h > index 930a7a8..6a13e9d 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9260.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h > @@ -86,7 +86,6 @@ > #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > @@ -96,6 +95,7 @@ > #define AT91SAM9260_BASE_PIOA 0xfffff400 > #define AT91SAM9260_BASE_PIOB 0xfffff600 > #define AT91SAM9260_BASE_PIOC 0xfffff800 > +#define AT91SAM9260_BASE_SHDWC 0xfffffd10 > #define AT91SAM9260_BASE_RTT 0xfffffd20 > #define AT91SAM9260_BASE_PIT 0xfffffd30 > > diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h > index 1ea2d6b..f9b5163 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9261.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h > @@ -71,7 +71,6 @@ > #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > @@ -79,6 +78,7 @@ > #define AT91SAM9261_BASE_PIOA 0xfffff400 > #define AT91SAM9261_BASE_PIOB 0xfffff600 > #define AT91SAM9261_BASE_PIOC 0xfffff800 > +#define AT91SAM9261_BASE_SHDWC 0xfffffd10 > #define AT91SAM9261_BASE_RTT 0xfffffd20 > #define AT91SAM9261_BASE_PIT 0xfffffd30 > > diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h > index 5b6b2b1..e8fb5bd 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9263.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h > @@ -81,7 +81,6 @@ > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > > @@ -95,6 +94,7 @@ > #define AT91SAM9263_BASE_PIOC 0xfffff600 > #define AT91SAM9263_BASE_PIOD 0xfffff800 > #define AT91SAM9263_BASE_PIOE 0xfffffa00 > +#define AT91SAM9263_BASE_SHDWC 0xfffffd10 > #define AT91SAM9263_BASE_RTT0 0xfffffd20 > #define AT91SAM9263_BASE_PIT 0xfffffd30 > #define AT91SAM9263_BASE_RTT1 0xfffffd50 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h > index ac051d4..5f3453e 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h > @@ -93,7 +93,6 @@ > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > #define AT91_RTC (0xfffffdb0 - AT91_BASE_SYS) > @@ -106,6 +105,7 @@ > #define AT91SAM9G45_BASE_PIOC 0xfffff600 > #define AT91SAM9G45_BASE_PIOD 0xfffff800 > #define AT91SAM9G45_BASE_PIOE 0xfffffa00 > +#define AT91SAM9G45_BASE_SHDWC 0xfffffd10 > #define AT91SAM9G45_BASE_RTT 0xfffffd20 > #define AT91SAM9G45_BASE_PIT 0xfffffd30 > > diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h > index c94e691..e012e69 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h > @@ -75,7 +75,6 @@ > #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_SHDWC (0xfffffd10 - AT91_BASE_SYS) > #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > @@ -89,6 +88,7 @@ > #define AT91SAM9RL_BASE_PIOB 0xfffff600 > #define AT91SAM9RL_BASE_PIOC 0xfffff800 > #define AT91SAM9RL_BASE_PIOD 0xfffffa00 > +#define AT91SAM9RL_BASE_SHDWC 0xfffffd10 > #define AT91SAM9RL_BASE_RTT 0xfffffd20 > #define AT91SAM9RL_BASE_PIT 0xfffffd30 > > diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c > index 63b3ac2..8ba2790 100644 > --- a/arch/arm/mach-at91/setup.c > +++ b/arch/arm/mach-at91/setup.c > @@ -8,6 +8,7 @@ > #include <linux/module.h> > #include <linux/io.h> > #include <linux/mm.h> > +#include <linux/pm.h> > > #include <asm/mach/map.h> > > @@ -15,6 +16,7 @@ > #include <mach/cpu.h> > #include <mach/at91_dbgu.h> > #include <mach/at91_pmc.h> > +#include <mach/at91_shdwc.h> > > #include "soc.h" > #include "generic.h" > @@ -285,6 +287,19 @@ void __init at91_map_io(void) > at91_boot_soc.map_io(); > } > > +static void __iomem *at91_shdwc; > + > +static void at91sam9_poweroff(void) > +{ > + writel(AT91_SHDW_KEY | AT91_SHDW_SHDW, at91_shdwc + AT91_SHDW_CR); > +} > + > +void at91_ioremap_shdwc(u32 base_addr) > +{ > + at91_shdwc = ioremap(base_addr, 16); Ditto: ioremap error path for debugging. > + pm_power_off = at91sam9_poweroff; > +} > + > void __init at91_initialize(unsigned long main_clock) > { > at91_boot_soc.ioremap_registers();
On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > switch the watchdog drivers to resource and pass it via platform_device > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> > Cc: linux-watchdog@vger.kernel.org > --- > HI Wim, > > this is part of a at91 cleanup > if you don't mind I'll apply via at91 tree > > Best Regards, > J. > arch/arm/mach-at91/at91_devices.c | 122 +++++++++++++++++++++++++ > arch/arm/mach-at91/at91cap9_devices.c | 11 ++- > arch/arm/mach-at91/at91sam9260_devices.c | 11 ++- > arch/arm/mach-at91/at91sam9261_devices.c | 11 ++- > arch/arm/mach-at91/at91sam9263_devices.c | 11 ++- > arch/arm/mach-at91/at91sam9g45_devices.c | 11 ++- > arch/arm/mach-at91/at91sam9rl_devices.c | 11 ++- > arch/arm/mach-at91/include/mach/at91cap9.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9261.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9263.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 +- > drivers/watchdog/at91sam9_wdt.c | 22 ++++- > drivers/watchdog/at91sam9_wdt.h | 6 +- > 15 files changed, 210 insertions(+), 18 deletions(-) > create mode 100644 arch/arm/mach-at91/at91_devices.c > > diff --git a/arch/arm/mach-at91/at91_devices.c b/arch/arm/mach-at91/at91_devices.c > new file mode 100644 > index 0000000..d0d55b4 > --- /dev/null > +++ b/arch/arm/mach-at91/at91_devices.c I do not understand what it the purpose of this file... > @@ -0,0 +1,122 @@ > +/* > + * arch/arm/mach-at91/at91cap9_devices.c > + * > + * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> > + * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> > + * Copyright (C) 2007 Atmel Corporation. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + */ > + > +#include <mach/gpio.h> > + > +#include "generic.h" > + > +void at91cap9_configure_dbgu_pins(void) > +{ > + at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */ > + at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */ > +} > + > +void at91cap9_configure_usart0_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */ > + at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */ > + > + if (pins & ATMEL_UART_RTS) > + at91_set_A_periph(AT91_PIN_PA24, 0); /* RTS0 */ > + if (pins & ATMEL_UART_CTS) > + at91_set_A_periph(AT91_PIN_PA25, 0); /* CTS0 */ > +} > + > +void at91cap9_configure_usart1_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ > + at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ > + > + if (pins & ATMEL_UART_RTS) > + at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */ > + if (pins & ATMEL_UART_CTS) > + at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */ > +} > + > +void at91cap9_configure_usart2_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ > + at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ > + > + if (pins & ATMEL_UART_RTS) > + at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */ > + if (pins & ATMEL_UART_CTS) > + at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */ > +} > + > +void at91rm9200_configure_dbgu_pins(void) > +{ > + at91_set_A_periph(AT91_PIN_PA30, 0); /* DRXD */ > + at91_set_A_periph(AT91_PIN_PA31, 1); /* DTXD */ > +} > + > +void at91rm9200_configure_usart0_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */ > + at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */ > + > + if (pins & ATMEL_UART_CTS) > + at91_set_A_periph(AT91_PIN_PA20, 0); /* CTS0 */ > + > + if (pins & ATMEL_UART_RTS) { > + /* > + * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21. > + * We need to drive the pin manually. Default is off (RTS is active low). > + */ > + at91_set_gpio_output(AT91_PIN_PA21, 1); > + } > +} > + > +void at91rm9200_configure_usart1_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PB20, 1); /* TXD1 */ > + at91_set_A_periph(AT91_PIN_PB21, 0); /* RXD1 */ > + > + if (pins & ATMEL_UART_RI) > + at91_set_A_periph(AT91_PIN_PB18, 0); /* RI1 */ > + if (pins & ATMEL_UART_DTR) > + at91_set_A_periph(AT91_PIN_PB19, 0); /* DTR1 */ > + if (pins & ATMEL_UART_DCD) > + at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD1 */ > + if (pins & ATMEL_UART_CTS) > + at91_set_A_periph(AT91_PIN_PB24, 0); /* CTS1 */ > + if (pins & ATMEL_UART_DSR) > + at91_set_A_periph(AT91_PIN_PB25, 0); /* DSR1 */ > + if (pins & ATMEL_UART_RTS) > + at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS1 */ > +} > + > +void at91rm9200_configure_usart2_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */ > + at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */ > + > + if (pins & ATMEL_UART_CTS) > + at91_set_B_periph(AT91_PIN_PA30, 0); /* CTS2 */ > + if (pins & ATMEL_UART_RTS) > + at91_set_B_periph(AT91_PIN_PA31, 0); /* RTS2 */ > +} > + > +void at91rm9200_configure_usart3_pins(unsigned pins) > +{ > + at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */ > + at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */ > + > + if (pins & ATMEL_UART_CTS) > + at91_set_B_periph(AT91_PIN_PB1, 0); /* CTS3 */ > + if (pins & ATMEL_UART_RTS) > + at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */ > +} > + > + > diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c > index 3262a7e..019dac0 100644 > --- a/arch/arm/mach-at91/at91cap9_devices.c > +++ b/arch/arm/mach-at91/at91cap9_devices.c > @@ -694,10 +694,19 @@ static void __init at91_add_device_rtt(void) > * -------------------------------------------------------------------- */ > > #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) > +static struct resource wdt_resources[] = { > + { > + .start = AT91CAP9_BASE_WDT, > + .end = AT91CAP9_BASE_WDT + SZ_16 - 1, > + .flags = IORESOURCE_MEM, > + } > +}; > + > static struct platform_device at91cap9_wdt_device = { > .name = "at91_wdt", > .id = -1, > - .num_resources = 0, > + .resource = wdt_resources, > + .num_resources = ARRAY_SIZE(wdt_resources), > }; > > static void __init at91_add_device_watchdog(void) > diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c > index 63cbfb8..9cdaffa 100644 > --- a/arch/arm/mach-at91/at91sam9260_devices.c > +++ b/arch/arm/mach-at91/at91sam9260_devices.c > @@ -738,10 +738,19 @@ static void __init at91_add_device_rtt(void) > * -------------------------------------------------------------------- */ > > #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) > +static struct resource wdt_resources[] = { > + { > + .start = AT91SAM9260_BASE_WDT, > + .end = AT91SAM9260_BASE_WDT + SZ_16 - 1, > + .flags = IORESOURCE_MEM, > + } > +}; > + > static struct platform_device at91sam9260_wdt_device = { > .name = "at91_wdt", > .id = -1, > - .num_resources = 0, > + .resource = wdt_resources, > + .num_resources = ARRAY_SIZE(wdt_resources), > }; > > static void __init at91_add_device_watchdog(void) > diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c > index d5bd1e7..c59e1e9 100644 > --- a/arch/arm/mach-at91/at91sam9261_devices.c > +++ b/arch/arm/mach-at91/at91sam9261_devices.c > @@ -624,10 +624,19 @@ static void __init at91_add_device_rtt(void) > * -------------------------------------------------------------------- */ > > #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) > +static struct resource wdt_resources[] = { > + { > + .start = AT91SAM9261_BASE_WDT, > + .end = AT91SAM9261_BASE_WDT + SZ_16 - 1, > + .flags = IORESOURCE_MEM, > + } > +}; > + > static struct platform_device at91sam9261_wdt_device = { > .name = "at91_wdt", > .id = -1, > - .num_resources = 0, > + .resource = wdt_resources, > + .num_resources = ARRAY_SIZE(wdt_resources), > }; > > static void __init at91_add_device_watchdog(void) > diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c > index 5d2b061..b5f4e25 100644 > --- a/arch/arm/mach-at91/at91sam9263_devices.c > +++ b/arch/arm/mach-at91/at91sam9263_devices.c > @@ -996,10 +996,19 @@ static void __init at91_add_device_rtt(void) > * -------------------------------------------------------------------- */ > > #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) > +static struct resource wdt_resources[] = { > + { > + .start = AT91SAM9263_BASE_WDT, > + .end = AT91SAM9263_BASE_WDT + SZ_16 - 1, > + .flags = IORESOURCE_MEM, > + } > +}; > + > static struct platform_device at91sam9263_wdt_device = { > .name = "at91_wdt", > .id = -1, > - .num_resources = 0, > + .resource = wdt_resources, > + .num_resources = ARRAY_SIZE(wdt_resources), > }; > > static void __init at91_add_device_watchdog(void) > diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c > index bb2ba0c..3b91706 100644 > --- a/arch/arm/mach-at91/at91sam9g45_devices.c > +++ b/arch/arm/mach-at91/at91sam9g45_devices.c > @@ -1133,10 +1133,19 @@ static void __init at91_add_device_trng(void) {} > * -------------------------------------------------------------------- */ > > #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) > +static struct resource wdt_resources[] = { > + { > + .start = AT91SAM9G45_BASE_WDT, > + .end = AT91SAM9G45_BASE_WDT + SZ_16 - 1, > + .flags = IORESOURCE_MEM, > + } > +}; > + > static struct platform_device at91sam9g45_wdt_device = { > .name = "at91_wdt", > .id = -1, > - .num_resources = 0, > + .resource = wdt_resources, > + .num_resources = ARRAY_SIZE(wdt_resources), > }; > > static void __init at91_add_device_watchdog(void) > diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c > index f9b423b..c7961b4 100644 > --- a/arch/arm/mach-at91/at91sam9rl_devices.c > +++ b/arch/arm/mach-at91/at91sam9rl_devices.c > @@ -709,10 +709,19 @@ static void __init at91_add_device_rtt(void) > * -------------------------------------------------------------------- */ > > #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) > +static struct resource wdt_resources[] = { > + { > + .start = AT91SAM9RL_BASE_WDT, > + .end = AT91SAM9RL_BASE_WDT + SZ_16 - 1, > + .flags = IORESOURCE_MEM, > + } > +}; > + > static struct platform_device at91sam9rl_wdt_device = { > .name = "at91_wdt", > .id = -1, > - .num_resources = 0, > + .resource = wdt_resources, > + .num_resources = ARRAY_SIZE(wdt_resources), > }; > > static void __init at91_add_device_watchdog(void) > diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h > index f2e7c34..844cba1 100644 > --- a/arch/arm/mach-at91/include/mach/at91cap9.h > +++ b/arch/arm/mach-at91/include/mach/at91cap9.h > @@ -86,7 +86,6 @@ > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (cpu_is_at91cap9_revB() ? \ > (0xfffffd50 - AT91_BASE_SYS) : \ > (0xfffffd60 - AT91_BASE_SYS)) > @@ -102,6 +101,7 @@ > #define AT91CAP9_BASE_SHDWC 0xfffffd10 > #define AT91CAP9_BASE_RTT 0xfffffd20 > #define AT91CAP9_BASE_PIT 0xfffffd30 > +#define AT91CAP9_BASE_WDT 0xfffffd40 > > #define AT91_USART0 AT91CAP9_BASE_US0 > #define AT91_USART1 AT91CAP9_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h > index 6a13e9d..8a26045 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9260.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h > @@ -86,7 +86,6 @@ > #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > #define AT91SAM9260_BASE_ECC 0xffffe800 > @@ -98,6 +97,7 @@ > #define AT91SAM9260_BASE_SHDWC 0xfffffd10 > #define AT91SAM9260_BASE_RTT 0xfffffd20 > #define AT91SAM9260_BASE_PIT 0xfffffd30 > +#define AT91SAM9260_BASE_WDT 0xfffffd40 > > #define AT91_USART0 AT91SAM9260_BASE_US0 > #define AT91_USART1 AT91SAM9260_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h > index f9b5163..df2ddfd 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9261.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h > @@ -71,7 +71,6 @@ > #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > #define AT91SAM9261_BASE_SMC 0xffffec00 > @@ -81,6 +80,7 @@ > #define AT91SAM9261_BASE_SHDWC 0xfffffd10 > #define AT91SAM9261_BASE_RTT 0xfffffd20 > #define AT91SAM9261_BASE_PIT 0xfffffd30 > +#define AT91SAM9261_BASE_WDT 0xfffffd40 > > #define AT91_USART0 AT91SAM9261_BASE_US0 > #define AT91_USART1 AT91SAM9261_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h > index e8fb5bd..f958ac9 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9263.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h > @@ -81,7 +81,6 @@ > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > > #define AT91SAM9263_BASE_ECC0 0xffffe000 > @@ -97,6 +96,7 @@ > #define AT91SAM9263_BASE_SHDWC 0xfffffd10 > #define AT91SAM9263_BASE_RTT0 0xfffffd20 > #define AT91SAM9263_BASE_PIT 0xfffffd30 > +#define AT91SAM9263_BASE_WDT 0xfffffd40 > #define AT91SAM9263_BASE_RTT1 0xfffffd50 > > #define AT91_USART0 AT91SAM9263_BASE_US0 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h > index 5f3453e..65098c3 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h > @@ -93,7 +93,6 @@ > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > #define AT91_RTC (0xfffffdb0 - AT91_BASE_SYS) > > @@ -108,6 +107,7 @@ > #define AT91SAM9G45_BASE_SHDWC 0xfffffd10 > #define AT91SAM9G45_BASE_RTT 0xfffffd20 > #define AT91SAM9G45_BASE_PIT 0xfffffd30 > +#define AT91SAM9G45_BASE_WDT 0xfffffd40 > > #define AT91_USART0 AT91SAM9G45_BASE_US0 > #define AT91_USART1 AT91SAM9G45_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h > index e012e69..6aee975 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h > @@ -75,7 +75,6 @@ > #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > -#define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) > #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) > @@ -91,6 +90,7 @@ > #define AT91SAM9RL_BASE_SHDWC 0xfffffd10 > #define AT91SAM9RL_BASE_RTT 0xfffffd20 > #define AT91SAM9RL_BASE_PIT 0xfffffd30 > +#define AT91SAM9RL_BASE_WDT 0xfffffd40 > > #define AT91_USART0 AT91SAM9RL_BASE_US0 > #define AT91_USART1 AT91SAM9RL_BASE_US1 > diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c > index 87445b2..0056256 100644 > --- a/drivers/watchdog/at91sam9_wdt.c > +++ b/drivers/watchdog/at91sam9_wdt.c > @@ -35,6 +35,11 @@ > > #define DRV_NAME "AT91SAM9 Watchdog" > > +#define wdt_read(field) \ > + __raw_readl(at91wdt_private.base + field) > +#define wdt_write(field, val) \ > + __raw_writel((val), at91wdt_private.base + field) > + > /* AT91SAM9 watchdog runs a 12bit counter @ 256Hz, > * use this to convert a watchdog > * value from/to milliseconds. > @@ -63,6 +68,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " > static void at91_ping(unsigned long data); > > static struct { > + void __iomem *base; > unsigned long next_heartbeat; /* the next_heartbeat for the timer */ > unsigned long open; > char expect_close; > @@ -77,7 +83,7 @@ static struct { > */ > static inline void at91_wdt_reset(void) > { > - at91_sys_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT); > + wdt_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT); > } > > /* > @@ -132,7 +138,7 @@ static int at91_wdt_settimeout(unsigned int timeout) > unsigned int mr; > > /* Check if disabled */ > - mr = at91_sys_read(AT91_WDT_MR); > + mr = wdt_read(AT91_WDT_MR); > if (mr & AT91_WDT_WDDIS) { > printk(KERN_ERR DRV_NAME": sorry, watchdog is disabled\n"); > return -EIO; > @@ -149,7 +155,7 @@ static int at91_wdt_settimeout(unsigned int timeout) > | AT91_WDT_WDDBGHLT /* disabled in debug mode */ > | AT91_WDT_WDD /* restart at any time */ > | (timeout & AT91_WDT_WDV); /* timer value */ > - at91_sys_write(AT91_WDT_MR, reg); > + wdt_write(AT91_WDT_MR, reg); > > return 0; > } > @@ -248,12 +254,22 @@ static struct miscdevice at91wdt_miscdev = { > > static int __init at91wdt_probe(struct platform_device *pdev) > { > + struct resource *r; > int res; > > if (at91wdt_miscdev.parent) > return -EBUSY; > at91wdt_miscdev.parent = &pdev->dev; > > + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!r) > + return -ENODEV; Blank line here > + at91wdt_private.base = ioremap(r->start, resource_size(r)); > + if (!at91wdt_private.base) { > + dev_err(&pdev->dev, "failed to map registers, aborting.\n"); > + return -ENOMEM; > + } > + > /* Set watchdog */ > res = at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000)); > if (res) > diff --git a/drivers/watchdog/at91sam9_wdt.h b/drivers/watchdog/at91sam9_wdt.h > index 757f9ca..c6fbb2e6 100644 > --- a/drivers/watchdog/at91sam9_wdt.h > +++ b/drivers/watchdog/at91sam9_wdt.h > @@ -16,11 +16,11 @@ > #ifndef AT91_WDT_H > #define AT91_WDT_H > > -#define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */ > +#define AT91_WDT_CR 0x00 /* Watchdog Control Register */ > #define AT91_WDT_WDRSTT (1 << 0) /* Restart */ > #define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */ > > -#define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */ > +#define AT91_WDT_MR 0x04 /* Watchdog Mode Register */ > #define AT91_WDT_WDV (0xfff << 0) /* Counter Value */ > #define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */ > #define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */ > @@ -30,7 +30,7 @@ > #define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */ > #define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */ > > -#define AT91_WDT_SR (AT91_WDT + 0x08) /* Watchdog Status Register */ > +#define AT91_WDT_SR 0x08 /* Watchdog Status Register */ > #define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */ > #define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */ >
On 11/13/2011 07:12 PM, Jean-Christophe PLAGNIOL-VILLARD : > this will allow to select the DBGU to use based on the SOC enabled for the > DEBUG_LL and early_printk via Kconfig Split this in several sentences: it will make it more readable. > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Otherwise, look good: Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > --- > arch/arm/mach-at91/Kconfig | 36 +++++++++++++++++++++++- > arch/arm/mach-at91/at91cap9_devices.c | 4 +- > arch/arm/mach-at91/at91rm9200_devices.c | 4 +- > arch/arm/mach-at91/at91sam9260_devices.c | 4 +- > arch/arm/mach-at91/at91sam9261_devices.c | 4 +- > arch/arm/mach-at91/at91sam9263_devices.c | 4 +- > arch/arm/mach-at91/at91sam9g45_devices.c | 4 +- > arch/arm/mach-at91/at91sam9rl_devices.c | 4 +- > arch/arm/mach-at91/include/mach/at91_dbgu.h | 2 +- > arch/arm/mach-at91/include/mach/at91cap9.h | 2 +- > arch/arm/mach-at91/include/mach/at91rm9200.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9260.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9261.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9263.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 +- > arch/arm/mach-at91/include/mach/debug-macro.S | 10 +++++- > arch/arm/mach-at91/include/mach/hardware.h | 6 ++++ > arch/arm/mach-at91/include/mach/uncompress.h | 6 +++- > arch/arm/mach-at91/setup.c | 7 +--- > 20 files changed, 76 insertions(+), 33 deletions(-) > > diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig > index d9ff0cd..c8d715e 100644 > --- a/arch/arm/mach-at91/Kconfig > +++ b/arch/arm/mach-at91/Kconfig > @@ -3,6 +3,12 @@ if ARCH_AT91 > config HAVE_AT91_DATAFLASH_CARD > bool > > +config HAVE_AT91_DBGU0 > + bool > + > +config HAVE_AT91_DBGU1 > + bool > + > config HAVE_AT91_USART3 > bool > > @@ -21,12 +27,14 @@ config ARCH_AT91RM9200 > bool "AT91RM9200" > select CPU_ARM920T > select GENERIC_CLOCKEVENTS > + select HAVE_AT91_DBGU0 > select HAVE_AT91_USART3 > > config ARCH_AT91SAM9260 > bool "AT91SAM9260 or AT91SAM9XE" > select CPU_ARM926T > select GENERIC_CLOCKEVENTS > + select HAVE_AT91_DBGU0 > select HAVE_AT91_USART3 > select HAVE_AT91_USART4 > select HAVE_AT91_USART5 > @@ -37,6 +45,7 @@ config ARCH_AT91SAM9261 > select CPU_ARM926T > select GENERIC_CLOCKEVENTS > select HAVE_FB_ATMEL > + select HAVE_AT91_DBGU0 > > config ARCH_AT91SAM9263 > bool "AT91SAM9263" > @@ -44,6 +53,7 @@ config ARCH_AT91SAM9263 > select GENERIC_CLOCKEVENTS > select HAVE_FB_ATMEL > select HAVE_NET_MACB > + select HAVE_AT91_DBGU1 > > config ARCH_AT91SAM9RL > bool "AT91SAM9RL" > @@ -51,6 +61,7 @@ config ARCH_AT91SAM9RL > select GENERIC_CLOCKEVENTS > select HAVE_AT91_USART3 > select HAVE_FB_ATMEL > + select HAVE_AT91_DBGU0 > > config ARCH_AT91SAM9G45 > bool "AT91SAM9G45" > @@ -59,6 +70,7 @@ config ARCH_AT91SAM9G45 > select HAVE_AT91_USART3 > select HAVE_FB_ATMEL > select HAVE_NET_MACB > + select HAVE_AT91_DBGU1 > > config ARCH_AT91CAP9 > bool "AT91CAP9" > @@ -66,6 +78,7 @@ config ARCH_AT91CAP9 > select GENERIC_CLOCKEVENTS > select HAVE_FB_ATMEL > select HAVE_NET_MACB > + select HAVE_AT91_DBGU1 > > config ARCH_AT91X40 > bool "AT91x40" > @@ -478,8 +491,13 @@ config AT91_TIMER_HZ > choice > prompt "Select a UART for early kernel messages" > > -config AT91_EARLY_DBGU > - bool "DBGU" > +config AT91_EARLY_DBGU0 > + bool "DBGU on rm9200, 9260, 9261 and 9rl" > + depends on HAVE_AT91_DBGU0 > + > +config AT91_EARLY_DBGU1 > + bool "DBGU on 9263, 9g45 and cap9" > + depends on HAVE_AT91_DBGU1 > > config AT91_EARLY_USART0 > bool "USART0" > @@ -505,6 +523,20 @@ config AT91_EARLY_USART5 > > endchoice > > +choice > + prompt "Select a DBGU for DEBUG_LL" > + depends on DEBUG_LL > + > +config AT91_DEBUG_LL_DBGU0 > + bool "DBGU on rm9200, 9260, 9261 and 9rl" > + depends on HAVE_AT91_DBGU0 > + > +config AT91_DEBUG_LL_DBGU1 > + bool "DBGU on 9263, 9g45 and cap9" > + depends on HAVE_AT91_DBGU1 > + > +endchoice > + > endmenu > > endif > diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c > index 019dac0..19975cf 100644 > --- a/arch/arm/mach-at91/at91cap9_devices.c > +++ b/arch/arm/mach-at91/at91cap9_devices.c > @@ -1030,8 +1030,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} > #if defined(CONFIG_SERIAL_ATMEL) > static struct resource dbgu_resources[] = { > [0] = { > - .start = AT91_BASE_SYS + AT91_DBGU, > - .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, > + .start = AT91CAP9_BASE_DBGU, > + .end = AT91CAP9_BASE_DBGU + SZ_512 - 1, > .flags = IORESOURCE_MEM, > }, > [1] = { > diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c > index 66591fa..1007ba8 100644 > --- a/arch/arm/mach-at91/at91rm9200_devices.c > +++ b/arch/arm/mach-at91/at91rm9200_devices.c > @@ -877,8 +877,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} > #if defined(CONFIG_SERIAL_ATMEL) > static struct resource dbgu_resources[] = { > [0] = { > - .start = AT91_BASE_SYS + AT91_DBGU, > - .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, > + .start = AT91RM9200_BASE_DBGU, > + .end = AT91RM9200_BASE_DBGU + SZ_512 - 1, > .flags = IORESOURCE_MEM, > }, > [1] = { > diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c > index 9cdaffa..5b424fc 100644 > --- a/arch/arm/mach-at91/at91sam9260_devices.c > +++ b/arch/arm/mach-at91/at91sam9260_devices.c > @@ -846,8 +846,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} > #if defined(CONFIG_SERIAL_ATMEL) > static struct resource dbgu_resources[] = { > [0] = { > - .start = AT91_BASE_SYS + AT91_DBGU, > - .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, > + .start = AT91SAM9260_BASE_DBGU, > + .end = AT91SAM9260_BASE_DBGU + SZ_512 - 1, > .flags = IORESOURCE_MEM, > }, > [1] = { > diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c > index c59e1e9..e5cff1d 100644 > --- a/arch/arm/mach-at91/at91sam9261_devices.c > +++ b/arch/arm/mach-at91/at91sam9261_devices.c > @@ -825,8 +825,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} > #if defined(CONFIG_SERIAL_ATMEL) > static struct resource dbgu_resources[] = { > [0] = { > - .start = AT91_BASE_SYS + AT91_DBGU, > - .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, > + .start = AT91SAM9261_BASE_DBGU, > + .end = AT91SAM9261_BASE_DBGU + SZ_512 - 1, > .flags = IORESOURCE_MEM, > }, > [1] = { > diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c > index b5f4e25..20e681c 100644 > --- a/arch/arm/mach-at91/at91sam9263_devices.c > +++ b/arch/arm/mach-at91/at91sam9263_devices.c > @@ -1205,8 +1205,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} > > static struct resource dbgu_resources[] = { > [0] = { > - .start = AT91_BASE_SYS + AT91_DBGU, > - .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, > + .start = AT91SAM9263_BASE_DBGU, > + .end = AT91SAM9263_BASE_DBGU + SZ_512 - 1, > .flags = IORESOURCE_MEM, > }, > [1] = { > diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c > index 3b91706..153dad0 100644 > --- a/arch/arm/mach-at91/at91sam9g45_devices.c > +++ b/arch/arm/mach-at91/at91sam9g45_devices.c > @@ -1341,8 +1341,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} > #if defined(CONFIG_SERIAL_ATMEL) > static struct resource dbgu_resources[] = { > [0] = { > - .start = AT91_BASE_SYS + AT91_DBGU, > - .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, > + .start = AT91SAM9G45_BASE_DBGU, > + .end = AT91SAM9G45_BASE_DBGU + SZ_512 - 1, > .flags = IORESOURCE_MEM, > }, > [1] = { > diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c > index c7961b4..366c1cf 100644 > --- a/arch/arm/mach-at91/at91sam9rl_devices.c > +++ b/arch/arm/mach-at91/at91sam9rl_devices.c > @@ -917,8 +917,8 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} > #if defined(CONFIG_SERIAL_ATMEL) > static struct resource dbgu_resources[] = { > [0] = { > - .start = AT91_BASE_SYS + AT91_DBGU, > - .end = AT91_BASE_SYS + AT91_DBGU + SZ_512 - 1, > + .start = AT91SAM9RL_BASE_DBGU, > + .end = AT91SAM9RL_BASE_DBGU + SZ_512 - 1, > .flags = IORESOURCE_MEM, > }, > [1] = { > diff --git a/arch/arm/mach-at91/include/mach/at91_dbgu.h b/arch/arm/mach-at91/include/mach/at91_dbgu.h > index dbfe455a..2aa0c5e 100644 > --- a/arch/arm/mach-at91/include/mach/at91_dbgu.h > +++ b/arch/arm/mach-at91/include/mach/at91_dbgu.h > @@ -19,7 +19,7 @@ > #define dbgu_readl(dbgu, field) \ > __raw_readl(AT91_VA_BASE_SYS + dbgu + AT91_DBGU_ ## field) > > -#ifdef AT91_DBGU > +#if !defined(CONFIG_ARCH_AT91X40) > #define AT91_DBGU_CR (0x00) /* Control Register */ > #define AT91_DBGU_MR (0x04) /* Mode Register */ > #define AT91_DBGU_IER (0x08) /* Interrupt Enable Register */ > diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h > index 844cba1..6bcb188 100644 > --- a/arch/arm/mach-at91/include/mach/at91cap9.h > +++ b/arch/arm/mach-at91/include/mach/at91cap9.h > @@ -82,7 +82,6 @@ > #define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS) > #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) > -#define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > @@ -94,6 +93,7 @@ > #define AT91CAP9_BASE_DMA 0xffffec00 > #define AT91CAP9_BASE_SMC 0xffffe800 > #define AT91CAP9_BASE_CCFG 0xffffeb10 > +#define AT91CAP9_BASE_DBGU AT91_BASE_DBGU1 > #define AT91CAP9_BASE_PIOA 0xfffff200 > #define AT91CAP9_BASE_PIOB 0xfffff400 > #define AT91CAP9_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h > index 5740954..1f767e2 100644 > --- a/arch/arm/mach-at91/include/mach/at91rm9200.h > +++ b/arch/arm/mach-at91/include/mach/at91rm9200.h > @@ -80,12 +80,12 @@ > * System Peripherals (offset from AT91_BASE_SYS) > */ > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) /* Advanced Interrupt Controller */ > -#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) /* Debug Unit */ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) /* Power Management Controller */ > #define AT91_ST (0xfffffd00 - AT91_BASE_SYS) /* System Timer */ > #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) /* Real-Time Clock */ > #define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */ > > +#define AT91RM9200_BASE_DBGU AT91_BASE_DBGU0 /* Debug Unit */ > #define AT91RM9200_BASE_PIOA 0xfffff400 /* PIO Controller A */ > #define AT91RM9200_BASE_PIOB 0xfffff600 /* PIO Controller B */ > #define AT91RM9200_BASE_PIOC 0xfffff800 /* PIO Controller C */ > diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h > index 8a26045..6deddb6 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9260.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h > @@ -83,7 +83,6 @@ > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > -#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > @@ -91,6 +90,7 @@ > #define AT91SAM9260_BASE_ECC 0xffffe800 > #define AT91SAM9260_BASE_SMC 0xffffec00 > #define AT91SAM9260_BASE_CCFG 0xffffef10 > +#define AT91SAM9260_BASE_DBGU AT91_BASE_DBGU0 > #define AT91SAM9260_BASE_PIOA 0xfffff400 > #define AT91SAM9260_BASE_PIOB 0xfffff600 > #define AT91SAM9260_BASE_PIOC 0xfffff800 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h > index df2ddfd..2ccc8a53 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9261.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h > @@ -68,12 +68,12 @@ > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > -#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) > > #define AT91SAM9261_BASE_SMC 0xffffec00 > +#define AT91SAM9261_BASE_DBGU AT91_BASE_DBGU0 > #define AT91SAM9261_BASE_PIOA 0xfffff400 > #define AT91SAM9261_BASE_PIOB 0xfffff600 > #define AT91SAM9261_BASE_PIOC 0xfffff800 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h > index f958ac9..f9eebb6 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9263.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h > @@ -77,7 +77,6 @@ > #define AT91_SDRAMC0 (0xffffe200 - AT91_BASE_SYS) > #define AT91_SDRAMC1 (0xffffe800 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffec00 - AT91_BASE_SYS) > -#define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > @@ -88,6 +87,7 @@ > #define AT91SAM9263_BASE_ECC1 0xffffe600 > #define AT91SAM9263_BASE_SMC1 0xffffea00 > #define AT91SAM9263_BASE_CCFG 0xffffed10 > +#define AT91SAM9263_BASE_DBGU AT91_BASE_DBGU1 > #define AT91SAM9263_BASE_PIOA 0xfffff200 > #define AT91SAM9263_BASE_PIOB 0xfffff400 > #define AT91SAM9263_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h > index 65098c3..211721b 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h > @@ -89,7 +89,6 @@ > #define AT91_DDRSDRC1 (0xffffe400 - AT91_BASE_SYS) > #define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) > -#define AT91_DBGU (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > @@ -99,6 +98,7 @@ > #define AT91SAM9G45_BASE_ECC 0xffffe200 > #define AT91SAM9G45_BASE_DMA 0xffffec00 > #define AT91SAM9G45_BASE_SMC 0xffffe800 > +#define AT91SAM9G45_BASE_DBGU AT91_BASE_DBGU1 > #define AT91SAM9G45_BASE_PIOA 0xfffff200 > #define AT91SAM9G45_BASE_PIOB 0xfffff400 > #define AT91SAM9G45_BASE_PIOC 0xfffff600 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h > index 6aee975..c7e3ab6 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h > @@ -72,7 +72,6 @@ > #define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS) > #define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) > #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) > -#define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) > @@ -83,6 +82,7 @@ > #define AT91SAM9RL_BASE_ECC 0xffffe800 > #define AT91SAM9RL_BASE_SMC 0xffffec00 > #define AT91SAM9RL_BASE_CCFG 0xffffef10 > +#define AT91SAM9RL_BASE_DBGU AT91_BASE_DBGU0 > #define AT91SAM9RL_BASE_PIOA 0xfffff400 > #define AT91SAM9RL_BASE_PIOB 0xfffff600 > #define AT91SAM9RL_BASE_PIOC 0xfffff800 > diff --git a/arch/arm/mach-at91/include/mach/debug-macro.S b/arch/arm/mach-at91/include/mach/debug-macro.S > index 0ed8648..c6bb9e2 100644 > --- a/arch/arm/mach-at91/include/mach/debug-macro.S > +++ b/arch/arm/mach-at91/include/mach/debug-macro.S > @@ -14,9 +14,15 @@ > #include <mach/hardware.h> > #include <mach/at91_dbgu.h> > > +#if defined(CONFIG_AT91_DEBUG_LL_DBGU0) > +#define AT91_DBGU AT91_BASE_DBGU0 > +#else > +#define AT91_DBGU AT91_BASE_DBGU1 > +#endif > + > .macro addruart, rp, rv, tmp > - ldr \rp, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address) > - ldr \rv, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address) > + ldr \rp, =AT91_DBGU @ System peripherals (phys address) > + ldr \rv, =AT91_IO_P2V(AT91_DBGU) @ System peripherals (virt address) > .endm > > .macro senduart,rd,rx > diff --git a/arch/arm/mach-at91/include/mach/hardware.h b/arch/arm/mach-at91/include/mach/hardware.h > index d0f634e2..8d24034 100644 > --- a/arch/arm/mach-at91/include/mach/hardware.h > +++ b/arch/arm/mach-at91/include/mach/hardware.h > @@ -16,6 +16,12 @@ > > #include <asm/sizes.h> > > +/* DBGU base */ > +/* rm9200, 9260/9g20, 9261/9g10, 9rl */ > +#define AT91_BASE_DBGU0 0xfffff200 > +/* 9263, 9g45, cap9 */ > +#define AT91_BASE_DBGU1 0xffffee00 > + > #if defined(CONFIG_ARCH_AT91RM9200) > #include <mach/at91rm9200.h> > #elif defined(CONFIG_ARCH_AT91SAM9260) > diff --git a/arch/arm/mach-at91/include/mach/uncompress.h b/arch/arm/mach-at91/include/mach/uncompress.h > index 18bdcde..0234fd9 100644 > --- a/arch/arm/mach-at91/include/mach/uncompress.h > +++ b/arch/arm/mach-at91/include/mach/uncompress.h > @@ -24,8 +24,10 @@ > #include <linux/io.h> > #include <linux/atmel_serial.h> > > -#if defined(CONFIG_AT91_EARLY_DBGU) > -#define UART_OFFSET (AT91_DBGU + AT91_BASE_SYS) > +#if defined(CONFIG_AT91_EARLY_DBGU0) > +#define UART_OFFSET AT91_BASE_DBGU0 > +#elif defined(CONFIG_AT91_EARLY_DBGU1) > +#define UART_OFFSET AT91_BASE_DBGU1 > #elif defined(CONFIG_AT91_EARLY_USART0) > #define UART_OFFSET AT91_USART0 > #elif defined(CONFIG_AT91_EARLY_USART1) > diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c > index 8ba2790..de93b7d 100644 > --- a/arch/arm/mach-at91/setup.c > +++ b/arch/arm/mach-at91/setup.c > @@ -93,9 +93,6 @@ void at91_iounmap(volatile void __iomem *addr) > } > EXPORT_SYMBOL(at91_iounmap); > > -#define AT91_DBGU0 0xfffff200 > -#define AT91_DBGU1 0xffffee00 > - > static void __init soc_detect(u32 dbgu_base) > { > u32 cidr, socid; > @@ -268,9 +265,9 @@ void __init at91_map_io(void) > at91_soc_initdata.type = AT91_SOC_NONE; > at91_soc_initdata.subtype = AT91_SOC_SUBTYPE_NONE; > > - soc_detect(AT91_DBGU0); > + soc_detect(AT91_BASE_DBGU0); > if (!at91_soc_is_detected()) > - soc_detect(AT91_DBGU1); > + soc_detect(AT91_BASE_DBGU1); > > if (!at91_soc_is_detected()) > panic("AT91: Impossible to detect the SOC type");
hi, > switch the watchdog drivers to resource and pass it via platform_device What's this at91_devices.c ? It looks like some unrelated code was included with a watchdog patch... Regards, Andrew Victor > +++ b/arch/arm/mach-at91/at91_devices.c > @@ -0,0 +1,122 @@ > +/* > + * arch/arm/mach-at91/at91cap9_devices.c > + * > + * Copyright (C) 2007 Stelian Pop <stelian.pop@leadtechdesign.com> > + * Copyright (C) 2007 Lead Tech Design <www.leadtechdesign.com> > + * Copyright (C) 2007 Atmel Corporation. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + */ > + > +#include <mach/gpio.h> > + > +#include "generic.h" > + > +void at91cap9_configure_dbgu_pins(void) > +{ > + at91_set_A_periph(AT91_PIN_PC30, 0); /* DRXD */ > + at91_set_A_periph(AT91_PIN_PC31, 1); /* DTXD */ > +} > + > +void at91cap9_configure_usart0_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PA22, 1); /* TXD0 */ > + at91_set_A_periph(AT91_PIN_PA23, 0); /* RXD0 */ > + > + if (pins & ATMEL_UART_RTS) > + at91_set_A_periph(AT91_PIN_PA24, 0); /* RTS0 */ > + if (pins & ATMEL_UART_CTS) > + at91_set_A_periph(AT91_PIN_PA25, 0); /* CTS0 */ > +} > + > +void at91cap9_configure_usart1_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PD0, 1); /* TXD1 */ > + at91_set_A_periph(AT91_PIN_PD1, 0); /* RXD1 */ > + > + if (pins & ATMEL_UART_RTS) > + at91_set_B_periph(AT91_PIN_PD7, 0); /* RTS1 */ > + if (pins & ATMEL_UART_CTS) > + at91_set_B_periph(AT91_PIN_PD8, 0); /* CTS1 */ > +} > + > +void at91cap9_configure_usart2_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PD2, 1); /* TXD2 */ > + at91_set_A_periph(AT91_PIN_PD3, 0); /* RXD2 */ > + > + if (pins & ATMEL_UART_RTS) > + at91_set_B_periph(AT91_PIN_PD5, 0); /* RTS2 */ > + if (pins & ATMEL_UART_CTS) > + at91_set_B_periph(AT91_PIN_PD6, 0); /* CTS2 */ > +} > + > +void at91rm9200_configure_dbgu_pins(void) > +{ > + at91_set_A_periph(AT91_PIN_PA30, 0); /* DRXD */ > + at91_set_A_periph(AT91_PIN_PA31, 1); /* DTXD */ > +} > + > +void at91rm9200_configure_usart0_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PA17, 1); /* TXD0 */ > + at91_set_A_periph(AT91_PIN_PA18, 0); /* RXD0 */ > + > + if (pins & ATMEL_UART_CTS) > + at91_set_A_periph(AT91_PIN_PA20, 0); /* CTS0 */ > + > + if (pins & ATMEL_UART_RTS) { > + /* > + * AT91RM9200 Errata #39 - RTS0 is not internally connected to PA21. > + * We need to drive the pin manually. Default is off (RTS is active low). > + */ > + at91_set_gpio_output(AT91_PIN_PA21, 1); > + } > +} > + > +void at91rm9200_configure_usart1_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PB20, 1); /* TXD1 */ > + at91_set_A_periph(AT91_PIN_PB21, 0); /* RXD1 */ > + > + if (pins & ATMEL_UART_RI) > + at91_set_A_periph(AT91_PIN_PB18, 0); /* RI1 */ > + if (pins & ATMEL_UART_DTR) > + at91_set_A_periph(AT91_PIN_PB19, 0); /* DTR1 */ > + if (pins & ATMEL_UART_DCD) > + at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD1 */ > + if (pins & ATMEL_UART_CTS) > + at91_set_A_periph(AT91_PIN_PB24, 0); /* CTS1 */ > + if (pins & ATMEL_UART_DSR) > + at91_set_A_periph(AT91_PIN_PB25, 0); /* DSR1 */ > + if (pins & ATMEL_UART_RTS) > + at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS1 */ > +} > + > +void at91rm9200_configure_usart2_pins(unsigned pins) > +{ > + at91_set_A_periph(AT91_PIN_PA22, 0); /* RXD2 */ > + at91_set_A_periph(AT91_PIN_PA23, 1); /* TXD2 */ > + > + if (pins & ATMEL_UART_CTS) > + at91_set_B_periph(AT91_PIN_PA30, 0); /* CTS2 */ > + if (pins & ATMEL_UART_RTS) > + at91_set_B_periph(AT91_PIN_PA31, 0); /* RTS2 */ > +} > + > +void at91rm9200_configure_usart3_pins(unsigned pins) > +{ > + at91_set_B_periph(AT91_PIN_PA5, 1); /* TXD3 */ > + at91_set_B_periph(AT91_PIN_PA6, 0); /* RXD3 */ > + > + if (pins & ATMEL_UART_CTS) > + at91_set_B_periph(AT91_PIN_PB1, 0); /* CTS3 */ > + if (pins & ATMEL_UART_RTS) > + at91_set_B_periph(AT91_PIN_PB0, 0); /* RTS3 */ > +} > + > +
On 11/15/2011 09:40 PM, Jean-Christophe PLAGNIOL-VILLARD : > switch the rtc drivers to resource and pass it via platform_device > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> > Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> > Cc: rtc-linux@googlegroups.com > --- > Hi Alessandro, > > Can I apply this one via at91 > it's part of a big cleanup > > Best Regards, > J. > arch/arm/mach-at91/at91rm9200_devices.c | 16 ++++- > arch/arm/mach-at91/at91sam9g45_devices.c | 16 ++++- > arch/arm/mach-at91/include/mach/at91_rtc.h | 24 +++--- > arch/arm/mach-at91/include/mach/at91rm9200.h | 2 +- > arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 +- > drivers/rtc/rtc-at91rm9200.c | 101 +++++++++++++++--------- > 6 files changed, 107 insertions(+), 54 deletions(-) > > diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c > index 1007ba8..ba4fefe 100644 > --- a/arch/arm/mach-at91/at91rm9200_devices.c > +++ b/arch/arm/mach-at91/at91rm9200_devices.c > @@ -665,10 +665,24 @@ static void __init at91_add_device_tc(void) { } > * -------------------------------------------------------------------- */ > > #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) > +static struct resource rtc_resources[] = { > + [0] = { > + .start = AT91RM9200_BASE_RTC, > + .end = AT91RM9200_BASE_RTC + SZ_256 - 1, > + .flags = IORESOURCE_MEM, > + }, > + [1] = { > + .start = AT91_ID_SYS, > + .end = AT91_ID_SYS, > + .flags = IORESOURCE_IRQ, > + }, > +}; > + > static struct platform_device at91rm9200_rtc_device = { > .name = "at91_rtc", > .id = -1, > - .num_resources = 0, > + .resource = rtc_resources, > + .num_resources = ARRAY_SIZE(rtc_resources), > }; > > static void __init at91_add_device_rtc(void) > diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c > index 153dad0..2c64e01 100644 > --- a/arch/arm/mach-at91/at91sam9g45_devices.c > +++ b/arch/arm/mach-at91/at91sam9g45_devices.c > @@ -1009,10 +1009,24 @@ static void __init at91_add_device_tc(void) { } > * -------------------------------------------------------------------- */ > > #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) > +static struct resource rtc_resources[] = { > + [0] = { > + .start = AT91SAM9G45_BASE_RTC, > + .end = AT91SAM9G45_BASE_RTC + SZ_256 - 1, > + .flags = IORESOURCE_MEM, > + }, > + [1] = { > + .start = AT91_ID_SYS, > + .end = AT91_ID_SYS, > + .flags = IORESOURCE_IRQ, > + }, > +}; > + > static struct platform_device at91sam9g45_rtc_device = { > .name = "at91_rtc", > .id = -1, > - .num_resources = 0, > + .resource = rtc_resources, > + .num_resources = ARRAY_SIZE(rtc_resources), > }; > > static void __init at91_add_device_rtc(void) > diff --git a/arch/arm/mach-at91/include/mach/at91_rtc.h b/arch/arm/mach-at91/include/mach/at91_rtc.h > index e56f470..da1945e 100644 > --- a/arch/arm/mach-at91/include/mach/at91_rtc.h > +++ b/arch/arm/mach-at91/include/mach/at91_rtc.h > @@ -16,7 +16,7 @@ > #ifndef AT91_RTC_H > #define AT91_RTC_H > > -#define AT91_RTC_CR (AT91_RTC + 0x00) /* Control Register */ > +#define AT91_RTC_CR 0x00 /* Control Register */ > #define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */ > #define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */ > #define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */ > @@ -29,44 +29,44 @@ > #define AT91_RTC_CALEVSEL_MONTH (1 << 16) > #define AT91_RTC_CALEVSEL_YEAR (2 << 16) > > -#define AT91_RTC_MR (AT91_RTC + 0x04) /* Mode Register */ > +#define AT91_RTC_MR 0x04 /* Mode Register */ > #define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */ > > -#define AT91_RTC_TIMR (AT91_RTC + 0x08) /* Time Register */ > +#define AT91_RTC_TIMR 0x08 /* Time Register */ > #define AT91_RTC_SEC (0x7f << 0) /* Current Second */ > #define AT91_RTC_MIN (0x7f << 8) /* Current Minute */ > #define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */ > #define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */ > > -#define AT91_RTC_CALR (AT91_RTC + 0x0c) /* Calendar Register */ > +#define AT91_RTC_CALR 0x0c /* Calendar Register */ > #define AT91_RTC_CENT (0x7f << 0) /* Current Century */ > #define AT91_RTC_YEAR (0xff << 8) /* Current Year */ > #define AT91_RTC_MONTH (0x1f << 16) /* Current Month */ > #define AT91_RTC_DAY (7 << 21) /* Current Day */ > #define AT91_RTC_DATE (0x3f << 24) /* Current Date */ > > -#define AT91_RTC_TIMALR (AT91_RTC + 0x10) /* Time Alarm Register */ > +#define AT91_RTC_TIMALR 0x10 /* Time Alarm Register */ > #define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */ > #define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */ > #define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */ > > -#define AT91_RTC_CALALR (AT91_RTC + 0x14) /* Calendar Alarm Register */ > +#define AT91_RTC_CALALR 0x14 /* Calendar Alarm Register */ > #define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */ > #define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */ > > -#define AT91_RTC_SR (AT91_RTC + 0x18) /* Status Register */ > +#define AT91_RTC_SR 0x18 /* Status Register */ > #define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */ > #define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */ > #define AT91_RTC_SECEV (1 << 2) /* Second Event */ > #define AT91_RTC_TIMEV (1 << 3) /* Time Event */ > #define AT91_RTC_CALEV (1 << 4) /* Calendar Event */ > > -#define AT91_RTC_SCCR (AT91_RTC + 0x1c) /* Status Clear Command Register */ > -#define AT91_RTC_IER (AT91_RTC + 0x20) /* Interrupt Enable Register */ > -#define AT91_RTC_IDR (AT91_RTC + 0x24) /* Interrupt Disable Register */ > -#define AT91_RTC_IMR (AT91_RTC + 0x28) /* Interrupt Mask Register */ > +#define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */ > +#define AT91_RTC_IER 0x20 /* Interrupt Enable Register */ > +#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */ > +#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */ > > -#define AT91_RTC_VER (AT91_RTC + 0x2c) /* Valid Entry Register */ > +#define AT91_RTC_VER 0x2c /* Valid Entry Register */ > #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */ > #define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */ > #define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */ > diff --git a/arch/arm/mach-at91/include/mach/at91rm9200.h b/arch/arm/mach-at91/include/mach/at91rm9200.h > index 90e92a8..bacb511 100644 > --- a/arch/arm/mach-at91/include/mach/at91rm9200.h > +++ b/arch/arm/mach-at91/include/mach/at91rm9200.h > @@ -81,7 +81,6 @@ > */ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) /* Power Management Controller */ > #define AT91_ST (0xfffffd00 - AT91_BASE_SYS) /* System Timer */ > -#define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) /* Real-Time Clock */ > #define AT91_MC (0xffffff00 - AT91_BASE_SYS) /* Memory Controllers */ > > #define AT91RM9200_BASE_DBGU AT91_BASE_DBGU0 /* Debug Unit */ > @@ -89,6 +88,7 @@ > #define AT91RM9200_BASE_PIOB 0xfffff600 /* PIO Controller B */ > #define AT91RM9200_BASE_PIOC 0xfffff800 /* PIO Controller C */ > #define AT91RM9200_BASE_PIOD 0xfffffa00 /* PIO Controller D */ > +#define AT91RM9200_BASE_RTC 0xfffffe00 /* Real-Time Clock */ > > #define AT91_USART0 AT91RM9200_BASE_US0 > #define AT91_USART1 AT91RM9200_BASE_US1 > diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h > index ac5c471..f0c23c9 100644 > --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h > +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h > @@ -92,7 +92,6 @@ > #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) > #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) > #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) > -#define AT91_RTC (0xfffffdb0 - AT91_BASE_SYS) > > #define AT91SAM9G45_BASE_ECC 0xffffe200 > #define AT91SAM9G45_BASE_DMA 0xffffec00 > @@ -107,6 +106,7 @@ > #define AT91SAM9G45_BASE_RTT 0xfffffd20 > #define AT91SAM9G45_BASE_PIT 0xfffffd30 > #define AT91SAM9G45_BASE_WDT 0xfffffd40 > +#define AT91SAM9G45_BASE_RTC 0xfffffdb0 > > #define AT91_USART0 AT91SAM9G45_BASE_US0 > #define AT91_USART1 AT91SAM9G45_BASE_US1 > diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c > index e39b77a..dc474bc 100644 > --- a/drivers/rtc/rtc-at91rm9200.c > +++ b/drivers/rtc/rtc-at91rm9200.c > @@ -32,11 +32,17 @@ > > #include <mach/at91_rtc.h> > > +#define at91_rtc_read(field) \ > + __raw_readl(at91_rtc_regs + field) > +#define at91_rtc_write(field, val) \ > + __raw_writel((val), at91_rtc_regs + field) > > #define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */ > > static DECLARE_COMPLETION(at91_rtc_updated); > static unsigned int at91_alarm_year = AT91_RTC_EPOCH; > +static void __iomem *at91_rtc_regs; > +static int irq; > > /* > * Decode time/date into rtc_time structure > @@ -48,10 +54,10 @@ static void at91_rtc_decodetime(unsigned int timereg, unsigned int calreg, > > /* must read twice in case it changes */ > do { > - time = at91_sys_read(timereg); > - date = at91_sys_read(calreg); > - } while ((time != at91_sys_read(timereg)) || > - (date != at91_sys_read(calreg))); > + time = at91_rtc_read(timereg); > + date = at91_rtc_read(calreg); > + } while ((time != at91_rtc_read(timereg)) || > + (date != at91_rtc_read(calreg))); > > tm->tm_sec = bcd2bin((time & AT91_RTC_SEC) >> 0); > tm->tm_min = bcd2bin((time & AT91_RTC_MIN) >> 8); > @@ -98,19 +104,19 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) > tm->tm_hour, tm->tm_min, tm->tm_sec); > > /* Stop Time/Calendar from counting */ > - cr = at91_sys_read(AT91_RTC_CR); > - at91_sys_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); > + cr = at91_rtc_read(AT91_RTC_CR); > + at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM); > > - at91_sys_write(AT91_RTC_IER, AT91_RTC_ACKUPD); > + at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD); > wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */ > - at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); > + at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD); > > - at91_sys_write(AT91_RTC_TIMR, > + at91_rtc_write(AT91_RTC_TIMR, > bin2bcd(tm->tm_sec) << 0 > | bin2bcd(tm->tm_min) << 8 > | bin2bcd(tm->tm_hour) << 16); > > - at91_sys_write(AT91_RTC_CALR, > + at91_rtc_write(AT91_RTC_CALR, > bin2bcd((tm->tm_year + 1900) / 100) /* century */ > | bin2bcd(tm->tm_year % 100) << 8 /* year */ > | bin2bcd(tm->tm_mon + 1) << 16 /* tm_mon starts at zero */ > @@ -118,8 +124,8 @@ static int at91_rtc_settime(struct device *dev, struct rtc_time *tm) > | bin2bcd(tm->tm_mday) << 24); > > /* Restart Time/Calendar */ > - cr = at91_sys_read(AT91_RTC_CR); > - at91_sys_write(AT91_RTC_CR, cr & ~(AT91_RTC_UPDCAL | AT91_RTC_UPDTIM)); > + cr = at91_rtc_read(AT91_RTC_CR); > + at91_rtc_write(AT91_RTC_CR, cr & ~(AT91_RTC_UPDCAL | AT91_RTC_UPDTIM)); > > return 0; > } > @@ -135,7 +141,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm) > tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); > tm->tm_year = at91_alarm_year - 1900; > > - alrm->enabled = (at91_sys_read(AT91_RTC_IMR) & AT91_RTC_ALARM) > + alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM) > ? 1 : 0; > > pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, > @@ -160,20 +166,20 @@ static int at91_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) > tm.tm_min = alrm->time.tm_min; > tm.tm_sec = alrm->time.tm_sec; > > - at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); > - at91_sys_write(AT91_RTC_TIMALR, > + at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); > + at91_rtc_write(AT91_RTC_TIMALR, > bin2bcd(tm.tm_sec) << 0 > | bin2bcd(tm.tm_min) << 8 > | bin2bcd(tm.tm_hour) << 16 > | AT91_RTC_HOUREN | AT91_RTC_MINEN | AT91_RTC_SECEN); > - at91_sys_write(AT91_RTC_CALALR, > + at91_rtc_write(AT91_RTC_CALALR, > bin2bcd(tm.tm_mon + 1) << 16 /* tm_mon starts at zero */ > | bin2bcd(tm.tm_mday) << 24 > | AT91_RTC_DATEEN | AT91_RTC_MTHEN); > > if (alrm->enabled) { > - at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM); > - at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); > + at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); > + at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); > } > > pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, > @@ -188,10 +194,10 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) > pr_debug("%s(): cmd=%08x\n", __func__, enabled); > > if (enabled) { > - at91_sys_write(AT91_RTC_SCCR, AT91_RTC_ALARM); > - at91_sys_write(AT91_RTC_IER, AT91_RTC_ALARM); > + at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM); > + at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM); > } else > - at91_sys_write(AT91_RTC_IDR, AT91_RTC_ALARM); > + at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM); > > return 0; > } > @@ -200,7 +206,7 @@ static int at91_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) > */ > static int at91_rtc_proc(struct device *dev, struct seq_file *seq) > { > - unsigned long imr = at91_sys_read(AT91_RTC_IMR); > + unsigned long imr = at91_rtc_read(AT91_RTC_IMR); > > seq_printf(seq, "update_IRQ\t: %s\n", > (imr & AT91_RTC_ACKUPD) ? "yes" : "no"); > @@ -220,7 +226,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) > unsigned int rtsr; > unsigned long events = 0; > > - rtsr = at91_sys_read(AT91_RTC_SR) & at91_sys_read(AT91_RTC_IMR); > + rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR); > if (rtsr) { /* this interrupt is shared! Is it ours? */ > if (rtsr & AT91_RTC_ALARM) > events |= (RTC_AF | RTC_IRQF); > @@ -229,7 +235,7 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id) > if (rtsr & AT91_RTC_ACKUPD) > complete(&at91_rtc_updated); > > - at91_sys_write(AT91_RTC_SCCR, rtsr); /* clear status reg */ > + at91_rtc_write(AT91_RTC_SCCR, rtsr); /* clear status reg */ > > rtc_update_irq(rtc, 1, events); > > @@ -256,22 +262,41 @@ static const struct rtc_class_ops at91_rtc_ops = { > static int __init at91_rtc_probe(struct platform_device *pdev) > { > struct rtc_device *rtc; > - int ret; > + struct resource *regs; > + int ret = 0; > > - at91_sys_write(AT91_RTC_CR, 0); > - at91_sys_write(AT91_RTC_MR, 0); /* 24 hour mode */ > + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + if (!regs) { > + dev_err(&pdev->dev, "no mmio resource defined\n"); > + return -ENXIO; > + } > + > + irq = platform_get_irq(pdev, 0); > + if (irq < 0) { > + dev_err(&pdev->dev, "no irq resource defined\n"); > + return -ENXIO; > + } > + > + at91_rtc_regs = ioremap(regs->start, resource_size(regs)); > + if (!at91_rtc_regs) { > + dev_err(&pdev->dev, "failed to map registers, aborting.\n"); > + return -ENOMEM; > + } > + > + at91_rtc_write(AT91_RTC_CR, 0); > + at91_rtc_write(AT91_RTC_MR, 0); /* 24 hour mode */ > > /* Disable all interrupts */ > - at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | > + at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | > AT91_RTC_SECEV | AT91_RTC_TIMEV | > AT91_RTC_CALEV); > > - ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, > + ret = request_irq(irq, at91_rtc_interrupt, > IRQF_SHARED, > "at91_rtc", pdev); > if (ret) { > printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", > - AT91_ID_SYS); > + irq); > return ret; > } > > @@ -284,7 +309,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev) > rtc = rtc_device_register(pdev->name, &pdev->dev, > &at91_rtc_ops, THIS_MODULE); > if (IS_ERR(rtc)) { > - free_irq(AT91_ID_SYS, pdev); > + free_irq(irq, pdev); > return PTR_ERR(rtc); > } > platform_set_drvdata(pdev, rtc); > @@ -301,10 +326,10 @@ static int __exit at91_rtc_remove(struct platform_device *pdev) > struct rtc_device *rtc = platform_get_drvdata(pdev); > > /* Disable all interrupts */ > - at91_sys_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | > + at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM | > AT91_RTC_SECEV | AT91_RTC_TIMEV | > AT91_RTC_CALEV); > - free_irq(AT91_ID_SYS, pdev); > + free_irq(irq, pdev); > > rtc_device_unregister(rtc); > platform_set_drvdata(pdev, NULL); > @@ -323,13 +348,13 @@ static int at91_rtc_suspend(struct device *dev) > /* this IRQ is shared with DBGU and other hardware which isn't > * necessarily doing PM like we are... > */ > - at91_rtc_imr = at91_sys_read(AT91_RTC_IMR) > + at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR) > & (AT91_RTC_ALARM|AT91_RTC_SECEV); > if (at91_rtc_imr) { > if (device_may_wakeup(dev)) > - enable_irq_wake(AT91_ID_SYS); > + enable_irq_wake(irq); > else > - at91_sys_write(AT91_RTC_IDR, at91_rtc_imr); > + at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr); > } > return 0; > } > @@ -338,9 +363,9 @@ static int at91_rtc_resume(struct device *dev) > { > if (at91_rtc_imr) { > if (device_may_wakeup(dev)) > - disable_irq_wake(AT91_ID_SYS); > + disable_irq_wake(irq); > else > - at91_sys_write(AT91_RTC_IER, at91_rtc_imr); > + at91_rtc_write(AT91_RTC_IER, at91_rtc_imr); > } > return 0; > }