1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Configuration settings for the VInCo platform.
4  *
5  * Based on the settings for the SAMA5-EK board
6  * Copyright (C) 2014 Atmel
7  *		      Bo Shen <voice.shen@atmel.com>
8  * Copyright (C) 2015 Free Electrons
9  *		      Gregory CLEMENT gregory.clement@free-electrons.com
10  */
11 
12 #ifndef __CONFIG_H
13 #define __CONFIG_H
14 
15 #include "at91-sama5_common.h"
16 
17 /* The value in the common file is too far away for the VInCo platform */
18 
19 /* serial console */
20 #define CONFIG_USART_BASE		0xfc00c000
21 #define CONFIG_USART_ID			30
22 
23 /* Timer */
24 #define CONFIG_SYS_TIMER_COUNTER	0xfc06863c
25 
26 /* SDRAM */
27 #define CONFIG_SYS_SDRAM_BASE           0x20000000
28 #define CONFIG_SYS_SDRAM_SIZE		0x4000000
29 
30 #define CONFIG_SYS_INIT_SP_ADDR \
31 	(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
32 
33 #define CONFIG_SYS_LOAD_ADDR		0x22000000 /* load address */
34 
35 /* SerialFlash */
36 
37 #ifdef CONFIG_CMD_SF
38 #define CONFIG_ATMEL_SPI0
39 #define CONFIG_SPI_FLASH_STMICRO
40 #endif
41 
42 /* MMC */
43 
44 #ifdef CONFIG_CMD_MMC
45 #define CONFIG_GENERIC_ATMEL_MCI
46 #define ATMEL_BASE_MMCI			0xfc000000
47 #define CONFIG_SYS_MMC_CLK_OD		500000
48 
49 /* For generating MMC partitions */
50 
51 #endif
52 
53 /* USB device */
54 
55 /* Ethernet Hardware */
56 #define CONFIG_MACB
57 #define CONFIG_RMII
58 #define CONFIG_NET_RETRY_COUNT		20
59 #define CONFIG_MACB_SEARCH_PHY
60 
61 #ifdef CONFIG_SPI_BOOT
62 /* bootstrap + u-boot + env + linux in serial flash */
63 /* Use our own mapping for the VInCo platform */
64 
65 /* Update the bootcommand according to our mapping for the VInCo platform */
66 #undef CONFIG_BOOTCOMMAND
67 #define CONFIG_BOOTCOMMAND  "mmc dev 0 0;" \
68 			    "mmc read ${loadaddr} ${k_offset} ${k_blksize};" \
69 			    "mmc read ${oftaddr} ${dtb_offset} ${dtb_blksize};" \
70 			    "bootz ${loadaddr} -  ${oftaddr}"
71 
72 #define CONFIG_EXTRA_ENV_SETTINGS \
73 	"kernel_start=0x20000\0" \
74 	"kernel_size=0x800000\0" \
75 	"mmcblksize=0x200\0" \
76 	"oftaddr=0x21000000\0" \
77 	"loadaddr=0x22000000\0" \
78 	"update_uboot=tftp ${loadaddr} u-boot.bin;sf probe 0;" \
79 	"sf erase 0x20000 0x4B000; sf write ${loadaddr} 0x20000 0x4B000\0" \
80 	"create_partition=setexpr dtb_start ${kernel_start} + 0x400000;" \
81 	"setexpr rootfs_start ${kernel_start} + ${kernel_size};" \
82 	"setenv partitions 'name=kernel,size=${kernel_size}," \
83 	"start=${kernel_start};name=rootfs,size=-';" \
84 	"gpt write mmc 0 ${partitions} \0"\
85 	"f2blk_size=setexpr fileblksize ${filesize} / ${mmcblksize};" \
86 	"setexpr fileblksize ${fileblksize} + 1\0" \
87 	"store_kernel=tftp ${loadaddr} zImage; run f2blk_size;" \
88 	"setexpr k_blksize ${fileblksize};" \
89 	"setexpr k_offset ${kernel_start} / ${mmcblksize};" \
90 	"mmc write ${fileaddr} ${k_offset} ${fileblksize}\0" \
91 	"store_dtb=tftp ${loadaddr} at91-vinco.dtb; run f2blk_size;" \
92 	"setexpr dtb_blksize ${fileblksize};" \
93 	"setexpr dtb_offset ${dtb_start} / ${mmcblksize};" \
94 	"mmc write ${fileaddr} ${dtb_offset} ${fileblksize}\0" \
95 	"store_rootfs=tftp ${loadaddr} vinco-gateway-image-vinco.ext4;" \
96 	"setexpr rootfs_offset ${rootfs_start} / ${mmcblksize};" \
97 	"mmc write ${fileaddr} ${rootfs_offset} ${fileblksize}\0" \
98 	"bootdelay=0\0"
99 
100 #endif
101 
102 #endif
103