Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c3583b6 authored by Jean-Christophe PLAGNIOL-VILLARD's avatar Jean-Christophe PLAGNIOL-VILLARD Committed by Arnd Bergmann
Browse files

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: default avatarJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
parent 1ff5b1b4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -403,7 +403,7 @@ static unsigned int at91cap9_default_irq_priority[NR_AIC_IRQS] __initdata = {
	0,	/* Advanced Interrupt Controller (IRQ1) */
};

struct at91_soc __initdata at91cap9_soc = {
struct at91_init_soc __initdata at91cap9_soc = {
	.map_io = at91cap9_map_io,
	.default_irq_priority = at91cap9_default_irq_priority,
	.init = at91cap9_initialize,
+1 −9
Original line number Diff line number Diff line
@@ -300,14 +300,6 @@ 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
 * -------------------------------------------------------------------- */
@@ -379,7 +371,7 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
	0	/* Advanced Interrupt Controller (IRQ6) */
};

struct at91_soc __initdata at91rm9200_soc = {
struct at91_init_soc __initdata at91rm9200_soc = {
	.map_io = at91rm9200_map_io,
	.default_irq_priority = at91rm9200_default_irq_priority,
	.init = at91rm9200_initialize,
+4 −5
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <mach/cpu.h>
#include <mach/at91_dbgu.h>
#include <mach/at91sam9260.h>
#include <mach/at91_pmc.h>
#include <mach/at91_rstc.h>
@@ -322,11 +323,9 @@ static void at91sam9260_poweroff(void)

static void __init at91sam9xe_map_io(void)
{
	unsigned long cidr, sram_size;
	unsigned long sram_size;

	cidr = dbgu_readl(AT91_DBGU, CIDR);

	switch (cidr & AT91_CIDR_SRAMSIZ) {
	switch (at91_soc_initdata.cidr & AT91_CIDR_SRAMSIZ) {
		case AT91_CIDR_SRAMSIZ_32K:
			sram_size = 2 * SZ_16K;
			break;
@@ -410,7 +409,7 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
	0,	/* Advanced Interrupt Controller */
};

struct at91_soc __initdata at91sam9260_soc = {
struct at91_init_soc __initdata at91sam9260_soc = {
	.map_io = at91sam9260_map_io,
	.default_irq_priority = at91sam9260_default_irq_priority,
	.init = at91sam9260_initialize,
+1 −1
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -372,7 +372,7 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
	0,	/* Advanced Interrupt Controller (IRQ1) */
};

struct at91_soc __initdata at91sam9263_soc = {
struct at91_init_soc __initdata at91sam9263_soc = {
	.map_io = at91sam9263_map_io,
	.default_irq_priority = at91sam9263_default_irq_priority,
	.init = at91sam9263_initialize,
Loading