arm: atmel: Add SAMA5D2 Xplained board
PATCH v2 1/1 arm: atmel: Add SAMA5D2 Xplained board
The board supports following features:
- Boot media support: SD card/e.MMC/SPI flash,
- Support LCD display (optional, disabled by default),
- Support ethernet,
- Support USB mass storage.
---
The patch is based on the following patches sent in mailing list.
[PATCH] gpio: atmel: Add the PIO4 driver support [PATCH] arm: at91: Change the Chip ID registers' addresses [PATCH v3] mmc: atmel: Add atmel sdhci support [PATCH v2] arm: at91: clock: Add the generated clock support
Changes in v2:
1./ re-order SAMA5D2 statements alphabetically.
2./ remove redundant "Unknown CPU type".
3./ rework sama5d2's macros.
4./ remove some #ifdef before functions.
5./ move CONFIG_CMD_SF to Kconfig.
6./ remove NAND macros from config file.
7./ CONFIG_BOOTCOMMAND for sf uses defines in at91-sama5_common.h.
arch/arm/mach-at91/Kconfig | 5 + arch/arm/mach-at91/armv7/Makefile | 1 + arch/arm/mach-at91/armv7/sama5d2_devices.c | 60 +++++ arch/arm/mach-at91/include/mach/at91_pmc.h | 9 +- arch/arm/mach-at91/include/mach/atmel_usba_udc.h | 3 +- arch/arm/mach-at91/include/mach/hardware.h | 2 + arch/arm/mach-at91/include/mach/sama5d2.h | 224 +++++++++++++++++ board/atmel/sama5d2_xplained/Kconfig | 15 ++ board/atmel/sama5d2_xplained/MAINTAINERS | 7 + board/atmel/sama5d2_xplained/Makefile | 8 + board/atmel/sama5d2_xplained/sama5d2_xplained.c | 282 ++++++++++++++++++++++ configs/sama5d2_xplained_mmc_defconfig | 11 + configs/sama5d2_xplained_spiflash_defconfig | 11 + include/configs/sama5d2_xplained.h | 126 ++++++++++ 14 files changed, 758 insertions(+), 6 deletions(-) create mode 100644 arch/arm/mach-at91/armv7/sama5d2_devices.c create mode 100644 arch/arm/mach-at91/include/mach/sama5d2.h create mode 100644 board/atmel/sama5d2_xplained/Kconfig create mode 100644 board/atmel/sama5d2_xplained/MAINTAINERS create mode 100644 board/atmel/sama5d2_xplained/Makefile create mode 100644 board/atmel/sama5d2_xplained/sama5d2_xplained.c create mode 100644 configs/sama5d2_xplained_mmc_defconfig create mode 100644 configs/sama5d2_xplained_spiflash_defconfig create mode 100644 include/configs/sama5d2_xplained.h
arch/arm/mach-at91/Kconfig +5 -0
@@ -71,6 +71,10 @@ config TARGET_AT91SAM9X5EK select CPU_ARM926EJS select SUPPORT_SPL +config TARGET_SAMA5D2_XPLAINED + bool "SAMA5D2 Xplained board" + select CPU_V7 + config TARGET_SAMA5D3_XPLAINED bool "SAMA5D3 Xplained board" select CPU_V7
@@ -123,6 +127,7 @@ source "board/atmel/at91sam9m10g45ek/Kconfig" source "board/atmel/at91sam9n12ek/Kconfig" source "board/atmel/at91sam9rlek/Kconfig" source "board/atmel/at91sam9x5ek/Kconfig" +source "board/atmel/sama5d2_xplained/Kconfig" source "board/atmel/sama5d3_xplained/Kconfig" source "board/atmel/sama5d3xek/Kconfig" source "board/atmel/sama5d4_xplained/Kconfig"
arch/arm/mach-at91/armv7/Makefile +1 -0
@@ -8,6 +8,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_SAMA5D2) += sama5d2_devices.o obj-$(CONFIG_SAMA5D3) += sama5d3_devices.o obj-$(CONFIG_SAMA5D4) += sama5d4_devices.o obj-y += clock.o
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +60 -0
60 lines not on this page · raw message
arch/arm/mach-at91/include/mach/at91_pmc.h +4 -5
@@ -78,7 +78,8 @@ typedef struct at91_pmc {#define AT91_PMC_PLLXR_DIV (x) (x & 0xFF)#define AT91_PMC_PLLXR_PLLCOUNT (x) ((x & 0x3F) << 8)#define AT91_PMC_PLLXR_OUT (x) ((x & 0x03) << 14) -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )#define AT91_PMC_PLLXR_MUL (x) ((x & 0x7F) << 18)#else #define AT91_PMC_PLLXR_MUL (x) ((x & 0x7FF) << 16)
@@ -97,7 +98,8 @@ typedef struct at91_pmc {#define AT91_PMC_MCKR_CSS_PLLB 0x00000003#define AT91_PMC_MCKR_CSS_MASK 0x00000003 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 ) || \ defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_PRES_1 0x00000000#define AT91_PMC_MCKR_PRES_2 0x00000010
@@ -127,10 +129,7 @@ typedef struct at91_pmc {#else #define AT91_PMC_MCKR_MDIV_1 0x00000000#define AT91_PMC_MCKR_MDIV_2 0x00000100 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ - defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_MDIV_3 0x00000300 -#endif #define AT91_PMC_MCKR_MDIV_4 0x00000200#define AT91_PMC_MCKR_MDIV_MASK 0x00000300#endif
arch/arm/mach-at91/include/mach/atmel_usba_udc.h +2 -1
@@ -31,7 +31,8 @@ static struct usba_ep_data usba_udc_ep[] = {EP ("ep5" ,5 ,1024 ,3 ,1 ,1 ), EP("ep6", 6, 1024, 3, 1, 1), }; -#elif defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#elif defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )static struct usba_ep_data usba_udc_ep[] = {EP ("ep0" ,0 ,64 ,1 ,0 ,0 ), EP("ep1", 1, 1024, 3, 1, 0),
arch/arm/mach-at91/include/mach/hardware.h +2 -0
@@ -23,6 +23,8 @@# include <asm/arch/at91sam9g45.h> #elif defined(CONFIG_AT91SAM9N12 ) || defined(CONFIG_AT91SAM9X5 )# include <asm/arch/at91sam9x5.h> +#elif defined(CONFIG_SAMA5D2 ) +# include <asm/arch/sama5d2.h> #elif defined(CONFIG_SAMA5D3 )# include <asm/arch/sama5d3.h> #elif defined(CONFIG_SAMA5D4 )
arch/arm/mach-at91/include/mach/sama5d2.h new file +224 -0
224 lines not on this page · raw message
board/atmel/sama5d2_xplained/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_SAMA5D2_XPLAINED + +config SYS_BOARD + default "sama5d2_xplained" + +config SYS_VENDOR + default "atmel" + +config SYS_SOC + default "at91" + +config SYS_CONFIG_NAME + default "sama5d2_xplained" + +endif
board/atmel/sama5d2_xplained/MAINTAINERS new file +7 -0
@@ -0,0 +1,7 @@ +SAMA5D2 XPLAINED BOARD +M: Wenyou Yang <[email protected]> +S: Maintained +F: board/atmel/sama5d2_xplained/ +F: include/configs/sama5d2_xplained.h +F: configs/sama5d2_xplained_mmc_defconfig +F: configs/sama5d2_xplained_spiflash_defconfig
board/atmel/sama5d2_xplained/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# Copyright (C) 2015 Atmel Corporation +# Wenyou Yang <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += sama5d2_xplained.o
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +282 -0
282 lines not on this page · raw message
configs/sama5d2_xplained_mmc_defconfig new file +11 -0
@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_MMC" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=y
configs/sama5d2_xplained_spiflash_defconfig new file +11 -0
@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_SERIALFLASH" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=y
include/configs/sama5d2_xplained.h new file +126 -0
126 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 1/1 arm: atmel: Add SAMA5D2 Xplained board
Hi Wenyou,
+ Andreas
Quoted 128 lines · Wenyou Yang
The board supports following features:
- Boot media support: SD card/e.MMC/SPI flash,
- Support LCD display (optional, disabled by default),
- Support ethernet,
- Support USB mass storage.Signed-off-by Wenyou Yang <[email protected]>---
The patch is based on the following patches sent in mailing list.
[PATCH] gpio: atmel: Add the PIO4 driver support [PATCH] arm: at91: Change the Chip ID registers' addresses [PATCH v3] mmc: atmel: Add atmel sdhci support [PATCH v2] arm: at91: clock: Add the generated clock supportChanges in v2:
1./ re-order SAMA5D2 statements alphabetically.
2./ remove redundant "Unknown CPU type".
3./ rework sama5d2's macros.
4./ remove some #ifdef before functions.
5./ moveCONFIG_CMD_SFtoKconfig.
6./ remove NAND macros from config file.
7./CONFIG_BOOTCOMMANDfor sf uses defines inat91-sama5_common.h.arch/arm/mach-at91/Kconfig | 5 + arch/arm/mach-at91/armv7/Makefile | 1 + arch/arm/mach-at91/armv7/sama5d2_devices.c | 60 +++++ arch/arm/mach-at91/include/mach/at91_pmc.h | 9 +- arch/arm/mach-at91/include/mach/atmel_usba_udc.h | 3 +- arch/arm/mach-at91/include/mach/hardware.h | 2 + arch/arm/mach-at91/include/mach/sama5d2.h | 224 +++++++++++++++++ board/atmel/sama5d2_xplained/Kconfig | 15 ++ board/atmel/sama5d2_xplained/MAINTAINERS | 7 + board/atmel/sama5d2_xplained/Makefile | 8 + board/atmel/sama5d2_xplained/sama5d2_xplained.c | 282 ++++++++++++++++++++++ configs/sama5d2_xplained_mmc_defconfig | 11 + configs/sama5d2_xplained_spiflash_defconfig | 11 + include/configs/sama5d2_xplained.h | 126 ++++++++++ 14 files changed, 758 insertions(+), 6 deletions(-)create mode 100644
arch/arm/mach-at91/armv7/sama5d2_devices.ccreate mode 100644arch/arm/mach-at91/include/mach/sama5d2.hcreate mode 100644 board/atmel/sama5d2_xplained/Kconfig create mode 100644 board/atmel/sama5d2_xplained/MAINTAINERS create mode 100644 board/atmel/sama5d2_xplained/Makefile create mode 100644board/atmel/sama5d2_xplained/sama5d2_xplained.ccreate mode 100644 configs/sama5d2_xplained_mmc_defconfig create mode 100644 configs/sama5d2_xplained_spiflash_defconfig create mode 100644include/configs/sama5d2_xplained.harch/arm/mach-at91/Kconfig +5
-0@@ -71,6 +71,10 @@ config TARGET_AT91SAM9X5EK select CPU_ARM926EJS select SUPPORT_SPL +config TARGET_SAMA5D2_XPLAINED + bool "SAMA5D2 Xplained board" + select CPU_V7 + config TARGET_SAMA5D3_XPLAINED bool "SAMA5D3 Xplained board" select CPU_V7@@ -123,6 +127,7 @@ source "board/atmel/at91sam9m10g45ek/Kconfig" source "board/atmel/at91sam9n12ek/Kconfig" source "board/atmel/at91sam9rlek/Kconfig" source "board/atmel/at91sam9x5ek/Kconfig" +source "board/atmel/sama5d2_xplained/Kconfig" source "board/atmel/sama5d3_xplained/Kconfig" source "board/atmel/sama5d3xek/Kconfig" source "board/atmel/sama5d4_xplained/Kconfig"arch/arm/mach-at91/armv7/Makefile +1
-0@@ -8,6 +8,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_SAMA5D2) += sama5d2_devices.o obj-$(CONFIG_SAMA5D3) += sama5d3_devices.o obj-$(CONFIG_SAMA5D4) += sama5d4_devices.o obj-y += clock.oarch/arm/mach-at91/armv7/sama5d2_devices.c new file +39
-0@@ -0,0 +1,60 @@ +/* +* Copyright (C) 2015 Atmel Corporation +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/clk.h> +#include <asm/arch/sama5d2.h> + +char *get_cpu_name () +{ +unsigned int extension_id =get_extension_chip_id (); + +if (cpu_is_sama5d2 ()) { +switch (extension_id) { +case ARCH_EXID_SAMA5D21CU : +return "SAMA5D21" ; +case ARCH_EXID_SAMA5D22CU : +return "SAMA5D22-CU" ; +case ARCH_EXID_SAMA5D22CN : +return "SAMA5D22-CN" ; +case ARCH_EXID_SAMA5D23CU : +return "SAMA5D23-CU" ; +case ARCH_EXID_SAMA5D24CX : +return "SAMA5D24-CX" ; +case ARCH_EXID_SAMA5D24CU : +return "SAMA5D24-CU" ; +case ARCH_EXID_SAMA5D26CU : +return "SAMA5D26-CU" ; +case ARCH_EXID_SAMA5D27CU : +return "SAMA5D27-CU" ; +case ARCH_EXID_SAMA5D27CN : +return "SAMA5D27-CN" ; +case ARCH_EXID_SAMA5D28CU : +return "SAMA5D28-CU" ;
arch/arm/mach-at91/armv7/sama5d2_devices.c line 49
Quoted 10 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +10
-0+case ARCH_EXID_SAMA5D28CN : +return "SAMA5D28-CN" ; +default : + goto err_exit; + } + } + +err_exit: +return "Unknown CPU type" ; +}
Can we return directly from default? (I guess when compile it will throw out warning message, if so, remove default option).
Quoted 83 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +11
-0+ +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +void at91_udp_hw_init (void ) +{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; + +writel (AT91_PMC_UPLLEN |AT91_PMC_BIASEN , &pmc->uckr); + +at91_periph_clk_enable (ATMEL_ID_UDPHS ); +} +#endif arch/arm/mach-at91/include/mach/at91_pmc.h +4
-5@@ -78,7 +78,8 @@ typedef struct at91_pmc {#define AT91_PMC_PLLXR_DIV (x) (x & 0xFF)#define AT91_PMC_PLLXR_PLLCOUNT (x) ((x & 0x3F) << 8)#define AT91_PMC_PLLXR_OUT (x) ((x & 0x03) << 14) -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )#define AT91_PMC_PLLXR_MUL (x) ((x & 0x7F) << 18)#else #define AT91_PMC_PLLXR_MUL (x) ((x & 0x7FF) << 16)@@ -97,7 +98,8 @@ typedef struct at91_pmc {#define AT91_PMC_MCKR_CSS_PLLB 0x00000003#define AT91_PMC_MCKR_CSS_MASK 0x00000003 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 ) || \ defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_PRES_1 0x00000000#define AT91_PMC_MCKR_PRES_2 0x00000010@@ -127,10 +129,7 @@ typedef struct at91_pmc {#else #define AT91_PMC_MCKR_MDIV_1 0x00000000#define AT91_PMC_MCKR_MDIV_2 0x00000100 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ - defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_MDIV_3 0x00000300 -#endif #define AT91_PMC_MCKR_MDIV_4 0x00000200#define AT91_PMC_MCKR_MDIV_MASK 0x00000300#endif arch/arm/mach-at91/include/mach/atmel_usba_udc.h +2
-1@@ -31,7 +31,8 @@ static struct usba_ep_data usba_udc_ep[] = {EP ("ep5" ,5 ,1024 ,3 ,1 ,1 ), EP("ep6", 6, 1024, 3, 1, 1), }; -#elif defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#elif defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )static struct usba_ep_data usba_udc_ep[] = {EP ("ep0" ,0 ,64 ,1 ,0 ,0 ), EP("ep1", 1, 1024, 3, 1, 0),arch/arm/mach-at91/include/mach/hardware.h +2
-0@@ -23,6 +23,8 @@# include <asm/arch/at91sam9g45.h> #elif defined(CONFIG_AT91SAM9N12 ) || defined(CONFIG_AT91SAM9X5 )# include <asm/arch/at91sam9x5.h> +#elif defined(CONFIG_SAMA5D2 ) +# include <asm/arch/sama5d2.h> #elif defined(CONFIG_SAMA5D3 )# include <asm/arch/sama5d3.h> #elif defined(CONFIG_SAMA5D4 )arch/arm/mach-at91/include/mach/sama5d2.h new file +4
-0@@ -0,0 +1,224 @@ +/* +* Chip-specific header file for the SAMA5D2 SoC +* +* Copyright (C) 2015 Atmel
arch/arm/mach-at91/include/mach/sama5d2.h line 14
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __SAMA5D2_H +#define __SAMA5D2_H + +/* +* defines to be used in other places
s/defines/definition
Quoted 126 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +126
-0+*/ +#define CONFIG_AT91FAMILY /* It's a member of AT91 */ + +/* +* Peripheral identifiers/interrupts. +*/ +#define ATMEL_ID_FIQ 0/* FIQ Interrupt ID */ +/* 1 */ +#define ATMEL_ID_ARM 2/* Performance Monitor Unit */ +#define ATMEL_ID_PIT 3/* Periodic Interval Timer Interrupt */ +#define ATMEL_ID_WDT 4/* Watchdog Timer Interrupt */ +#define ATMEL_ID_GMAC 5/* Ethernet MAC */ +#define ATMEL_ID_XDMAC0 6/* DMA Controller 0 */ +#define ATMEL_ID_XDMAC1 7/* DMA Controller 1 */ +#define ATMEL_ID_ICM 8/* Integrity Check Monitor */ +#define ATMEL_ID_AES 9/* Advanced Encryption Standard */ +#define ATMEL_ID_AESB 10/* AES bridge */ +#define ATMEL_ID_TDES 11/* Triple Data Encryption Standard */ +#define ATMEL_ID_SHA 12/* SHA Signature */ +#define ATMEL_ID_MPDDRC 13/* MPDDR Controller */ +#define ATMEL_ID_MATRIX1 14/* H32MX, 32-bit AHB Matrix */ +#define ATMEL_ID_MATRIX0 15/* H64MX, 64-bit AHB Matrix */ +#define ATMEL_ID_SECUMOD 16/* Secure Module */ +#define ATMEL_ID_HSMC 17/* Multi-bit ECC interrupt */ +#define ATMEL_ID_PIOA 18/* Parallel I/O Controller A */ +#define ATMEL_ID_FLEXCOM0 19/* FLEXCOM0 */ +#define ATMEL_ID_FLEXCOM1 20/* FLEXCOM1 */ +#define ATMEL_ID_FLEXCOM2 21/* FLEXCOM2 */ +#define ATMEL_ID_FLEXCOM3 22/* FLEXCOM3 */ +#define ATMEL_ID_FLEXCOM4 23/* FLEXCOM4 */ +#define ATMEL_ID_UART0 24/* UART0 */ +#define ATMEL_ID_UART1 25/* UART1 */ +#define ATMEL_ID_UART2 26/* UART2 */ +#define ATMEL_ID_UART3 27/* UART3 */ +#define ATMEL_ID_UART4 28/* UART4 */ +#define ATMEL_ID_TWIHS0 29/* Two-wire Interface 0 */ +#define ATMEL_ID_TWIHS1 30/* Two-wire Interface 1 */ +#define ATMEL_ID_SDMMC0 31/* Secure Data Memory Card Controller 0 */ +#define ATMEL_ID_SDMMC1 32/* Secure Data Memory Card Controller 1 */ +#define ATMEL_ID_SPI0 33/* Serial Peripheral Interface 0 */ +#define ATMEL_ID_SPI1 34/* Serial Peripheral Interface 1 */ +#define ATMEL_ID_TC0 35/* Timer Counter 0 (ch.0,1,2) */ +#define ATMEL_ID_TC1 36/* Timer Counter 1 (ch.3,4,5) */ +/* 37 */ +#define ATMEL_ID_PWM 38/* PWMController0 (ch. 0,1,2,3) */ +/* 39 */ +#define ATMEL_ID_ADC 40/* Touch Screen ADC Controller */ +#define ATMEL_ID_UHPHS 41/* USB Host High Speed */ +#define ATMEL_ID_UDPHS 42/* USB Device High Speed */ +#define ATMEL_ID_SSC0 43/* Serial Synchronous Controller 0 */ +#define ATMEL_ID_SSC1 44/* Serial Synchronous Controller 1 */ +#define ATMEL_ID_LCDC 45/* LCD Controller */ +#define ATMEL_ID_ISI 46/* Image Sensor Controller, for A5D2, named after ISC */ +#define ATMEL_ID_TRNG 47/* True Random Number Generator */ +#define ATMEL_ID_PDMIC 48/* PDM Interface Controller */ +#define ATMEL_ID_AIC_IRQ 49/* IRQ Interrupt ID */ +#define ATMEL_ID_SFC 50/* Fuse Controller */ +#define ATMEL_ID_SECURAM 51/* Secure RAM */ +#define ATMEL_ID_QSPI0 52/* QSPI0 */ +#define ATMEL_ID_QSPI1 53/* QSPI1 */ +#define ATMEL_ID_I2SC0 54/* Inter-IC Sound Controller 0 */ +#define ATMEL_ID_I2SC1 55/* Inter-IC Sound Controller 1 */ +#define ATMEL_ID_CAN0_INT0 56/* MCAN 0 Interrupt0 */ +#define ATMEL_ID_CAN1_INT0 57/* MCAN 1 Interrupt0 */ +/* 58 */ +#define ATMEL_ID_CLASSD 59/* Audio Class D Amplifier */ +#define ATMEL_ID_SFR 60/* Special Function Register */ +#define ATMEL_ID_SAIC 61/* Secured AIC */ +#define ATMEL_ID_AIC 62/* Advanced Interrupt Controller */ +#define ATMEL_ID_L2CC 63/* L2 Cache Controller */ +#define ATMEL_ID_CAN0_INT1 64/* MCAN 0 Interrupt1 */ +#define ATMEL_ID_CAN1_INT1 65/* MCAN 1 Interrupt1 */ +#define ATMEL_ID_GMAC_Q1 66/* GMAC Queue 1 Interrupt */ +#define ATMEL_ID_GMAC_Q2 67/* GMAC Queue 2 Interrupt */ +#define ATMEL_ID_PIOB 68/* Parallel I/O Controller B */ +#define ATMEL_ID_PIOC 69/* Parallel I/O Controller C */ +#define ATMEL_ID_PIOD 70/* Parallel I/O Controller D */ +#define ATMEL_ID_SDMMC0_TIMER 71/* Secure Data Memory Card Controller 0 (TIMER) */ +#define ATMEL_ID_SDMMC1_TIMER 72/* Secure Data Memory Card Controller 1 (TIMER) */ +/* 73 */ +#define ATMEL_ID_SYS 74/* System Controller Interrupt */ +#define ATMEL_ID_ACC 75/* Analog Comparator */ +#define ATMEL_ID_RXLP 76/* UART Low-Power */ +#define ATMEL_ID_SFRBU 77/* Special Function Register BackUp */ +#define ATMEL_ID_CHIPID 78/* Chip ID */ + +/* +* User Peripherals physical base addresses. +*/ +#define ATMEL_BASE_LCDC 0xf0000000 +#define ATMEL_BASE_XDMAC1 0xf0004000 +#define ATMEL_BASE_MPDDRC 0xf000c000 +#define ATMEL_BASE_XDMAC0 0xf0010000 +#define ATMEL_BASE_PMC 0xf0014000 +#define ATMEL_BASE_QSPI0 0xf0020000 +#define ATMEL_BASE_QSPI1 0xf0024000 +#define ATMEL_BASE_SPI0 0xf8000000 +#define ATMEL_BASE_GMAC 0xf8008000 +#define ATMEL_BASE_TC0 0xf800c000 +#define ATMEL_BASE_TC1 0xf8010000 +#define ATMEL_BASE_HSMC 0xf8014000 +#define ATMEL_BASE_UART0 0xf801c000 +#define ATMEL_BASE_UART1 0xf8020000 +#define ATMEL_BASE_UART2 0xf8024000 +#define ATMEL_BASE_TWI0 0xf8028000 +#define ATMEL_BASE_SYSC 0xf8048000 +#define ATMEL_BASE_SPI1 0xfc000000 +#define ATMEL_BASE_UART3 0xfc008000 +#define ATMEL_BASE_UART4 0xfc00c000 +#define ATMEL_BASE_TWI1 0xfc028000 +#define ATMEL_BASE_UDPHS 0xfc02c000 + +#define ATMEL_BASE_PIOA 0xfc038000 + +#define ATMEL_CHIPID_CIDR 0xfc069000 +#define ATMEL_CHIPID_EXID 0xfc069004 + +/* +* Address Memory Space +*/ +#define ATMEL_BASE_DDRCS 0x20000000 +#define ATMEL_BASE_QSPI0_AES_MEM 0x90000000 +#define ATMEL_BASE_QSPI1_AES_MEM 0x98000000 +#define ATMEL_BASE_SDMMC0 0xa0000000 +#define ATMEL_BASE_SDMMC1 0xb0000000 +#define ATMEL_BASE_QSPI0_MEM 0xd0000000
arch/arm/mach-at91/include/mach/sama5d2.h line 150
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define ATMEL_BASE_QSPI1_MEM 0xd8000000 + +/* +* Internal Memories +*/ +#define ATMEL_BASE_UDPHS_FIFO 0x00300000/* USB Device HS controller */ +#define ATMEL_BASE_OHCI 0x00400000/* USB Host controller (OHCI) */ +#define ATMEL_BASE_EHCI 0x00500000/* USB Host controller (EHCI) */ + +/* Other misc defines */
Ditto
Quoted 7 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +7
-0+#define ATMEL_BASE_PMECC (ATMEL_BASE_HSMC + 0x70) +#define ATMEL_BASE_PMERRLOC (ATMEL_BASE_HSMC + 0x500) + +#define ATMEL_BASE_PIOB (ATMEL_BASE_PIOA + 0x40) +#define ATMEL_BASE_PIOC (ATMEL_BASE_PIOB + 0x40) +#define ATMEL_BASE_PIOD (ATMEL_BASE_PIOC + 0x40) +
arch/arm/mach-at91/include/mach/sama5d2.h line 167
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+/* SYSC spawns */ +#define ATMEL_BASE_RSTC ATMEL_BASE_SYSC +#define ATMEL_BASE_SHDWC (ATMEL_BASE_SYSC + 0x10) +#define ATMEL_BASE_PIT (ATMEL_BASE_SYSC + 0x30) +#define ATMEL_BASE_WDT (ATMEL_BASE_SYSC + 0x40) +#define ATMEL_BASE_SCKC (ATMEL_BASE_SYSC + 0x50) +#define ATMEL_BASE_RTC (ATMEL_BASE_SYSC + 0xb0) + +/* +* Other misc defines
Ditto
You have two section of "Other misc defines", would it be OK to put them together?
Quoted 32 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +32
-0+*/ +#define ATMEL_PIO_PORTS 4 +#define CPU_HAS_PCR +#define CPU_HAS_H32MXDIV + +/* SAMA5D2 series chip id definitions */ +#define ARCH_ID_SAMA5D2 0x8a5c08c0 +#define ARCH_EXID_SAMA5D21CU 0x0000005a +#define ARCH_EXID_SAMA5D22CU 0x00000059 +#define ARCH_EXID_SAMA5D22CN 0x00000069 +#define ARCH_EXID_SAMA5D23CU 0x00000058 +#define ARCH_EXID_SAMA5D24CX 0x00000004 +#define ARCH_EXID_SAMA5D24CU 0x00000014 +#define ARCH_EXID_SAMA5D26CU 0x00000012 +#define ARCH_EXID_SAMA5D27CU 0x00000011 +#define ARCH_EXID_SAMA5D27CN 0x00000021 +#define ARCH_EXID_SAMA5D28CU 0x00000010 +#define ARCH_EXID_SAMA5D28CN 0x00000020 + +#define cpu_is_sama5d2 () (get_chip_id() == ARCH_ID_SAMA5D2) +#define cpu_is_sama5d21cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D21CU)) +#define cpu_is_sama5d22cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D22CU)) +#define cpu_is_sama5d22cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D22CN)) +#define cpu_is_sama5d23cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D23CU)) +#define cpu_is_sama5d24cx () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D24CX)) +#define cpu_is_sama5d24cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D24CU))
arch/arm/mach-at91/include/mach/sama5d2.h line 209
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define cpu_is_sama5d26cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D26CU)) +#define cpu_is_sama5d27cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D27CU)) +#define cpu_is_sama5d27cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D27CN)) +#define cpu_is_sama5d28cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D28CU)) +#define cpu_is_sama5d28cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D28CN))
I don't see where use this part of code? Add I think it is the same as get_cpu_name() function.
Quoted 141 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +14
-0+/* PIT Timer(PIT_PIIR) */ +#define CONFIG_SYS_TIMER_COUNTER 0xf804803c + +/* No PMECC Galois table in ROM */ +#define NO_GALOIS_TABLE_IN_ROM + +#ifndef __ASSEMBLY__ +unsigned int get_chip_id (void ); +unsigned int get_extension_chip_id (void ); +unsigned int has_lcdc (void ); +char *get_cpu_name (void ); +#endif + +#endif board/atmel/sama5d2_xplained/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_SAMA5D2_XPLAINED + +config SYS_BOARD + default "sama5d2_xplained" + +config SYS_VENDOR + default "atmel" + +config SYS_SOC + default "at91" + +config SYS_CONFIG_NAME + default "sama5d2_xplained" + +endifboard/atmel/sama5d2_xplained/MAINTAINERS new file +7
-0@@ -0,0 +1,7 @@ +SAMA5D2 XPLAINED BOARD +M: Wenyou Yang <[email protected]> +S: Maintained +F: board/atmel/sama5d2_xplained/ +F: include/configs/sama5d2_xplained.h +F: configs/sama5d2_xplained_mmc_defconfig +F: configs/sama5d2_xplained_spiflash_defconfigboard/atmel/sama5d2_xplained/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# +# Copyright (C) 2015 Atmel Corporation +# Wenyou Yang <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += sama5d2_xplained.oboard/atmel/sama5d2_xplained/sama5d2_xplained.c new file +73
-0@@ -0,0 +1,282 @@ +/* +* Copyright (C) 2015 Atmel Corporation +* Wenyou.Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <atmel_hlcdc.h> +#include <lcd.h> +#include <mmc.h> +#include <net.h> +#include <netdev.h> +#include <spi.h> +#include <version.h> +#include <asm/io.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/atmel_pio4.h> +#include <asm/arch/atmel_usba_udc.h> +#include <asm/arch/atmel_sdhci.h> +#include <asm/arch/clk.h> +#include <asm/arch/gpio.h> +#include <asm/arch/sama5d2.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int spi_cs_is_valid (unsigned int bus,unsigned int cs) +{ +return bus ==0 && cs ==0 ; +} + +void spi_cs_activate (struct spi_slave *slave) +{ +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,0 ); +} + +void spi_cs_deactivate (struct spi_slave *slave) +{ +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,1 ); +} + +static void board_spi0_hw_init (void ) +{ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,14 ,0 ); +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,15 ,0 ); +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,16 ,0 ); + +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,1 ); + +at91_periph_clk_enable (ATMEL_ID_SPI0 ); +} + +static void board_usb_hw_init (void ) +{ +atmel_pio4_set_pio_output (AT91_PIO_PORTB ,9 ,1 ); +atmel_pio4_set_pio_output (AT91_PIO_PORTB ,10 ,1 ); +} + +#ifdef CONFIG_LCD +vidinfo_t panel_info = { + .vl_col =480 , + .vl_row =272 , + .vl_clk =9000000 , + .vl_bpix =LCD_BPP , + .vl_tft =1 , + .vl_hsync_len =41 , + .vl_left_margin =2 , + .vl_right_margin =2 , + .vl_vsync_len =11 , + .vl_upper_margin =2 , + .vl_lower_margin =2 , + .mmio = ATMEL_BASE_LCDC,
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 83
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+}; + +/* No power up/down pin for the LCD pannel */ +void lcd_enable (void ) {/* Empty! */ } +void lcd_disable (void ) {/* Empty! */ } + +unsigned int has_lcdc (void ) +{ +return 1 ; +}
For this, I think you can add a following patch to define it as a weak function, then it don't need to repeat it.
Quoted 50 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +50
-0+ +static void board_lcd_hw_init (void ) +{ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,28 ,0 );/* LCDPWM */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,29 ,0 );/* LCDDISP */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,30 ,0 );/* LCDVSYNC */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,31 ,0 );/* LCDHSYNC */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,0 ,0 );/* LCDPCK */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,1 ,0 );/* LCDDEN */ + +/* LCDDAT0 */ +/* LCDDAT1 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,10 ,0 );/* LCDDAT2 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,11 ,0 );/* LCDDAT3 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,12 ,0 );/* LCDDAT4 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,13 ,0 );/* LCDDAT5 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,14 ,0 );/* LCDDAT6 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,15 ,0 );/* LCDDAT7 */ + +/* LCDDAT8 */ +/* LCDDAT9 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,16 ,0 );/* LCDDAT10 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,17 ,0 );/* LCDDAT11 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,18 ,0 );/* LCDDAT12 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,19 ,0 );/* LCDDAT13 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,20 ,0 );/* LCDDAT14 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,21 ,0 );/* LCDDAT15 */ + +/* LCDD16 */ +/* LCDD17 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,22 ,0 );/* LCDDAT18 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,23 ,0 );/* LCDDAT19 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,24 ,0 );/* LCDDAT20 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,25 ,0 );/* LCDDAT21 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,26 ,0 );/* LCDDAT22 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,27 ,0 );/* LCDDAT23 */ + +at91_periph_clk_enable (ATMEL_ID_LCDC ); +} + +#ifdef CONFIG_LCD_INFO +void lcd_show_board_info (void ) +{ +ulong dram_size; +int i; +char temp[32 ]; + +lcd_printf ("%s\n" ,U_BOOT_VERSION ); +lcd_printf ("2015 ATMEL Corp\n" ); + lcd_printf("%s CPU at %s MHz\n", get_cpu_name(),
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 143
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+ strmhz(temp, get_cpu_clk_rate())); + + dram_size =0 ; +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) + dram_size += gd->bd->bi_dram[i].size; + +lcd_printf ("%ld MB SDRAM\n" , dram_size >>20 ); +} +#endif /* CONFIG_LCD_INFO */ +#endif /* CONFIG_LCD_INFO */
s/CONFIG_LCD_INFO/CONFIG_LCD
Quoted 76 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +76
-0+ +static void board_gmac_hw_init (void ) +{ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,14 ,0 );/* GTXCK */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,15 ,0 );/* GTXEN */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,16 ,0 );/* GRXDV */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,17 ,0 );/* GRXER */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,18 ,0 );/* GRX0 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,19 ,0 );/* GRX1 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,20 ,0 );/* GTX0 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,21 ,0 );/* GTX1 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,22 ,0 );/* GMDC */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,23 ,0 );/* GMDIO */ + +at91_periph_clk_enable (ATMEL_ID_GMAC ); +} + +static void board_sdhci0_hw_init (void ) +{ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,0 ,0 );/* SDMMC0_CK */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,1 ,0 );/* SDMMC0_CMD */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,2 ,0 );/* SDMMC0_DAT0 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,3 ,0 );/* SDMMC0_DAT1 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,4 ,0 );/* SDMMC0_DAT2 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,5 ,0 );/* SDMMC0_DAT3 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,6 ,0 );/* SDMMC0_DAT4 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,7 ,0 );/* SDMMC0_DAT5 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,8 ,0 );/* SDMMC0_DAT6 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,9 ,0 );/* SDMMC0_DAT7 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,10 ,0 );/* SDMMC0_RSTN */ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,11 ,0 );/* SDMMC0_VDDSEL */ + +at91_periph_clk_enable (ATMEL_ID_SDMMC0 ); +at91_enable_periph_generated_clk (ATMEL_ID_SDMMC0 ); +} + +static void board_sdhci1_hw_init (void ) +{ +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,18 ,0 );/* SDMMC1_DAT0 */ +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,19 ,0 );/* SDMMC1_DAT1 */ +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,20 ,0 );/* SDMMC1_DAT2 */ +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,21 ,0 );/* SDMMC1_DAT3 */ +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,22 ,0 );/* SDMMC1_CK */ +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,27 ,0 );/* SDMMC1_RSTN */ +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,28 ,0 );/* SDMMC1_CMD */ +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,30 ,0 );/* SDMMC1_CD */ + +at91_periph_clk_enable (ATMEL_ID_SDMMC1 ); +at91_enable_periph_generated_clk (ATMEL_ID_SDMMC1 ); +} + +int board_mmc_init (bd_t *bis) +{ +#ifdef CONFIG_ATMEL_SDHCI0 +atmel_sdhci_init ((void *)ATMEL_BASE_SDMMC0 ,ATMEL_ID_SDMMC0 ); +#endif +#ifdef CONFIG_ATMEL_SDHCI1 +atmel_sdhci_init ((void *)ATMEL_BASE_SDMMC1 ,ATMEL_ID_SDMMC1 ); +#endif + +return 0 ; +} + +static void board_uart1_hw_init (void ) +{ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,2 ,1 );/* URXD1 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,3 ,0 );/* UTXD1 */ + +at91_periph_clk_enable (ATMEL_ID_UART1 ); +} + +int board_early_init_f (void ) +{ +at91_periph_clk_enable (ATMEL_ID_PIOA ); +at91_periph_clk_enable (ATMEL_ID_PIOB ); +at91_periph_clk_enable (ATMEL_ID_PIOC );
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 229
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+at91_periph_clk_enable (ATMEL_ID_PIOD ); + +board_uart1_hw_init (); + +return 0 ; +} + +int board_init (void ) +{ +/* adress of boot parameters */
s/adress/address
Quoted 40 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +40
-0+ gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x100 ; + +#ifdef CONFIG_ATMEL_SPI +board_spi0_hw_init (); +#endif +#ifdef CONFIG_ATMEL_SDHCI +#ifdef CONFIG_ATMEL_SDHCI0 +board_sdhci0_hw_init (); +#endif +#ifdef CONFIG_ATMEL_SDHCI1 +board_sdhci1_hw_init (); +#endif +#endif +#ifdef CONFIG_MACB +board_gmac_hw_init (); +#endif +#ifdef CONFIG_LCD +board_lcd_hw_init (); +#endif +#ifdef CONFIG_CMD_USB +board_usb_hw_init (); +#endif +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +at91_udp_hw_init (); +#endif + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =get_ram_size ((void *)CONFIG_SYS_SDRAM_BASE , +CONFIG_SYS_SDRAM_SIZE ); +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +int rc =0 ; +
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 279
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+#ifdef CONFIG_MACB + rc =macb_eth_initialize (0 , (void *)ATMEL_BASE_GMAC ,0x00 ); +#endif + +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +usba_udc_probe (&pdata); +#ifdef CONFIG_USB_ETH_RNDIS +usb_eth_initialize (bis); +#endif +#endif
Here, I think you'd better address the comments from Andreas.
Quoted 61 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +3
-0+ +return rc; +}configs/sama5d2_xplained_mmc_defconfig new file +11
-0@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_MMC" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=yconfigs/sama5d2_xplained_spiflash_defconfig new file +11
-0@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_SERIALFLASH" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=yinclude/configs/sama5d2_xplained.h new file +18
-0@@ -0,0 +1,126 @@ +/* +* Configuration file for the SAMA5D2 Xplained Board. +* +* Copyright (C) 2015 Atmel Corporation +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH + +#include "at91-sama5_common.h" + +/* serial console */
include/configs/sama5d2_xplained.h line 28
Quoted 10 lines
include/configs/sama5d2_xplained.h new file +10
-0+#define CONFIG_ATMEL_USART +#define CONFIG_USART_BASE ATMEL_BASE_UART1 +#define CONFIG_USART_ID ATMEL_ID_UART1 + +/* SDRAM */ +#define CONFIG_NR_DRAM_BANKS 1 +#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS +#define CONFIG_SYS_SDRAM_SIZE 0x20000000 + +#ifdef CONFIG_SPL_BUILD
As you don't support SPL, can you add this later? (The same time when add spl support)
Quoted 86 lines
include/configs/sama5d2_xplained.h new file +86
-0+#define CONFIG_SYS_INIT_SP_ADDR 0x210000 +#else +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE) +#endif + +#define CONFIG_SYS_LOAD_ADDR 0x22000000/* load address */ + +#undef CONFIG_AT91_GPIO +#define CONFIG_ATMEL_PIO4 + +/* SerialFlash */ +#ifdef CONFIG_CMD_SF +#define CONFIG_ATMEL_SPI +#define CONFIG_ATMEL_SPI0 +#define CONFIG_SPI_FLASH_ATMEL +#define CONFIG_SF_DEFAULT_BUS 0 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 30000000 +#endif + +/* NAND flash */ +#undef CONFIG_CMD_NAND + +/* MMC */ +#define CONFIG_CMD_MMC + +#ifdef CONFIG_CMD_MMC +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_SDHCI +#define CONFIG_ATMEL_SDHCI +#define CONFIG_ATMEL_SDHCI0 +#define CONFIG_ATMEL_SDHCI1 +#define CONFIG_SUPPORT_EMMC_BOOT +#endif + +/* USB */ +#define CONFIG_CMD_USB + +#ifdef CONFIG_CMD_USB +#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_ATMEL +#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 +#define CONFIG_USB_STORAGE +#endif + +/* USB device */ +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_ATMEL_USBA +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_MANUFACTURER "Atmel SAMA5D2 XPlained" + +#if defined(CONFIG_CMD_USB ) || defined(CONFIG_CMD_MMC ) +#define CONFIG_CMD_FAT +#define CONFIG_DOS_PARTITION +#endif + +/* Ethernet Hardware */ +#define CONFIG_MACB +#define CONFIG_RMII +#define CONFIG_NET_RETRY_COUNT 20 +#define CONFIG_MACB_SEARCH_PHY + +/* LCD */ +/* #define CONFIG_LCD */ + +#ifdef CONFIG_LCD +#define LCD_BPP LCD_COLOR16 +#define LCD_OUTPUT_BPP 24 +#define CONFIG_LCD_LOGO +#define CONFIG_LCD_INFO +#define CONFIG_LCD_INFO_BELOW_LOGO +#define CONFIG_SYS_WHITE_ON_BLACK +#define CONFIG_ATMEL_HLCD +#define CONFIG_ATMEL_LCD_RGB565 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#endif + +#ifdef CONFIG_SYS_USE_MMC + +/* bootstrap + u-boot + env in sd card */ +#undef FAT_ENV_DEVICE_AND_PART +#undef CONFIG_BOOTCOMMAND
include/configs/sama5d2_xplained.h line 124
Quoted 10 lines
include/configs/sama5d2_xplained.h new file +10
-0+ +#define FAT_ENV_DEVICE_AND_PART "1" +#define CONFIG_BOOTCOMMAND "fatload mmc 1:1 0x21000000 at91-sama5d2_xplained.dtb; " \ + "fatload mmc 1:1 0x22000000 zImage; " \ + "bootz 0x22000000 - 0x21000000" +#undef CONFIG_BOOTARGS +#define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait" + +#endif
This part also present in at91-sama5_common.h, can it be used?
include/configs/sama5d2_xplained.h line 126
Quoted 3 lines
include/configs/sama5d2_xplained.h new file +2
-0+ +#endif
Best Regards,
Bo Shen
Yang
PATCH v2 1/1 arm: atmel: Add SAMA5D2 Xplained board
Hi Shen Bo,
Thank you very much for your review.
Quoted 148 lines
-----Original Message-----
From: Bo Shen [mailto:voice.shen at gmail.com]
Sent: 2015?10?27? 11:09
To: Yang, Wenyou; andreas.devel at googlemail.com
Cc: U-Boot Mailing List
Subject: Re: [U-Boot] [PATCH v2] arm: atmel: Add SAMA5D2 Xplained boardHi Wenyou,
+ AndreasQuoted 23 lines · Wenyou Yang
The board supports following features:
- Boot media support: SD card/e.MMC/SPI flash,
- Support LCD display (optional, disabled by default),
- Support ethernet,
- Support USB mass storage.Signed-off-by Wenyou Yang <[email protected]>---
The patch is based on the following patches sent in mailing list.
[PATCH] gpio: atmel: Add the PIO4 driver support [PATCH] arm: at91: Change the Chip ID registers' addresses [PATCH v3] mmc: atmel: Add atmel sdhci support [PATCH v2] arm: at91: clock: Add the generated clock supportChanges in v2:
1./ re-order SAMA5D2 statements alphabetically.
2./ remove redundant "Unknown CPU type".
3./ rework sama5d2's macros.
4./ remove some #ifdef before functions.
5./ moveCONFIG_CMD_SFtoKconfig.
6./ remove NAND macros from config file.
7./CONFIG_BOOTCOMMANDfor sf uses defines inat91-sama5_common.h.Quoted 7 lines
arch/arm/mach-at91/Kconfig | 5 + arch/arm/mach-at91/armv7/Makefile | 1 + arch/arm/mach-at91/armv7/sama5d2_devices.c | 60 +++++ arch/arm/mach-at91/include/mach/at91_pmc.h | 9 +- arch/arm/mach-at91/include/mach/atmel_usba_udc.h | 3 +- arch/arm/mach-at91/include/mach/hardware.h | 2 + arch/arm/mach-at91/include/mach/sama5d2.h | 224+++++++++++++++++
Quoted 4 lines
board/atmel/sama5d2_xplained/Kconfig | 15 ++ board/atmel/sama5d2_xplained/MAINTAINERS | 7 + board/atmel/sama5d2_xplained/Makefile | 8 + board/atmel/sama5d2_xplained/sama5d2_xplained.c | 282++++++++++++++++++++++
Quoted 101 lines
configs/sama5d2_xplained_mmc_defconfig | 11 + configs/sama5d2_xplained_spiflash_defconfig | 11 + include/configs/sama5d2_xplained.h | 126 ++++++++++ 14 files changed, 758 insertions(+), 6 deletions(-)create mode 100644
arch/arm/mach-at91/armv7/sama5d2_devices.ccreate mode 100644arch/arm/mach-at91/include/mach/sama5d2.hcreate mode 100644 board/atmel/sama5d2_xplained/Kconfig create mode 100644 board/atmel/sama5d2_xplained/MAINTAINERS create mode 100644 board/atmel/sama5d2_xplained/Makefile create mode 100644board/atmel/sama5d2_xplained/sama5d2_xplained.ccreate mode 100644 configs/sama5d2_xplained_mmc_defconfig create mode 100644 configs/sama5d2_xplained_spiflash_defconfig create mode 100644include/configs/sama5d2_xplained.harch/arm/mach-at91/Kconfig +5
-0@@ -71,6 +71,10 @@ config TARGET_AT91SAM9X5EK select CPU_ARM926EJS select SUPPORT_SPL +config TARGET_SAMA5D2_XPLAINED + bool "SAMA5D2 Xplained board" + select CPU_V7 + config TARGET_SAMA5D3_XPLAINED bool "SAMA5D3 Xplained board" select CPU_V7@@ -123,6 +127,7 @@ source "board/atmel/at91sam9m10g45ek/Kconfig" source "board/atmel/at91sam9n12ek/Kconfig" source "board/atmel/at91sam9rlek/Kconfig" source "board/atmel/at91sam9x5ek/Kconfig" +source "board/atmel/sama5d2_xplained/Kconfig" source "board/atmel/sama5d3_xplained/Kconfig" source "board/atmel/sama5d3xek/Kconfig" source "board/atmel/sama5d4_xplained/Kconfig"arch/arm/mach-at91/armv7/Makefile +1
-0@@ -8,6 +8,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_SAMA5D2) += sama5d2_devices.o obj-$(CONFIG_SAMA5D3) += sama5d3_devices.o obj-$(CONFIG_SAMA5D4) += sama5d4_devices.o obj-y += clock.oarch/arm/mach-at91/armv7/sama5d2_devices.c new file +44
-0@@ -0,0 +1,60 @@ +/* +* Copyright (C) 2015 Atmel Corporation +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/clk.h> +#include <asm/arch/sama5d2.h> + +char *get_cpu_name () +{ +unsigned int extension_id =get_extension_chip_id (); + +if (cpu_is_sama5d2 ()) { +switch (extension_id) { +case ARCH_EXID_SAMA5D21CU : +return "SAMA5D21" ; +case ARCH_EXID_SAMA5D22CU : +return "SAMA5D22-CU" ; +case ARCH_EXID_SAMA5D22CN : +return "SAMA5D22-CN" ; +case ARCH_EXID_SAMA5D23CU : +return "SAMA5D23-CU" ; +case ARCH_EXID_SAMA5D24CX : +return "SAMA5D24-CX" ; +case ARCH_EXID_SAMA5D24CU : +return "SAMA5D24-CU" ; +case ARCH_EXID_SAMA5D26CU : +return "SAMA5D26-CU" ; +case ARCH_EXID_SAMA5D27CU : +return "SAMA5D27-CU" ; +case ARCH_EXID_SAMA5D27CN : +return "SAMA5D27-CN" ; +case ARCH_EXID_SAMA5D28CU : +return "SAMA5D28-CU" ; +case ARCH_EXID_SAMA5D28CN : +return "SAMA5D28-CN" ; +default : + goto err_exit; + }
Quoted 8 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c line 49
Quoted 5 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +5
-0+ } + +err_exit: +return "Unknown CPU type" ; +}Can we return directly from default? (I guess when compile it will throw out warning message, if so, remove default option).
I don't think the default can be remove in switch-case statement.
Quoted 92 lines
Quoted 92 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +11
-0+ +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +void at91_udp_hw_init (void ) +{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; + +writel (AT91_PMC_UPLLEN |AT91_PMC_BIASEN , &pmc->uckr); + +at91_periph_clk_enable (ATMEL_ID_UDPHS ); +} +#endif arch/arm/mach-at91/include/mach/at91_pmc.h +4
-5@@ -78,7 +78,8 @@ typedef struct at91_pmc {#define AT91_PMC_PLLXR_DIV (x) (x & 0xFF)#define AT91_PMC_PLLXR_PLLCOUNT (x) ((x & 0x3F) << 8)#define AT91_PMC_PLLXR_OUT (x) ((x & 0x03) << 14) -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )#define AT91_PMC_PLLXR_MUL (x) ((x & 0x7F) << 18)#else #define AT91_PMC_PLLXR_MUL (x) ((x & 0x7FF) << 16)@@ -97,7 +98,8 @@ typedef struct at91_pmc {#define AT91_PMC_MCKR_CSS_PLLB 0x00000003#define AT91_PMC_MCKR_CSS_MASK 0x00000003 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 ) || \ defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_PRES_1 0x00000000#define AT91_PMC_MCKR_PRES_2 0x00000010@@ -127,10 +129,7 @@ typedef struct at91_pmc {#else #define AT91_PMC_MCKR_MDIV_1 0x00000000#define AT91_PMC_MCKR_MDIV_2 0x00000100 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ - defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_MDIV_3 0x00000300 -#endif #define AT91_PMC_MCKR_MDIV_4 0x00000200#define AT91_PMC_MCKR_MDIV_MASK 0x00000300#endif arch/arm/mach-at91/include/mach/atmel_usba_udc.h +2
-1@@ -31,7 +31,8 @@ static struct usba_ep_data usba_udc_ep[] = {EP ("ep5" ,5 ,1024 ,3 ,1 ,1 ), EP("ep6", 6, 1024, 3, 1, 1), }; -#elif defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#elif defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )static struct usba_ep_data usba_udc_ep[] = {EP ("ep0" ,0 ,64 ,1 ,0 ,0 ), EP("ep1", 1, 1024, 3, 1, 0),arch/arm/mach-at91/include/mach/hardware.h +2
-0@@ -23,6 +23,8 @@# include <asm/arch/at91sam9g45.h> #elif defined(CONFIG_AT91SAM9N12 ) || defined(CONFIG_AT91SAM9X5 )# include <asm/arch/at91sam9x5.h> +#elif defined(CONFIG_SAMA5D2 ) +# include <asm/arch/sama5d2.h> #elif defined(CONFIG_SAMA5D3 )# include <asm/arch/sama5d3.h> #elif defined(CONFIG_SAMA5D4 )arch/arm/mach-at91/include/mach/sama5d2.h new file +8
-0@@ -0,0 +1,224 @@ +/* +* Chip-specific header file for the SAMA5D2 SoC +* +* Copyright (C) 2015 Atmel +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/
Quoted 8 lines
arch/arm/mach-at91/include/mach/sama5d2.h line 14
Quoted 6 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +6
-0+ +#ifndef __SAMA5D2_H +#define __SAMA5D2_H + +/* +* defines to be used in other places s/defines/definition
All changed, more clearly.
Quoted 176 lines
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 11 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+*/ +#define CONFIG_AT91FAMILY /* It's a member of AT91 */ + +/* +* Peripheral identifiers/interrupts. +*/ +#define ATMEL_ID_FIQ 0/* FIQ Interrupt ID */ +/* 1 */ +#define ATMEL_ID_ARM 2/* Performance Monitor Unit */ +#define ATMEL_ID_PIT 3/* Periodic Interval Timer Interrupt */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 6 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +6
-0+#define ATMEL_ID_WDT 4/* Watchdog Timer Interrupt */ +#define ATMEL_ID_GMAC 5/* Ethernet MAC */ +#define ATMEL_ID_XDMAC0 6/* DMA Controller 0 */ +#define ATMEL_ID_XDMAC1 7/* DMA Controller 1 */ +#define ATMEL_ID_ICM 8/* Integrity Check Monitor */ +#define ATMEL_ID_AES 9/* Advanced Encryption Standard */
arch/arm/mach-at91/include/mach/sama5d2.h line 32
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +2
-0+#define ATMEL_ID_AESB 10/* AES bridge */ +#define ATMEL_ID_TDES 11/* Triple Data Encryption Standard */
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define ATMEL_ID_SHA 12/* SHA Signature */ +#define ATMEL_ID_MPDDRC 13/* MPDDR Controller */ +#define ATMEL_ID_MATRIX1 14/* H32MX, 32-bit AHB Matrix */ +#define ATMEL_ID_MATRIX0 15/* H64MX, 64-bit AHB Matrix */ +#define ATMEL_ID_SECUMOD 16/* Secure Module */ +#define ATMEL_ID_HSMC 17/* Multi-bit ECC interrupt */ +#define ATMEL_ID_PIOA 18/* Parallel I/O Controller A */ +#define ATMEL_ID_FLEXCOM0 19/* FLEXCOM0 */ +#define ATMEL_ID_FLEXCOM1 20/* FLEXCOM1 */ +#define ATMEL_ID_FLEXCOM2 21/* FLEXCOM2 */ arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define ATMEL_ID_FLEXCOM3 22/* FLEXCOM3 */ +#define ATMEL_ID_FLEXCOM4 23/* FLEXCOM4 */ +#define ATMEL_ID_UART0 24/* UART0 */ +#define ATMEL_ID_UART1 25/* UART1 */ +#define ATMEL_ID_UART2 26/* UART2 */ +#define ATMEL_ID_UART3 27/* UART3 */ +#define ATMEL_ID_UART4 28/* UART4 */ +#define ATMEL_ID_TWIHS0 29/* Two-wire Interface 0 */ +#define ATMEL_ID_TWIHS1 30/* Two-wire Interface 1 */ +#define ATMEL_ID_SDMMC0 31/* Secure Data Memory Card Controller 0 */
arch/arm/mach-at91/include/mach/sama5d2.h line 53
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SDMMC1 32/* Secure Data Memory Card Controller 1 */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 11 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +11
-0+#define ATMEL_ID_SPI0 33/* Serial Peripheral Interface 0 */ +#define ATMEL_ID_SPI1 34/* Serial Peripheral Interface 1 */ +#define ATMEL_ID_TC0 35/* Timer Counter 0 (ch.0,1,2) */ +#define ATMEL_ID_TC1 36/* Timer Counter 1 (ch.3,4,5) */ +/* 37 */ +#define ATMEL_ID_PWM 38/* PWMController0 (ch. 0,1,2,3) */ +/* 39 */ +#define ATMEL_ID_ADC 40/* Touch Screen ADC Controller */ +#define ATMEL_ID_UHPHS 41/* USB Host High Speed */ +#define ATMEL_ID_UDPHS 42/* USB Device High Speed */ +#define ATMEL_ID_SSC0 43/* Serial Synchronous Controller 0 */
arch/arm/mach-at91/include/mach/sama5d2.h line 65
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SSC1 44/* Serial Synchronous Controller 1 */
arch/arm/mach-at91/include/mach/sama5d2.h line 67
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +2
-0+#define ATMEL_ID_LCDC 45/* LCD Controller */ +#define ATMEL_ID_ISI 46/* Image Sensor Controller, for A5D2, named after ISC */
arch/arm/mach-at91/include/mach/sama5d2.h line 68
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_TRNG 47/* True Random Number Generator */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 12 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +12
-0+#define ATMEL_ID_PDMIC 48/* PDM Interface Controller */ +#define ATMEL_ID_AIC_IRQ 49/* IRQ Interrupt ID */ +#define ATMEL_ID_SFC 50/* Fuse Controller */ +#define ATMEL_ID_SECURAM 51/* Secure RAM */ +#define ATMEL_ID_QSPI0 52/* QSPI0 */ +#define ATMEL_ID_QSPI1 53/* QSPI1 */ +#define ATMEL_ID_I2SC0 54/* Inter-IC Sound Controller 0 */ +#define ATMEL_ID_I2SC1 55/* Inter-IC Sound Controller 1 */ +#define ATMEL_ID_CAN0_INT0 56/* MCAN 0 Interrupt0 */ +#define ATMEL_ID_CAN1_INT0 57/* MCAN 1 Interrupt0 */ +/* 58 */ +#define ATMEL_ID_CLASSD 59/* Audio Class D Amplifier */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 12 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +12
-0+#define ATMEL_ID_SFR 60/* Special Function Register */ +#define ATMEL_ID_SAIC 61/* Secured AIC */ +#define ATMEL_ID_AIC 62/* Advanced Interrupt Controller */ +#define ATMEL_ID_L2CC 63/* L2 Cache Controller */ +#define ATMEL_ID_CAN0_INT1 64/* MCAN 0 Interrupt1 */ +#define ATMEL_ID_CAN1_INT1 65/* MCAN 1 Interrupt1 */ +#define ATMEL_ID_GMAC_Q1 66/* GMAC Queue 1 Interrupt */ +#define ATMEL_ID_GMAC_Q2 67/* GMAC Queue 2 Interrupt */ +#define ATMEL_ID_PIOB 68/* Parallel I/O Controller B */ +#define ATMEL_ID_PIOC 69/* Parallel I/O Controller C */ +#define ATMEL_ID_PIOD 70/* Parallel I/O Controller D */ +#define ATMEL_ID_SDMMC0_TIMER 71/* Secure Data Memory Card Controller 0 (TIMER) */
arch/arm/mach-at91/include/mach/sama5d2.h line 93
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SDMMC1_TIMER 72/* Secure Data Memory Card Controller 1 (TIMER) */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 5 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +5
-0+/* 73 */ +#define ATMEL_ID_SYS 74/* System Controller Interrupt */ +#define ATMEL_ID_ACC 75/* Analog Comparator */ +#define ATMEL_ID_RXLP 76/* UART Low-Power */ +#define ATMEL_ID_SFRBU 77/* Special Function Register BackUp */
Quoted 38 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +38
-0+#define ATMEL_ID_CHIPID 78/* Chip ID */ + +/* +* User Peripherals physical base addresses. +*/ +#define ATMEL_BASE_LCDC 0xf0000000 +#define ATMEL_BASE_XDMAC1 0xf0004000 +#define ATMEL_BASE_MPDDRC 0xf000c000 +#define ATMEL_BASE_XDMAC0 0xf0010000 +#define ATMEL_BASE_PMC 0xf0014000 +#define ATMEL_BASE_QSPI0 0xf0020000 +#define ATMEL_BASE_QSPI1 0xf0024000 +#define ATMEL_BASE_SPI0 0xf8000000 +#define ATMEL_BASE_GMAC 0xf8008000 +#define ATMEL_BASE_TC0 0xf800c000 +#define ATMEL_BASE_TC1 0xf8010000 +#define ATMEL_BASE_HSMC 0xf8014000 +#define ATMEL_BASE_UART0 0xf801c000 +#define ATMEL_BASE_UART1 0xf8020000 +#define ATMEL_BASE_UART2 0xf8024000 +#define ATMEL_BASE_TWI0 0xf8028000 +#define ATMEL_BASE_SYSC 0xf8048000 +#define ATMEL_BASE_SPI1 0xfc000000 +#define ATMEL_BASE_UART3 0xfc008000 +#define ATMEL_BASE_UART4 0xfc00c000 +#define ATMEL_BASE_TWI1 0xfc028000 +#define ATMEL_BASE_UDPHS 0xfc02c000 + +#define ATMEL_BASE_PIOA 0xfc038000 + +#define ATMEL_CHIPID_CIDR 0xfc069000 +#define ATMEL_CHIPID_EXID 0xfc069004 + +/* +* Address Memory Space +*/ +#define ATMEL_BASE_DDRCS 0x20000000 +#define ATMEL_BASE_QSPI0_AES_MEM 0x90000000arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define ATMEL_BASE_QSPI1_AES_MEM 0x98000000 +#define ATMEL_BASE_SDMMC0 0xa0000000 +#define ATMEL_BASE_SDMMC1 0xb0000000 +#define ATMEL_BASE_QSPI0_MEM 0xd0000000 +#define ATMEL_BASE_QSPI1_MEM 0xd8000000 + +/* +* Internal Memories +*/ +#define ATMEL_BASE_UDPHS_FIFO 0x00300000/* USB Device HS controller */
arch/arm/mach-at91/include/mach/sama5d2.h line 147
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_BASE_OHCI 0x00400000/* USB Host controller (OHCI) */
arch/arm/mach-at91/include/mach/sama5d2.h line 148
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_BASE_EHCI 0x00500000/* USB Host controller (EHCI) */
arch/arm/mach-at91/include/mach/sama5d2.h line 150
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +2
-0+ +/* Other misc defines */ Ditto
Quoted 7 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +7
-0+#define ATMEL_BASE_PMECC (ATMEL_BASE_HSMC + 0x70) +#define ATMEL_BASE_PMERRLOC (ATMEL_BASE_HSMC + 0x500) + +#define ATMEL_BASE_PIOB (ATMEL_BASE_PIOA + 0x40) +#define ATMEL_BASE_PIOC (ATMEL_BASE_PIOB + 0x40) +#define ATMEL_BASE_PIOD (ATMEL_BASE_PIOC + 0x40) +arch/arm/mach-at91/include/mach/sama5d2.h line 167
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+/* SYSC spawns */ +#define ATMEL_BASE_RSTC ATMEL_BASE_SYSC +#define ATMEL_BASE_SHDWC (ATMEL_BASE_SYSC + 0x10) +#define ATMEL_BASE_PIT (ATMEL_BASE_SYSC + 0x30) +#define ATMEL_BASE_WDT (ATMEL_BASE_SYSC + 0x40) +#define ATMEL_BASE_SCKC (ATMEL_BASE_SYSC + 0x50) +#define ATMEL_BASE_RTC (ATMEL_BASE_SYSC + 0xb0) + +/* +* Other misc defines Ditto
Quoted 1 line
You have two section of "Other misc defines", would it be OK to put them together?
Put them together.
Quoted 38 lines
Quoted 38 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +37
-0+*/ +#define ATMEL_PIO_PORTS 4 +#define CPU_HAS_PCR +#define CPU_HAS_H32MXDIV + +/* SAMA5D2 series chip id definitions */ +#define ARCH_ID_SAMA5D2 0x8a5c08c0 +#define ARCH_EXID_SAMA5D21CU 0x0000005a +#define ARCH_EXID_SAMA5D22CU 0x00000059 +#define ARCH_EXID_SAMA5D22CN 0x00000069 +#define ARCH_EXID_SAMA5D23CU 0x00000058 +#define ARCH_EXID_SAMA5D24CX 0x00000004 +#define ARCH_EXID_SAMA5D24CU 0x00000014 +#define ARCH_EXID_SAMA5D26CU 0x00000012 +#define ARCH_EXID_SAMA5D27CU 0x00000011 +#define ARCH_EXID_SAMA5D27CN 0x00000021 +#define ARCH_EXID_SAMA5D28CU 0x00000010 +#define ARCH_EXID_SAMA5D28CN 0x00000020 + +#define cpu_is_sama5d2 () (get_chip_id() == ARCH_ID_SAMA5D2) +#define cpu_is_sama5d21cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D21CU)) +#define cpu_is_sama5d22cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D22CU)) +#define cpu_is_sama5d22cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D22CN)) +#define cpu_is_sama5d23cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D23CU)) +#define cpu_is_sama5d24cx () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D24CX)) +#define cpu_is_sama5d24cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D24CU)) +#define cpu_is_sama5d26cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D26CU)) +#define cpu_is_sama5d27cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D27CU)) +#define cpu_is_sama5d27cn () (cpu_is_sama5d2() && \
Quoted 8 lines
arch/arm/mach-at91/include/mach/sama5d2.h line 209
Quoted 5 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +5
-0+ (get_extension_chip_id() == ARCH_EXID_SAMA5D27CN)) +#define cpu_is_sama5d28cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D28CU)) +#define cpu_is_sama5d28cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D28CN))I don't see where use this part of code? Add I think it is the same as
get_cpu_name()function.
Remove cpu_is_sama5d2x() macros, which are unused for now.
Thanks.
Quoted 143 lines
Quoted 143 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +12
-0+/* PIT Timer(PIT_PIIR) */ +#define CONFIG_SYS_TIMER_COUNTER 0xf804803c + +/* No PMECC Galois table in ROM */ +#define NO_GALOIS_TABLE_IN_ROM + +#ifndef __ASSEMBLY__ +unsigned int get_chip_id (void ); +unsigned int get_extension_chip_id (void );unsigned int +has_lcdc (void );char *get_cpu_name (void );#endif + +#endif board/atmel/sama5d2_xplained/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_SAMA5D2_XPLAINED + +config SYS_BOARD + default "sama5d2_xplained" + +config SYS_VENDOR + default "atmel" + +config SYS_SOC + default "at91" + +config SYS_CONFIG_NAME + default "sama5d2_xplained" + +endifboard/atmel/sama5d2_xplained/MAINTAINERS new file +7
-0@@ -0,0 +1,7 @@ +SAMA5D2 XPLAINED BOARD +M: Wenyou Yang <[email protected]> +S: Maintained +F: board/atmel/sama5d2_xplained/ +F: include/configs/sama5d2_xplained.h +F: configs/sama5d2_xplained_mmc_defconfig +F: configs/sama5d2_xplained_spiflash_defconfigboard/atmel/sama5d2_xplained/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# +# Copyright (C) 2015 Atmel Corporation +# Wenyou Yang <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += sama5d2_xplained.oboard/atmel/sama5d2_xplained/sama5d2_xplained.c new file +72
-0@@ -0,0 +1,282 @@ +/* +* Copyright (C) 2015 Atmel Corporation +* Wenyou.Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <atmel_hlcdc.h> +#include <lcd.h> +#include <mmc.h> +#include <net.h> +#include <netdev.h> +#include <spi.h> +#include <version.h> +#include <asm/io.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/atmel_pio4.h> +#include <asm/arch/atmel_usba_udc.h> +#include <asm/arch/atmel_sdhci.h> +#include <asm/arch/clk.h> +#include <asm/arch/gpio.h> +#include <asm/arch/sama5d2.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int spi_cs_is_valid (unsigned int bus,unsigned int cs) { +return bus ==0 && cs ==0 ; +} + +void spi_cs_activate (struct spi_slave *slave) { +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,0 ); } + +void spi_cs_deactivate (struct spi_slave *slave) { +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,1 ); } + +static void board_spi0_hw_init (void ) +{ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,14 ,0 ); +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,15 ,0 ); +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,16 ,0 ); + +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,1 ); + +at91_periph_clk_enable (ATMEL_ID_SPI0 ); +} + +static void board_usb_hw_init (void ) +{ +atmel_pio4_set_pio_output (AT91_PIO_PORTB ,9 ,1 ); +atmel_pio4_set_pio_output (AT91_PIO_PORTB ,10 ,1 ); } + +#ifdef CONFIG_LCD +vidinfo_t panel_info = { + .vl_col =480 , + .vl_row =272 , + .vl_clk =9000000 , + .vl_bpix =LCD_BPP , + .vl_tft =1 , + .vl_hsync_len =41 , + .vl_left_margin =2 , + .vl_right_margin =2 , + .vl_vsync_len =11 , + .vl_upper_margin =2 , + .vl_lower_margin =2 , + .mmio =ATMEL_BASE_LCDC , +}; + +/* No power up/down pin for the LCD pannel */ +void lcd_enable (void ) {/* Empty! */ } +void lcd_disable (void ) {/* Empty! */ }
Quoted 8 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 83
Quoted 5 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +5
-0+ +unsigned int has_lcdc (void ) +{ +return 1 ; +}For this, I think you can add a following patch to define it as a weak function, then it don't need to repeat it.
Add __weak attribute.
Quoted 53 lines
Quoted 53 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +52
-0+ +static void board_lcd_hw_init (void ) +{ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,28 ,0 );/* LCDPWM */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,29 ,0 );/* LCDDISP */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,30 ,0 );/* LCDVSYNC */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,31 ,0 );/* LCDHSYNC */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,0 ,0 );/* LCDPCK */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,1 ,0 );/* LCDDEN */ + +/* LCDDAT0 */ +/* LCDDAT1 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,10 ,0 );/* LCDDAT2 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,11 ,0 );/* LCDDAT3 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,12 ,0 );/* LCDDAT4 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,13 ,0 );/* LCDDAT5 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,14 ,0 );/* LCDDAT6 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,15 ,0 );/* LCDDAT7 */ + +/* LCDDAT8 */ +/* LCDDAT9 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,16 ,0 );/* LCDDAT10 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,17 ,0 );/* LCDDAT11 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,18 ,0 );/* LCDDAT12 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,19 ,0 );/* LCDDAT13 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,20 ,0 );/* LCDDAT14 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,21 ,0 );/* LCDDAT15 */ + +/* LCDD16 */ +/* LCDD17 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,22 ,0 );/* LCDDAT18 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,23 ,0 );/* LCDDAT19 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,24 ,0 );/* LCDDAT20 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,25 ,0 );/* LCDDAT21 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,26 ,0 );/* LCDDAT22 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,27 ,0 );/* LCDDAT23 */ + +at91_periph_clk_enable (ATMEL_ID_LCDC ); +} + +#ifdef CONFIG_LCD_INFO +void lcd_show_board_info (void ) +{ +ulong dram_size; +int i; +char temp[32 ]; + +lcd_printf ("%s\n" ,U_BOOT_VERSION ); +lcd_printf ("2015 ATMEL Corp\n" ); +lcd_printf ("%s CPU at %s MHz\n" ,get_cpu_name (), +strmhz (temp,get_cpu_clk_rate ())); +
Quoted 8 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c
Quoted 6 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +6
-0+ dram_size =0 ; +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) + dram_size += gd->bd->bi_dram[i].size; + +lcd_printf ("%ld MB SDRAM\n" , dram_size >>20 ); }#endif /* +CONFIG_LCD_INFO */ #endif/* CONFIG_LCD_INFO */ s/CONFIG_LCD_INFO/CONFIG_LCD
Done
Quoted 98 lines
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +9
-0+ +static void board_gmac_hw_init (void ) +{ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,14 ,0 );/* GTXCK */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,15 ,0 );/* GTXEN */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,16 ,0 );/* GRXDV */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,17 ,0 );/* GRXER */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,18 ,0 );/* GRX0 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,19 ,0 );/* GRX1 */ board/atmel/sama5d2_xplained/sama5d2_xplained.c
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+atmel_pio4_set_f_periph (AT91_PIO_PORTB ,20 ,0 );/* GTX0 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,21 ,0 );/* GTX1 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,22 ,0 );/* GMDC */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,23 ,0 );/* GMDIO */ + +at91_periph_clk_enable (ATMEL_ID_GMAC ); +} + +static void board_sdhci0_hw_init (void ) { +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,0 ,0 );/* SDMMC0_CK */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 155
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,1 ,0 );/* SDMMC0_CMD */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 156
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,2 ,0 );/*
SDMMC0_DAT0*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 157
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,3 ,0 );/*
SDMMC0_DAT1*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 158
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,4 ,0 );/*
SDMMC0_DAT2*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 159
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,5 ,0 );/*
SDMMC0_DAT3*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 160
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,6 ,0 );/*
SDMMC0_DAT4*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 161
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,7 ,0 );/*
SDMMC0_DAT5*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 162
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,8 ,0 );/*
SDMMC0_DAT6*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 163
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,9 ,0 );/*
SDMMC0_DAT7*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 164
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,10 ,0 );/*
SDMMC0_RSTN*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 165
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,11 ,0 );/*
SDMMC0_VDDSEL*/board/atmel/sama5d2_xplained/sama5d2_xplained.c
Quoted 7 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +7
-0+ +at91_periph_clk_enable (ATMEL_ID_SDMMC0 ); +at91_enable_periph_generated_clk (ATMEL_ID_SDMMC0 ); +} + +static void board_sdhci1_hw_init (void ) { +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,18 ,0 );/*
SDMMC1_DAT0*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 173
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,19 ,0 );/*
SDMMC1_DAT1*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 174
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,20 ,0 );/*
SDMMC1_DAT2*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 175
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,21 ,0 );/*
SDMMC1_DAT3*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 176
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,22 ,0 );/* SDMMC1_CK */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 177
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,27 ,0 );/*
SDMMC1_RSTN*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 178
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,28 ,0 );/* SDMMC1_CMD */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 179
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,30 ,0 );/* SDMMC1_CD */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 198
Quoted 9 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +9
-0+ +at91_periph_clk_enable (ATMEL_ID_SDMMC1 ); +at91_enable_periph_generated_clk (ATMEL_ID_SDMMC1 ); +} + +int board_mmc_init (bd_t *bis) +{ +#ifdef CONFIG_ATMEL_SDHCI0 +atmel_sdhci_init ((void *)ATMEL_BASE_SDMMC0 ,ATMEL_ID_SDMMC0 );#endif
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 201
Quoted 2 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +2
-0+#ifdef CONFIG_ATMEL_SDHCI1 +atmel_sdhci_init ((void *)ATMEL_BASE_SDMMC1 ,ATMEL_ID_SDMMC1 );#endif
Quoted 20 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +20
-0+ +return 0 ; +} + +static void board_uart1_hw_init (void ) { +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,2 ,1 );/* URXD1 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,3 ,0 );/* UTXD1 */ + +at91_periph_clk_enable (ATMEL_ID_UART1 ); +} + +int board_early_init_f (void ) +{ +at91_periph_clk_enable (ATMEL_ID_PIOA ); +at91_periph_clk_enable (ATMEL_ID_PIOB ); +at91_periph_clk_enable (ATMEL_ID_PIOC ); +at91_periph_clk_enable (ATMEL_ID_PIOD ); + +board_uart1_hw_init (); +
Quoted 8 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 229
Quoted 6 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +6
-0+return 0 ; +} + +int board_init (void ) +{ +/* adress of boot parameters */ s/adress/address
Thank you for your finding.
Quoted 122 lines
Quoted 40 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +39
-0+ gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x100 ; + +#ifdef CONFIG_ATMEL_SPI +board_spi0_hw_init (); +#endif +#ifdef CONFIG_ATMEL_SDHCI +#ifdef CONFIG_ATMEL_SDHCI0 +board_sdhci0_hw_init (); +#endif +#ifdef CONFIG_ATMEL_SDHCI1 +board_sdhci1_hw_init (); +#endif +#endif +#ifdef CONFIG_MACB +board_gmac_hw_init (); +#endif +#ifdef CONFIG_LCD +board_lcd_hw_init (); +#endif +#ifdef CONFIG_CMD_USB +board_usb_hw_init (); +#endif +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +at91_udp_hw_init (); +#endif + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =get_ram_size ((void *)CONFIG_SYS_SDRAM_BASE , +CONFIG_SYS_SDRAM_SIZE ); +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +int rc =0 ;board/atmel/sama5d2_xplained/sama5d2_xplained.c line 279
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+ +#ifdef CONFIG_MACB + rc =macb_eth_initialize (0 , (void *)ATMEL_BASE_GMAC ,0x00 );#endif + +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +usba_udc_probe (&pdata); +#ifdef CONFIG_USB_ETH_RNDIS +usb_eth_initialize (bis); +#endif +#endif Here, I think you'd better address the comments from Andreas.
Quoted 69 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +3
-0+ +return rc; +}configs/sama5d2_xplained_mmc_defconfig new file +11
-0@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_MMC" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=yconfigs/sama5d2_xplained_spiflash_defconfig new file +11
-0@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_SERIALFLASH" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=yinclude/configs/sama5d2_xplained.h new file +23
-0@@ -0,0 +1,126 @@ +/* +* Configuration file for the SAMA5D2 Xplained Board. +* +* Copyright (C) 2015 Atmel Corporation +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH + +#include "at91-sama5_common.h" + +/* serial console */ +#define CONFIG_ATMEL_USART +#define CONFIG_USART_BASE ATMEL_BASE_UART1 +#define CONFIG_USART_ID ATMEL_ID_UART1 + +/* SDRAM */
Quoted 8 lines
include/configs/sama5d2_xplained.h line 28
Quoted 5 lines
include/configs/sama5d2_xplained.h new file +5
-0+#define CONFIG_NR_DRAM_BANKS 1 +#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS +#define CONFIG_SYS_SDRAM_SIZE 0x20000000 + +#ifdef CONFIG_SPL_BUILD As you don't support SPL, can you add this later? (The same time when add spl support)
Removed. The SPL support will be added soon.
Quoted 89 lines
include/configs/sama5d2_xplained.h
Quoted 5 lines
include/configs/sama5d2_xplained.h new file +4
-0+#define CONFIG_SYS_INIT_SP_ADDR 0x210000 +#else +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_SDRAM_BASE + 4 * 1024 -
GENERATED_GBL_DATA_SIZE) #endifinclude/configs/sama5d2_xplained.h line 34
Quoted 2 lines
include/configs/sama5d2_xplained.h new file +2
-0+ +#define CONFIG_SYS_LOAD_ADDR 0x22000000/* load address */
Quoted 69 lines
include/configs/sama5d2_xplained.h new file +69
-0+ +#undef CONFIG_AT91_GPIO +#define CONFIG_ATMEL_PIO4 + +/* SerialFlash */ +#ifdef CONFIG_CMD_SF +#define CONFIG_ATMEL_SPI +#define CONFIG_ATMEL_SPI0 +#define CONFIG_SPI_FLASH_ATMEL +#define CONFIG_SF_DEFAULT_BUS 0 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 30000000 +#endif + +/* NAND flash */ +#undef CONFIG_CMD_NAND + +/* MMC */ +#define CONFIG_CMD_MMC + +#ifdef CONFIG_CMD_MMC +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_SDHCI +#define CONFIG_ATMEL_SDHCI +#define CONFIG_ATMEL_SDHCI0 +#define CONFIG_ATMEL_SDHCI1 +#define CONFIG_SUPPORT_EMMC_BOOT +#endif + +/* USB */ +#define CONFIG_CMD_USB + +#ifdef CONFIG_CMD_USB +#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_ATMEL +#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 +#define CONFIG_USB_STORAGE +#endif + +/* USB device */ +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_ATMEL_USBA +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_MANUFACTURER "Atmel SAMA5D2 XPlained" + +#if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC) #define +CONFIG_CMD_FAT #define CONFIG_DOS_PARTITION #endif + +/* Ethernet Hardware */ +#define CONFIG_MACB +#define CONFIG_RMII +#define CONFIG_NET_RETRY_COUNT 20 +#define CONFIG_MACB_SEARCH_PHY + +/* LCD */ +/* #define CONFIG_LCD */ + +#ifdef CONFIG_LCD +#define LCD_BPP LCD_COLOR16 +#define LCD_OUTPUT_BPP 24 +#define CONFIG_LCD_LOGO +#define CONFIG_LCD_INFO +#define CONFIG_LCD_INFO_BELOW_LOGO +#define CONFIG_SYS_WHITE_ON_BLACK +#define CONFIG_ATMEL_HLCD +#define CONFIG_ATMEL_LCD_RGB565 include/configs/sama5d2_xplained.h
Quoted 10 lines
include/configs/sama5d2_xplained.h new file +10
-0+#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#endif + +#ifdef CONFIG_SYS_USE_MMC + +/* bootstrap + u-boot + env in sd card */ #undef +FAT_ENV_DEVICE_AND_PART #undef CONFIG_BOOTCOMMAND + +#define FAT_ENV_DEVICE_AND_PART "1" +#define CONFIG_BOOTCOMMAND "fatload mmc 1:1 0x21000000 at91-sama5d2_xplained.dtb; " \
Quoted 9 lines
include/configs/sama5d2_xplained.h line 124
Quoted 7 lines
include/configs/sama5d2_xplained.h new file +7
-0+"fatload mmc 1:1 0x22000000 zImage; " \ + "bootz 0x22000000 - 0x21000000" +#undef CONFIG_BOOTARGS +#define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait" + +#endif This part also present in
at91-sama5_common.h, can it be used?
They have a little difference, so be overridden.
Quoted 7 lines
include/configs/sama5d2_xplained.h line 122
Quoted 4 lines
include/configs/sama5d2_xplained.h new file +2
-0+ +#endif Best Regards,
Bo Shen
Best Regards,
Wenyou Yang
PATCH v2 1/1 arm: atmel: Add SAMA5D2 Xplained board
Hi Wenyou,
Quoted 161 lines · Wenyou
Hi Shen Bo,
Thank you very much for your review.
Quoted 148 lines
-----Original Message-----
From: Bo Shen [mailto:voice.shen at gmail.com]
Sent: 2015?10?27? 11:09
To: Yang, Wenyou; andreas.devel at googlemail.com
Cc: U-Boot Mailing List
Subject: Re: [U-Boot] [PATCH v2] arm: atmel: Add SAMA5D2 Xplained boardHi Wenyou,
+ AndreasQuoted 23 lines · Wenyou Yang
The board supports following features:
- Boot media support: SD card/e.MMC/SPI flash,
- Support LCD display (optional, disabled by default),
- Support ethernet,
- Support USB mass storage.Signed-off-by Wenyou Yang <[email protected]>---
The patch is based on the following patches sent in mailing list.
[PATCH] gpio: atmel: Add the PIO4 driver support [PATCH] arm: at91: Change the Chip ID registers' addresses [PATCH v3] mmc: atmel: Add atmel sdhci support [PATCH v2] arm: at91: clock: Add the generated clock supportChanges in v2:
1./ re-order SAMA5D2 statements alphabetically.
2./ remove redundant "Unknown CPU type".
3./ rework sama5d2's macros.
4./ remove some #ifdef before functions.
5./ moveCONFIG_CMD_SFtoKconfig.
6./ remove NAND macros from config file.
7./CONFIG_BOOTCOMMANDfor sf uses defines inat91-sama5_common.h.Quoted 7 lines
arch/arm/mach-at91/Kconfig | 5 + arch/arm/mach-at91/armv7/Makefile | 1 + arch/arm/mach-at91/armv7/sama5d2_devices.c | 60 +++++ arch/arm/mach-at91/include/mach/at91_pmc.h | 9 +- arch/arm/mach-at91/include/mach/atmel_usba_udc.h | 3 +- arch/arm/mach-at91/include/mach/hardware.h | 2 + arch/arm/mach-at91/include/mach/sama5d2.h | 224+++++++++++++++++
Quoted 4 lines
board/atmel/sama5d2_xplained/Kconfig | 15 ++ board/atmel/sama5d2_xplained/MAINTAINERS | 7 + board/atmel/sama5d2_xplained/Makefile | 8 + board/atmel/sama5d2_xplained/sama5d2_xplained.c | 282++++++++++++++++++++++
Quoted 101 lines
configs/sama5d2_xplained_mmc_defconfig | 11 + configs/sama5d2_xplained_spiflash_defconfig | 11 + include/configs/sama5d2_xplained.h | 126 ++++++++++ 14 files changed, 758 insertions(+), 6 deletions(-)create mode 100644
arch/arm/mach-at91/armv7/sama5d2_devices.ccreate mode 100644arch/arm/mach-at91/include/mach/sama5d2.hcreate mode 100644 board/atmel/sama5d2_xplained/Kconfig create mode 100644 board/atmel/sama5d2_xplained/MAINTAINERS create mode 100644 board/atmel/sama5d2_xplained/Makefile create mode 100644board/atmel/sama5d2_xplained/sama5d2_xplained.ccreate mode 100644 configs/sama5d2_xplained_mmc_defconfig create mode 100644 configs/sama5d2_xplained_spiflash_defconfig create mode 100644include/configs/sama5d2_xplained.harch/arm/mach-at91/Kconfig +5
-0@@ -71,6 +71,10 @@ config TARGET_AT91SAM9X5EK select CPU_ARM926EJS select SUPPORT_SPL +config TARGET_SAMA5D2_XPLAINED + bool "SAMA5D2 Xplained board" + select CPU_V7 + config TARGET_SAMA5D3_XPLAINED bool "SAMA5D3 Xplained board" select CPU_V7@@ -123,6 +127,7 @@ source "board/atmel/at91sam9m10g45ek/Kconfig" source "board/atmel/at91sam9n12ek/Kconfig" source "board/atmel/at91sam9rlek/Kconfig" source "board/atmel/at91sam9x5ek/Kconfig" +source "board/atmel/sama5d2_xplained/Kconfig" source "board/atmel/sama5d3_xplained/Kconfig" source "board/atmel/sama5d3xek/Kconfig" source "board/atmel/sama5d4_xplained/Kconfig"arch/arm/mach-at91/armv7/Makefile +1
-0@@ -8,6 +8,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_SAMA5D2) += sama5d2_devices.o obj-$(CONFIG_SAMA5D3) += sama5d3_devices.o obj-$(CONFIG_SAMA5D4) += sama5d4_devices.o obj-y += clock.oarch/arm/mach-at91/armv7/sama5d2_devices.c new file +44
-0@@ -0,0 +1,60 @@ +/* +* Copyright (C) 2015 Atmel Corporation +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/clk.h> +#include <asm/arch/sama5d2.h> + +char *get_cpu_name () +{ +unsigned int extension_id =get_extension_chip_id (); + +if (cpu_is_sama5d2 ()) { +switch (extension_id) { +case ARCH_EXID_SAMA5D21CU : +return "SAMA5D21" ; +case ARCH_EXID_SAMA5D22CU : +return "SAMA5D22-CU" ; +case ARCH_EXID_SAMA5D22CN : +return "SAMA5D22-CN" ; +case ARCH_EXID_SAMA5D23CU : +return "SAMA5D23-CU" ; +case ARCH_EXID_SAMA5D24CX : +return "SAMA5D24-CX" ; +case ARCH_EXID_SAMA5D24CU : +return "SAMA5D24-CU" ; +case ARCH_EXID_SAMA5D26CU : +return "SAMA5D26-CU" ; +case ARCH_EXID_SAMA5D27CU : +return "SAMA5D27-CU" ; +case ARCH_EXID_SAMA5D27CN : +return "SAMA5D27-CN" ; +case ARCH_EXID_SAMA5D28CU : +return "SAMA5D28-CU" ; +case ARCH_EXID_SAMA5D28CN : +return "SAMA5D28-CN" ; +default : + goto err_exit; + }Quoted 8 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c line 49
Quoted 5 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +5
-0+ } + +err_exit: +return "Unknown CPU type" ; +}Can we return directly from default? (I guess when compile it will throw out warning message, if so, remove default option).
Quoted 1 line
I don't think the default can be remove in switch-case statement.
Could you show me more detail why can not be removed?
Quoted 482 lines
Quoted 92 lines
Quoted 92 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +11
-0+ +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +void at91_udp_hw_init (void ) +{ +struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; + +writel (AT91_PMC_UPLLEN |AT91_PMC_BIASEN , &pmc->uckr); + +at91_periph_clk_enable (ATMEL_ID_UDPHS ); +} +#endif arch/arm/mach-at91/include/mach/at91_pmc.h +4
-5@@ -78,7 +78,8 @@ typedef struct at91_pmc {#define AT91_PMC_PLLXR_DIV (x) (x & 0xFF)#define AT91_PMC_PLLXR_PLLCOUNT (x) ((x & 0x3F) << 8)#define AT91_PMC_PLLXR_OUT (x) ((x & 0x03) << 14) -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )#define AT91_PMC_PLLXR_MUL (x) ((x & 0x7F) << 18)#else #define AT91_PMC_PLLXR_MUL (x) ((x & 0x7FF) << 16)@@ -97,7 +98,8 @@ typedef struct at91_pmc {#define AT91_PMC_MCKR_CSS_PLLB 0x00000003#define AT91_PMC_MCKR_CSS_MASK 0x00000003 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 ) || \ defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_PRES_1 0x00000000#define AT91_PMC_MCKR_PRES_2 0x00000010@@ -127,10 +129,7 @@ typedef struct at91_pmc {#else #define AT91_PMC_MCKR_MDIV_1 0x00000000#define AT91_PMC_MCKR_MDIV_2 0x00000100 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ - defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_MDIV_3 0x00000300 -#endif #define AT91_PMC_MCKR_MDIV_4 0x00000200#define AT91_PMC_MCKR_MDIV_MASK 0x00000300#endif arch/arm/mach-at91/include/mach/atmel_usba_udc.h +2
-1@@ -31,7 +31,8 @@ static struct usba_ep_data usba_udc_ep[] = {EP ("ep5" ,5 ,1024 ,3 ,1 ,1 ), EP("ep6", 6, 1024, 3, 1, 1), }; -#elif defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#elif defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )static struct usba_ep_data usba_udc_ep[] = {EP ("ep0" ,0 ,64 ,1 ,0 ,0 ), EP("ep1", 1, 1024, 3, 1, 0),arch/arm/mach-at91/include/mach/hardware.h +2
-0@@ -23,6 +23,8 @@# include <asm/arch/at91sam9g45.h> #elif defined(CONFIG_AT91SAM9N12 ) || defined(CONFIG_AT91SAM9X5 )# include <asm/arch/at91sam9x5.h> +#elif defined(CONFIG_SAMA5D2 ) +# include <asm/arch/sama5d2.h> #elif defined(CONFIG_SAMA5D3 )# include <asm/arch/sama5d3.h> #elif defined(CONFIG_SAMA5D4 )arch/arm/mach-at91/include/mach/sama5d2.h new file +8
-0@@ -0,0 +1,224 @@ +/* +* Chip-specific header file for the SAMA5D2 SoC +* +* Copyright (C) 2015 Atmel +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ Quoted 8 lines
arch/arm/mach-at91/include/mach/sama5d2.h line 14
Quoted 6 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +6
-0+ +#ifndef __SAMA5D2_H +#define __SAMA5D2_H + +/* +* defines to be used in other places s/defines/definition
All changed, more clearly.
Quoted 176 lines
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 11 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+*/ +#define CONFIG_AT91FAMILY /* It's a member of AT91 */ + +/* +* Peripheral identifiers/interrupts. +*/ +#define ATMEL_ID_FIQ 0/* FIQ Interrupt ID */ +/* 1 */ +#define ATMEL_ID_ARM 2/* Performance Monitor Unit */ +#define ATMEL_ID_PIT 3/* Periodic Interval Timer Interrupt */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 6 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +6
-0+#define ATMEL_ID_WDT 4/* Watchdog Timer Interrupt */ +#define ATMEL_ID_GMAC 5/* Ethernet MAC */ +#define ATMEL_ID_XDMAC0 6/* DMA Controller 0 */ +#define ATMEL_ID_XDMAC1 7/* DMA Controller 1 */ +#define ATMEL_ID_ICM 8/* Integrity Check Monitor */ +#define ATMEL_ID_AES 9/* Advanced Encryption Standard */
arch/arm/mach-at91/include/mach/sama5d2.h line 32
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +2
-0+#define ATMEL_ID_AESB 10/* AES bridge */ +#define ATMEL_ID_TDES 11/* Triple Data Encryption Standard */
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define ATMEL_ID_SHA 12/* SHA Signature */ +#define ATMEL_ID_MPDDRC 13/* MPDDR Controller */ +#define ATMEL_ID_MATRIX1 14/* H32MX, 32-bit AHB Matrix */ +#define ATMEL_ID_MATRIX0 15/* H64MX, 64-bit AHB Matrix */ +#define ATMEL_ID_SECUMOD 16/* Secure Module */ +#define ATMEL_ID_HSMC 17/* Multi-bit ECC interrupt */ +#define ATMEL_ID_PIOA 18/* Parallel I/O Controller A */ +#define ATMEL_ID_FLEXCOM0 19/* FLEXCOM0 */ +#define ATMEL_ID_FLEXCOM1 20/* FLEXCOM1 */ +#define ATMEL_ID_FLEXCOM2 21/* FLEXCOM2 */ arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define ATMEL_ID_FLEXCOM3 22/* FLEXCOM3 */ +#define ATMEL_ID_FLEXCOM4 23/* FLEXCOM4 */ +#define ATMEL_ID_UART0 24/* UART0 */ +#define ATMEL_ID_UART1 25/* UART1 */ +#define ATMEL_ID_UART2 26/* UART2 */ +#define ATMEL_ID_UART3 27/* UART3 */ +#define ATMEL_ID_UART4 28/* UART4 */ +#define ATMEL_ID_TWIHS0 29/* Two-wire Interface 0 */ +#define ATMEL_ID_TWIHS1 30/* Two-wire Interface 1 */ +#define ATMEL_ID_SDMMC0 31/* Secure Data Memory Card Controller 0 */
arch/arm/mach-at91/include/mach/sama5d2.h line 53
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SDMMC1 32/* Secure Data Memory Card Controller 1 */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 11 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +11
-0+#define ATMEL_ID_SPI0 33/* Serial Peripheral Interface 0 */ +#define ATMEL_ID_SPI1 34/* Serial Peripheral Interface 1 */ +#define ATMEL_ID_TC0 35/* Timer Counter 0 (ch.0,1,2) */ +#define ATMEL_ID_TC1 36/* Timer Counter 1 (ch.3,4,5) */ +/* 37 */ +#define ATMEL_ID_PWM 38/* PWMController0 (ch. 0,1,2,3) */ +/* 39 */ +#define ATMEL_ID_ADC 40/* Touch Screen ADC Controller */ +#define ATMEL_ID_UHPHS 41/* USB Host High Speed */ +#define ATMEL_ID_UDPHS 42/* USB Device High Speed */ +#define ATMEL_ID_SSC0 43/* Serial Synchronous Controller 0 */
arch/arm/mach-at91/include/mach/sama5d2.h line 65
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SSC1 44/* Serial Synchronous Controller 1 */
arch/arm/mach-at91/include/mach/sama5d2.h line 67
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +2
-0+#define ATMEL_ID_LCDC 45/* LCD Controller */ +#define ATMEL_ID_ISI 46/* Image Sensor Controller, for A5D2, named after ISC */
arch/arm/mach-at91/include/mach/sama5d2.h line 68
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_TRNG 47/* True Random Number Generator */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 12 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +12
-0+#define ATMEL_ID_PDMIC 48/* PDM Interface Controller */ +#define ATMEL_ID_AIC_IRQ 49/* IRQ Interrupt ID */ +#define ATMEL_ID_SFC 50/* Fuse Controller */ +#define ATMEL_ID_SECURAM 51/* Secure RAM */ +#define ATMEL_ID_QSPI0 52/* QSPI0 */ +#define ATMEL_ID_QSPI1 53/* QSPI1 */ +#define ATMEL_ID_I2SC0 54/* Inter-IC Sound Controller 0 */ +#define ATMEL_ID_I2SC1 55/* Inter-IC Sound Controller 1 */ +#define ATMEL_ID_CAN0_INT0 56/* MCAN 0 Interrupt0 */ +#define ATMEL_ID_CAN1_INT0 57/* MCAN 1 Interrupt0 */ +/* 58 */ +#define ATMEL_ID_CLASSD 59/* Audio Class D Amplifier */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 12 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +12
-0+#define ATMEL_ID_SFR 60/* Special Function Register */ +#define ATMEL_ID_SAIC 61/* Secured AIC */ +#define ATMEL_ID_AIC 62/* Advanced Interrupt Controller */ +#define ATMEL_ID_L2CC 63/* L2 Cache Controller */ +#define ATMEL_ID_CAN0_INT1 64/* MCAN 0 Interrupt1 */ +#define ATMEL_ID_CAN1_INT1 65/* MCAN 1 Interrupt1 */ +#define ATMEL_ID_GMAC_Q1 66/* GMAC Queue 1 Interrupt */ +#define ATMEL_ID_GMAC_Q2 67/* GMAC Queue 2 Interrupt */ +#define ATMEL_ID_PIOB 68/* Parallel I/O Controller B */ +#define ATMEL_ID_PIOC 69/* Parallel I/O Controller C */ +#define ATMEL_ID_PIOD 70/* Parallel I/O Controller D */ +#define ATMEL_ID_SDMMC0_TIMER 71/* Secure Data Memory Card Controller 0 (TIMER) */
arch/arm/mach-at91/include/mach/sama5d2.h line 93
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SDMMC1_TIMER 72/* Secure Data Memory Card Controller 1 (TIMER) */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 5 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +5
-0+/* 73 */ +#define ATMEL_ID_SYS 74/* System Controller Interrupt */ +#define ATMEL_ID_ACC 75/* Analog Comparator */ +#define ATMEL_ID_RXLP 76/* UART Low-Power */ +#define ATMEL_ID_SFRBU 77/* Special Function Register BackUp */
Quoted 38 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +38
-0+#define ATMEL_ID_CHIPID 78/* Chip ID */ + +/* +* User Peripherals physical base addresses. +*/ +#define ATMEL_BASE_LCDC 0xf0000000 +#define ATMEL_BASE_XDMAC1 0xf0004000 +#define ATMEL_BASE_MPDDRC 0xf000c000 +#define ATMEL_BASE_XDMAC0 0xf0010000 +#define ATMEL_BASE_PMC 0xf0014000 +#define ATMEL_BASE_QSPI0 0xf0020000 +#define ATMEL_BASE_QSPI1 0xf0024000 +#define ATMEL_BASE_SPI0 0xf8000000 +#define ATMEL_BASE_GMAC 0xf8008000 +#define ATMEL_BASE_TC0 0xf800c000 +#define ATMEL_BASE_TC1 0xf8010000 +#define ATMEL_BASE_HSMC 0xf8014000 +#define ATMEL_BASE_UART0 0xf801c000 +#define ATMEL_BASE_UART1 0xf8020000 +#define ATMEL_BASE_UART2 0xf8024000 +#define ATMEL_BASE_TWI0 0xf8028000 +#define ATMEL_BASE_SYSC 0xf8048000 +#define ATMEL_BASE_SPI1 0xfc000000 +#define ATMEL_BASE_UART3 0xfc008000 +#define ATMEL_BASE_UART4 0xfc00c000 +#define ATMEL_BASE_TWI1 0xfc028000 +#define ATMEL_BASE_UDPHS 0xfc02c000 + +#define ATMEL_BASE_PIOA 0xfc038000 + +#define ATMEL_CHIPID_CIDR 0xfc069000 +#define ATMEL_CHIPID_EXID 0xfc069004 + +/* +* Address Memory Space +*/ +#define ATMEL_BASE_DDRCS 0x20000000 +#define ATMEL_BASE_QSPI0_AES_MEM 0x90000000arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define ATMEL_BASE_QSPI1_AES_MEM 0x98000000 +#define ATMEL_BASE_SDMMC0 0xa0000000 +#define ATMEL_BASE_SDMMC1 0xb0000000 +#define ATMEL_BASE_QSPI0_MEM 0xd0000000 +#define ATMEL_BASE_QSPI1_MEM 0xd8000000 + +/* +* Internal Memories +*/ +#define ATMEL_BASE_UDPHS_FIFO 0x00300000/* USB Device HS controller */
arch/arm/mach-at91/include/mach/sama5d2.h line 147
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_BASE_OHCI 0x00400000/* USB Host controller (OHCI) */
arch/arm/mach-at91/include/mach/sama5d2.h line 148
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_BASE_EHCI 0x00500000/* USB Host controller (EHCI) */
arch/arm/mach-at91/include/mach/sama5d2.h line 150
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +2
-0+ +/* Other misc defines */ Ditto
Quoted 7 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +7
-0+#define ATMEL_BASE_PMECC (ATMEL_BASE_HSMC + 0x70) +#define ATMEL_BASE_PMERRLOC (ATMEL_BASE_HSMC + 0x500) + +#define ATMEL_BASE_PIOB (ATMEL_BASE_PIOA + 0x40) +#define ATMEL_BASE_PIOC (ATMEL_BASE_PIOB + 0x40) +#define ATMEL_BASE_PIOD (ATMEL_BASE_PIOC + 0x40) +arch/arm/mach-at91/include/mach/sama5d2.h line 167
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+/* SYSC spawns */ +#define ATMEL_BASE_RSTC ATMEL_BASE_SYSC +#define ATMEL_BASE_SHDWC (ATMEL_BASE_SYSC + 0x10) +#define ATMEL_BASE_PIT (ATMEL_BASE_SYSC + 0x30) +#define ATMEL_BASE_WDT (ATMEL_BASE_SYSC + 0x40) +#define ATMEL_BASE_SCKC (ATMEL_BASE_SYSC + 0x50) +#define ATMEL_BASE_RTC (ATMEL_BASE_SYSC + 0xb0) + +/* +* Other misc defines Ditto
Quoted 1 line
You have two section of "Other misc defines", would it be OK to put them together?
Put them together.
Quoted 38 lines
Quoted 38 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +37
-0+*/ +#define ATMEL_PIO_PORTS 4 +#define CPU_HAS_PCR +#define CPU_HAS_H32MXDIV + +/* SAMA5D2 series chip id definitions */ +#define ARCH_ID_SAMA5D2 0x8a5c08c0 +#define ARCH_EXID_SAMA5D21CU 0x0000005a +#define ARCH_EXID_SAMA5D22CU 0x00000059 +#define ARCH_EXID_SAMA5D22CN 0x00000069 +#define ARCH_EXID_SAMA5D23CU 0x00000058 +#define ARCH_EXID_SAMA5D24CX 0x00000004 +#define ARCH_EXID_SAMA5D24CU 0x00000014 +#define ARCH_EXID_SAMA5D26CU 0x00000012 +#define ARCH_EXID_SAMA5D27CU 0x00000011 +#define ARCH_EXID_SAMA5D27CN 0x00000021 +#define ARCH_EXID_SAMA5D28CU 0x00000010 +#define ARCH_EXID_SAMA5D28CN 0x00000020 + +#define cpu_is_sama5d2 () (get_chip_id() == ARCH_ID_SAMA5D2) +#define cpu_is_sama5d21cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D21CU)) +#define cpu_is_sama5d22cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D22CU)) +#define cpu_is_sama5d22cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D22CN)) +#define cpu_is_sama5d23cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D23CU)) +#define cpu_is_sama5d24cx () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D24CX)) +#define cpu_is_sama5d24cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D24CU)) +#define cpu_is_sama5d26cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D26CU)) +#define cpu_is_sama5d27cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D27CU)) +#define cpu_is_sama5d27cn () (cpu_is_sama5d2() && \Quoted 8 lines
arch/arm/mach-at91/include/mach/sama5d2.h line 209
Quoted 5 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +5
-0+ (get_extension_chip_id() == ARCH_EXID_SAMA5D27CN)) +#define cpu_is_sama5d28cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D28CU)) +#define cpu_is_sama5d28cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D28CN))I don't see where use this part of code? Add I think it is the same as
get_cpu_name()function.Remove
cpu_is_sama5d2x()macros, which are unused for now.Thanks.
Quoted 143 lines
Quoted 143 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +12
-0+/* PIT Timer(PIT_PIIR) */ +#define CONFIG_SYS_TIMER_COUNTER 0xf804803c + +/* No PMECC Galois table in ROM */ +#define NO_GALOIS_TABLE_IN_ROM + +#ifndef __ASSEMBLY__ +unsigned int get_chip_id (void ); +unsigned int get_extension_chip_id (void );unsigned int +has_lcdc (void );char *get_cpu_name (void );#endif + +#endif board/atmel/sama5d2_xplained/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_SAMA5D2_XPLAINED + +config SYS_BOARD + default "sama5d2_xplained" + +config SYS_VENDOR + default "atmel" + +config SYS_SOC + default "at91" + +config SYS_CONFIG_NAME + default "sama5d2_xplained" + +endifboard/atmel/sama5d2_xplained/MAINTAINERS new file +7
-0@@ -0,0 +1,7 @@ +SAMA5D2 XPLAINED BOARD +M: Wenyou Yang <[email protected]> +S: Maintained +F: board/atmel/sama5d2_xplained/ +F: include/configs/sama5d2_xplained.h +F: configs/sama5d2_xplained_mmc_defconfig +F: configs/sama5d2_xplained_spiflash_defconfigboard/atmel/sama5d2_xplained/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# +# Copyright (C) 2015 Atmel Corporation +# Wenyou Yang <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += sama5d2_xplained.oboard/atmel/sama5d2_xplained/sama5d2_xplained.c new file +72
-0@@ -0,0 +1,282 @@ +/* +* Copyright (C) 2015 Atmel Corporation +* Wenyou.Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <atmel_hlcdc.h> +#include <lcd.h> +#include <mmc.h> +#include <net.h> +#include <netdev.h> +#include <spi.h> +#include <version.h> +#include <asm/io.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/atmel_pio4.h> +#include <asm/arch/atmel_usba_udc.h> +#include <asm/arch/atmel_sdhci.h> +#include <asm/arch/clk.h> +#include <asm/arch/gpio.h> +#include <asm/arch/sama5d2.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int spi_cs_is_valid (unsigned int bus,unsigned int cs) { +return bus ==0 && cs ==0 ; +} + +void spi_cs_activate (struct spi_slave *slave) { +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,0 ); } + +void spi_cs_deactivate (struct spi_slave *slave) { +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,1 ); } + +static void board_spi0_hw_init (void ) +{ +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,14 ,0 ); +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,15 ,0 ); +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,16 ,0 ); + +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,1 ); + +at91_periph_clk_enable (ATMEL_ID_SPI0 ); +} + +static void board_usb_hw_init (void ) +{ +atmel_pio4_set_pio_output (AT91_PIO_PORTB ,9 ,1 ); +atmel_pio4_set_pio_output (AT91_PIO_PORTB ,10 ,1 ); } + +#ifdef CONFIG_LCD +vidinfo_t panel_info = { + .vl_col =480 , + .vl_row =272 , + .vl_clk =9000000 , + .vl_bpix =LCD_BPP , + .vl_tft =1 , + .vl_hsync_len =41 , + .vl_left_margin =2 , + .vl_right_margin =2 , + .vl_vsync_len =11 , + .vl_upper_margin =2 , + .vl_lower_margin =2 , + .mmio =ATMEL_BASE_LCDC , +}; + +/* No power up/down pin for the LCD pannel */ +void lcd_enable (void ) {/* Empty! */ } +void lcd_disable (void ) {/* Empty! */ }Quoted 8 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 83
Quoted 5 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +5
-0+ +unsigned int has_lcdc (void ) +{ +return 1 ; +}For this, I think you can add a following patch to define it as a weak function, then it don't need to repeat it.
Quoted 1 line
Add
__weakattribute.
I think you misunderstand the meaning of my statements in your v3 patch.
As many board files have this function, so can you define a weak function in common place, overwrite it in board file which needed. Add following patch is OK.
Quoted 169 lines
Quoted 53 lines
Quoted 53 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +52
-0+ +static void board_lcd_hw_init (void ) +{ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,28 ,0 );/* LCDPWM */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,29 ,0 );/* LCDDISP */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,30 ,0 );/* LCDVSYNC */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,31 ,0 );/* LCDHSYNC */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,0 ,0 );/* LCDPCK */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,1 ,0 );/* LCDDEN */ + +/* LCDDAT0 */ +/* LCDDAT1 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,10 ,0 );/* LCDDAT2 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,11 ,0 );/* LCDDAT3 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,12 ,0 );/* LCDDAT4 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,13 ,0 );/* LCDDAT5 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,14 ,0 );/* LCDDAT6 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,15 ,0 );/* LCDDAT7 */ + +/* LCDDAT8 */ +/* LCDDAT9 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,16 ,0 );/* LCDDAT10 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,17 ,0 );/* LCDDAT11 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,18 ,0 );/* LCDDAT12 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,19 ,0 );/* LCDDAT13 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,20 ,0 );/* LCDDAT14 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,21 ,0 );/* LCDDAT15 */ + +/* LCDD16 */ +/* LCDD17 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,22 ,0 );/* LCDDAT18 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,23 ,0 );/* LCDDAT19 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,24 ,0 );/* LCDDAT20 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,25 ,0 );/* LCDDAT21 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,26 ,0 );/* LCDDAT22 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,27 ,0 );/* LCDDAT23 */ + +at91_periph_clk_enable (ATMEL_ID_LCDC ); +} + +#ifdef CONFIG_LCD_INFO +void lcd_show_board_info (void ) +{ +ulong dram_size; +int i; +char temp[32 ]; + +lcd_printf ("%s\n" ,U_BOOT_VERSION ); +lcd_printf ("2015 ATMEL Corp\n" ); +lcd_printf ("%s CPU at %s MHz\n" ,get_cpu_name (), +strmhz (temp,get_cpu_clk_rate ())); +Quoted 8 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c
Quoted 6 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +6
-0+ dram_size =0 ; +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) + dram_size += gd->bd->bi_dram[i].size; + +lcd_printf ("%ld MB SDRAM\n" , dram_size >>20 ); }#endif /* +CONFIG_LCD_INFO */ #endif/* CONFIG_LCD_INFO */ s/CONFIG_LCD_INFO/CONFIG_LCD
Done
Quoted 98 lines
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +9
-0+ +static void board_gmac_hw_init (void ) +{ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,14 ,0 );/* GTXCK */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,15 ,0 );/* GTXEN */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,16 ,0 );/* GRXDV */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,17 ,0 );/* GRXER */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,18 ,0 );/* GRX0 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,19 ,0 );/* GRX1 */ board/atmel/sama5d2_xplained/sama5d2_xplained.c
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+atmel_pio4_set_f_periph (AT91_PIO_PORTB ,20 ,0 );/* GTX0 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,21 ,0 );/* GTX1 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,22 ,0 );/* GMDC */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,23 ,0 );/* GMDIO */ + +at91_periph_clk_enable (ATMEL_ID_GMAC ); +} + +static void board_sdhci0_hw_init (void ) { +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,0 ,0 );/* SDMMC0_CK */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 155
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,1 ,0 );/* SDMMC0_CMD */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 156
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,2 ,0 );/*
SDMMC0_DAT0*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 157
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,3 ,0 );/*
SDMMC0_DAT1*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 158
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,4 ,0 );/*
SDMMC0_DAT2*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 159
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,5 ,0 );/*
SDMMC0_DAT3*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 160
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,6 ,0 );/*
SDMMC0_DAT4*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 161
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,7 ,0 );/*
SDMMC0_DAT5*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 162
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,8 ,0 );/*
SDMMC0_DAT6*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 163
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,9 ,0 );/*
SDMMC0_DAT7*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 164
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,10 ,0 );/*
SDMMC0_RSTN*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 165
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,11 ,0 );/*
SDMMC0_VDDSEL*/board/atmel/sama5d2_xplained/sama5d2_xplained.c
Quoted 7 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +7
-0+ +at91_periph_clk_enable (ATMEL_ID_SDMMC0 ); +at91_enable_periph_generated_clk (ATMEL_ID_SDMMC0 ); +} + +static void board_sdhci1_hw_init (void ) { +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,18 ,0 );/*
SDMMC1_DAT0*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 173
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,19 ,0 );/*
SDMMC1_DAT1*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 174
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,20 ,0 );/*
SDMMC1_DAT2*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 175
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,21 ,0 );/*
SDMMC1_DAT3*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 176
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,22 ,0 );/* SDMMC1_CK */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 177
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,27 ,0 );/*
SDMMC1_RSTN*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 178
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,28 ,0 );/* SDMMC1_CMD */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 179
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,30 ,0 );/* SDMMC1_CD */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 198
Quoted 9 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +9
-0+ +at91_periph_clk_enable (ATMEL_ID_SDMMC1 ); +at91_enable_periph_generated_clk (ATMEL_ID_SDMMC1 ); +} + +int board_mmc_init (bd_t *bis) +{ +#ifdef CONFIG_ATMEL_SDHCI0 +atmel_sdhci_init ((void *)ATMEL_BASE_SDMMC0 ,ATMEL_ID_SDMMC0 );#endif
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 201
Quoted 2 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +2
-0+#ifdef CONFIG_ATMEL_SDHCI1 +atmel_sdhci_init ((void *)ATMEL_BASE_SDMMC1 ,ATMEL_ID_SDMMC1 );#endif
Quoted 20 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +20
-0+ +return 0 ; +} + +static void board_uart1_hw_init (void ) { +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,2 ,1 );/* URXD1 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,3 ,0 );/* UTXD1 */ + +at91_periph_clk_enable (ATMEL_ID_UART1 ); +} + +int board_early_init_f (void ) +{ +at91_periph_clk_enable (ATMEL_ID_PIOA ); +at91_periph_clk_enable (ATMEL_ID_PIOB ); +at91_periph_clk_enable (ATMEL_ID_PIOC ); +at91_periph_clk_enable (ATMEL_ID_PIOD ); + +board_uart1_hw_init (); +Quoted 8 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 229
Quoted 6 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +6
-0+return 0 ; +} + +int board_init (void ) +{ +/* adress of boot parameters */ s/adress/address
Quoted 54 lines
Thank you for your finding.
Quoted 52 lines
Quoted 40 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +39
-0+ gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x100 ; + +#ifdef CONFIG_ATMEL_SPI +board_spi0_hw_init (); +#endif +#ifdef CONFIG_ATMEL_SDHCI +#ifdef CONFIG_ATMEL_SDHCI0 +board_sdhci0_hw_init (); +#endif +#ifdef CONFIG_ATMEL_SDHCI1 +board_sdhci1_hw_init (); +#endif +#endif +#ifdef CONFIG_MACB +board_gmac_hw_init (); +#endif +#ifdef CONFIG_LCD +board_lcd_hw_init (); +#endif +#ifdef CONFIG_CMD_USB +board_usb_hw_init (); +#endif +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +at91_udp_hw_init (); +#endif + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =get_ram_size ((void *)CONFIG_SYS_SDRAM_BASE , +CONFIG_SYS_SDRAM_SIZE ); +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +int rc =0 ;board/atmel/sama5d2_xplained/sama5d2_xplained.c line 279
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+ +#ifdef CONFIG_MACB + rc =macb_eth_initialize (0 , (void *)ATMEL_BASE_GMAC ,0x00 );#endif + +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +usba_udc_probe (&pdata); +#ifdef CONFIG_USB_ETH_RNDIS +usb_eth_initialize (bis); +#endif +#endif Here, I think you'd better address the comments from Andreas.
How about this one?
Quoted 177 lines
Quoted 69 lines
Quoted 69 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +3
-0+ +return rc; +}configs/sama5d2_xplained_mmc_defconfig new file +11
-0@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_MMC" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=yconfigs/sama5d2_xplained_spiflash_defconfig new file +11
-0@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_SERIALFLASH" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=yinclude/configs/sama5d2_xplained.h new file +23
-0@@ -0,0 +1,126 @@ +/* +* Configuration file for the SAMA5D2 Xplained Board. +* +* Copyright (C) 2015 Atmel Corporation +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH + +#include "at91-sama5_common.h" + +/* serial console */ +#define CONFIG_ATMEL_USART +#define CONFIG_USART_BASE ATMEL_BASE_UART1 +#define CONFIG_USART_ID ATMEL_ID_UART1 + +/* SDRAM */ Quoted 8 lines
include/configs/sama5d2_xplained.h line 28
Quoted 5 lines
include/configs/sama5d2_xplained.h new file +5
-0+#define CONFIG_NR_DRAM_BANKS 1 +#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS +#define CONFIG_SYS_SDRAM_SIZE 0x20000000 + +#ifdef CONFIG_SPL_BUILD As you don't support SPL, can you add this later? (The same time when add spl support)
Removed. The SPL support will be added soon.
Quoted 89 lines
include/configs/sama5d2_xplained.h
Quoted 5 lines
include/configs/sama5d2_xplained.h new file +4
-0+#define CONFIG_SYS_INIT_SP_ADDR 0x210000 +#else +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_SDRAM_BASE + 4 * 1024 -
GENERATED_GBL_DATA_SIZE) #endifinclude/configs/sama5d2_xplained.h line 34
Quoted 2 lines
include/configs/sama5d2_xplained.h new file +2
-0+ +#define CONFIG_SYS_LOAD_ADDR 0x22000000/* load address */
Quoted 69 lines
include/configs/sama5d2_xplained.h new file +69
-0+ +#undef CONFIG_AT91_GPIO +#define CONFIG_ATMEL_PIO4 + +/* SerialFlash */ +#ifdef CONFIG_CMD_SF +#define CONFIG_ATMEL_SPI +#define CONFIG_ATMEL_SPI0 +#define CONFIG_SPI_FLASH_ATMEL +#define CONFIG_SF_DEFAULT_BUS 0 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 30000000 +#endif + +/* NAND flash */ +#undef CONFIG_CMD_NAND + +/* MMC */ +#define CONFIG_CMD_MMC + +#ifdef CONFIG_CMD_MMC +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_SDHCI +#define CONFIG_ATMEL_SDHCI +#define CONFIG_ATMEL_SDHCI0 +#define CONFIG_ATMEL_SDHCI1 +#define CONFIG_SUPPORT_EMMC_BOOT +#endif + +/* USB */ +#define CONFIG_CMD_USB + +#ifdef CONFIG_CMD_USB +#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_ATMEL +#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 +#define CONFIG_USB_STORAGE +#endif + +/* USB device */ +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED +#define CONFIG_USB_GADGET_ATMEL_USBA +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_MANUFACTURER "Atmel SAMA5D2 XPlained" + +#if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC) #define +CONFIG_CMD_FAT #define CONFIG_DOS_PARTITION #endif + +/* Ethernet Hardware */ +#define CONFIG_MACB +#define CONFIG_RMII +#define CONFIG_NET_RETRY_COUNT 20 +#define CONFIG_MACB_SEARCH_PHY + +/* LCD */ +/* #define CONFIG_LCD */ + +#ifdef CONFIG_LCD +#define LCD_BPP LCD_COLOR16 +#define LCD_OUTPUT_BPP 24 +#define CONFIG_LCD_LOGO +#define CONFIG_LCD_INFO +#define CONFIG_LCD_INFO_BELOW_LOGO +#define CONFIG_SYS_WHITE_ON_BLACK +#define CONFIG_ATMEL_HLCD +#define CONFIG_ATMEL_LCD_RGB565 include/configs/sama5d2_xplained.h
Quoted 10 lines
include/configs/sama5d2_xplained.h new file +10
-0+#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#endif + +#ifdef CONFIG_SYS_USE_MMC + +/* bootstrap + u-boot + env in sd card */ #undef +FAT_ENV_DEVICE_AND_PART #undef CONFIG_BOOTCOMMAND + +#define FAT_ENV_DEVICE_AND_PART "1" +#define CONFIG_BOOTCOMMAND "fatload mmc 1:1 0x21000000 at91-sama5d2_xplained.dtb; " \
Quoted 9 lines
include/configs/sama5d2_xplained.h line 124
Quoted 7 lines
include/configs/sama5d2_xplained.h new file +7
-0+"fatload mmc 1:1 0x22000000 zImage; " \ + "bootz 0x22000000 - 0x21000000" +#undef CONFIG_BOOTARGS +#define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait" + +#endif This part also present in
at91-sama5_common.h, can it be used?
Quoted 1 line
They have a little difference, so be overridden.
I know, but can we deal with it as in the at91-sama5_common.h? (No strong opinion here.)
Quoted 9 lines
Quoted 7 lines
include/configs/sama5d2_xplained.h line 122
Quoted 4 lines
include/configs/sama5d2_xplained.h new file +2
-0+ +#endif Best Regards,
Bo Shen
Quoted 3 lines
Best Regards,
Wenyou Yang
Best Regards,
Bo Shen
Yang
PATCH v2 1/1 arm: atmel: Add SAMA5D2 Xplained board
Hi Bo Shen,
Thank you again for your review.
Quoted 173 lines
-----Original Message-----
From: Bo Shen [mailto:voice.shen at gmail.com]
Sent: 2015?10?27? 16:32
To: Yang, Wenyou; andreas.devel at googlemail.com
Cc: U-Boot Mailing List
Subject: Re: [U-Boot] [PATCH v2] arm: atmel: Add SAMA5D2 Xplained boardHi Wenyou,
Quoted 39 lines · Wenyou
Hi Shen Bo,
Thank you very much for your review.
Quoted 34 lines
-----Original Message-----
From: Bo Shen [mailto:voice.shen at gmail.com]
Sent: 2015?10?27? 11:09
To: Yang, Wenyou; andreas.devel at googlemail.com
Cc: U-Boot Mailing List
Subject: Re: [U-Boot] [PATCH v2] arm: atmel: Add SAMA5D2 Xplained boardHi Wenyou,
+ AndreasQuoted 22 lines · Wenyou Yang
The board supports following features:
- Boot media support: SD card/e.MMC/SPI flash,
- Support LCD display (optional, disabled by default),
- Support ethernet,
- Support USB mass storage.Signed-off-by Wenyou Yang <[email protected]>---
The patch is based on the following patches sent in mailing list.
[PATCH] gpio: atmel: Add the PIO4 driver support [PATCH] arm: at91: Change the Chip ID registers' addresses [PATCH v3] mmc: atmel: Add atmel sdhci support [PATCH v2] arm: at91: clock: Add the generated clock supportChanges in v2:
1./ re-order SAMA5D2 statements alphabetically. 2./ remove redundant "Unknown CPU type". 3./ rework sama5d2's macros.
4./ remove some #ifdef before functions. 5./ moveCONFIG_CMD_SFtoKconfig.
6./ remove NAND macros from config file. 7./CONFIG_BOOTCOMMANDfor sf uses defines in at91-
sama5_common.h.Quoted 123 lines
Quoted 123 lines
Quoted 8 lines
arch/arm/mach-at91/Kconfig | 5 + arch/arm/mach-at91/armv7/Makefile | 1 + arch/arm/mach-at91/armv7/sama5d2_devices.c | 60 +++++ arch/arm/mach-at91/include/mach/at91_pmc.h | 9 +- arch/arm/mach-at91/include/mach/atmel_usba_udc.h | 3 +- arch/arm/mach-at91/include/mach/hardware.h | 2 + arch/arm/mach-at91/include/mach/sama5d2.h | 224+++++++++++++++++
Quoted 4 lines
board/atmel/sama5d2_xplained/Kconfig | 15 ++ board/atmel/sama5d2_xplained/MAINTAINERS | 7 + board/atmel/sama5d2_xplained/Makefile | 8 + board/atmel/sama5d2_xplained/sama5d2_xplained.c | 282++++++++++++++++++++++
Quoted 96 lines
configs/sama5d2_xplained_mmc_defconfig | 11 + configs/sama5d2_xplained_spiflash_defconfig | 11 + include/configs/sama5d2_xplained.h | 126 ++++++++++ 14 files changed, 758 insertions(+), 6 deletions(-)create mode 100644
arch/arm/mach-at91/armv7/sama5d2_devices.ccreate mode 100644arch/arm/mach-at91/include/mach/sama5d2.hcreate mode 100644 board/atmel/sama5d2_xplained/Kconfig create mode 100644 board/atmel/sama5d2_xplained/MAINTAINERS create mode 100644 board/atmel/sama5d2_xplained/Makefile create mode 100644board/atmel/sama5d2_xplained/sama5d2_xplained.ccreate mode 100644 configs/sama5d2_xplained_mmc_defconfig create mode 100644 configs/sama5d2_xplained_spiflash_defconfig create mode 100644include/configs/sama5d2_xplained.harch/arm/mach-at91/Kconfig +5
-0@@ -71,6 +71,10 @@ config TARGET_AT91SAM9X5EK select CPU_ARM926EJS select SUPPORT_SPL +config TARGET_SAMA5D2_XPLAINED + bool "SAMA5D2 Xplained board" + select CPU_V7 + config TARGET_SAMA5D3_XPLAINED bool "SAMA5D3 Xplained board" select CPU_V7@@ -123,6 +127,7 @@ source "board/atmel/at91sam9m10g45ek/Kconfig" source "board/atmel/at91sam9n12ek/Kconfig" source "board/atmel/at91sam9rlek/Kconfig" source "board/atmel/at91sam9x5ek/Kconfig" +source "board/atmel/sama5d2_xplained/Kconfig" source "board/atmel/sama5d3_xplained/Kconfig" source "board/atmel/sama5d3xek/Kconfig" source "board/atmel/sama5d4_xplained/Kconfig"arch/arm/mach-at91/armv7/Makefile +1
-0@@ -8,6 +8,7 @@ # SPDX-License-Identifier: GPL-2.0+ # +obj-$(CONFIG_SAMA5D2) += sama5d2_devices.o obj-$(CONFIG_SAMA5D3) += sama5d3_devices.o obj-$(CONFIG_SAMA5D4) += sama5d4_devices.o obj-y += clock.oarch/arm/mach-at91/armv7/sama5d2_devices.c new file +39
-0@@ -0,0 +1,60 @@ +/* +* Copyright (C) 2015 Atmel Corporation +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/clk.h> +#include <asm/arch/sama5d2.h> + +char *get_cpu_name () +{ +unsigned int extension_id =get_extension_chip_id (); + +if (cpu_is_sama5d2 ()) { +switch (extension_id) { +case ARCH_EXID_SAMA5D21CU : +return "SAMA5D21" ; +case ARCH_EXID_SAMA5D22CU : +return "SAMA5D22-CU" ; +case ARCH_EXID_SAMA5D22CN : +return "SAMA5D22-CN" ; +case ARCH_EXID_SAMA5D23CU : +return "SAMA5D23-CU" ; +case ARCH_EXID_SAMA5D24CX : +return "SAMA5D24-CX" ; +case ARCH_EXID_SAMA5D24CU : +return "SAMA5D24-CU" ; +case ARCH_EXID_SAMA5D26CU : +return "SAMA5D26-CU" ; +case ARCH_EXID_SAMA5D27CU : +return "SAMA5D27-CU" ; +case ARCH_EXID_SAMA5D27CN : +return "SAMA5D27-CN" ; +case ARCH_EXID_SAMA5D28CU : +return "SAMA5D28-CU" ;arch/arm/mach-at91/armv7/sama5d2_devices.c line 49
Quoted 10 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +10
-0+case ARCH_EXID_SAMA5D28CN : +return "SAMA5D28-CN" ; +default : + goto err_exit; + } + } + +err_exit: +return "Unknown CPU type" ; +}Can we return directly from default? (I guess when compile it will throw out warning message, if so, remove default option).
Quoted 3 lines
Quoted 1 line
I don't think the default can be remove in switch-case statement.
Could you show me more detail why can not be removed?
The default should not be removed.
But I think statement goto err_exit: can be removed.
Quoted 488 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c line 51
Quoted 4 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +2
-0+ +#ifdef CONFIG_USB_GADGET_ATMEL_USBA void at91_udp_hw_init (void ){
Quoted 116 lines
Quoted 87 lines
Quoted 87 lines
arch/arm/mach-at91/armv7/sama5d2_devices.c new file +7
-0+struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC ; + +writel (AT91_PMC_UPLLEN |AT91_PMC_BIASEN , &pmc->uckr); + + at91_periph_clk_enable(ATMEL_ID_UDPHS); +} +#endif arch/arm/mach-at91/include/mach/at91_pmc.h +4
-5@@ -78,7 +78,8 @@ typedef struct at91_pmc {#define AT91_PMC_PLLXR_DIV (x) (x & 0xFF)#define AT91_PMC_PLLXR_PLLCOUNT (x) ((x & 0x3F) << 8)#define AT91_PMC_PLLXR_OUT (x) ((x & 0x03) << 14) -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )#define AT91_PMC_PLLXR_MUL (x) ((x & 0x7F) << 18)#else #define AT91_PMC_PLLXR_MUL (x) ((x & 0x7FF) << 16)@@ -97,7 +98,8 @@ typedef struct at91_pmc {#define AT91_PMC_MCKR_CSS_PLLB 0x00000003#define AT91_PMC_MCKR_CSS_MASK 0x00000003 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ +#if defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 ) || \ defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_PRES_1 0x00000000#define AT91_PMC_MCKR_PRES_2 0x00000010@@ -127,10 +129,7 @@ typedef struct at91_pmc {#else #define AT91_PMC_MCKR_MDIV_1 0x00000000#define AT91_PMC_MCKR_MDIV_2 0x00000100 -#if defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) || \ - defined(CONFIG_AT91SAM9X5 ) || defined(CONFIG_AT91SAM9N12 )#define AT91_PMC_MCKR_MDIV_3 0x00000300 -#endif #define AT91_PMC_MCKR_MDIV_4 0x00000200#define AT91_PMC_MCKR_MDIV_MASK 0x00000300#endif arch/arm/mach-at91/include/mach/atmel_usba_udc.h +2
-1@@ -31,7 +31,8 @@ static struct usba_ep_data usba_udc_ep[] = {EP ("ep5" ,5 ,1024 ,3 ,1 ,1 ), EP("ep6", 6, 1024, 3, 1, 1), }; -#elif defined(CONFIG_SAMA5D3 ) || defined(CONFIG_SAMA5D4 ) +#elif defined(CONFIG_SAMA5D2 ) || defined(CONFIG_SAMA5D3 ) || \ + defined(CONFIG_SAMA5D4 )static struct usba_ep_data usba_udc_ep[] = {EP ("ep0" ,0 ,64 ,1 ,0 ,0 ), EP("ep1", 1, 1024, 3, 1, 0),arch/arm/mach-at91/include/mach/hardware.h +2
-0@@ -23,6 +23,8 @@# include <asm/arch/at91sam9g45.h> #elif defined(CONFIG_AT91SAM9N12 ) || defined(CONFIG_AT91SAM9X5 )# include <asm/arch/at91sam9x5.h> +#elif defined(CONFIG_SAMA5D2 ) +# include <asm/arch/sama5d2.h> #elif defined(CONFIG_SAMA5D3 )# include <asm/arch/sama5d3.h> #elif defined(CONFIG_SAMA5D4 )arch/arm/mach-at91/include/mach/sama5d2.h new file +8
-0@@ -0,0 +1,224 @@ +/* +* Chip-specific header file for the SAMA5D2 SoC +* +* Copyright (C) 2015 Atmel +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ Quoted 8 lines
arch/arm/mach-at91/include/mach/sama5d2.h line 14
Quoted 6 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +6
-0+ +#ifndef __SAMA5D2_H +#define __SAMA5D2_H + +/* +* defines to be used in other places s/defines/definition
All changed, more clearly.
Quoted 19 lines
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 11 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+*/ +#define CONFIG_AT91FAMILY /* It's a member of AT91 */ + +/* +* Peripheral identifiers/interrupts. +*/ +#define ATMEL_ID_FIQ 0/* FIQ Interrupt ID */ +/* 1 */ +#define ATMEL_ID_ARM 2/* Performance Monitor Unit */ +#define ATMEL_ID_PIT 3/* Periodic Interval Timer Interrupt */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 6 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +6
-0+#define ATMEL_ID_WDT 4/* Watchdog Timer Interrupt */ +#define ATMEL_ID_GMAC 5/* Ethernet MAC */ +#define ATMEL_ID_XDMAC0 6/* DMA Controller 0 */ +#define ATMEL_ID_XDMAC1 7/* DMA Controller 1 */ +#define ATMEL_ID_ICM 8/* Integrity Check Monitor */ +#define ATMEL_ID_AES 9/* Advanced Encryption Standard */
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h line 32
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +2
-0+#define ATMEL_ID_AESB 10/* AES bridge */ +#define ATMEL_ID_TDES 11/* Triple Data Encryption Standard
Quoted 7 lines
Quoted 7 lines
*/
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 6 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +6
-0+#define ATMEL_ID_SHA 12/* SHA Signature */ +#define ATMEL_ID_MPDDRC 13/* MPDDR Controller */ +#define ATMEL_ID_MATRIX1 14/* H32MX, 32-bit AHB Matrix */ +#define ATMEL_ID_MATRIX0 15/* H64MX, 64-bit AHB Matrix */ +#define ATMEL_ID_SECUMOD 16/* Secure Module */ +#define ATMEL_ID_HSMC 17/* Multi-bit ECC interrupt */
Quoted 17 lines
Quoted 17 lines
Quoted 4 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +4
-0+#define ATMEL_ID_PIOA 18/* Parallel I/O Controller A */ +#define ATMEL_ID_FLEXCOM0 19/* FLEXCOM0 */ +#define ATMEL_ID_FLEXCOM1 20/* FLEXCOM1 */ +#define ATMEL_ID_FLEXCOM2 21/* FLEXCOM2 */ arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define ATMEL_ID_FLEXCOM3 22/* FLEXCOM3 */ +#define ATMEL_ID_FLEXCOM4 23/* FLEXCOM4 */ +#define ATMEL_ID_UART0 24/* UART0 */ +#define ATMEL_ID_UART1 25/* UART1 */ +#define ATMEL_ID_UART2 26/* UART2 */ +#define ATMEL_ID_UART3 27/* UART3 */ +#define ATMEL_ID_UART4 28/* UART4 */ +#define ATMEL_ID_TWIHS0 29/* Two-wire Interface 0 */ +#define ATMEL_ID_TWIHS1 30/* Two-wire Interface 1 */ +#define ATMEL_ID_SDMMC0 31/* Secure Data Memory Card Controller 0 */
arch/arm/mach-at91/include/mach/sama5d2.h line 53
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SDMMC1 32/* Secure Data Memory Card Controller 1 */
Quoted 9 lines
Quoted 9 lines
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 9 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +9
-0+#define ATMEL_ID_SPI0 33/* Serial Peripheral Interface 0 */ +#define ATMEL_ID_SPI1 34/* Serial Peripheral Interface 1 */ +#define ATMEL_ID_TC0 35/* Timer Counter 0 (ch.0,1,2) */ +#define ATMEL_ID_TC1 36/* Timer Counter 1 (ch.3,4,5) */ +/* 37 */ +#define ATMEL_ID_PWM 38/* PWMController0 (ch. 0,1,2,3) */ +/* 39 */ +#define ATMEL_ID_ADC 40/* Touch Screen ADC Controller */ +#define ATMEL_ID_UHPHS 41/* USB Host High Speed */
Quoted 1 line
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h line 63
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_UDPHS 42/* USB Device High Speed */
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h line 64
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SSC0 43/* Serial Synchronous Controller 0 */
arch/arm/mach-at91/include/mach/sama5d2.h line 65
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SSC1 44/* Serial Synchronous Controller 1 */
arch/arm/mach-at91/include/mach/sama5d2.h line 67
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +2
-0+#define ATMEL_ID_LCDC 45/* LCD Controller */ +#define ATMEL_ID_ISI 46/* Image Sensor Controller, for A5D2, named after ISC */
arch/arm/mach-at91/include/mach/sama5d2.h line 68
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_TRNG 47/* True Random Number Generator */
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_PDMIC 48/* PDM Interface Controller */
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 6 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +6
-0+#define ATMEL_ID_AIC_IRQ 49/* IRQ Interrupt ID */ +#define ATMEL_ID_SFC 50/* Fuse Controller */ +#define ATMEL_ID_SECURAM 51/* Secure RAM */ +#define ATMEL_ID_QSPI0 52/* QSPI0 */ +#define ATMEL_ID_QSPI1 53/* QSPI1 */ +#define ATMEL_ID_I2SC0 54/* Inter-IC Sound Controller 0 */
Quoted 1 line
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h line 76
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_I2SC1 55/* Inter-IC Sound Controller 1 */
Quoted 18 lines
Quoted 18 lines
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 4 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +4
-0+#define ATMEL_ID_CAN0_INT0 56/* MCAN 0 Interrupt0 */ +#define ATMEL_ID_CAN1_INT0 57/* MCAN 1 Interrupt0 */ +/* 58 */ +#define ATMEL_ID_CLASSD 59/* Audio Class D Amplifier */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 12 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +12
-0+#define ATMEL_ID_SFR 60/* Special Function Register */ +#define ATMEL_ID_SAIC 61/* Secured AIC */ +#define ATMEL_ID_AIC 62/* Advanced Interrupt Controller */ +#define ATMEL_ID_L2CC 63/* L2 Cache Controller */ +#define ATMEL_ID_CAN0_INT1 64/* MCAN 0 Interrupt1 */ +#define ATMEL_ID_CAN1_INT1 65/* MCAN 1 Interrupt1 */ +#define ATMEL_ID_GMAC_Q1 66/* GMAC Queue 1 Interrupt */ +#define ATMEL_ID_GMAC_Q2 67/* GMAC Queue 2 Interrupt */ +#define ATMEL_ID_PIOB 68/* Parallel I/O Controller B */ +#define ATMEL_ID_PIOC 69/* Parallel I/O Controller C */ +#define ATMEL_ID_PIOD 70/* Parallel I/O Controller D */ +#define ATMEL_ID_SDMMC0_TIMER 71/* Secure Data Memory Card Controller 0 (TIMER) */
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-at91/include/mach/sama5d2.h line 93
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_ID_SDMMC1_TIMER 72/* Secure Data Memory Card Controller 1 (TIMER) */
arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 5 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +5
-0+/* 73 */ +#define ATMEL_ID_SYS 74/* System Controller Interrupt */ +#define ATMEL_ID_ACC 75/* Analog Comparator */ +#define ATMEL_ID_RXLP 76/* UART Low-Power */ +#define ATMEL_ID_SFRBU 77/* Special Function Register
Quoted 79 lines
Quoted 79 lines
BackUp */
Quoted 38 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +38
-0+#define ATMEL_ID_CHIPID 78/* Chip ID */ + +/* +* User Peripherals physical base addresses. +*/ +#define ATMEL_BASE_LCDC 0xf0000000 +#define ATMEL_BASE_XDMAC1 0xf0004000 +#define ATMEL_BASE_MPDDRC 0xf000c000 +#define ATMEL_BASE_XDMAC0 0xf0010000 +#define ATMEL_BASE_PMC 0xf0014000 +#define ATMEL_BASE_QSPI0 0xf0020000 +#define ATMEL_BASE_QSPI1 0xf0024000 +#define ATMEL_BASE_SPI0 0xf8000000 +#define ATMEL_BASE_GMAC 0xf8008000 +#define ATMEL_BASE_TC0 0xf800c000 +#define ATMEL_BASE_TC1 0xf8010000 +#define ATMEL_BASE_HSMC 0xf8014000 +#define ATMEL_BASE_UART0 0xf801c000 +#define ATMEL_BASE_UART1 0xf8020000 +#define ATMEL_BASE_UART2 0xf8024000 +#define ATMEL_BASE_TWI0 0xf8028000 +#define ATMEL_BASE_SYSC 0xf8048000 +#define ATMEL_BASE_SPI1 0xfc000000 +#define ATMEL_BASE_UART3 0xfc008000 +#define ATMEL_BASE_UART4 0xfc00c000 +#define ATMEL_BASE_TWI1 0xfc028000 +#define ATMEL_BASE_UDPHS 0xfc02c000 + +#define ATMEL_BASE_PIOA 0xfc038000 + +#define ATMEL_CHIPID_CIDR 0xfc069000 +#define ATMEL_CHIPID_EXID 0xfc069004 + +/* +* Address Memory Space +*/ +#define ATMEL_BASE_DDRCS 0x20000000 +#define ATMEL_BASE_QSPI0_AES_MEM 0x90000000arch/arm/mach-at91/include/mach/sama5d2.h
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+#define ATMEL_BASE_QSPI1_AES_MEM 0x98000000 +#define ATMEL_BASE_SDMMC0 0xa0000000 +#define ATMEL_BASE_SDMMC1 0xb0000000 +#define ATMEL_BASE_QSPI0_MEM 0xd0000000 +#define ATMEL_BASE_QSPI1_MEM 0xd8000000 + +/* +* Internal Memories +*/ +#define ATMEL_BASE_UDPHS_FIFO 0x00300000/* USB Device HS controller */
arch/arm/mach-at91/include/mach/sama5d2.h line 147
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_BASE_OHCI 0x00400000/* USB Host controller (OHCI) */
arch/arm/mach-at91/include/mach/sama5d2.h line 148
Quoted 1 line
arch/arm/mach-at91/include/mach/sama5d2.h new file +1
-0+#define ATMEL_BASE_EHCI 0x00500000/* USB Host controller (EHCI) */
arch/arm/mach-at91/include/mach/sama5d2.h line 150
Quoted 2 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +2
-0+ +/* Other misc defines */ Ditto
Quoted 7 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +7
-0+#define ATMEL_BASE_PMECC (ATMEL_BASE_HSMC + 0x70) +#define ATMEL_BASE_PMERRLOC (ATMEL_BASE_HSMC + 0x500) + +#define ATMEL_BASE_PIOB (ATMEL_BASE_PIOA + 0x40) +#define ATMEL_BASE_PIOC (ATMEL_BASE_PIOB + 0x40) +#define ATMEL_BASE_PIOD (ATMEL_BASE_PIOC + 0x40) +arch/arm/mach-at91/include/mach/sama5d2.h line 167
Quoted 10 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +10
-0+/* SYSC spawns */ +#define ATMEL_BASE_RSTC ATMEL_BASE_SYSC +#define ATMEL_BASE_SHDWC (ATMEL_BASE_SYSC + 0x10) +#define ATMEL_BASE_PIT (ATMEL_BASE_SYSC + 0x30) +#define ATMEL_BASE_WDT (ATMEL_BASE_SYSC + 0x40) +#define ATMEL_BASE_SCKC (ATMEL_BASE_SYSC + 0x50) +#define ATMEL_BASE_RTC (ATMEL_BASE_SYSC + 0xb0) + +/* +* Other misc defines Ditto
Quoted 1 line
Quoted 1 line
You have two section of "Other misc defines", would it be OK to put them
together?
Quoted 200 lines
Put them together.
Quoted 39 lines
Quoted 39 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +38
-0+*/ +#define ATMEL_PIO_PORTS 4 +#define CPU_HAS_PCR +#define CPU_HAS_H32MXDIV + +/* SAMA5D2 series chip id definitions */ +#define ARCH_ID_SAMA5D2 0x8a5c08c0 +#define ARCH_EXID_SAMA5D21CU 0x0000005a +#define ARCH_EXID_SAMA5D22CU 0x00000059 +#define ARCH_EXID_SAMA5D22CN 0x00000069 +#define ARCH_EXID_SAMA5D23CU 0x00000058 +#define ARCH_EXID_SAMA5D24CX 0x00000004 +#define ARCH_EXID_SAMA5D24CU 0x00000014 +#define ARCH_EXID_SAMA5D26CU 0x00000012 +#define ARCH_EXID_SAMA5D27CU 0x00000011 +#define ARCH_EXID_SAMA5D27CN 0x00000021 +#define ARCH_EXID_SAMA5D28CU 0x00000010 +#define ARCH_EXID_SAMA5D28CN 0x00000020 + +#define cpu_is_sama5d2 () (get_chip_id() == ARCH_ID_SAMA5D2) +#define cpu_is_sama5d21cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D21CU)) +#define cpu_is_sama5d22cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D22CU)) +#define cpu_is_sama5d22cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D22CN)) +#define cpu_is_sama5d23cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D23CU)) +#define cpu_is_sama5d24cx () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D24CX)) +#define cpu_is_sama5d24cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D24CU)) +#define cpu_is_sama5d26cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D26CU)) +#define cpu_is_sama5d27cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D27CU)) +#define cpu_is_sama5d27cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D27CN))Quoted 8 lines
arch/arm/mach-at91/include/mach/sama5d2.h line 209
Quoted 4 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +4
-0+#define cpu_is_sama5d28cu () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D28CU)) +#define cpu_is_sama5d28cn () (cpu_is_sama5d2() && \ + (get_extension_chip_id() == ARCH_EXID_SAMA5D28CN))I don't see where use this part of code? Add I think it is the same as
get_cpu_name()function.Remove
cpu_is_sama5d2x()macros, which are unused for now.Thanks.
Quoted 147 lines
Quoted 134 lines
arch/arm/mach-at91/include/mach/sama5d2.h new file +12
-0+/* PIT Timer(PIT_PIIR) */ +#define CONFIG_SYS_TIMER_COUNTER 0xf804803c + +/* No PMECC Galois table in ROM */ +#define NO_GALOIS_TABLE_IN_ROM + +#ifndef __ASSEMBLY__ +unsigned int get_chip_id (void ); +unsigned int get_extension_chip_id (void );unsigned int +has_lcdc (void );char *get_cpu_name (void );#endif + +#endif board/atmel/sama5d2_xplained/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_SAMA5D2_XPLAINED + +config SYS_BOARD + default "sama5d2_xplained" + +config SYS_VENDOR + default "atmel" + +config SYS_SOC + default "at91" + +config SYS_CONFIG_NAME + default "sama5d2_xplained" + +endifboard/atmel/sama5d2_xplained/MAINTAINERS new file +7
-0@@ -0,0 +1,7 @@ +SAMA5D2 XPLAINED BOARD +M: Wenyou Yang <[email protected]> +S: Maintained +F: board/atmel/sama5d2_xplained/ +F: include/configs/sama5d2_xplained.h +F: configs/sama5d2_xplained_mmc_defconfig +F: configs/sama5d2_xplained_spiflash_defconfigboard/atmel/sama5d2_xplained/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# +# Copyright (C) 2015 Atmel Corporation +# Wenyou Yang <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-y += sama5d2_xplained.oboard/atmel/sama5d2_xplained/sama5d2_xplained.c new file +63
-0@@ -0,0 +1,282 @@ +/* +* Copyright (C) 2015 Atmel Corporation +* Wenyou.Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <atmel_hlcdc.h> +#include <lcd.h> +#include <mmc.h> +#include <net.h> +#include <netdev.h> +#include <spi.h> +#include <version.h> +#include <asm/io.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/atmel_pio4.h> +#include <asm/arch/atmel_usba_udc.h> #include +<asm/arch/atmel_sdhci.h> #include <asm/arch/clk.h> #include +<asm/arch/gpio.h> #include <asm/arch/sama5d2.h> + +DECLARE_GLOBAL_DATA_PTR ; + +int spi_cs_is_valid (unsigned int bus,unsigned int cs) { +return bus ==0 && cs ==0 ; +} + +void spi_cs_activate (struct spi_slave *slave) { +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,0 ); } + +void spi_cs_deactivate (struct spi_slave *slave) { +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,1 ); } + +static void board_spi0_hw_init (void ) { +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,14 ,0 ); +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,15 ,0 ); +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,16 ,0 ); + +atmel_pio4_set_pio_output (AT91_PIO_PORTA ,17 ,1 ); + +at91_periph_clk_enable (ATMEL_ID_SPI0 ); +} + +static void board_usb_hw_init (void ) { +atmel_pio4_set_pio_output (AT91_PIO_PORTB ,9 ,1 ); +atmel_pio4_set_pio_output (AT91_PIO_PORTB ,10 ,1 ); } + +#ifdef CONFIG_LCD +vidinfo_t panel_info = { + .vl_col =480 , + .vl_row =272 , + .vl_clk =9000000 , + .vl_bpix =LCD_BPP , + .vl_tft =1 , + .vl_hsync_len =41 , + .vl_left_margin =2 , + .vl_right_margin =2 , + .vl_vsync_len =11 , + .vl_upper_margin =2 , + .vl_lower_margin =2 , + .mmio = ATMEL_BASE_LCDC,board/atmel/sama5d2_xplained/sama5d2_xplained.c line 73
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+}; + +/* No power up/down pin for the LCD pannel */ +void lcd_enable (void ) {/* Empty! */ } +void lcd_disable (void ) {/* Empty! */ } + +unsigned int has_lcdc (void ) +{ +return 1 ; +}For this, I think you can add a following patch to define it as a weak function, then it don't need to repeat it.
Quoted 6 lines
Quoted 1 line
Add
__weakattribute.I think you misunderstand the meaning of my statements in your v3 patch.
As many board files have this function, so can you define a weak function in common place, overwrite it in board file which needed. Add following patch is OK.
Sorry about it, I will remove it again.
Quoted 223 lines
Quoted 168 lines
Quoted 53 lines
Quoted 53 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +51
-0+ +static void board_lcd_hw_init (void ) { +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,28 ,0 );/* LCDPWM */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,29 ,0 );/* LCDDISP */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,30 ,0 );/* LCDVSYNC */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,31 ,0 );/* LCDHSYNC */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,0 ,0 );/* LCDPCK */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,1 ,0 );/* LCDDEN */ + +/* LCDDAT0 */ +/* LCDDAT1 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,10 ,0 );/* LCDDAT2 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,11 ,0 );/* LCDDAT3 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,12 ,0 );/* LCDDAT4 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,13 ,0 );/* LCDDAT5 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,14 ,0 );/* LCDDAT6 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,15 ,0 );/* LCDDAT7 */ + +/* LCDDAT8 */ +/* LCDDAT9 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,16 ,0 );/* LCDDAT10 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,17 ,0 );/* LCDDAT11 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,18 ,0 );/* LCDDAT12 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,19 ,0 );/* LCDDAT13 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,20 ,0 );/* LCDDAT14 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,21 ,0 );/* LCDDAT15 */ + +/* LCDD16 */ +/* LCDD17 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,22 ,0 );/* LCDDAT18 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,23 ,0 );/* LCDDAT19 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,24 ,0 );/* LCDDAT20 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,25 ,0 );/* LCDDAT21 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,26 ,0 );/* LCDDAT22 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTC ,27 ,0 );/* LCDDAT23 */ + +at91_periph_clk_enable (ATMEL_ID_LCDC ); +} + +#ifdef CONFIG_LCD_INFO +void lcd_show_board_info (void ) +{ +ulong dram_size; +int i; +char temp[32 ]; + +lcd_printf ("%s\n" ,U_BOOT_VERSION ); +lcd_printf ("2015 ATMEL Corp\n" ); +lcd_printf ("%s CPU at %s MHz\n" ,get_cpu_name (), +strmhz (temp,get_cpu_clk_rate ())); +Quoted 8 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c
Quoted 6 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +6
-0+ dram_size =0 ; +for (i =0 ; i <CONFIG_NR_DRAM_BANKS ; i++) + dram_size += gd->bd->bi_dram[i].size; + +lcd_printf ("%ld MB SDRAM\n" , dram_size >>20 ); }#endif /* +CONFIG_LCD_INFO */ #endif/* CONFIG_LCD_INFO */ s/CONFIG_LCD_INFO/CONFIG_LCD
Done
Quoted 97 lines
Quoted 9 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +8
-0+ +static void board_gmac_hw_init (void ) { +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,14 ,0 );/* GTXCK */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,15 ,0 );/* GTXEN */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,16 ,0 );/* GRXDV */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,17 ,0 );/* GRXER */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,18 ,0 );/* GRX0 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,19 ,0 );/* GRX1 */ board/atmel/sama5d2_xplained/sama5d2_xplained.c
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+atmel_pio4_set_f_periph (AT91_PIO_PORTB ,20 ,0 );/* GTX0 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,21 ,0 );/* GTX1 */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,22 ,0 );/* GMDC */ +atmel_pio4_set_f_periph (AT91_PIO_PORTB ,23 ,0 );/* GMDIO */ + +at91_periph_clk_enable (ATMEL_ID_GMAC ); +} + +static void board_sdhci0_hw_init (void ) { +atmel_pio4_set_a_periph (AT91_PIO_PORTA ,0 ,0 );/* SDMMC0_CK */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 149
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,1 ,0 );/* SDMMC0_CMD */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 150
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,2 ,0 );/*
SDMMC0_DAT0*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 151
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,3 ,0 );/*
SDMMC0_DAT1*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 152
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,4 ,0 );/*
SDMMC0_DAT2*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 153
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,5 ,0 );/*
SDMMC0_DAT3*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 154
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,6 ,0 );/*
SDMMC0_DAT4*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 155
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,7 ,0 );/*
SDMMC0_DAT5*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 156
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,8 ,0 );/*
SDMMC0_DAT6*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 157
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,9 ,0 );/*
SDMMC0_DAT7*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 158
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,10 ,0 );/*
SDMMC0_RSTN*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 159
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_a_periph (AT91_PIO_PORTA ,11 ,0 );/*
SDMMC0_VDDSEL*/board/atmel/sama5d2_xplained/sama5d2_xplained.c
Quoted 7 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +7
-0+ +at91_periph_clk_enable (ATMEL_ID_SDMMC0 ); +at91_enable_periph_generated_clk (ATMEL_ID_SDMMC0 ); +} + +static void board_sdhci1_hw_init (void ) { +atmel_pio4_set_e_periph (AT91_PIO_PORTA ,18 ,0 );/*
SDMMC1_DAT0*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 167
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,19 ,0 );/*
SDMMC1_DAT1*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 168
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,20 ,0 );/*
SDMMC1_DAT2*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 169
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,21 ,0 );/*
SDMMC1_DAT3*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 170
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,22 ,0 );/* SDMMC1_CK */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 171
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,27 ,0 );/*
SDMMC1_RSTN*/board/atmel/sama5d2_xplained/sama5d2_xplained.c line 172
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,28 ,0 );/* SDMMC1_CMD */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 173
Quoted 1 line
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +1
-0+atmel_pio4_set_e_periph (AT91_PIO_PORTA ,30 ,0 );/* SDMMC1_CD */
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 198
Quoted 9 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +9
-0+ +at91_periph_clk_enable (ATMEL_ID_SDMMC1 ); +at91_enable_periph_generated_clk (ATMEL_ID_SDMMC1 ); +} + +int board_mmc_init (bd_t *bis) +{ +#ifdef CONFIG_ATMEL_SDHCI0 +atmel_sdhci_init ((void *)ATMEL_BASE_SDMMC0 ,ATMEL_ID_SDMMC0 );#endif
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 201
Quoted 2 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +2
-0+#ifdef CONFIG_ATMEL_SDHCI1 +atmel_sdhci_init ((void *)ATMEL_BASE_SDMMC1 ,ATMEL_ID_SDMMC1 );#endif
Quoted 20 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +20
-0+ +return 0 ; +} + +static void board_uart1_hw_init (void ) { +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,2 ,1 );/* URXD1 */ +atmel_pio4_set_a_periph (AT91_PIO_PORTD ,3 ,0 );/* UTXD1 */ + +at91_periph_clk_enable (ATMEL_ID_UART1 ); +} + +int board_early_init_f (void ) +{ +at91_periph_clk_enable (ATMEL_ID_PIOA ); +at91_periph_clk_enable (ATMEL_ID_PIOB ); +at91_periph_clk_enable (ATMEL_ID_PIOC ); +at91_periph_clk_enable (ATMEL_ID_PIOD ); + +board_uart1_hw_init (); +Quoted 8 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c line 229
Quoted 6 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +6
-0+return 0 ; +} + +int board_init (void ) +{ +/* adress of boot parameters */ s/adress/address
Quoted 54 lines
Thank you for your finding.
Quoted 52 lines
Quoted 40 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +39
-0+ gd->bd->bi_boot_params =CONFIG_SYS_SDRAM_BASE +0x100 ; + +#ifdef CONFIG_ATMEL_SPI +board_spi0_hw_init (); +#endif +#ifdef CONFIG_ATMEL_SDHCI +#ifdef CONFIG_ATMEL_SDHCI0 +board_sdhci0_hw_init (); +#endif +#ifdef CONFIG_ATMEL_SDHCI1 +board_sdhci1_hw_init (); +#endif +#endif +#ifdef CONFIG_MACB +board_gmac_hw_init (); +#endif +#ifdef CONFIG_LCD +board_lcd_hw_init (); +#endif +#ifdef CONFIG_CMD_USB +board_usb_hw_init (); +#endif +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +at91_udp_hw_init (); +#endif + +return 0 ; +} + +int dram_init (void ) +{ + gd->ram_size =get_ram_size ((void *)CONFIG_SYS_SDRAM_BASE , +CONFIG_SYS_SDRAM_SIZE ); +return 0 ; +} + +int board_eth_init (bd_t *bis) +{ +int rc =0 ;board/atmel/sama5d2_xplained/sama5d2_xplained.c line 279
Quoted 10 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +10
-0+ +#ifdef CONFIG_MACB + rc =macb_eth_initialize (0 , (void *)ATMEL_BASE_GMAC ,0x00 );#endif + +#ifdef CONFIG_USB_GADGET_ATMEL_USBA +usba_udc_probe (&pdata); +#ifdef CONFIG_USB_ETH_RNDIS +usb_eth_initialize (bis); +#endif +#endif Here, I think you'd better address the comments from Andreas.
Quoted 1 line
How about this one?
What do you think what address here?
I don't think additional information needs here.
Quoted 182 lines
Quoted 126 lines
Quoted 71 lines
Quoted 71 lines
board/atmel/sama5d2_xplained/sama5d2_xplained.c new file +3
-0+ +return rc; +}configs/sama5d2_xplained_mmc_defconfig new file +11
-0@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_MMC" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=yconfigs/sama5d2_xplained_spiflash_defconfig new file +11
-0@@ -0,0 +1,11 @@ +CONFIG_ARM=y +CONFIG_ARCH_AT91=y +CONFIG_TARGET_SAMA5D2_XPLAINED=y +CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_SERIALFLASH" +# CONFIG_CMD_IMI is not set +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_LOADS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_SF=y +# CONFIG_CMD_FPGA is not set +CONFIG_SPI_FLASH=yinclude/configs/sama5d2_xplained.h new file +24
-0@@ -0,0 +1,126 @@ +/* +* Configuration file for the SAMA5D2 Xplained Board. +* +* Copyright (C) 2015 Atmel Corporation +* Wenyou Yang <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __CONFIG_H +#define __CONFIG_H + +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH + +#include "at91-sama5_common.h" + +/* serial console */ +#define CONFIG_ATMEL_USART +#define CONFIG_USART_BASE ATMEL_BASE_UART1 +#define CONFIG_USART_ID ATMEL_ID_UART1 + +/* SDRAM */ +#define CONFIG_NR_DRAM_BANKS 1Quoted 8 lines
include/configs/sama5d2_xplained.h line 28
Quoted 4 lines
include/configs/sama5d2_xplained.h new file +4
-0+#define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS +#define CONFIG_SYS_SDRAM_SIZE 0x20000000 + +#ifdef CONFIG_SPL_BUILD As you don't support SPL, can you add this later? (The same time when add spl
support)Removed. The SPL support will be added soon.
Quoted 45 lines
include/configs/sama5d2_xplained.h
Quoted 5 lines
include/configs/sama5d2_xplained.h new file +4
-0+#define CONFIG_SYS_INIT_SP_ADDR 0x210000 +#else +#define CONFIG_SYS_INIT_SP_ADDR \ + (CONFIG_SYS_SDRAM_BASE + 4 * 1024 -
GENERATED_GBL_DATA_SIZE) #endifinclude/configs/sama5d2_xplained.h line 34
Quoted 2 lines
include/configs/sama5d2_xplained.h new file +2
-0+ +#define CONFIG_SYS_LOAD_ADDR 0x22000000/* load address */
Quoted 36 lines
include/configs/sama5d2_xplained.h new file +36
-0+ +#undef CONFIG_AT91_GPIO +#define CONFIG_ATMEL_PIO4 + +/* SerialFlash */ +#ifdef CONFIG_CMD_SF +#define CONFIG_ATMEL_SPI +#define CONFIG_ATMEL_SPI0 +#define CONFIG_SPI_FLASH_ATMEL +#define CONFIG_SF_DEFAULT_BUS 0 +#define CONFIG_SF_DEFAULT_CS 0 +#define CONFIG_SF_DEFAULT_SPEED 30000000 +#endif + +/* NAND flash */ +#undef CONFIG_CMD_NAND + +/* MMC */ +#define CONFIG_CMD_MMC + +#ifdef CONFIG_CMD_MMC +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_SDHCI +#define CONFIG_ATMEL_SDHCI +#define CONFIG_ATMEL_SDHCI0 +#define CONFIG_ATMEL_SDHCI1 +#define CONFIG_SUPPORT_EMMC_BOOT +#endif + +/* USB */ +#define CONFIG_CMD_USB + +#ifdef CONFIG_CMD_USB +#define CONFIG_USB_EHCI +#define CONFIG_USB_EHCI_ATMEL Quoted 8 lines
Quoted 8 lines
include/configs/sama5d2_xplained.h
Quoted 8 lines
include/configs/sama5d2_xplained.h new file +8
-0+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 +#define CONFIG_USB_STORAGE +#endif + +/* USB device */ +#define CONFIG_USB_GADGET +#define CONFIG_USB_GADGET_DUALSPEED #define +CONFIG_USB_GADGET_ATMEL_USBA #define CONFIG_USB_ETHER#define
Quoted 2 lines
Quoted 2 lines
include/configs/sama5d2_xplained.h line 80
Quoted 2 lines
include/configs/sama5d2_xplained.h new file +2
-0+CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_MANUFACTURER "Atmel SAMA5D2XPlained"
Quoted 23 lines
Quoted 23 lines
Quoted 23 lines
include/configs/sama5d2_xplained.h new file +23
-0+ +#if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC) #define +CONFIG_CMD_FAT #define CONFIG_DOS_PARTITION #endif + +/* Ethernet Hardware */ +#define CONFIG_MACB +#define CONFIG_RMII +#define CONFIG_NET_RETRY_COUNT 20 +#define CONFIG_MACB_SEARCH_PHY + +/* LCD */ +/* #define CONFIG_LCD */ + +#ifdef CONFIG_LCD +#define LCD_BPP LCD_COLOR16 +#define LCD_OUTPUT_BPP 24 +#define CONFIG_LCD_LOGO +#define CONFIG_LCD_INFO +#define CONFIG_LCD_INFO_BELOW_LOGO +#define CONFIG_SYS_WHITE_ON_BLACK +#define CONFIG_ATMEL_HLCD +#define CONFIG_ATMEL_LCD_RGB565 +#define CONFIG_SYS_CONSOLE_IS_IN_ENV #endifQuoted 8 lines
Quoted 8 lines
include/configs/sama5d2_xplained.h
Quoted 8 lines
include/configs/sama5d2_xplained.h new file +8
-0+ +#ifdef CONFIG_SYS_USE_MMC + +/* bootstrap + u-boot + env in sd card */ #undef +FAT_ENV_DEVICE_AND_PART #undef CONFIG_BOOTCOMMAND + +#define FAT_ENV_DEVICE_AND_PART "1" +#define CONFIG_BOOTCOMMAND "fatload mmc 1:1 0x21000000at91-
Quoted 11 lines
Quoted 10 lines
sama5d2_xplained.dtb; " \
include/configs/sama5d2_xplained.h line 124
Quoted 7 lines
include/configs/sama5d2_xplained.h new file +7
-0+"fatload mmc 1:1 0x22000000 zImage; " \ + "bootz 0x22000000 - 0x21000000" +#undef CONFIG_BOOTARGS +#define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p2 rw rootwait" + +#endif This part also present in
at91-sama5_common.h, can it be used?They have a little difference, so be overridden.
Quoted 7 lines
I know, but can we deal with it as in the
at91-sama5_common.h? (No strong opinion here.)Quoted 4 lines
Quoted 4 lines
include/configs/sama5d2_xplained.h line 120
Quoted 4 lines
include/configs/sama5d2_xplained.h new file +2
-0+ +#endif
Best Regards,
Wenyou Yang