From: rmallon@gmail.com (Ryan Mallon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: at91/rtc-at91sam9: rework resources assignment
Date: Tue, 21 Feb 2012 07:04:26 +1100 [thread overview]
Message-ID: <4F42A74A.1070008@gmail.com> (raw)
In-Reply-To: <1329749142-6965-1-git-send-email-nicolas.ferre@atmel.com>
On 21/02/12 01:45, Nicolas Ferre wrote:
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
> Russell, Ryan,
>
> As I do think that these changes need explanation, here is my rework of Jean's
> patch. I would like to know if the little comment and general rework of
> resources assignment sound ok...
>
> I plan to merge this patch with the one discussed previously:
> "[PATCH 13/18] ARM: at91/rtc-at91sam9: pass the GPBR to use via ressources"
Thanks Nicolas,
Reviewed-by: Ryan Mallon <rmallon@gmail.com>
> If you agree, I will repost the whole series afterwards.
>
>
> arch/arm/mach-at91/at91sam9260_devices.c | 13 ++++++++++---
> arch/arm/mach-at91/at91sam9261_devices.c | 13 ++++++++++---
> arch/arm/mach-at91/at91sam9263_devices.c | 22 ++++++++++++++++------
> arch/arm/mach-at91/at91sam9g45_devices.c | 13 ++++++++++---
> arch/arm/mach-at91/at91sam9rl_devices.c | 13 ++++++++++---
> 5 files changed, 56 insertions(+), 18 deletions(-)
>
> diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
> index f8a88fb..df487ce 100644
> --- a/arch/arm/mach-at91/at91sam9260_devices.c
> +++ b/arch/arm/mach-at91/at91sam9260_devices.c
> @@ -727,7 +727,6 @@ static struct platform_device at91sam9260_rtt_device = {
> .name = "at91_rtt",
> .id = 0,
> .resource = rtt_resources,
> - .num_resources = 1,
> };
>
>
> @@ -735,13 +734,21 @@ static struct platform_device at91sam9260_rtt_device = {
> static void __init at91_add_device_rtt_rtc(void)
> {
> at91sam9260_rtt_device.name = "rtc-at91sam9";
> - at91sam9260_rtt_device.num_resources++;
> + /*
> + * The second resource is needed:
> + * GPBR will serve as the storage for RTC time offset
> + */
> + at91sam9260_rtt_device.num_resources = 2;
> rtt_resources[1].start = AT91SAM9260_BASE_GPBR +
> 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
> rtt_resources[1].end = rtt_resources[1].start + 3;
> }
> #else
> -static void __init at91_add_device_rtt_rtc(void) {}
> +static void __init at91_add_device_rtt_rtc(void)
> +{
> + /* Only one resource is needed: RTT not used as RTC */
> + at91sam9260_rtt_device.num_resources = 1;
> +}
> #endif
>
> static void __init at91_add_device_rtt(void)
> diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
> index 32a20ef..3bd10ce 100644
> --- a/arch/arm/mach-at91/at91sam9261_devices.c
> +++ b/arch/arm/mach-at91/at91sam9261_devices.c
> @@ -613,20 +613,27 @@ static struct platform_device at91sam9261_rtt_device = {
> .name = "at91_rtt",
> .id = 0,
> .resource = rtt_resources,
> - .num_resources = 1,
> };
>
> #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
> static void __init at91_add_device_rtt_rtc(void)
> {
> at91sam9261_rtt_device.name = "rtc-at91sam9";
> - at91sam9261_rtt_device.num_resources++;
> + /*
> + * The second resource is needed:
> + * GPBR will serve as the storage for RTC time offset
> + */
> + at91sam9261_rtt_device.num_resources = 2;
> rtt_resources[1].start = AT91SAM9261_BASE_GPBR +
> 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
> rtt_resources[1].end = rtt_resources[1].start + 3;
> }
> #else
> -static void __init at91_add_device_rtt_rtc(void) {}
> +static void __init at91_add_device_rtt_rtc(void)
> +{
> + /* Only one resource is needed: RTT not used as RTC */
> + at91sam9261_rtt_device.num_resources = 1;
> +}
> #endif
>
> static void __init at91_add_device_rtt(void)
> diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
> index 28cb074..7792de5 100644
> --- a/arch/arm/mach-at91/at91sam9263_devices.c
> +++ b/arch/arm/mach-at91/at91sam9263_devices.c
> @@ -976,7 +976,6 @@ static struct platform_device at91sam9263_rtt0_device = {
> .name = "at91_rtt",
> .id = 0,
> .resource = rtt0_resources,
> - .num_resources = 1,
> };
>
> static struct resource rtt1_resources[] = {
> @@ -993,7 +992,6 @@ static struct platform_device at91sam9263_rtt1_device = {
> .name = "at91_rtt",
> .id = 1,
> .resource = rtt1_resources,
> - .num_resources = 1,
> };
>
> #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
> @@ -1004,26 +1002,38 @@ static void __init at91_add_device_rtt_rtc(void)
>
> switch (CONFIG_RTC_DRV_AT91SAM9_RTT) {
> case 0:
> + /*
> + * The second resource is needed only for the chosen RTT:
> + * GPBR will serve as the storage for RTC time offset
> + */
> + at91sam9263_rtt0_device.num_resources = 2;
> + at91sam9263_rtt1_device.num_resources = 1;
> pdev = &at91sam9263_rtt0_device;
> r = rtt0_resources;
> break;
> case 1:
> + at91sam9263_rtt0_device.num_resources = 1;
> + at91sam9263_rtt1_device.num_resources = 2;
> pdev = &at91sam9263_rtt1_device;
> r = rtt1_resources;
> break;
> default:
> - pr_err("at91sam9263: support only 2 RTT (%d)\n",
> + pr_err("at91sam9263: only supports 2 RTT (%d)\n",
> CONFIG_RTC_DRV_AT91SAM9_RTT);
> return;
> }
>
> + pdev->name = "rtc-at91sam9";
> r[1].start = AT91SAM9263_BASE_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
> r[1].end = r[1].start + 3;
> - pdev->name = "rtc-at91sam9";
> - pdev->num_resources++;
> }
> #else
> -static void __init at91_add_device_rtt_rtc(void) {}
> +static void __init at91_add_device_rtt_rtc(void)
> +{
> + /* Only one resource is needed: RTT not used as RTC */
> + at91sam9263_rtt0_device.num_resources = 1;
> + at91sam9263_rtt1_device.num_resources = 1;
> +}
> #endif
>
> static void __init at91_add_device_rtt(void)
> diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
> index bb7e2ce..4108295 100644
> --- a/arch/arm/mach-at91/at91sam9g45_devices.c
> +++ b/arch/arm/mach-at91/at91sam9g45_devices.c
> @@ -1203,20 +1203,27 @@ static struct platform_device at91sam9g45_rtt_device = {
> .name = "at91_rtt",
> .id = 0,
> .resource = rtt_resources,
> - .num_resources = 1,
> };
>
> #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
> static void __init at91_add_device_rtt_rtc(void)
> {
> at91sam9g45_rtt_device.name = "rtc-at91sam9";
> - at91sam9g45_rtt_device.num_resources++;
> + /*
> + * The second resource is needed:
> + * GPBR will serve as the storage for RTC time offset
> + */
> + at91sam9g45_rtt_device.num_resources = 2;
> rtt_resources[1].start = AT91SAM9G45_BASE_GPBR +
> 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
> rtt_resources[1].end = rtt_resources[1].start + 3;
> }
> #else
> -static void __init at91_add_device_rtt_rtc(void) {}
> +static void __init at91_add_device_rtt_rtc(void)
> +{
> + /* Only one resource is needed: RTT not used as RTC */
> + at91sam9g45_rtt_device.num_resources = 1;
> +}
> #endif
>
> static void __init at91_add_device_rtt(void)
> diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
> index 16fd20b..eda72e8 100644
> --- a/arch/arm/mach-at91/at91sam9rl_devices.c
> +++ b/arch/arm/mach-at91/at91sam9rl_devices.c
> @@ -692,20 +692,27 @@ static struct platform_device at91sam9rl_rtt_device = {
> .name = "at91_rtt",
> .id = 0,
> .resource = rtt_resources,
> - .num_resources = 1,
> };
>
> #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
> static void __init at91_add_device_rtt_rtc(void)
> {
> at91sam9rl_rtt_device.name = "rtc-at91sam9";
> - at91sam9rl_rtt_device.num_resources++;
> + /*
> + * The second resource is needed:
> + * GPBR will serve as the storage for RTC time offset
> + */
> + at91sam9rl_rtt_device.num_resources = 2;
> rtt_resources[1].start = AT91SAM9RL_BASE_GPBR +
> 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
> rtt_resources[1].end = rtt_resources[1].start + 3;
> }
> #else
> -static void __init at91_add_device_rtt_rtc(void) {}
> +static void __init at91_add_device_rtt_rtc(void)
> +{
> + /* Only one resource is needed: RTT not used as RTC */
> + at91sam9rl_rtt_device.num_resources = 1;
> +}
> #endif
>
> static void __init at91_add_device_rtt(void)
next prev parent reply other threads:[~2012-02-20 20:04 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-17 17:49 [PATCH 00/18] at91 first cleanup series for 3.4 Nicolas Ferre
2012-02-17 17:49 ` [PATCH 01/18] ARM: at91: factorise duplicated at91sam9 idle Nicolas Ferre
2012-02-17 17:49 ` [PATCH 02/18] ARM: at91/at91x40: remove use of at91_sys_read/write Nicolas Ferre
2012-02-17 17:49 ` [PATCH 03/18] ARM: at91: make matrix register base soc independent Nicolas Ferre
2012-02-17 17:49 ` [PATCH 04/18] ARM: at91: make ST (System Timer) " Nicolas Ferre
2012-02-20 0:22 ` Ryan Mallon
2012-02-20 1:38 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 1:52 ` Ryan Mallon
2012-02-20 3:02 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 3:16 ` Ryan Mallon
2012-02-20 3:23 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 3:48 ` Ryan Mallon
2012-02-20 3:49 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 7:33 ` Russell King - ARM Linux
2012-02-20 9:18 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-17 17:49 ` [PATCH 05/18] ARM: at91/pm_slowclock: rename register to named define Nicolas Ferre
2012-02-17 17:49 ` [PATCH 06/18] ARM: at91/pm_slowclock: function slow_clock() accepts parameters Nicolas Ferre
2012-02-17 17:49 ` [PATCH 07/18] ARM: at91: move at91rm9200 sdramc defines to at91rm9200_sdramc.h Nicolas Ferre
2012-02-17 17:50 ` [PATCH 08/18] ARM: at91: make sdram/ddr register base soc independent Nicolas Ferre
2012-02-17 17:50 ` [PATCH 09/18] ARM: at91/pm_slowclock: add runtime detection of memory contoller Nicolas Ferre
2012-02-17 17:50 ` [PATCH 10/18] ARM: at91/PMC: make register base soc independent Nicolas Ferre
2012-02-20 0:27 ` Ryan Mallon
2012-02-17 17:50 ` [PATCH 11/18] ARM: at91/rtc-at91sam9: each SoC can select the RTT device to use Nicolas Ferre
2012-02-20 0:32 ` Ryan Mallon
2012-02-20 1:25 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-17 17:50 ` [PATCH 12/18] ARM: at91:rtc/rtc-at91sam9: ioremap register bank Nicolas Ferre
2012-02-17 17:50 ` [PATCH 13/18] ARM: at91/rtc-at91sam9: pass the GPBR to use via ressources Nicolas Ferre
2012-02-20 0:43 ` Ryan Mallon
2012-02-20 1:20 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 7:36 ` Russell King - ARM Linux
2012-02-20 9:16 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-20 10:04 ` Russell King - ARM Linux
2012-02-20 11:21 ` Nicolas Ferre
2012-02-20 14:45 ` [PATCH] ARM: at91/rtc-at91sam9: rework resources assignment Nicolas Ferre
2012-02-20 15:06 ` Russell King - ARM Linux
2012-02-20 20:04 ` Ryan Mallon [this message]
2012-02-17 17:50 ` [PATCH 14/18] ARM: at91: finally drop at91_sys_read/write Nicolas Ferre
2012-02-17 17:50 ` [PATCH 15/18] ARM: at91: merge SRAM Memory banks thanks to mirroring Nicolas Ferre
2012-02-17 17:50 ` [PATCH 16/18] Atmel: move console default platform_device to serial driver Nicolas Ferre
2012-02-18 9:17 ` Hans-Christian Egtvedt
2012-02-19 7:07 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-17 17:50 ` [PATCH 17/18] ARM: at91/board-dt: drop default console Nicolas Ferre
2012-02-17 17:50 ` [PATCH 18/18] ARM: at91/board-dt: move at91_initialize() to init_irq() Nicolas Ferre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F42A74A.1070008@gmail.com \
--to=rmallon@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).