at91rm9200: introduce at91rm9200_set_type to specficy cpu package
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sun, 24 Apr 2011 03:40:22 +0000 (11:40 +0800)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Wed, 25 May 2011 15:04:35 +0000 (23:04 +0800)
as we can not detect it
by defaut the type will be bga
introduce cpu_is_at91rm9200_bga and cpu_is_at91rm9200_pqfp

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
17 files changed:
arch/arm/mach-at91/at91rm9200.c
arch/arm/mach-at91/board-1arm.c
arch/arm/mach-at91/board-carmeva.c
arch/arm/mach-at91/board-cpuat91.c
arch/arm/mach-at91/board-csb337.c
arch/arm/mach-at91/board-csb637.c
arch/arm/mach-at91/board-eb9200.c
arch/arm/mach-at91/board-ecbat91.c
arch/arm/mach-at91/board-eco920.c
arch/arm/mach-at91/board-kafa.c
arch/arm/mach-at91/board-kb9202.c
arch/arm/mach-at91/board-picotux200.c
arch/arm/mach-at91/board-rm9200dk.c
arch/arm/mach-at91/board-rm9200ek.c
arch/arm/mach-at91/board-yl-9200.c
arch/arm/mach-at91/generic.h
arch/arm/mach-at91/include/mach/cpu.h

index d3638bd994da74dccf74cd8b2a44c7cd8cbd5bd4..b228ce9e21a14b9e6c20c57e5b87d8bcc5b769bf 100644 (file)
@@ -18,6 +18,7 @@
 #include <mach/at91rm9200.h>
 #include <mach/at91_pmc.h>
 #include <mach/at91_st.h>
+#include <mach/cpu.h>
 
 #include "generic.h"
 #include "clock.h"
@@ -303,6 +304,13 @@ static void at91rm9200_reset(void)
        at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
 }
 
+int rm9200_type;
+EXPORT_SYMBOL(rm9200_type);
+
+void __init at91rm9200_set_type(int type)
+{
+       rm9200_type = type;
+}
 
 /* --------------------------------------------------------------------
  *  AT91RM9200 processor initialization
@@ -313,7 +321,7 @@ void __init at91rm9200_map_io(void)
        iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc));
 }
 
-void __init at91rm9200_initialize(unsigned long main_clock, unsigned short banks)
+void __init at91rm9200_initialize(unsigned long main_clock)
 {
        at91_arch_reset = at91rm9200_reset;
        at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
@@ -328,7 +336,8 @@ void __init at91rm9200_initialize(unsigned long main_clock, unsigned short banks
        at91rm9200_register_clocks();
 
        /* Initialize GPIO subsystem */
-       at91_gpio_init(at91rm9200_gpio, banks);
+       at91_gpio_init(at91rm9200_gpio,
+               cpu_is_at91rm9200_bga() ? AT91RM9200_BGA : AT91RM9200_PQFP);
 }
 
 
