blob: f1ea47654671f187e842ae8bc30a170ed4e5eb3b [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Chris Zankel05d0c5d2016-08-10 18:36:48 +03002/*
3 * Copyright (C) 2007-2013 Tensilica, Inc.
4 * Copyright (C) 2014 - 2016 Cadence Design Systems Inc.
Chris Zankel05d0c5d2016-08-10 18:36:48 +03005 */
6
7#ifndef __CONFIG_H
8#define __CONFIG_H
9
10#include <asm/arch/core.h>
11#include <asm/addrspace.h>
12#include <asm/config.h>
13
14/*
15 * The 'xtfpga' board describes a set of very similar boards with only minimal
16 * differences.
17 */
18
Chris Zankel05d0c5d2016-08-10 18:36:48 +030019/*===================*/
20/* RAM Layout */
21/*===================*/
22
23#if XCHAL_HAVE_PTP_MMU
24#define CONFIG_SYS_MEMORY_BASE \
25 (XCHAL_VECBASE_RESET_VADDR - XCHAL_VECBASE_RESET_PADDR)
26#define CONFIG_SYS_IO_BASE 0xf0000000
27#else
28#define CONFIG_SYS_MEMORY_BASE 0x60000000
29#define CONFIG_SYS_IO_BASE 0x90000000
30#define CONFIG_MAX_MEM_MAPPED 0x10000000
31#endif
32
33/* Onboard RAM sizes:
34 *
35 * LX60 0x04000000 64 MB
36 * LX110 0x03000000 48 MB
37 * LX200 0x06000000 96 MB
38 * ML605 0x18000000 384 MB
39 * KC705 0x38000000 896 MB
40 *
41 * noMMU configurations can only see first 256MB of onboard memory.
42 */
43
44#if XCHAL_HAVE_PTP_MMU || CONFIG_BOARD_SDRAM_SIZE < 0x10000000
45#define CONFIG_SYS_SDRAM_SIZE CONFIG_BOARD_SDRAM_SIZE
46#else
47#define CONFIG_SYS_SDRAM_SIZE 0x10000000
48#endif
49
50#define CONFIG_SYS_SDRAM_BASE MEMADDR(0x00000000)
51
52/* Lx60 can only map 128kb memory (instead of 256kb) when running under OCD */
53#ifdef CONFIG_XTFPGA_LX60
54# define CONFIG_SYS_MONITOR_LEN 0x00020000 /* 128KB */
55#else
56# define CONFIG_SYS_MONITOR_LEN 0x00040000 /* 256KB */
57#endif
58
Chris Zankel05d0c5d2016-08-10 18:36:48 +030059/* Memory test is destructive so default must not overlap vectors or U-Boot*/
Chris Zankel05d0c5d2016-08-10 18:36:48 +030060
61/* Load address for stand-alone applications.
62 * MEMADDR cannot be used here, because the definition needs to be
63 * a plain number as it's used as -Ttext argument for ld in standalone
64 * example makefile.
65 * Handle noMMU vs MMUv2 vs MMUv3 distinction here manually.
66 */
67#if XCHAL_HAVE_PTP_MMU
68#if XCHAL_VECBASE_RESET_VADDR == XCHAL_VECBASE_RESET_PADDR
69#define CONFIG_STANDALONE_LOAD_ADDR 0x00800000
70#else
71#define CONFIG_STANDALONE_LOAD_ADDR 0xd0800000
72#endif
73#else
74#define CONFIG_STANDALONE_LOAD_ADDR 0x60800000
75#endif
76
77#if defined(CONFIG_MAX_MEM_MAPPED) && \
78 CONFIG_MAX_MEM_MAPPED < CONFIG_SYS_SDRAM_SIZE
79#define CONFIG_SYS_MEMORY_SIZE CONFIG_MAX_MEM_MAPPED
80#else
81#define CONFIG_SYS_MEMORY_SIZE CONFIG_SYS_SDRAM_SIZE
82#endif
83
Max Filippove2e0ac52018-02-12 15:39:19 -080084#define XTENSA_SYS_TEXT_ADDR \
85 (MEMADDR(CONFIG_SYS_MEMORY_SIZE) - CONFIG_SYS_MONITOR_LEN)
Chris Zankel05d0c5d2016-08-10 18:36:48 +030086
Chris Zankel05d0c5d2016-08-10 18:36:48 +030087/*==============================*/
88/* U-Boot general configuration */
89/*==============================*/
90
Chris Zankel05d0c5d2016-08-10 18:36:48 +030091 /* Console I/O Buffer Size */
Chris Zankel05d0c5d2016-08-10 18:36:48 +030092/*==============================*/
93/* U-Boot autoboot configuration */
94/*==============================*/
95
Chris Zankel05d0c5d2016-08-10 18:36:48 +030096
97/*=========================================*/
98/* FPGA Registers (board info and control) */
99/*=========================================*/
100
101/*
102 * These assume FPGA bitstreams from Tensilica release RB and up. Earlier
103 * releases may not provide any/all of these registers or at these offsets.
104 * Some of the FPGA registers are broken down into bitfields described by
105 * SHIFT left amount and field WIDTH (bits), and also by a bitMASK.
106 */
107
108/* Date of FPGA bitstream build in binary coded decimal (BCD) */
109#define CONFIG_SYS_FPGAREG_DATE IOADDR(0x0D020000)
110#define FPGAREG_MTH_SHIFT 24 /* BCD month 1..12 */
111#define FPGAREG_MTH_WIDTH 8
112#define FPGAREG_MTH_MASK 0xFF000000
113#define FPGAREG_DAY_SHIFT 16 /* BCD day 1..31 */
114#define FPGAREG_DAY_WIDTH 8
115#define FPGAREG_DAY_MASK 0x00FF0000
116#define FPGAREG_YEAR_SHIFT 0 /* BCD year 2001..9999*/
117#define FPGAREG_YEAR_WIDTH 16
118#define FPGAREG_YEAR_MASK 0x0000FFFF
119
120/* FPGA core clock frequency in Hz (also input to UART) */
121#define CONFIG_SYS_FPGAREG_FREQ IOADDR(0x0D020004) /* CPU clock frequency*/
122
123/*
124 * DIP switch (left=sw1=lsb=bit0, right=sw8=msb=bit7; off=0, on=1):
125 * Bits 0..5 set the lower 6 bits of the default ethernet MAC.
126 * Bit 6 is reserved for future use by Tensilica.
127 * Bit 7 maps the first 128KB of ROM address space at CONFIG_SYS_ROM_BASE to
128 * the base of flash * (when on/1) or to the base of RAM (when off/0).
129 */
130#define CONFIG_SYS_FPGAREG_DIPSW IOADDR(0x0D02000C)
131#define FPGAREG_MAC_SHIFT 0 /* Ethernet MAC bits 0..5 */
132#define FPGAREG_MAC_WIDTH 6
133#define FPGAREG_MAC_MASK 0x3f
134#define FPGAREG_BOOT_SHIFT 7 /* Boot ROM addr mapping */
135#define FPGAREG_BOOT_WIDTH 1
136#define FPGAREG_BOOT_MASK 0x80
137#define FPGAREG_BOOT_RAM 0
138#define FPGAREG_BOOT_FLASH (1<<FPGAREG_BOOT_SHIFT)
139
140/* Force hard reset of board by writing a code to this register */
141#define CONFIG_SYS_FPGAREG_RESET IOADDR(0x0D020010) /* Reset board .. */
142#define CONFIG_SYS_FPGAREG_RESET_CODE 0x0000DEAD /* by writing this code */
143
144/*====================*/
145/* Serial Driver Info */
146/*====================*/
147
148#define CONFIG_SYS_NS16550_SERIAL
149#define CONFIG_SYS_NS16550_REG_SIZE (-4)
150#define CONFIG_SYS_NS16550_COM1 IOADDR(0x0D050020) /* Base address */
151
152/* Input clk to NS16550 (in Hz; the SYS_CLK_FREQ is in kHz) */
Tom Rini8c70baa2021-12-14 13:36:40 -0500153#define CONFIG_SYS_NS16550_CLK get_board_sys_clk()
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300154
155/*======================*/
156/* Ethernet Driver Info */
157/*======================*/
158
159#define CONFIG_ETHBASE 00:50:C2:13:6f:00
160#define CONFIG_SYS_ETHOC_BASE IOADDR(0x0d030000)
161#define CONFIG_SYS_ETHOC_BUFFER_ADDR IOADDR(0x0D800000)
162
163/*=====================*/
164/* Flash & Environment */
165/*=====================*/
166
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300167#ifdef CONFIG_XTFPGA_LX60
168# define CONFIG_SYS_FLASH_SIZE 0x0040000 /* 4MB */
169# define CONFIG_SYS_FLASH_SECT_SZ 0x10000 /* block size 64KB */
170# define CONFIG_SYS_FLASH_PARMSECT_SZ 0x2000 /* param size 8KB */
171# define CONFIG_SYS_FLASH_BASE IOADDR(0x08000000)
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300172#elif defined(CONFIG_XTFPGA_KC705)
173# define CONFIG_SYS_FLASH_SIZE 0x8000000 /* 128MB */
174# define CONFIG_SYS_FLASH_SECT_SZ 0x20000 /* block size 128KB */
175# define CONFIG_SYS_FLASH_PARMSECT_SZ 0x8000 /* param size 32KB */
176# define CONFIG_SYS_FLASH_BASE IOADDR(0x00000000)
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300177#else
178# define CONFIG_SYS_FLASH_SIZE 0x1000000 /* 16MB */
179# define CONFIG_SYS_FLASH_SECT_SZ 0x20000 /* block size 128KB */
180# define CONFIG_SYS_FLASH_PARMSECT_SZ 0x8000 /* param size 32KB */
181# define CONFIG_SYS_FLASH_BASE IOADDR(0x08000000)
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300182#endif
183#define CONFIG_SYS_MAX_FLASH_SECT \
184 (CONFIG_SYS_FLASH_SECT_SZ/CONFIG_SYS_FLASH_PARMSECT_SZ + \
185 CONFIG_SYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ - 1)
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300186
187/*
188 * Put environment in top block (64kB)
189 * Another option would be to put env. in 2nd param block offs 8KB, size 8KB
190 */
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300191
192/* print 'E' for empty sector on flinfo */
193#define CONFIG_SYS_FLASH_EMPTY_INFO
194
195#endif /* __CONFIG_H */