xref: /rk3399_rockchip-uboot/include/configs/at91sam9n12ek.h (revision c6de2aae290151e042ec480accafecb4e77fd4fd)
19e336903SWu, Josh /*
29e336903SWu, Josh  * (C) Copyright 2013 Atmel Corporation.
39e336903SWu, Josh  * Josh Wu <josh.wu@atmel.com>
49e336903SWu, Josh  *
59e336903SWu, Josh  * Configuation settings for the AT91SAM9N12-EK boards.
69e336903SWu, Josh  *
71a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
89e336903SWu, Josh  */
99e336903SWu, Josh 
109e336903SWu, Josh #ifndef __AT91SAM9N12_CONFIG_H_
119e336903SWu, Josh #define __AT91SAM9N12_CONFIG_H_
129e336903SWu, Josh 
139e336903SWu, Josh /*
149e336903SWu, Josh  * SoC must be defined first, before hardware.h is included.
159e336903SWu, Josh  * In this case SoC is defined in boards.cfg.
169e336903SWu, Josh  */
179e336903SWu, Josh #include <asm/hardware.h>
189e336903SWu, Josh 
199e336903SWu, Josh #define CONFIG_SYS_TEXT_BASE		0x26f00000
209e336903SWu, Josh 
219e336903SWu, Josh /* ARM asynchronous clock */
229e336903SWu, Josh #define CONFIG_SYS_AT91_SLOW_CLOCK	32768		/* slow clock xtal */
239e336903SWu, Josh #define CONFIG_SYS_AT91_MAIN_CLOCK	16000000	/* main clock xtal */
249e336903SWu, Josh 
259e336903SWu, Josh /* Misc CPU related */
269e336903SWu, Josh #define CONFIG_CMDLINE_TAG		/* enable passing of ATAGs */
279e336903SWu, Josh #define CONFIG_SETUP_MEMORY_TAGS
289e336903SWu, Josh #define CONFIG_INITRD_TAG
299e336903SWu, Josh #define CONFIG_SKIP_LOWLEVEL_INIT
309e336903SWu, Josh 
319e336903SWu, Josh /* LCD */
329e336903SWu, Josh #define LCD_BPP				LCD_COLOR16
339e336903SWu, Josh #define LCD_OUTPUT_BPP			24
349e336903SWu, Josh #define CONFIG_LCD_LOGO
359e336903SWu, Josh #define CONFIG_LCD_INFO
369e336903SWu, Josh #define CONFIG_LCD_INFO_BELOW_LOGO
379e336903SWu, Josh #define CONFIG_ATMEL_HLCD
389e336903SWu, Josh #define CONFIG_ATMEL_LCD_RGB565
399e336903SWu, Josh 
409e336903SWu, Josh /*
419e336903SWu, Josh  * BOOTP options
429e336903SWu, Josh  */
439e336903SWu, Josh #define CONFIG_BOOTP_BOOTFILESIZE
449e336903SWu, Josh #define CONFIG_BOOTP_BOOTPATH
459e336903SWu, Josh #define CONFIG_BOOTP_GATEWAY
469e336903SWu, Josh #define CONFIG_BOOTP_HOSTNAME
479e336903SWu, Josh 
489e336903SWu, Josh #define CONFIG_NR_DRAM_BANKS		1
499e336903SWu, Josh #define CONFIG_SYS_SDRAM_BASE		0x20000000
509e336903SWu, Josh #define CONFIG_SYS_SDRAM_SIZE		0x08000000
519e336903SWu, Josh 
529e336903SWu, Josh /*
539e336903SWu, Josh  * Initial stack pointer: 4k - GENERATED_GBL_DATA_SIZE in internal SRAM,
549e336903SWu, Josh  * leaving the correct space for initial global data structure above
559e336903SWu, Josh  * that address while providing maximum stack area below.
569e336903SWu, Josh  */
579e336903SWu, Josh # define CONFIG_SYS_INIT_SP_ADDR \
580ab5433dSWenyou Yang 	(ATMEL_BASE_SRAM + 16 * 1024 - GENERATED_GBL_DATA_SIZE)
599e336903SWu, Josh 
609e336903SWu, Josh /* DataFlash */
619e336903SWu, Josh #ifdef CONFIG_CMD_SF
629e336903SWu, Josh #define CONFIG_SF_DEFAULT_SPEED		30000000
639e336903SWu, Josh #endif
649e336903SWu, Josh 
659e336903SWu, Josh /* NAND flash */
669e336903SWu, Josh #ifdef CONFIG_CMD_NAND
679e336903SWu, Josh #define CONFIG_SYS_MAX_NAND_DEVICE	1
689e336903SWu, Josh #define CONFIG_SYS_NAND_BASE		0x40000000
699e336903SWu, Josh #define CONFIG_SYS_NAND_MASK_ALE	(1 << 21)
709e336903SWu, Josh #define CONFIG_SYS_NAND_MASK_CLE	(1 << 22)
71ac45bb16SAndreas Bießmann #define CONFIG_SYS_NAND_ENABLE_PIN	GPIO_PIN_PD(4)
72ac45bb16SAndreas Bießmann #define CONFIG_SYS_NAND_READY_PIN	GPIO_PIN_PD(5)
73*8f1a80e9STom Rini #endif
749e336903SWu, Josh 
759e336903SWu, Josh #define CONFIG_EXTRA_ENV_SETTINGS                                       \
769e336903SWu, Josh 	"console=console=ttyS0,115200\0"                                \
779e336903SWu, Josh 	"mtdparts="MTDPARTS_DEFAULT"\0"					\
789e336903SWu, Josh 	"bootargs_nand=rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs rw\0"\
799e336903SWu, Josh 	"bootargs_mmc=root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait\0"
809e336903SWu, Josh 
8116276220SBo Shen /* Ethernet */
8216276220SBo Shen #define CONFIG_KS8851_MLL
8316276220SBo Shen #define CONFIG_KS8851_MLL_BASEADDR	0x30000000 /* use NCS2 */
8416276220SBo Shen 
859e336903SWu, Josh #define CONFIG_SYS_LOAD_ADDR		0x22000000 /* load address */
869e336903SWu, Josh 
879e336903SWu, Josh #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
889e336903SWu, Josh #define CONFIG_SYS_MEMTEST_END		0x26e00000
899e336903SWu, Josh 
90d9bef0adSBo Shen /* USB host */
91d9bef0adSBo Shen #ifdef CONFIG_CMD_USB
92d9bef0adSBo Shen #define CONFIG_USB_ATMEL
93dcd2f1a0SBo Shen #define CONFIG_USB_ATMEL_CLK_SEL_PLLB
94d9bef0adSBo Shen #define CONFIG_USB_OHCI_NEW
95d9bef0adSBo Shen #define CONFIG_SYS_USB_OHCI_CPU_INIT
96d9bef0adSBo Shen #define CONFIG_SYS_USB_OHCI_REGS_BASE	ATMEL_BASE_OHCI
97d9bef0adSBo Shen #define CONFIG_SYS_USB_OHCI_SLOT_NAME	"at91sam9n12"
98d9bef0adSBo Shen #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	1
99d9bef0adSBo Shen #endif
100d9bef0adSBo Shen 
1019e336903SWu, Josh #ifdef CONFIG_SYS_USE_SPIFLASH
1029e336903SWu, Josh 
1039e336903SWu, Josh /* bootstrap + u-boot + env + linux in dataflash on CS0 */
1049e336903SWu, Josh #define CONFIG_ENV_OFFSET		0x5000
1059e336903SWu, Josh #define CONFIG_ENV_SIZE			0x3000
1069e336903SWu, Josh #define CONFIG_ENV_SECT_SIZE		0x1000
1079e336903SWu, Josh #define CONFIG_BOOTCOMMAND						\
1089e336903SWu, Josh 	"setenv bootargs ${console} ${mtdparts} ${bootargs_nand};"	\
1099e336903SWu, Josh 	"sf probe 0; sf read 0x22000000 0x100000 0x300000; "		\
1109e336903SWu, Josh 	"bootm 0x22000000"
1119e336903SWu, Josh 
1129e336903SWu, Josh #elif defined(CONFIG_SYS_USE_NANDFLASH)
1139e336903SWu, Josh 
1149e336903SWu, Josh /* bootstrap + u-boot + env + linux in nandflash */
1150ab5433dSWenyou Yang #define CONFIG_ENV_OFFSET		0x120000
1169e336903SWu, Josh #define CONFIG_ENV_OFFSET_REDUND	0x100000
1179e336903SWu, Josh #define CONFIG_ENV_SIZE			0x20000		/* 1 sector = 128 kB */
1189e336903SWu, Josh #define CONFIG_BOOTCOMMAND						\
1199e336903SWu, Josh 	"setenv bootargs ${console} ${mtdparts} ${bootargs_nand};"	\
1209e336903SWu, Josh 	"nand read 0x21000000 0x180000 0x080000;"			\
1219e336903SWu, Josh 	"nand read 0x22000000 0x200000 0x400000;"			\
1229e336903SWu, Josh 	"bootm 0x22000000 - 0x21000000"
1239e336903SWu, Josh 
1249e336903SWu, Josh #else /* CONFIG_SYS_USE_MMC */
1259e336903SWu, Josh 
1269e336903SWu, Josh /* bootstrap + u-boot + env + linux in mmc */
12723ac62d4SWu, Josh 
12823ac62d4SWu, Josh #ifdef CONFIG_ENV_IS_IN_MMC
12923ac62d4SWu, Josh /* Use raw reserved sectors to save environment */
1309e336903SWu, Josh #define CONFIG_ENV_OFFSET		0x2000
1319e336903SWu, Josh #define CONFIG_ENV_SIZE			0x1000
1329e336903SWu, Josh #define CONFIG_SYS_MMC_ENV_DEV		0
13323ac62d4SWu, Josh #else
13423ac62d4SWu, Josh /* Use file in FAT file to save environment */
13523ac62d4SWu, Josh #define CONFIG_ENV_SIZE			0x4000
13623ac62d4SWu, Josh #endif
13723ac62d4SWu, Josh 
1389e336903SWu, Josh #define CONFIG_BOOTCOMMAND						\
1399e336903SWu, Josh 	"setenv bootargs ${console} ${mtdparts} ${bootargs_mmc};"	\
1409e336903SWu, Josh 	"fatload mmc 0:1 0x21000000 dtb;"				\
1419e336903SWu, Josh 	"fatload mmc 0:1 0x22000000 uImage;"				\
1429e336903SWu, Josh 	"bootm 0x22000000 - 0x21000000"
1439e336903SWu, Josh 
1449e336903SWu, Josh #endif
1459e336903SWu, Josh 
1469e336903SWu, Josh #define CONFIG_SYS_LONGHELP
1479e336903SWu, Josh #define CONFIG_CMDLINE_EDITING
1489e336903SWu, Josh #define CONFIG_AUTO_COMPLETE
1499e336903SWu, Josh 
1509e336903SWu, Josh /*
1519e336903SWu, Josh  * Size of malloc() pool
1529e336903SWu, Josh  */
1539e336903SWu, Josh #define CONFIG_SYS_MALLOC_LEN	(4 * 1024 * 1024)
154ff255e83SBo Shen 
155ff255e83SBo Shen /* SPL */
156ff255e83SBo Shen #define CONFIG_SPL_FRAMEWORK
157ff255e83SBo Shen #define CONFIG_SPL_TEXT_BASE		0x300000
158ff255e83SBo Shen #define CONFIG_SPL_MAX_SIZE		0x6000
159ff255e83SBo Shen #define CONFIG_SPL_STACK		0x308000
160ff255e83SBo Shen 
161ff255e83SBo Shen #define CONFIG_SPL_BSS_START_ADDR	0x20000000
162ff255e83SBo Shen #define CONFIG_SPL_BSS_MAX_SIZE		0x80000
163ff255e83SBo Shen #define CONFIG_SYS_SPL_MALLOC_START	0x20080000
164ff255e83SBo Shen #define CONFIG_SYS_SPL_MALLOC_SIZE	0x80000
165ff255e83SBo Shen 
166ff255e83SBo Shen #define CONFIG_SYS_MONITOR_LEN		(512 << 10)
167ff255e83SBo Shen 
168ff255e83SBo Shen #define CONFIG_SYS_MASTER_CLOCK		132096000
169ff255e83SBo Shen #define CONFIG_SYS_AT91_PLLA		0x20953f03
170ff255e83SBo Shen #define CONFIG_SYS_MCKR			0x1301
171ff255e83SBo Shen #define CONFIG_SYS_MCKR_CSS		0x1302
172ff255e83SBo Shen 
173ff255e83SBo Shen #ifdef CONFIG_SYS_USE_MMC
174ff255e83SBo Shen #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
175ff255e83SBo Shen #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot.img"
176ff255e83SBo Shen 
177ff255e83SBo Shen #elif CONFIG_SYS_USE_NANDFLASH
178ff255e83SBo Shen #define CONFIG_SPL_NAND_DRIVERS
179ff255e83SBo Shen #define CONFIG_SPL_NAND_BASE
180ff255e83SBo Shen #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x40000
181ff255e83SBo Shen #define CONFIG_SYS_NAND_5_ADDR_CYCLE
182ff255e83SBo Shen #define CONFIG_SYS_NAND_PAGE_SIZE	0x800
183ff255e83SBo Shen #define CONFIG_SYS_NAND_PAGE_COUNT	64
184ff255e83SBo Shen #define CONFIG_SYS_NAND_OOBSIZE		64
185ff255e83SBo Shen #define CONFIG_SYS_NAND_BLOCK_SIZE	0x20000
186ff255e83SBo Shen #define CONFIG_SYS_NAND_BAD_BLOCK_POS	0x0
187ff255e83SBo Shen 
188ff255e83SBo Shen #elif CONFIG_SYS_USE_SPIFLASH
189ff255e83SBo Shen #define CONFIG_SPL_SPI_LOAD
190ff255e83SBo Shen #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x8400
191ff255e83SBo Shen 
192ff255e83SBo Shen #endif
1939e336903SWu, Josh 
1949e336903SWu, Josh #endif
195