blob: 5bb776859d7c83cf1db7d837aacec553b29fa4a5 [file] [log] [blame]
Thomas Chou7ffbbf52010-04-21 08:40:59 +08001/*
2 * (C) Copyright 2005, Psyent Corporation <www.psyent.com>
3 * Scott McNutt <smcnutt@psyent.com>
4 * (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw>
5 *
Wolfgang Denkbd8ec7e2013-10-07 13:07:26 +02006 * SPDX-License-Identifier: GPL-2.0+
Thomas Chou7ffbbf52010-04-21 08:40:59 +08007 */
8
9#ifndef __CONFIG_H
10#define __CONFIG_H
11
12/*
13 * BOARD/CPU
14 */
15#include "../board/altera/nios2-generic/custom_fpga.h" /* fpga parameters */
16#define CONFIG_BOARD_NAME "nios2-generic" /* custom board name */
17#define CONFIG_BOARD_EARLY_INIT_F /* enable early board-spec. init */
Thomas Choucce3e752014-08-22 11:36:47 +080018#define CONFIG_DISPLAY_CPUINFO
19#define CONFIG_DISPLAY_BOARDINFO
Thomas Chou7ffbbf52010-04-21 08:40:59 +080020#define CONFIG_SYS_NIOS_SYSID_BASE CONFIG_SYS_SYSID_BASE
21
22/*
23 * SERIAL
24 */
Thomas Chou2f8e2562014-08-30 17:45:23 +080025#define CONFIG_ALTERA_JTAG_UART
Thomas Chou7ffbbf52010-04-21 08:40:59 +080026#if defined(CONFIG_ALTERA_JTAG_UART)
27# define CONFIG_SYS_NIOS_CONSOLE CONFIG_SYS_JTAG_UART_BASE
28#else
29# define CONFIG_SYS_NIOS_CONSOLE CONFIG_SYS_UART_BASE
30#endif
31
32#define CONFIG_ALTERA_JTAG_UART_BYPASS
33#define CONFIG_SYS_NIOS_FIXEDBAUD
34#define CONFIG_BAUDRATE CONFIG_SYS_UART_BAUD
35#define CONFIG_SYS_BAUDRATE_TABLE {CONFIG_BAUDRATE}
36#define CONFIG_SYS_CONSOLE_INFO_QUIET /* Suppress console info */
37
38/*
39 * TIMER
40 */
Graeme Russ13ec42b2011-07-15 02:18:56 +000041#define CONFIG_SYS_LOW_RES_TIMER
Thomas Chou7ffbbf52010-04-21 08:40:59 +080042#define CONFIG_SYS_NIOS_TMRBASE CONFIG_SYS_TIMER_BASE
43#define CONFIG_SYS_NIOS_TMRIRQ CONFIG_SYS_TIMER_IRQ
Thomas Chou7ffbbf52010-04-21 08:40:59 +080044#define CONFIG_SYS_NIOS_TMRMS 10 /* Desired period (msec)*/
45#define CONFIG_SYS_NIOS_TMRCNT \
46 (CONFIG_SYS_NIOS_TMRMS * (CONFIG_SYS_TIMER_FREQ / 1000) - 1)
47
48/*
49 * STATUS LED
50 */
Joachim Foersterb19bfad2011-10-21 15:48:51 +020051#define CONFIG_ALTERA_PIO
52#define CONFIG_SYS_ALTERA_PIO_NUM 1
53#define CONFIG_SYS_ALTERA_PIO_GPIO_NUM LED_PIO_WIDTH
54
Thomas Chou7ffbbf52010-04-21 08:40:59 +080055#define CONFIG_STATUS_LED /* Enable status driver */
Thomas Choud3db57b2012-11-05 12:51:54 +080056#define CONFIG_BOARD_SPECIFIC_LED
Thomas Chouf6a59cb2010-04-30 11:34:15 +080057#define CONFIG_GPIO_LED /* Enable GPIO LED driver */
58#define CONFIG_GPIO /* Enable GPIO driver */
Thomas Chou2f8e2562014-08-30 17:45:23 +080059#define LED_PIO_BASE USER_LED_PIO_8OUT_BASE
60#define LED_PIO_WIDTH 8
61#define LED_PIO_RSTVAL 0xff
Thomas Chou7ffbbf52010-04-21 08:40:59 +080062
Thomas Chouf6a59cb2010-04-30 11:34:15 +080063#define STATUS_LED_BIT 0 /* Bit-0 on GPIO */
Thomas Chou7ffbbf52010-04-21 08:40:59 +080064#define STATUS_LED_STATE 1 /* Blinking */
65#define STATUS_LED_PERIOD (500 / CONFIG_SYS_NIOS_TMRMS) /* 500 msec */
66
67/*
68 * BOOTP options
69 */
70#define CONFIG_BOOTP_BOOTFILESIZE
71#define CONFIG_BOOTP_BOOTPATH
72#define CONFIG_BOOTP_GATEWAY
73#define CONFIG_BOOTP_HOSTNAME
74
75/*
Thomas Chou44d3cf42015-08-26 21:24:35 +080076 * FDT options
Thomas Chou7ffbbf52010-04-21 08:40:59 +080077 */
Thomas Chou2f8e2562014-08-30 17:45:23 +080078#define CONFIG_OF_LIBFDT
79#define CONFIG_OF_BOARD_SETUP
80#define CONFIG_LMB
81
Thomas Chou7ffbbf52010-04-21 08:40:59 +080082/*
83 * ENVIRONMENT -- Put environment in sector CONFIG_SYS_MONITOR_LEN above
84 * CONFIG_SYS_RESET_ADDR, since we assume the monitor is stored at the
85 * reset address, no? This will keep the environment in user region
86 * of flash. NOTE: the monitor length must be multiple of sector size
87 * (which is common practice).
88 */
89#define CONFIG_ENV_IS_IN_FLASH
90
Thomas Chou2f8e2562014-08-30 17:45:23 +080091#define CONFIG_ENV_SIZE 0x20000 /* 128k, 1 sector */
Thomas Chou7ffbbf52010-04-21 08:40:59 +080092#define CONFIG_ENV_OVERWRITE /* Serial change Ok */
93#define CONFIG_ENV_ADDR ((CONFIG_SYS_RESET_ADDR + \
94 CONFIG_SYS_MONITOR_LEN) | \
95 CONFIG_SYS_FLASH_BASE)
96
97/*
98 * MEMORY ORGANIZATION
Thomas Choufe06c182012-04-23 10:55:02 +080099 * -Monitor at top of sdram.
100 * -The heap is placed below the monitor
101 * -The stack is placed below the heap (&grows down).
Thomas Chou7ffbbf52010-04-21 08:40:59 +0800102 */
103#define CONFIG_MONITOR_IS_IN_RAM
104#define CONFIG_SYS_MONITOR_LEN 0x40000 /* Reserve 256k */
105#define CONFIG_SYS_MONITOR_BASE (CONFIG_SYS_SDRAM_BASE + \
106 CONFIG_SYS_SDRAM_SIZE - \
107 CONFIG_SYS_MONITOR_LEN)
Thomas Chou7ffbbf52010-04-21 08:40:59 +0800108#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 0x20000)
109#define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - \
110 CONFIG_SYS_MALLOC_LEN)
Thomas Choufe06c182012-04-23 10:55:02 +0800111#define CONFIG_SYS_INIT_SP CONFIG_SYS_MALLOC_BASE
Thomas Chou7ffbbf52010-04-21 08:40:59 +0800112
113/*
114 * MISC
115 */
116#define CONFIG_SYS_LONGHELP /* Provide extended help */
Thomas Chou7ffbbf52010-04-21 08:40:59 +0800117#define CONFIG_SYS_CBSIZE 256 /* Console I/O buf size */
118#define CONFIG_SYS_MAXARGS 16 /* Max command args */
119#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Bootarg buf size */
120#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
121 sizeof(CONFIG_SYS_PROMPT) + \
122 16) /* Print buf size */
123#define CONFIG_SYS_LOAD_ADDR CONFIG_SYS_SDRAM_BASE
124#define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE
125#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_INIT_SP - 0x20000)
126#define CONFIG_CMDLINE_EDITING
127
Thomas Chou7ffbbf52010-04-21 08:40:59 +0800128#endif /* __CONFIG_H */