at91: add sama5d3 support
v2 cover at91: add sama5d3 support
HI,
v2:
update clock support
drop fec.h
this patch serie add the support of the new Cortex-A5 of Atmel the sama5d3x series
This patch serie depends on the w1 dual scan and the macb prepare for gmac
The following changes since commit 1be4806dcc68d6999a07e93ec83c6b12a213dffa:
at91: add clock dump command (2013-01-29 04:16:21 +0800)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git delivery/sama5
for you to fetch changes up to 77510b9afb1a126fac5eb6a364666ad6f832cb44:
at91: add sama5d3xek board support (2013-01-29 20:24:07 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (2):
at91: add sama5d3 support
at91: add sama5d3xek board support
arch/arm/Makefile | 1 + arch/arm/boards/sama5d3xek/Makefile | 2 + arch/arm/boards/sama5d3xek/config.h | 6 ++ arch/arm/boards/sama5d3xek/env/config | 44 +++++++++ arch/arm/boards/sama5d3xek/hw_version.c | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/boards/sama5d3xek/hw_version.h | 34 +++++++ arch/arm/boards/sama5d3xek/init.c | 351 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/configs/sama5d3xek_defconfig | 91 +++++++++++++++++++ arch/arm/mach-at91/Kconfig | 31 +++++++ arch/arm/mach-at91/Makefile | 1 + arch/arm/mach-at91/clock.c | 113 ++++++++++++++++++----- arch/arm/mach-at91/clock.h | 2 + arch/arm/mach-at91/include/mach/at91_pmc.h | 14 ++- arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | 37 ++++++++ arch/arm/mach-at91/include/mach/cpu.h | 27 ++++++ arch/arm/mach-at91/include/mach/hardware.h | 8 ++ arch/arm/mach-at91/include/mach/sama5d3.h | 152 +++++++++++++++++++++++++++++++ arch/arm/mach-at91/include/mach/sama5d3_matrix.h | 15 +++ arch/arm/mach-at91/sama5d3.c | 336 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-at91/sama5d3_devices.c | 444 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-at91/setup.c | 27 ++++++ arch/arm/mach-at91/soc.h | 5 + 22 files changed, 1964 insertions(+), 28 deletions(-) create mode 100644 arch/arm/boards/sama5d3xek/Makefile create mode 100644 arch/arm/boards/sama5d3xek/config.h create mode 100644 arch/arm/boards/sama5d3xek/env/config create mode 100644 arch/arm/boards/sama5d3xek/hw_version.c create mode 100644 arch/arm/boards/sama5d3xek/hw_version.h create mode 100644 arch/arm/boards/sama5d3xek/init.c create mode 100644 arch/arm/configs/sama5d3xek_defconfig create mode 100644 arch/arm/mach-at91/include/mach/sama5d3.h create mode 100644 arch/arm/mach-at91/include/mach/sama5d3_matrix.h create mode 100644 arch/arm/mach-at91/sama5d3.c create mode 100644 arch/arm/mach-at91/sama5d3_devices.c
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 1/2 at91: add sama5d3 support
--- arch/arm/mach-at91/Kconfig | 14 + arch/arm/mach-at91/Makefile | 1 + arch/arm/mach-at91/clock.c | 113 ++++-- arch/arm/mach-at91/clock.h | 2 + arch/arm/mach-at91/include/mach/at91_pmc.h | 14 +- arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h | 37 ++ arch/arm/mach-at91/include/mach/cpu.h | 27 ++ arch/arm/mach-at91/include/mach/hardware.h | 8 + arch/arm/mach-at91/include/mach/sama5d3.h | 152 +++++++ arch/arm/mach-at91/include/mach/sama5d3_matrix.h | 15 + arch/arm/mach-at91/sama5d3.c | 336 ++++++++++++++++ arch/arm/mach-at91/sama5d3_devices.c | 444 +++++++++++++++++++++ arch/arm/mach-at91/setup.c | 27 ++ arch/arm/mach-at91/soc.h | 5 + 14 files changed, 1167 insertions(+), 28 deletions(-) create mode 100644 arch/arm/mach-at91/include/mach/sama5d3.h create mode 100644 arch/arm/mach-at91/include/mach/sama5d3_matrix.h create mode 100644 arch/arm/mach-at91/sama5d3.c create mode 100644 arch/arm/mach-at91/sama5d3_devices.c
arch/arm/mach-at91/Kconfig +14 -0
@@ -18,6 +18,12 @@ config SOC_AT91SAM9 select AT91SAM9_SMC select AT91SAM9_TIMER +config SOC_SAMA5 + bool + select CPU_V7 + select AT91SAM9_SMC + select AT91SAM9_TIMER + config ARCH_TEXT_BASE hex default 0x73f00000 if ARCH_AT91SAM9G45
@@ -168,6 +174,13 @@ config ARCH_AT91SAM9N12 bool "AT91SAM9N12" select SOC_AT91SAM9N12 +config ARCH_SAMA5D3 + bool "SAMA5D3x" + select SOC_SAMA5 + select HAVE_AT91_DBGU1 + select HAS_MACB + select AT91SAM9G45_RESET + endchoice config ARCH_BAREBOX_MAX_BARE_INIT_SIZE
@@ -180,6 +193,7 @@ config ARCH_BAREBOX_MAX_BARE_INIT_SIZE default 0xF000 if ARCH_AT91SAM9G45 default 0x6000 if ARCH_AT91SAM9X5 default 0x6000 if ARCH_AT91SAM9N12 + default 0x6000 if ARCH_SAMA5D3 default 0xffffffff config SUPPORT_CALAO_DAB_MMX
arch/arm/mach-at91/Makefile +1 -0
@@ -24,3 +24,4 @@ obj-$(CONFIG_ARCH_AT91SAM9G20) += at91sam9260.o at91sam9260_devices.o obj-$(CONFIG_ARCH_AT91SAM9G45) += at91sam9g45.o at91sam9g45_devices.o obj-$(CONFIG_ARCH_AT91SAM9X5) += at91sam9x5.o at91sam9x5_devices.o obj-$(CONFIG_ARCH_AT91SAM9N12) += at91sam9n12.o at91sam9n12_devices.o +obj-$(CONFIG_ARCH_SAMA5D3) += sama5d3.o sama5d3_devices.o
arch/arm/mach-at91/clock.c +89 -24
212 lines not on this page · raw message
arch/arm/mach-at91/clock.h +2 -0
@@ -20,7 +20,9 @@ struct clk {const char *name;/* unique clock name */ struct clk_lookup cl;unsigned long rate_hz; +unsigned div;/* parent clock divider */ struct clk *parent; +unsigned pid;/* peripheral ID */ u32 pmc_mask;void (*mode)(struct clk *,int ); unsigned id:3; /* PCK0..4, or 32k/main/a/b */
arch/arm/mach-at91/include/mach/at91_pmc.h +10 -4
@@ -163,13 +163,19 @@#define AT91_PMC_WPVS (0x1 << 0)/* Write Protect Violation Status */ #define AT91_PMC_WPVSRC (0xffff << 8)/* Write Protect Violation Source */ -#define AT91_PMC_VER (AT91_PMC + 0xfc)/* PMC Module Version [AT91CAP9 only] */ +#define AT91_PMC_VER 0xfc/* PMC Module Version [AT91CAP9 only] */ -#define AT91_PMC_PCR (AT91_PMC + 0x10c)/* Peripheral Control Register [some SAM9] */ +#define AT91_PMC_PCR 0x10c/* Peripheral Control Register [some SAM9] */ #define AT91_PMC_PCR_PID (0x3f << 0)/* Peripheral ID */ #define AT91_PMC_PCR_CMD (0x1 << 12)/* Command */ -#define AT91_PMC_PCR_DIV (0x3 << 16)/* Divisor Value */ -#define AT91_PMC_PCRDIV (n) (((n) << 16) & AT91_PMC_PCR_DIV) +#define AT91_PMC_PCR_DIV (n) ((n) << 16)/* Divisor value */ +#define AT91_PMC_PCR_DIV0 0x0/* Peripheral clock is MCK */ +#define AT91_PMC_PCR_DIV2 0x1/* Peripheral clock is MCK/2 */ +#define AT91_PMC_PCR_DIV4 0x2/* Peripheral clock is MCK/4 */ +#define AT91_PMC_PCR_DIV8 0x3/* Peripheral clock is MCK/8 */ #define AT91_PMC_PCR_EN (0x1 << 28)/* Enable */ +#define AT91_PMC_PCER1 0x100/* Peripheral Clock Enable Register 1 */ +#define AT91_PMC_PCDR1 0x104/* Peripheral Clock Disable Register 1 */ +#define AT91_PMC_PCSR1 0x108/* Peripheral Clock Status Register 1 */ #endif
arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h +37 -0
@@ -218,6 +218,43 @@ static inline u32 at91sam9n12_get_ddram_size(void) }#endif +#ifdef CONFIG_SOC_SAMA5 +static inline u32 at91sama5_get_ddram_size (void ) +{ +u32 cr; +u32 mdr; +u32 size; +void *__iomem base =IOMEM (SAMA5D3_BASE_MPDDRC ); + + cr =__raw_readl (base +AT91_DDRSDRC_CR ); + mdr =__raw_readl (base +AT91_DDRSDRC_MDR ); + +/* Formula: +* size = bank << (col + row + 1); +* if (bandwidth == 32 bits) +* size <<= 1; +*/ + size =1 ; +/* COL */ + size += (cr &AT91_DDRSDRC_NC ) +9 ; +/* ROW */ + size += ((cr &AT91_DDRSDRC_NR ) >>2 ) +11 ; +/* BANK */ + size = ((cr &AT91_DDRSDRC_NB ) ?8 :4 ) << size; + +/* bandwidth */ +if (!(mdr &AT91_DDRSDRC_DBW )) + size <<=1 ; + +return size; +} +#else +static inline u32 at91sama5_get_ddram_size (void ) +{ +return 0 ; +} +#endif +#endif #endif
arch/arm/mach-at91/include/mach/cpu.h +27 -0
@@ -26,6 +26,7 @@#define ARCH_ID_AT91SAM9G45ES 0x819b05a1/* 9G45-ES (Engineering Sample) */ #define ARCH_ID_AT91SAM9X5 0x819a05a0#define ARCH_ID_AT91SAM9N12 0x819a07a0 +#define ARCH_ID_SAMA5D3 0x8A5C07C0#define ARCH_ID_AT91SAM9XE128 0x329973a0#define ARCH_ID_AT91SAM9XE256 0x329a93a0
@@ -47,6 +48,11 @@#define ARCH_EXID_AT91SAM9G25 0x00000003#define ARCH_EXID_AT91SAM9X25 0x00000004 +#define ARCH_EXID_SAMA5D31 0x00444300 +#define ARCH_EXID_SAMA5D33 0x00414300 +#define ARCH_EXID_SAMA5D34 0x00414301 +#define ARCH_EXID_SAMA5D35 0x00584300 +#define ARCH_FAMILY_AT91X92 0x09200000#define ARCH_FAMILY_AT91SAM9 0x01900000#define ARCH_FAMILY_AT91SAM9XE 0x02900000
@@ -75,6 +81,9 @@ enum at91_soc_type {/* SAM9N12 */ AT91_SOC_SAM9N12 , +/* SAMA5D3 */ +AT91_SOC_SAMA5D3 , +/* Unknown type */ AT91_SOC_NONE };
@@ -93,6 +102,10 @@ enum at91_soc_subtype {AT91_SOC_SAM9G15 ,AT91_SOC_SAM9G35 ,AT91_SOC_SAM9X35 ,AT91_SOC_SAM9G25 ,AT91_SOC_SAM9X25 , +/* SAMA5D3 */ +AT91_SOC_SAMA5D31 ,AT91_SOC_SAMA5D33 ,AT91_SOC_SAMA5D34 , +AT91_SOC_SAMA5D35 , +/* Unknown subtype */ AT91_SOC_SUBTYPE_NONE };
@@ -187,6 +200,20 @@ static inline int at91_soc_is_detected(void)#define cpu_is_at91sam9n12 () (0)#endif +#ifdef CONFIG_ARCH_SAMA5D3 +#define cpu_is_sama5d3 () (at91_soc_initdata.type == AT91_SOC_SAMA5D3) +#define cpu_is_sama5d31 () (at91_soc_initdata.subtype == AT91_SOC_SAMA5D31) +#define cpu_is_sama5d33 () (at91_soc_initdata.subtype == AT91_SOC_SAMA5D33) +#define cpu_is_sama5d34 () (at91_soc_initdata.subtype == AT91_SOC_SAMA5D34) +#define cpu_is_sama5d35 () (at91_soc_initdata.subtype == AT91_SOC_SAMA5D35) +#else +#define cpu_is_sama5d3 () (0) +#define cpu_is_sama5d31 () (0) +#define cpu_is_sama5d33 () (0) +#define cpu_is_sama5d34 () (0) +#define cpu_is_sama5d35 () (0) +#endif +/* * Since this is ARM, we will never run on any AVR32 CPU. But these * definitions may reduce clutter in common drivers.
arch/arm/mach-at91/include/mach/hardware.h +8 -0
@@ -38,6 +38,8 @@#include <mach/at91sam9n12.h> #elif defined(CONFIG_ARCH_AT91SAM9X5 )#include <mach/at91sam9x5.h> +#elif defined(CONFIG_ARCH_SAMA5D3 ) +#include <mach/sama5d3.h> #elif defined(CONFIG_ARCH_AT91CAP9 )#include <mach/at91cap9.h> #elif defined(CONFIG_ARCH_AT91X40 )
@@ -56,6 +58,12 @@#define AT91_CHIPSELECT_6 0x70000000#define AT91_CHIPSELECT_7 0x80000000 +#define SAMA5_CHIPSELECT_0 0x10000000 +#define SAMA5_DDRCS 0x20000000 +#define SAMA5_CHIPSELECT_1 0x40000000 +#define SAMA5_CHIPSELECT_2 0x50000000 +#define SAMA5_CHIPSELECT_3 0x60000000 +/* SDRAM */ #ifdef CONFIG_DRAM_BASE #define AT91_SDRAM_BASE CONFIG_DRAM_BASE
arch/arm/mach-at91/include/mach/sama5d3.h new file +152 -0
152 lines not on this page · raw message
arch/arm/mach-at91/include/mach/sama5d3_matrix.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* Matrix-centric header file for the SAMA5D3 family +* +* Copyright (C) 2009-2012 Atmel Corporation. +* +* Only EBI related registers. +* Write Protect register definitions may be useful. +* +* Licensed under GPLv2 or later. +*/ + +#ifndef SAMA5D3_MATRIX_H +#define SAMA5D3_MATRIX_H + +#endif
arch/arm/mach-at91/sama5d3.c new file +336 -0
336 lines not on this page · raw message
arch/arm/mach-at91/sama5d3_devices.c new file +444 -0
444 lines not on this page · raw message
arch/arm/mach-at91/setup.c +27 -0
@@ -87,6 +87,11 @@ static void __init soc_detect(u32 dbgu_base) at91_soc_initdata.type =AT91_SOC_SAM9N12 ; at91_boot_soc = at91sam9n12_soc;break ; + +case ARCH_ID_SAMA5D3 : + at91_soc_initdata.type =AT91_SOC_SAMA5D3 ; + at91_boot_soc = at91sama5d3_soc; +break ; }/* at91sam9g10 */
@@ -142,6 +147,23 @@ static void __init soc_detect(u32 dbgu_base)break ; } } + +if (at91_soc_initdata.type ==AT91_SOC_SAMA5D3 ) { +switch (at91_soc_initdata.exid) { +case ARCH_EXID_SAMA5D31 : + at91_soc_initdata.subtype =AT91_SOC_SAMA5D31 ; +break ; +case ARCH_EXID_SAMA5D33 : + at91_soc_initdata.subtype =AT91_SOC_SAMA5D33 ; +break ; +case ARCH_EXID_SAMA5D34 : + at91_soc_initdata.subtype =AT91_SOC_SAMA5D34 ; +break ; +case ARCH_EXID_SAMA5D35 : + at91_soc_initdata.subtype =AT91_SOC_SAMA5D35 ; +break ; + } + } }static const char *soc_name[] = {
@@ -155,6 +177,7 @@ static const char *soc_name[] = { [AT91_SOC_SAM9RL] = "at91sam9rl", [AT91_SOC_SAM9X5] = "at91sam9x5", [AT91_SOC_SAM9N12] = "at91sam9n12", + [AT91_SOC_SAMA5D3] = "sama5d3", [AT91_SOC_NONE] = "Unknown" };
@@ -177,6 +200,10 @@ static const char *soc_subtype_name[] = { [AT91_SOC_SAM9X35] = "at91sam9x35", [AT91_SOC_SAM9G25] = "at91sam9g25", [AT91_SOC_SAM9X25] = "at91sam9x25", + [AT91_SOC_SAMA5D31] = "sama5d31", + [AT91_SOC_SAMA5D33] = "sama5d33", + [AT91_SOC_SAMA5D34] = "sama5d34", + [AT91_SOC_SAMA5D35] = "sama5d35", [AT91_SOC_SUBTYPE_NONE] = "Unknown" };
arch/arm/mach-at91/soc.h +5 -0
@@ -18,6 +18,7 @@ extern struct at91_init_soc at91sam9g45_soc;extern struct at91_init_soc at91sam9rl_soc;extern struct at91_init_soc at91sam9x5_soc;extern struct at91_init_soc at91sam9n12_soc; +extern struct at91_init_soc at91sama5d3_soc;#define AT91_SOC_START (_name) \ struct at91_init_soc __initdata at91##_name##_soc \
@@ -64,3 +65,7 @@ static inline int at91_soc_is_enabled(void)#if !defined(CONFIG_SOC_AT91SAM9N12 )#define at91sam9n12_soc at91_boot_soc#endif + +#if !defined(CONFIG_SOC_SAMA5 ) +#define at91sama5d3_soc at91_boot_soc +#endif
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 2/2 at91: add sama5d3xek board support
currently missing the GMAC support
--- arch/arm/Makefile | 1 + arch/arm/boards/sama5d3xek/Makefile | 2 + arch/arm/boards/sama5d3xek/config.h | 6 + arch/arm/boards/sama5d3xek/env/config | 44 ++++ arch/arm/boards/sama5d3xek/hw_version.c | 251 ++++++++++++++++++++++ arch/arm/boards/sama5d3xek/hw_version.h | 34 +++ arch/arm/boards/sama5d3xek/init.c | 351 +++++++++++++++++++++++++++++++ arch/arm/configs/sama5d3xek_defconfig | 91 ++++++++ arch/arm/mach-at91/Kconfig | 17 ++ 9 files changed, 797 insertions(+) create mode 100644 arch/arm/boards/sama5d3xek/Makefile create mode 100644 arch/arm/boards/sama5d3xek/config.h create mode 100644 arch/arm/boards/sama5d3xek/env/config create mode 100644 arch/arm/boards/sama5d3xek/hw_version.c create mode 100644 arch/arm/boards/sama5d3xek/hw_version.h create mode 100644 arch/arm/boards/sama5d3xek/init.c create mode 100644 arch/arm/configs/sama5d3xek_defconfig
arch/arm/Makefile +1 -0
@@ -80,6 +80,7 @@ board-$(CONFIG_MACH_AT91SAM9N12EK) := at91sam9n12ek board-$(CONFIG_MACH_AT91SAM9X5EK) := at91sam9x5ek board-$(CONFIG_MACH_AT91SAM9M10IHD) := at91sam9m10ihd board-$(CONFIG_MACH_AT91SAM9M10G45EK) := at91sam9m10g45ek +board-$(CONFIG_MACH_SAMA5D3XEK) := sama5d3xek board-$(CONFIG_MACH_CLEP7212) := clep7212 board-$(CONFIG_MACH_DSS11) := dss11 board-$(CONFIG_MACH_EDB9301) := edb93xx
arch/arm/boards/sama5d3xek/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-y += init.o +obj-y += hw_version.o
arch/arm/boards/sama5d3xek/config.h new file +6 -0
@@ -0,0 +1,6 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#define AT91_MAIN_CLOCK 12000000/* 12 MHz crystal */ + +#endif /* __CONFIG_H */
arch/arm/boards/sama5d3xek/env/config new file +44 -0
44 lines not on this page · raw message
arch/arm/boards/sama5d3xek/hw_version.c new file +251 -0
251 lines not on this page · raw message
arch/arm/boards/sama5d3xek/hw_version.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* +*/ + +#ifndef __HW_REVISION_H__ +#define __HW_REVISION_H__ + +enum vendor_id { +VENDOR_UNKNOWN =0 , +VENDOR_EMBEST =1 , +VENDOR_FLEX =2 , +VENDOR_RONETIX =3 , +VENDOR_COGENT =4 , +VENDOR_PDA =5 , +}; + +bool at91sama5d3xek_cm_is_vendor (enum vendor_id vid); +bool at91sama5d3xek_ek_is_vendor (enum vendor_id vid); +bool at91sama5d3xek_dm_is_vendor (enum vendor_id vid); +void at91sama5d3xek_devices_detect_hw (void ); + +#endif /* __HW_REVISION_H__ */
arch/arm/boards/sama5d3xek/init.c new file +351 -0
351 lines not on this page · raw message
arch/arm/configs/sama5d3xek_defconfig new file +91 -0
91 lines not on this page · raw message
arch/arm/mach-at91/Kconfig +17 -0
@@ -43,6 +43,7 @@ config BOARDINFO default "Atmel at91sam9m10g45-ek" if MACH_AT91SAM9M10G45EK default "Atmel at91sam9n12-ek" if MACH_AT91SAM9N12EK default "Atmel at91sam9x5-ek" if MACH_AT91SAM9X5EK + default "Atmel sama5d3x-ek" if MACH_SAMA5D3XEK default "Bucyrus MMC-CPU" if MACH_MMCCPU default "Calao USB-A9260" if MACH_USB_A9260 default "Calao USB-A9263" if MACH_USB_A9263
@@ -450,6 +451,22 @@ endif # ---------------------------------------------------------- +if ARCH_SAMA5D3 + +choice + prompt "SAMA5D3 Board Type" + +config MACH_SAMA5D3XEK + bool "Atmel SAMA5D3X Evaluation Kit" + help + Select this if you are using Atmel's SAMA5D3X-EK Evaluation Kit. + +endchoice + +endif + +# ---------------------------------------------------------- + comment "AT91 Board Options" config MTD_AT91_DATAFLASH_CARD
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox