01085dc5c1149e2e30649b261bd03e78438d3c32
[karo-tx-uboot.git] / include / configs / stamp9g20.h
1 /*
2  * (C) Copyright 2007-2008
3  * Stelian Pop <stelian@popies.net>
4  * Lead Tech Design <www.leadtechdesign.com>
5  *
6  * (C) Copyright 2010
7  * Achim Ehrlich <aehrlich@taskit.de>
8  * taskit GmbH <www.taskit.de>
9  *
10  * (C) Copyright 2012
11  * Markus Hubig <mhubig@imko.de>
12  * IMKO GmbH <www.imko.de>
13  *
14  * Configuation settings for the stamp9g20 CPU module.
15  *
16  * SPDX-License-Identifier:     GPL-2.0+
17  */
18
19 #ifndef __CONFIG_H
20 #define __CONFIG_H
21
22 /*
23  * SoC must be defined first, before hardware.h is included.
24  * In this case SoC is defined in boards.cfg.
25  */
26 #include <asm/hardware.h>
27
28 /*
29  * Warning: changing CONFIG_SYS_TEXT_BASE requires adapting the initial boot
30  * program. Since the linker has to swallow that define, we must use a pure
31  * hex number here!
32  */
33 #define CONFIG_SYS_TEXT_BASE            0x23f00000
34
35 /* ARM asynchronous clock */
36 #define CONFIG_SYS_AT91_SLOW_CLOCK      32768           /* slow clock xtal */
37 #define CONFIG_SYS_AT91_MAIN_CLOCK      18432000        /* 18.432MHz crystal */
38
39 /* misc settings */
40 #define CONFIG_CMDLINE_TAG              /* pass commandline to Kernel */
41 #define CONFIG_SETUP_MEMORY_TAGS        /* pass memory defs to kernel */
42 #define CONFIG_INITRD_TAG               /* pass initrd param to kernel */
43 #define CONFIG_SKIP_LOWLEVEL_INIT       /* U-Boot is loaded by a bootloader */
44 #define CONFIG_BOARD_EARLY_INIT_f       /* call board_early_init_f() */
45 #define CONFIG_BOARD_POSTCLK_INIT       /* call board_postclk_init() */
46 #define CONFIG_DISPLAY_CPUINFO          /* display CPU Info at startup */
47
48 /* setting board specific options */
49 #ifdef CONFIG_PORTUXG20
50 # define CONFIG_MACH_TYPE               MACH_TYPE_PORTUXG20
51 # define CONFIG_MACB
52 #else
53 # define CONFIG_MACH_TYPE               MACH_TYPE_STAMP9G20
54 #endif
55
56 /*
57  * SDRAM: 1 bank, 64 MB, base address 0x20000000
58  * Already initialized before u-boot gets started.
59  */
60 #define CONFIG_NR_DRAM_BANKS            1
61 #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_CS1
62 #define CONFIG_SYS_SDRAM_SIZE           (64 << 20)
63
64 /*
65  * Perform a SDRAM Memtest from the start of SDRAM
66  * till the beginning of the U-Boot position in RAM.
67  */
68 #define CONFIG_SYS_MEMTEST_START        CONFIG_SYS_SDRAM_BASE
69 #define CONFIG_SYS_MEMTEST_END          (CONFIG_SYS_TEXT_BASE - 0x100000)
70
71 /* Size of malloc() pool */
72 #define CONFIG_SYS_MALLOC_LEN \
73         ROUND(3 * CONFIG_ENV_SIZE + (128 << 10), 0x1000)
74
75 /*
76  * Initial stack pointer: 4k - GENERATED_GBL_DATA_SIZE in internal SRAM,
77  * leaving the correct space for initial global data structure above that
78  * address while providing maximum stack area below.
79  */
80 #define CONFIG_SYS_INIT_SP_ADDR \
81         (ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
82
83 /* NAND flash settings */
84 #define CONFIG_NAND_ATMEL
85 #define CONFIG_SYS_NO_FLASH
86 #define CONFIG_SYS_MAX_NAND_DEVICE      1
87 #define CONFIG_SYS_NAND_BASE            ATMEL_BASE_CS3
88 #define CONFIG_SYS_NAND_DBW_8
89 #define CONFIG_SYS_NAND_MASK_ALE        (1 << 21)
90 #define CONFIG_SYS_NAND_MASK_CLE        (1 << 22)
91 #define CONFIG_SYS_NAND_ENABLE_PIN      AT91_PIN_PC14
92 #define CONFIG_SYS_NAND_READY_PIN       AT91_PIN_PC13
93
94 /* general purpose I/O */
95 #define CONFIG_ATMEL_LEGACY             /* required until (g)pio is fixed */
96 #define CONFIG_AT91_GPIO                /* enable the GPIO features */
97 #define CONFIG_AT91_GPIO_PULLUP 1       /* keep pullups on peripheral pins */
98
99 /* serial console */
100 #define CONFIG_ATMEL_USART
101 #define CONFIG_USART_BASE               ATMEL_BASE_DBGU
102 #define CONFIG_USART_ID                 ATMEL_ID_SYS
103 #define CONFIG_BAUDRATE                 115200
104
105 /* LED configuration */
106 #define CONFIG_STATUS_LED
107 #define CONFIG_BOARD_SPECIFIC_LED
108
109 /* The LED PINs */
110 #define CONFIG_RED_LED                  AT91_PIN_PC5
111 #define CONFIG_GREEN_LED                AT91_PIN_PC4
112 #define CONFIG_YELLOW_LED               AT91_PIN_PC10
113
114 #define STATUS_LED_RED                  0
115 #define STATUS_LED_GREEN                1
116 #define STATUS_LED_YELLOW               2
117
118 /* Red LED */
119 #define STATUS_LED_BIT                  STATUS_LED_RED
120 #define STATUS_LED_STATE                STATUS_LED_OFF
121 #define STATUS_LED_PERIOD               (CONFIG_SYS_HZ / 2)
122
123 /* Green LED */
124 #define STATUS_LED_BIT1                 STATUS_LED_GREEN
125 #define STATUS_LED_STATE1               STATUS_LED_ON
126 #define STATUS_LED_PERIOD1              (CONFIG_SYS_HZ / 2)
127
128 /* Yellow LED */
129 #define STATUS_LED_BIT2                 STATUS_LED_YELLOW
130 #define STATUS_LED_STATE2               STATUS_LED_OFF
131 #define STATUS_LED_PERIOD2              (CONFIG_SYS_HZ / 2)
132
133 /* Boot status LED */
134 #define STATUS_LED_BOOT                 STATUS_LED_GREEN
135
136 /*
137  * Ethernet configuration
138  *
139  * PortuxG20 has always ethernet but for Stamp9G20 you
140  * can enable it here if your baseboard features ethernet.
141  */
142
143 #define CONFIG_MACB
144 #define CONFIG_USB_HOST_ETHER
145 #define CONFIG_USB_ETHER_ASIX
146 #define CONFIG_USB_ETHER_MCS7830
147
148 #ifdef CONFIG_MACB
149 # define CONFIG_RMII                    /* use reduced MII inteface */
150 # define CONFIG_NET_RETRY_COUNT 20      /* # of DHCP/BOOTP retries */
151 #define CONFIG_AT91_WANTS_COMMON_PHY
152
153 /* BOOTP and DHCP options */
154 # define CONFIG_BOOTP_BOOTFILESIZE
155 # define CONFIG_BOOTP_BOOTPATH
156 # define CONFIG_BOOTP_GATEWAY
157 # define CONFIG_BOOTP_HOSTNAME
158 # define CONFIG_NFSBOOTCOMMAND                                          \
159         "setenv autoload yes; setenv autoboot yes; "                    \
160         "setenv bootargs ${basicargs} ${mtdparts} "                     \
161         "root=/dev/nfs ip=dhcp nfsroot=${serverip}:/srv/nfs/rootfs; "   \
162         "dhcp"
163 #endif /* CONFIG_MACB */
164
165 /* Enable the watchdog */
166 #define CONFIG_AT91SAM9_WATCHDOG
167 #define CONFIG_HW_WATCHDOG
168
169 /* USB configuration */
170 #define CONFIG_USB_ATMEL
171 #define CONFIG_USB_ATMEL_CLK_SEL_PLLB
172 #define CONFIG_USB_OHCI_NEW
173 #define CONFIG_USB_STORAGE
174 #define CONFIG_DOS_PARTITION
175 #define CONFIG_SYS_USB_OHCI_CPU_INIT
176 #define CONFIG_SYS_USB_OHCI_REGS_BASE   ATMEL_UHP_BASE
177 #define CONFIG_SYS_USB_OHCI_SLOT_NAME   "at91sam9260"
178 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS      2
179
180 /* General Boot Parameter */
181 #define CONFIG_BOOTDELAY                3
182 #define CONFIG_BOOTCOMMAND              "run flashboot"
183 #define CONFIG_SYS_PROMPT               "U-Boot> "
184 #define CONFIG_SYS_CBSIZE               256
185 #define CONFIG_SYS_MAXARGS              16
186 #define CONFIG_SYS_PBSIZE \
187         (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
188 #define CONFIG_SYS_LONGHELP
189 #define CONFIG_CMDLINE_EDITING
190
191 /*
192  * RAM Memory address where to put the
193  * Linux Kernel befor starting.
194  */
195 #define CONFIG_SYS_LOAD_ADDR            0x22000000
196
197 /*
198  * The NAND Flash partitions:
199  * ==========================================
200  * 0x0000000-0x001ffff -> 128k, bootstrap
201  * 0x0020000-0x005ffff -> 256k, u-boot
202  * 0x0060000-0x007ffff -> 128k, env1
203  * 0x0080000-0x009ffff -> 128k, env2 (backup)
204  * 0x0100000-0x06fffff ->   6M, kernel
205  * 0x0700000-0x8000000 -> 121M, RootFS
206  */
207 #define CONFIG_ENV_IS_IN_NAND
208 #define CONFIG_ENV_OFFSET               ((128 + 256) << 10)
209 #define CONFIG_ENV_OFFSET_REDUND        ((128 + 256 + 128) << 10)
210 #define CONFIG_ENV_SIZE                 (128 << 10)
211
212 /*
213  * Predefined environment variables.
214  * Usefull to define some easy to use boot commands.
215  */
216 #define CONFIG_EXTRA_ENV_SETTINGS                                       \
217                                                                         \
218         "basicargs=console=ttyS0,115200\0"                              \
219                                                                         \
220         "mtdparts=mtdparts=atmel_nand:128k(bootstrap)ro,"               \
221                 "256k(uboot)ro,128k(env1)ro,"                           \
222                 "128k(env2)ro,6M(linux),-(root)rw\0"                    \
223                                                                         \
224         "flashboot=setenv bootargs ${basicargs} ${mtdparts} "           \
225                 "root=/dev/mtdblock5 rootfstype=jffs2; "                \
226                 "nand read 0x22000000 0x100000 0x600000; "              \
227                 "bootm 22000000\0"                                      \
228                                                                         \
229         "sdboot=setenv bootargs ${basicargs} ${mtdparts} "              \
230                 "root=/dev/mmcblk0p1 rootwait; "                        \
231                 "nand read 0x22000000 0x100000 0x600000; "              \
232                 "bootm 22000000"
233
234 /* Command line & features configuration */
235 #include <config_cmd_default.h>
236 #undef CONFIG_CMD_FPGA
237 #undef CONFIG_CMD_IMI
238 #undef CONFIG_CMD_IMLS
239 #undef CONFIG_CMD_LOADS
240
241 #define CONFIG_CMD_NAND
242 #define CONFIG_CMD_USB
243 #define CONFIG_CMD_FAT
244 #define CONFIG_CMD_LED
245
246 #ifdef CONFIG_MACB
247 # define CONFIG_CMD_PING
248 # define CONFIG_CMD_DHCP
249 #else
250 # undef CONFIG_CMD_BOOTD
251 # undef CONFIG_CMD_NET
252 # undef CONFIG_CMD_NFS
253 #endif /* CONFIG_MACB */
254
255 #endif /* __CONFIG_H */