diff options
-rw-r--r-- | arch/arm/cpu/armv7/at91/at91sama5_devices.c | 50 | ||||
-rw-r--r-- | arch/arm/cpu/armv7/at91/cpu.c | 2 | ||||
-rw-r--r-- | arch/arm/include/asm/arch-at91/at91sama5.h | 26 | ||||
-rw-r--r-- | board/atmel/at91sama5ek/at91sama5ek.c | 14 | ||||
-rw-r--r-- | drivers/video/atmel_lcdfb.c | 4 |
5 files changed, 86 insertions, 10 deletions
diff --git a/arch/arm/cpu/armv7/at91/at91sama5_devices.c b/arch/arm/cpu/armv7/at91/at91sama5_devices.c index 3abc8179a7f..50238e48c57 100644 --- a/arch/arm/cpu/armv7/at91/at91sama5_devices.c +++ b/arch/arm/cpu/armv7/at91/at91sama5_devices.c @@ -23,6 +23,7 @@ */ #include <common.h> +#include <asm/arch/at91sama5.h> #include <asm/arch/at91_common.h> #include <asm/arch/at91_pmc.h> #include <asm/arch/gpio.h> @@ -43,6 +44,55 @@ # define PUP 0 #endif +#define CIDR 0x40 +#define EXID 0x44 + +unsigned int get_chip_id(void) +{ + return readl(ATMEL_BASE_DBGU + CIDR); +} + +unsigned int get_extension_chip_id(void) +{ + return readl(ATMEL_BASE_DBGU + EXID); +} + +unsigned int has_emac() +{ + return cpu_is_at91sama5d31() || cpu_is_at91sama5d35(); +} + +unsigned int has_gmac() +{ + return !cpu_is_at91sama5d31(); +} + +unsigned int has_lcdc() +{ + return !cpu_is_at91sama5d35(); +} + +char *get_cpu_name() +{ + unsigned int extension_id = get_extension_chip_id(); + + if (cpu_is_at91sama5()) + switch (extension_id) { + case ARCH_EXID_AT91SAMA5D31: + return CONFIG_SYS_AT91_D31_CPU_NAME; + case ARCH_EXID_AT91SAMA5D33: + return CONFIG_SYS_AT91_D33_CPU_NAME; + case ARCH_EXID_AT91SAMA5D34: + return CONFIG_SYS_AT91_D34_CPU_NAME; + case ARCH_EXID_AT91SAMA5D35: + return CONFIG_SYS_AT91_D35_CPU_NAME; + default: + return CONFIG_SYS_AT91_UNKNOWN_CPU; + } + else + return CONFIG_SYS_AT91_UNKNOWN_CPU; +} + #if 0 void at91_serial0_hw_init(void) { diff --git a/arch/arm/cpu/armv7/at91/cpu.c b/arch/arm/cpu/armv7/at91/cpu.c index c47fb31e999..98102576f2b 100644 --- a/arch/arm/cpu/armv7/at91/cpu.c +++ b/arch/arm/cpu/armv7/at91/cpu.c @@ -60,7 +60,7 @@ int print_cpuinfo(void) { char buf[32]; - printf("CPU: %s\n", ATMEL_CPU_NAME); + printf("CPU: %s\n", get_cpu_name()); printf("Crystal frequency: %8s MHz\n", strmhz(buf, get_main_clk_rate())); printf("CPU clock : %8s MHz\n", diff --git a/arch/arm/include/asm/arch-at91/at91sama5.h b/arch/arm/include/asm/arch-at91/at91sama5.h index fa8b302d815..7b0dcb0bd1f 100644 --- a/arch/arm/include/asm/arch-at91/at91sama5.h +++ b/arch/arm/include/asm/arch-at91/at91sama5.h @@ -18,7 +18,7 @@ /* * defines to be used in other places */ -#define CONFIG_ARMV7 /* ARM926EJS Core */ +#define CONFIG_ARMV7 /* ARM A5 Core */ #define CONFIG_AT91FAMILY /* it's a member of AT91 */ /* @@ -75,6 +75,23 @@ #define ATMEL_ID_FUSE 48 #define ATMEL_ID_MPDDRC 49 +/* sama5 series chip id definitions */ +#define ARCH_ID_AT91SAMA5 0x8a5c07c1 +#define ARCH_EXID_AT91SAMA5D31 0x00444300 +#define ARCH_EXID_AT91SAMA5D33 0x00414300 +#define ARCH_EXID_AT91SAMA5D34 0x00414301 +#define ARCH_EXID_AT91SAMA5D35 0x00584300 + +#define cpu_is_at91sama5() (get_chip_id() == ARCH_ID_AT91SAMA5) +#define cpu_is_at91sama5d31() (cpu_is_at91sama5() && \ + (get_extension_chip_id() == ARCH_EXID_AT91SAMA5D31)) +#define cpu_is_at91sama5d33() (cpu_is_at91sama5() && \ + (get_extension_chip_id() == ARCH_EXID_AT91SAMA5D33)) +#define cpu_is_at91sama5d34() (cpu_is_at91sama5() && \ + (get_extension_chip_id() == ARCH_EXID_AT91SAMA5D34)) +#define cpu_is_at91sama5d35() (cpu_is_at91sama5() && \ + (get_extension_chip_id() == ARCH_EXID_AT91SAMA5D35)) + /* * User Peripherals physical base addresses. */ @@ -171,6 +188,11 @@ /* * Cpu Name */ -#define ATMEL_CPU_NAME "AT91SAMA5" +#define CONFIG_SYS_AT91_D31_CPU_NAME "AT91SAMA5D31" +#define CONFIG_SYS_AT91_D33_CPU_NAME "AT91SAMA5D33" +#define CONFIG_SYS_AT91_D34_CPU_NAME "AT91SAMA5D34" +#define CONFIG_SYS_AT91_D35_CPU_NAME "AT91SAMA5D35" +#define CONFIG_SYS_AT91_UNKNOWN_CPU "Unknown CPU type" + #endif diff --git a/board/atmel/at91sama5ek/at91sama5ek.c b/board/atmel/at91sama5ek/at91sama5ek.c index f95c10e8cc0..9c7ca3ffea0 100644 --- a/board/atmel/at91sama5ek/at91sama5ek.c +++ b/board/atmel/at91sama5ek/at91sama5ek.c @@ -195,7 +195,7 @@ void lcd_show_board_info(void) lcd_printf ("(C) 2008 ATMEL Corp\n"); lcd_printf ("at91support@atmel.com\n"); lcd_printf ("%s CPU at %s MHz\n", - ATMEL_CPU_NAME, + get_cpu_name(), strmhz(temp, get_cpu_clk_rate())); dram_size = 0; @@ -247,10 +247,12 @@ int board_init(void) at91_spi0_hw_init(1 << 4); #endif #ifdef CONFIG_MACB - at91sama5ek_macb_hw_init(); + if(has_emac()) + at91sama5ek_macb_hw_init(); #endif #ifdef CONFIG_GMACB - at91sama5ek_gmacb_hw_init(); + if (has_gmac()) + at91sama5ek_gmacb_hw_init(); #endif #ifdef CONFIG_LCD at91sama5ek_lcd_hw_init(); @@ -275,10 +277,12 @@ int board_eth_init(bd_t *bis) { int rc = 0; #ifdef CONFIG_MACB - rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC, 0x00); + if (has_emac()) + rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC, 0x00); #endif #ifdef CONFIG_GMACB - rc = gmacb_eth_initialize(0, (void *)ATMEL_BASE_GMAC, 0x00); + if (has_gmac()) + rc = gmacb_eth_initialize(0, (void *)ATMEL_BASE_GMAC, 0x00); #endif return rc; } diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index f357d5f9f68..860cbcc4d2e 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c @@ -75,8 +75,8 @@ void lcd_9x5_ctrl_init(void *lcdbase) unsigned long value; lcd_dma_desc *desc; - //if (!has_lcdc()) - // return; /* No lcdc */ + if (!has_lcdc()) + return; /* No lcdc */ /* Disable DISP signal */ lcdc_writel(panel_info.mmio, ATMEL_LCDC_LCDDIS, LCDC_LCDDIS_DISPDIS); |