index 73372ca868dec45a6b32baa4b34cc92bc74a8613..ab1d463aa47d4c3c72d6df44f590bec8a767d24e 100644 (file)
 
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/cpu.h>
 
 #include "generic.h"
 
 
 static void __init onearm_init_early(void)
 {
+       /* Set cpu type: PQFP */
+       at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
+
        /* Initialize processor: 18.432 MHz crystal */
-       at91rm9200_initialize(18432000, AT91RM9200_PQFP);
+       at91rm9200_initialize(18432000);
 
        /* DBGU on ttyS0. (Rx & Tx only) */
        at91_register_uart(0, 0, 0);
index 3929b1172067270d64d0eb617c82ddb1387a8a2f..f36b18687494a5548ace1b4a534cee7cb284aa1d 100644 (file)
@@ -43,7 +43,7 @@
 static void __init carmeva_init_early(void)
 {
        /* Initialize processor: 20.000 MHz crystal */
-       at91rm9200_initialize(20000000, AT91RM9200_BGA);
+       at91rm9200_initialize(20000000);
 
        /* DBGU on ttyS0. (Rx & Tx only) */
        at91_register_uart(0, 0, 0);
index 620a36ae79c4ccd005e09afc4e1d1e34d094f2b9..6daabe3907a1d7cdaa033147de021114ce6727d2 100644 (file)
@@ -38,6 +38,7 @@
 #include <mach/board.h>
 #include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
+#include <mach/cpu.h>
 
 #include "generic.h"
 
@@ -52,8 +53,11 @@ static struct gpio_led cpuat91_leds[] = {
 
 static void __init cpuat91_init_early(void)
 {
+       /* Set cpu type: PQFP */
+       at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
+
        /* Initialize processor: 18.432 MHz crystal */
-       at91rm9200_initialize(18432000, AT91RM9200_PQFP);
+       at91rm9200_initialize(18432000);
 
        /* DBGU on ttyS0. (Rx & Tx only) */
        at91_register_uart(0, 0, 0);
index a7be81e8b9101b56e115f3103d98816306b6e2ed..d98bcec1dfe000d6dc667081f36655a6206bf5fa 100644 (file)
@@ -46,7 +46,7 @@
 static void __init csb337_init_early(void)
 {
        /* Initialize processor: 3.6864 MHz crystal */
-       at91rm9200_initialize(3686400, AT91RM9200_BGA);
+       at91rm9200_initialize(3686400);
 
        /* Setup the LEDs */
        at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
index 58a80c368652006f59ec3d237e130f8d8222b3ec..019aab4e20b01394aba18eb89580e2ed729b08a6 100644 (file)
@@ -43,7 +43,7 @@
 static void __init csb637_init_early(void)
 {
        /* Initialize processor: 3.6864 MHz crystal */
-       at91rm9200_initialize(3686400, AT91RM9200_BGA);
+       at91rm9200_initialize(3686400);
 
        /* DBGU on ttyS0. (Rx & Tx only) */
        at91_register_uart(0, 0, 0);
index e9fff803029362faff32537a21af6f81918e5201..e9484535cbc81f213b77bf617068721a037a3b9a 100644 (file)
@@ -43,7 +43,7 @@
 static void __init eb9200_init_early(void)
 {
        /* Initialize processor: 18.432 MHz crystal */
-       at91rm9200_initialize(18432000, AT91RM9200_BGA);
+       at91rm9200_initialize(18432000);
 
        /* DBGU on ttyS0. (Rx & Tx only) */
        at91_register_uart(0, 0, 0);
index eea65eaf062a180fb6e99de08763e621f26a333f..a6f57faa10a7f1dbc202c6d320c03854fff54982 100644 (file)
 
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/cpu.h>
 
 #include "generic.h"
 
 
 static void __init ecb_at91init_early(void)
 {
+       /* Set cpu type: PQFP */
+       at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
+
        /* Initialize processor: 18.432 MHz crystal */
-       at91rm9200_initialize(18432000, AT91RM9200_PQFP);
+       at91rm9200_initialize(18432000);
 
        /* Setup the LEDs */
        at91_init_leds(AT91_PIN_PC7, AT91_PIN_PC7);
index 90a44e5c6391d1fbf93a6ce1a41d33d2fa56457d..bfc0062d1483f61e0a1d7026ca9a859a41253840 100644 (file)
 
 #include <mach/board.h>
 #include <mach/at91rm9200_mc.h>
+#include <mach/cpu.h>
+
 #include "generic.h"
 
 static void __init eco920_init_early(void)
 {
-       at91rm9200_initialize(18432000, AT91RM9200_PQFP);
+       /* Set cpu type: PQFP */
+       at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
+
+       at91rm9200_initialize(18432000);
 
        /* Setup the LEDs */
        at91_init_leds(AT91_PIN_PB0, AT91_PIN_PB1);
index 4f17a1c98f2ef01bb550d5373eebac28986c19d4..9b003ff744ba4c87d3746001de09125a36fe7657 100644 (file)
 
 #include <mach/board.h>
 #include <mach/gpio.h>
+#include <mach/cpu.h>
 
 #include "generic.h"
 
 
 static void __init kafa_init_early(void)
 {
+       /* Set cpu type: PQFP */
+       at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
+
        /* Initialize processor: 18.432 MHz crystal */
-       at91rm9200_initialize(18432000, AT91RM9200_PQFP);
+       at91rm9200_initialize(18432000);
 
        /* Set up the LEDs */
        at91_init_leds(AT91_PIN_PB4, AT91_PIN_PB4);
index 39247fae5171ebe4938061ccb65628a826e43404..a813a74b65f9e296aba3d4d31af7f48913dd87e2 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <mach/board.h>
 #include <mach/gpio.h>
-
+#include <mach/cpu.h>
 #include <mach/at91rm9200_mc.h>
 
 #include "generic.h"
 
 static void __init kb9202_init_early(void)
 {
+       /* Set cpu type: PQFP */
+       at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
+
        /* Initialize processor: 10 MHz crystal */
-       at91rm9200_initialize(10000000, AT91RM9200_PQFP);
+       at91rm9200_initialize(10000000);
 
        /* Set up the LEDs */
        at91_init_leds(AT91_PIN_PC19, AT91_PIN_PC18);
index 8294eae1e6648e385605f5f2a88ec2163d871bf7..756cc2a745ddd16c5ac5f1f3a23cc10aac4fe158 100644 (file)
@@ -46,7 +46,7 @@
 static void __init picotux200_init_early(void)
 {
        /* Initialize processor: 18.432 MHz crystal */
-       at91rm9200_initialize(18432000, AT91RM9200_BGA);
+       at91rm9200_initialize(18432000);
 
        /* DBGU on ttyS0. (Rx & Tx only) */
        at91_register_uart(0, 0, 0);
index b90d0f9ade32a7f2736b9f38aea1464c5a0d7ff1..aef9627710b0cee79ce885abb8b6e1be60df1bf5 100644 (file)
@@ -48,7 +48,7 @@
 static void __init dk_init_early(void)
 {
        /* Initialize processor: 18.432 MHz crystal */
-       at91rm9200_initialize(18432000, AT91RM9200_BGA);
+       at91rm9200_initialize(18432000);
 
        /* Setup the LEDs */
        at91_init_leds(AT91_PIN_PB2, AT91_PIN_PB2);
index 51c266807b1e8eef5c5ed62be1118991532db559..015a02183080973619b389bf406c98ee87ba91af 100644 (file)
@@ -48,7 +48,7 @@
 static void __init ek_init_early(void)
 {
        /* Initialize processor: 18.432 MHz crystal */
-       at91rm9200_initialize(18432000, AT91RM9200_BGA);
+       at91rm9200_initialize(18432000);
 
        /* Setup the LEDs */
        at91_init_leds(AT91_PIN_PB1, AT91_PIN_PB2);
index 167337ff79c82113dbbadb6d02799c8e8b40129f..c208cc334d7df8421e34ea004b8380c374159791 100644 (file)
 #include <mach/board.h>
 #include <mach/gpio.h>
 #include <mach/at91rm9200_mc.h>
+#include <mach/cpu.h>
 
 #include "generic.h"
 
 
 static void __init yl9200_init_early(void)
 {
+       /* Set cpu type: PQFP */
+       at91rm9200_set_type(ARCH_REVISON_9200_PQFP);
+
        /* Initialize processor: 18.432 MHz crystal */
-       at91rm9200_initialize(18432000, AT91RM9200_PQFP);
+       at91rm9200_initialize(18432000);
 
        /* Setup the LEDs D2=PB17 (timer), D3=PB16 (cpu) */
        at91_init_leds(AT91_PIN_PB16, AT91_PIN_PB17);
index ecba94ee520bb5424fd69a0d5c88e8fa1ae9f400..5783bd1b6c4062f4154fa5c1510f558bb809b2f9 100644 (file)
@@ -22,7 +22,8 @@ extern void __init at91cap9_map_io(void);
 extern void __init at572d940hf_map_io(void);
 
  /* Processors */
-extern void __init at91rm9200_initialize(unsigned long main_clock, unsigned short banks);
+extern void __init at91rm9200_set_type(int type);
+extern void __init at91rm9200_initialize(unsigned long main_clock);
 extern void __init at91sam9260_initialize(unsigned long main_clock);
 extern void __init at91sam9261_initialize(unsigned long main_clock);
 extern void __init at91sam9263_initialize(unsigned long main_clock);
index 0700f2125305d99fd769f46726fe1e09afaa3dcc..ab00372ca04538bc8957e88821cd12e59e50cbd7 100644 (file)
@@ -90,9 +90,16 @@ static inline unsigned long at91cap9_rev_identify(void)
 #endif
 
 #ifdef CONFIG_ARCH_AT91RM9200
+extern int rm9200_type;
+#define ARCH_REVISON_9200_BGA  (0 << 0)
+#define ARCH_REVISON_9200_PQFP (1 << 0)
 #define cpu_is_at91rm9200()    (at91_cpu_identify() == ARCH_ID_AT91RM9200)
+#define cpu_is_at91rm9200_bga()        (!cpu_is_at91rm9200_pqfp())
+#define cpu_is_at91rm9200_pqfp() (cpu_is_at91rm9200() && rm9200_type & ARCH_REVISON_9200_PQFP)
 #else
 #define cpu_is_at91rm9200()    (0)
+#define cpu_is_at91rm9200_bga()        (0)
+#define cpu_is_at91rm9200_pqfp() (0)
 #endif
 
 #ifdef CONFIG_ARCH_AT91SAM9260