From 21d08b9d5536ac418bbce4f419fe2b528b7ddf31 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 23 Apr 2011 15:28:34 +0800 Subject: at91: introduce commom AT91_BASE_SYS On all at91 except rm9200 and x40 have the System Controller starts at address 0xffffc000 and has a size of 16KiB. On rm9200 it's start at 0xfffe4000 of 111KiB with non reserved data starting at 0xfffff000 This patch removes the individual definitions of AT91_BASE_SYS and replaces them with a common version at base 0xfffffc000 and size 16KiB and map the same memory space Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Nicolas Ferre Cc: Patrice Vilchez --- arch/arm/mach-at91/at91sam9261.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) (limited to 'arch/arm/mach-at91/at91sam9261.c') diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index c1483168c97a..a0081c081c32 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -22,18 +22,10 @@ #include #include +#include "soc.h" #include "generic.h" #include "clock.h" -static struct map_desc at91sam9261_io_desc[] __initdata = { - { - .virtual = AT91_VA_BASE_SYS, - .pfn = __phys_to_pfn(AT91_BASE_SYS), - .length = SZ_16K, - .type = MT_DEVICE, - }, -}; - static struct map_desc at91sam9261_sram_desc[] __initdata = { { .virtual = AT91_IO_VIRT_BASE - AT91SAM9261_SRAM_SIZE, @@ -302,18 +294,15 @@ static void at91sam9261_poweroff(void) * AT91SAM9261 processor initialization * -------------------------------------------------------------------- */ -void __init at91sam9261_map_io(void) +static void __init at91sam9261_map_io(void) { - /* Map peripherals */ - iotable_init(at91sam9261_io_desc, ARRAY_SIZE(at91sam9261_io_desc)); - if (cpu_is_at91sam9g10()) iotable_init(at91sam9g10_sram_desc, ARRAY_SIZE(at91sam9g10_sram_desc)); else iotable_init(at91sam9261_sram_desc, ARRAY_SIZE(at91sam9261_sram_desc)); } -void __init at91sam9261_initialize(unsigned long main_clock) +static void __init at91sam9261_initialize(unsigned long main_clock) { at91_arch_reset = at91sam9_alt_reset; pm_power_off = at91sam9261_poweroff; @@ -383,3 +372,8 @@ void __init at91sam9261_init_interrupts(unsigned int priority[NR_AIC_IRQS]) /* Enable GPIO interrupts */ at91_gpio_irq_setup(); } + +struct at91_soc __initdata at91sam9261_soc = { + .map_io = at91sam9261_map_io, + .init = at91sam9261_initialize, +}; -- cgit v1.2.2 From 92100c12ca1bc5f347ff41c1413f9db07c4d276c Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 23 Apr 2011 15:28:34 +0800 Subject: at91: factorize at91 interrupts init to soc they are the same except the default priority Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Nicolas Ferre Cc: Patrice Vilchez --- arch/arm/mach-at91/at91sam9261.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'arch/arm/mach-at91/at91sam9261.c') diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index a0081c081c32..7a4a673eedeb 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -361,19 +361,8 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = { 0, /* Advanced Interrupt Controller */ }; -void __init at91sam9261_init_interrupts(unsigned int priority[NR_AIC_IRQS]) -{ - if (!priority) - priority = at91sam9261_default_irq_priority; - - /* Initialize the AIC interrupt controller */ - at91_aic_init(priority); - - /* Enable GPIO interrupts */ - at91_gpio_irq_setup(); -} - struct at91_soc __initdata at91sam9261_soc = { .map_io = at91sam9261_map_io, + .default_irq_priority = at91sam9261_default_irq_priority, .init = at91sam9261_initialize, }; -- cgit v1.2.2 From 8c3583b634d5705d8f604c0d9392bc273d19c256 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 23 Apr 2011 22:12:57 +0800 Subject: at91: use structure to store the current soc instead of reading the registers everytime the current implementation respect the following constrain: - allow 1 to n soc to be enabled - allow to have a virtual cpu type and subtype - always detect the cpu type and subtype and report it - detect if the soc support is enabled - prepare for sysfs export support - drop soc specific code via compiler when the soc not enabled (via cpu_is_xxx) Today if we read the exid we will have the same value for 9g35 and 9m11 and we will need to check the cidr too with the new implementation we just need to check the soc subtype this will also allow to have specific virtual subtype for rm9200 which the board will have to specify via at91rm9200_set_type(int) as we have no way to detect it. this implementation is inspired by the SH cpu detection support Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Nicolas Ferre Cc: Patrice Vilchez --- arch/arm/mach-at91/at91sam9261.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/arm/mach-at91/at91sam9261.c') diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 7a4a673eedeb..f6a2b30884e9 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -361,7 +361,7 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = { 0, /* Advanced Interrupt Controller */ }; -struct at91_soc __initdata at91sam9261_soc = { +struct at91_init_soc __initdata at91sam9261_soc = { .map_io = at91sam9261_map_io, .default_irq_priority = at91sam9261_default_irq_priority, .init = at91sam9261_initialize, -- cgit v1.2.2 From 465393749da3a3229f6067246c7e8f97f7cc833d Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 24 Apr 2011 18:20:28 +0800 Subject: at91: move clock subsystem init to soc generic init Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Nicolas Ferre Cc: Patrice Vilchez --- arch/arm/mach-at91/at91sam9261.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'arch/arm/mach-at91/at91sam9261.c') diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index f6a2b30884e9..963197383870 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -302,16 +302,13 @@ static void __init at91sam9261_map_io(void) iotable_init(at91sam9261_sram_desc, ARRAY_SIZE(at91sam9261_sram_desc)); } -static void __init at91sam9261_initialize(unsigned long main_clock) +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); - /* Init clock subsystem */ - at91_clock_init(main_clock); - /* Register the processor-specific clocks */ at91sam9261_register_clocks(); -- cgit v1.2.2 From 51ddec7617bd0d4c73c44a8862faac5d7d97eb03 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Sun, 24 Apr 2011 18:15:34 +0800 Subject: at91: move register clocks to soc generic init Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Nicolas Ferre Cc: Patrice Vilchez --- arch/arm/mach-at91/at91sam9261.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'arch/arm/mach-at91/at91sam9261.c') diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 963197383870..8f97bd4a5268 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -309,9 +309,6 @@ static void __init at91sam9261_initialize(void) at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1) | (1 << AT91SAM9261_ID_IRQ2); - /* Register the processor-specific clocks */ - at91sam9261_register_clocks(); - /* Register GPIO subsystem */ at91_gpio_init(at91sam9261_gpio, 3); } @@ -361,5 +358,6 @@ 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, + .register_clocks = at91sam9261_register_clocks, .init = at91sam9261_initialize, }; -- cgit v1.2.2 From f0051d82a68abcf35418d49db1c82e6f0e514d78 Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Tue, 10 May 2011 03:20:09 +0800 Subject: at91: factorize sram init Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD Cc: Nicolas Ferre Cc: Patrice Vilchez --- arch/arm/mach-at91/at91sam9261.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'arch/arm/mach-at91/at91sam9261.c') diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c index 8f97bd4a5268..d522b47e30b5 100644 --- a/arch/arm/mach-at91/at91sam9261.c +++ b/arch/arm/mach-at91/at91sam9261.c @@ -26,24 +26,6 @@ #include "generic.h" #include "clock.h" -static struct map_desc at91sam9261_sram_desc[] __initdata = { - { - .virtual = AT91_IO_VIRT_BASE - AT91SAM9261_SRAM_SIZE, - .pfn = __phys_to_pfn(AT91SAM9261_SRAM_BASE), - .length = AT91SAM9261_SRAM_SIZE, - .type = MT_DEVICE, - }, -}; - -static struct map_desc at91sam9g10_sram_desc[] __initdata = { - { - .virtual = AT91_IO_VIRT_BASE - AT91SAM9G10_SRAM_SIZE, - .pfn = __phys_to_pfn(AT91SAM9G10_SRAM_BASE), - .length = AT91SAM9G10_SRAM_SIZE, - .type = MT_DEVICE, - }, -}; - /* -------------------------------------------------------------------- * Clocks * -------------------------------------------------------------------- */ @@ -297,9 +279,9 @@ static void at91sam9261_poweroff(void) static void __init at91sam9261_map_io(void) { if (cpu_is_at91sam9g10()) - iotable_init(at91sam9g10_sram_desc, ARRAY_SIZE(at91sam9g10_sram_desc)); + at91_init_sram(0, AT91SAM9G10_SRAM_BASE, AT91SAM9G10_SRAM_SIZE); else - iotable_init(at91sam9261_sram_desc, ARRAY_SIZE(at91sam9261_sram_desc)); + at91_init_sram(0, AT91SAM9261_SRAM_BASE, AT91SAM9261_SRAM_SIZE); } static void __init at91sam9261_initialize(void) -- cgit v1.2.2