xref: /rk3399_rockchip-uboot/include/configs/at91sam9n12ek.h (revision 8f1a80e99e4a838d1540cdb1d59ccc7785fe4618)
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_NAND_ATMEL
689e336903SWu, Josh #define CONFIG_SYS_MAX_NAND_DEVICE	1
699e336903SWu, Josh #define CONFIG_SYS_NAND_BASE		0x40000000
709e336903SWu, Josh #define CONFIG_SYS_NAND_MASK_ALE	(1 << 21)
719e336903SWu, Josh #define CONFIG_SYS_NAND_MASK_CLE	(1 << 22)
72ac45bb16SAndreas Bießmann #define CONFIG_SYS_NAND_ENABLE_PIN	GPIO_PIN_PD(4)
73ac45bb16SAndreas Bießmann #define CONFIG_SYS_NAND_READY_PIN	GPIO_PIN_PD(5)
74*8f1a80e9STom Rini #endif
759e336903SWu, Josh 
769e336903SWu, Josh /* PMECC & PMERRLOC */
779e336903SWu, Josh #define CONFIG_ATMEL_NAND_HWECC
789e336903SWu, Josh #define CONFIG_ATMEL_NAND_HW_PMECC
799e336903SWu, Josh #define CONFIG_PMECC_CAP		2
809e336903SWu, Josh #define CONFIG_PMECC_SECTOR_SIZE	512
819e336903SWu, Josh #define CONFIG_PMECC_INDEX_TABLE_OFFSET	0x8000
82ce76f0aaSBo Shen 
839e336903SWu, Josh #define CONFIG_MTD_PARTITIONS
849e336903SWu, Josh #define CONFIG_MTD_DEVICE
859e336903SWu, Josh #define MTDIDS_DEFAULT			"nand0=atmel_nand"
869e336903SWu, Josh #define MTDPARTS_DEFAULT						\
879e336903SWu, Josh 	"mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,"		\
889e336903SWu, Josh 	"256k(env),256k(env_redundant),256k(spare),"			\
899e336903SWu, Josh 	"512k(dtb),6M(kernel)ro,-(rootfs)"
909e336903SWu, Josh 
919e336903SWu, Josh #define CONFIG_EXTRA_ENV_SETTINGS                                       \
929e336903SWu, Josh 	"console=console=ttyS0,115200\0"                                \
939e336903SWu, Josh 	"mtdparts="MTDPARTS_DEFAULT"\0"					\
949e336903SWu, Josh 	"bootargs_nand=rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs rw\0"\
959e336903SWu, Josh 	"bootargs_mmc=root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait\0"
969e336903SWu, Josh 
9716276220SBo Shen /* Ethernet */
9816276220SBo Shen #define CONFIG_KS8851_MLL
9916276220SBo Shen #define CONFIG_KS8851_MLL_BASEADDR	0x30000000 /* use NCS2 */
10016276220SBo Shen 
1019e336903SWu, Josh #define CONFIG_SYS_LOAD_ADDR		0x22000000 /* load address */
1029e336903SWu, Josh 
1039e336903SWu, Josh #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
1049e336903SWu, Josh #define CONFIG_SYS_MEMTEST_END		0x26e00000
1059e336903SWu, Josh 
106d9bef0adSBo Shen /* USB host */
107d9bef0adSBo Shen #ifdef CONFIG_CMD_USB
108d9bef0adSBo Shen #define CONFIG_USB_ATMEL
109dcd2f1a0SBo Shen #define CONFIG_USB_ATMEL_CLK_SEL_PLLB
110d9bef0adSBo Shen #define CONFIG_USB_OHCI_NEW
111d9bef0adSBo Shen #define CONFIG_SYS_USB_OHCI_CPU_INIT
112d9bef0adSBo Shen #define CONFIG_SYS_USB_OHCI_REGS_BASE	ATMEL_BASE_OHCI
113d9bef0adSBo Shen #define CONFIG_SYS_USB_OHCI_SLOT_NAME	"at91sam9n12"
114d9bef0adSBo Shen #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	1
115d9bef0adSBo Shen #endif
116d9bef0adSBo Shen 
1179e336903SWu, Josh #ifdef CONFIG_SYS_USE_SPIFLASH
1189e336903SWu, Josh 
1199e336903SWu, Josh /* bootstrap + u-boot + env + linux in dataflash on CS0 */
1209e336903SWu, Josh #define CONFIG_ENV_OFFSET		0x5000
1219e336903SWu, Josh #define CONFIG_ENV_SIZE			0x3000
1229e336903SWu, Josh #define CONFIG_ENV_SECT_SIZE		0x1000
1239e336903SWu, Josh #define CONFIG_BOOTCOMMAND						\
1249e336903SWu, Josh 	"setenv bootargs ${console} ${mtdparts} ${bootargs_nand};"	\
1259e336903SWu, Josh 	"sf probe 0; sf read 0x22000000 0x100000 0x300000; "		\
1269e336903SWu, Josh 	"bootm 0x22000000"
1279e336903SWu, Josh 
1289e336903SWu, Josh #elif defined(CONFIG_SYS_USE_NANDFLASH)
1299e336903SWu, Josh 
1309e336903SWu, Josh /* bootstrap + u-boot + env + linux in nandflash */
1310ab5433dSWenyou Yang #define CONFIG_ENV_OFFSET		0x120000
1329e336903SWu, Josh #define CONFIG_ENV_OFFSET_REDUND	0x100000
1339e336903SWu, Josh #define CONFIG_ENV_SIZE			0x20000		/* 1 sector = 128 kB */
1349e336903SWu, Josh #define CONFIG_BOOTCOMMAND						\
1359e336903SWu, Josh 	"setenv bootargs ${console} ${mtdparts} ${bootargs_nand};"	\
1369e336903SWu, Josh 	"nand read 0x21000000 0x180000 0x080000;"			\
1379e336903SWu, Josh 	"nand read 0x22000000 0x200000 0x400000;"			\
1389e336903SWu, Josh 	"bootm 0x22000000 - 0x21000000"
1399e336903SWu, Josh 
1409e336903SWu, Josh #else /* CONFIG_SYS_USE_MMC */
1419e336903SWu, Josh 
1429e336903SWu, Josh /* bootstrap + u-boot + env + linux in mmc */
14323ac62d4SWu, Josh 
14423ac62d4SWu, Josh #ifdef CONFIG_ENV_IS_IN_MMC
14523ac62d4SWu, Josh /* Use raw reserved sectors to save environment */
1469e336903SWu, Josh #define CONFIG_ENV_OFFSET		0x2000
1479e336903SWu, Josh #define CONFIG_ENV_SIZE			0x1000
1489e336903SWu, Josh #define CONFIG_SYS_MMC_ENV_DEV		0
14923ac62d4SWu, Josh #else
15023ac62d4SWu, Josh /* Use file in FAT file to save environment */
15123ac62d4SWu, Josh #define CONFIG_ENV_SIZE			0x4000
15223ac62d4SWu, Josh #endif
15323ac62d4SWu, Josh 
1549e336903SWu, Josh #define CONFIG_BOOTCOMMAND						\
1559e336903SWu, Josh 	"setenv bootargs ${console} ${mtdparts} ${bootargs_mmc};"	\
1569e336903SWu, Josh 	"fatload mmc 0:1 0x21000000 dtb;"				\
1579e336903SWu, Josh 	"fatload mmc 0:1 0x22000000 uImage;"				\
1589e336903SWu, Josh 	"bootm 0x22000000 - 0x21000000"
1599e336903SWu, Josh 
1609e336903SWu, Josh #endif
1619e336903SWu, Josh 
1629e336903SWu, Josh #define CONFIG_SYS_CBSIZE	256
1639e336903SWu, Josh #define CONFIG_SYS_MAXARGS	16
1649e336903SWu, Josh #define CONFIG_SYS_LONGHELP
1659e336903SWu, Josh #define CONFIG_CMDLINE_EDITING
1669e336903SWu, Josh #define CONFIG_AUTO_COMPLETE
1679e336903SWu, Josh 
1689e336903SWu, Josh /*
1699e336903SWu, Josh  * Size of malloc() pool
1709e336903SWu, Josh  */
1719e336903SWu, Josh #define CONFIG_SYS_MALLOC_LEN	(4 * 1024 * 1024)
172ff255e83SBo Shen 
173ff255e83SBo Shen /* SPL */
174ff255e83SBo Shen #define CONFIG_SPL_FRAMEWORK
175ff255e83SBo Shen #define CONFIG_SPL_TEXT_BASE		0x300000
176ff255e83SBo Shen #define CONFIG_SPL_MAX_SIZE		0x6000
177ff255e83SBo Shen #define CONFIG_SPL_STACK		0x308000
178ff255e83SBo Shen 
179ff255e83SBo Shen #define CONFIG_SPL_BSS_START_ADDR	0x20000000
180ff255e83SBo Shen #define CONFIG_SPL_BSS_MAX_SIZE		0x80000
181ff255e83SBo Shen #define CONFIG_SYS_SPL_MALLOC_START	0x20080000
182ff255e83SBo Shen #define CONFIG_SYS_SPL_MALLOC_SIZE	0x80000
183ff255e83SBo Shen 
184ff255e83SBo Shen #define CONFIG_SYS_MONITOR_LEN		(512 << 10)
185ff255e83SBo Shen 
186ff255e83SBo Shen #define CONFIG_SYS_MASTER_CLOCK		132096000
187ff255e83SBo Shen #define CONFIG_SYS_AT91_PLLA		0x20953f03
188ff255e83SBo Shen #define CONFIG_SYS_MCKR			0x1301
189ff255e83SBo Shen #define CONFIG_SYS_MCKR_CSS		0x1302
190ff255e83SBo Shen 
191ff255e83SBo Shen #ifdef CONFIG_SYS_USE_MMC
192ff255e83SBo Shen #define CONFIG_SPL_LDSCRIPT		arch/arm/mach-at91/arm926ejs/u-boot-spl.lds
193ff255e83SBo Shen #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
194ff255e83SBo Shen #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot.img"
195ff255e83SBo Shen 
196ff255e83SBo Shen #elif CONFIG_SYS_USE_NANDFLASH
197ff255e83SBo Shen #define CONFIG_SPL_NAND_DRIVERS
198ff255e83SBo Shen #define CONFIG_SPL_NAND_BASE
199ff255e83SBo Shen #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x40000
200ff255e83SBo Shen #define CONFIG_SYS_NAND_5_ADDR_CYCLE
201ff255e83SBo Shen #define CONFIG_SYS_NAND_PAGE_SIZE	0x800
202ff255e83SBo Shen #define CONFIG_SYS_NAND_PAGE_COUNT	64
203ff255e83SBo Shen #define CONFIG_SYS_NAND_OOBSIZE		64
204ff255e83SBo Shen #define CONFIG_SYS_NAND_BLOCK_SIZE	0x20000
205ff255e83SBo Shen #define CONFIG_SYS_NAND_BAD_BLOCK_POS	0x0
206ff255e83SBo Shen #define CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER
207ff255e83SBo Shen 
208ff255e83SBo Shen #elif CONFIG_SYS_USE_SPIFLASH
209ff255e83SBo Shen #define CONFIG_SPL_SPI_LOAD
210ff255e83SBo Shen #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x8400
211ff255e83SBo Shen 
212ff255e83SBo Shen #endif
2139e336903SWu, Josh 
2149e336903SWu, Josh #endif
215