blob: 468c5b85ab7c474775c4ef7d9327e2b296d7746b [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
Tom Rini6a5dccc2022-11-16 13:10:41 -050024#define CFG_SYS_MEMORY_BASE \
Chris Zankel05d0c5d2016-08-10 18:36:48 +030025 (XCHAL_VECBASE_RESET_VADDR - XCHAL_VECBASE_RESET_PADDR)
Tom Rini6a5dccc2022-11-16 13:10:41 -050026#define CFG_SYS_IO_BASE 0xf0000000
Chris Zankel05d0c5d2016-08-10 18:36:48 +030027#else
Tom Rini6a5dccc2022-11-16 13:10:41 -050028#define CFG_SYS_MEMORY_BASE 0x60000000
29#define CFG_SYS_IO_BASE 0x90000000
Tom Rinibc9d46b2022-12-04 10:04:50 -050030#define CFG_MAX_MEM_MAPPED 0x10000000
Chris Zankel05d0c5d2016-08-10 18:36:48 +030031#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
Tom Rinibb4dd962022-11-16 13:10:37 -050045#define CFG_SYS_SDRAM_SIZE CONFIG_BOARD_SDRAM_SIZE
Chris Zankel05d0c5d2016-08-10 18:36:48 +030046#else
Tom Rinibb4dd962022-11-16 13:10:37 -050047#define CFG_SYS_SDRAM_SIZE 0x10000000
Chris Zankel05d0c5d2016-08-10 18:36:48 +030048#endif
49
Tom Rinibb4dd962022-11-16 13:10:37 -050050#define CFG_SYS_SDRAM_BASE MEMADDR(0x00000000)
Chris Zankel05d0c5d2016-08-10 18:36:48 +030051
52/* Lx60 can only map 128kb memory (instead of 256kb) when running under OCD */
Chris Zankel05d0c5d2016-08-10 18:36:48 +030053
Chris Zankel05d0c5d2016-08-10 18:36:48 +030054/* Memory test is destructive so default must not overlap vectors or U-Boot*/
Chris Zankel05d0c5d2016-08-10 18:36:48 +030055
Tom Rinibc9d46b2022-12-04 10:04:50 -050056#if defined(CFG_MAX_MEM_MAPPED) && \
57 CFG_MAX_MEM_MAPPED < CFG_SYS_SDRAM_SIZE
Tom Rini8d86fe32022-07-23 13:05:07 -040058#define XTENSA_SYS_TEXT_ADDR \
Tom Rinibc9d46b2022-12-04 10:04:50 -050059 (MEMADDR(CFG_MAX_MEM_MAPPED) - CONFIG_SYS_MONITOR_LEN)
Chris Zankel05d0c5d2016-08-10 18:36:48 +030060#else
Max Filippove2e0ac52018-02-12 15:39:19 -080061#define XTENSA_SYS_TEXT_ADDR \
Tom Rinibb4dd962022-11-16 13:10:37 -050062 (MEMADDR(CFG_SYS_SDRAM_SIZE) - CONFIG_SYS_MONITOR_LEN)
Tom Rini8d86fe32022-07-23 13:05:07 -040063#endif
Chris Zankel05d0c5d2016-08-10 18:36:48 +030064
Chris Zankel05d0c5d2016-08-10 18:36:48 +030065/*==============================*/
66/* U-Boot general configuration */
67/*==============================*/
68
Chris Zankel05d0c5d2016-08-10 18:36:48 +030069 /* Console I/O Buffer Size */
Chris Zankel05d0c5d2016-08-10 18:36:48 +030070/*==============================*/
71/* U-Boot autoboot configuration */
72/*==============================*/
73
Chris Zankel05d0c5d2016-08-10 18:36:48 +030074/*=========================================*/
75/* FPGA Registers (board info and control) */
76/*=========================================*/
77
78/*
79 * These assume FPGA bitstreams from Tensilica release RB and up. Earlier
80 * releases may not provide any/all of these registers or at these offsets.
81 * Some of the FPGA registers are broken down into bitfields described by
82 * SHIFT left amount and field WIDTH (bits), and also by a bitMASK.
83 */
84
Chris Zankel05d0c5d2016-08-10 18:36:48 +030085/* FPGA core clock frequency in Hz (also input to UART) */
Tom Rini6a5dccc2022-11-16 13:10:41 -050086#define CFG_SYS_FPGAREG_FREQ IOADDR(0x0D020004) /* CPU clock frequency*/
Chris Zankel05d0c5d2016-08-10 18:36:48 +030087
88/*
89 * DIP switch (left=sw1=lsb=bit0, right=sw8=msb=bit7; off=0, on=1):
90 * Bits 0..5 set the lower 6 bits of the default ethernet MAC.
91 * Bit 6 is reserved for future use by Tensilica.
Tom Rini6a5dccc2022-11-16 13:10:41 -050092 * Bit 7 maps the first 128KB of ROM address space at CFG_SYS_ROM_BASE to
Chris Zankel05d0c5d2016-08-10 18:36:48 +030093 * the base of flash * (when on/1) or to the base of RAM (when off/0).
94 */
Tom Rini6a5dccc2022-11-16 13:10:41 -050095#define CFG_SYS_FPGAREG_DIPSW IOADDR(0x0D02000C)
Chris Zankel05d0c5d2016-08-10 18:36:48 +030096#define FPGAREG_MAC_SHIFT 0 /* Ethernet MAC bits 0..5 */
97#define FPGAREG_MAC_WIDTH 6
98#define FPGAREG_MAC_MASK 0x3f
99#define FPGAREG_BOOT_SHIFT 7 /* Boot ROM addr mapping */
100#define FPGAREG_BOOT_WIDTH 1
101#define FPGAREG_BOOT_MASK 0x80
102#define FPGAREG_BOOT_RAM 0
103#define FPGAREG_BOOT_FLASH (1<<FPGAREG_BOOT_SHIFT)
104
105/* Force hard reset of board by writing a code to this register */
Tom Rini6a5dccc2022-11-16 13:10:41 -0500106#define CFG_SYS_FPGAREG_RESET IOADDR(0x0D020010) /* Reset board .. */
107#define CFG_SYS_FPGAREG_RESET_CODE 0x0000DEAD /* by writing this code */
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300108
109/*====================*/
110/* Serial Driver Info */
111/*====================*/
112
Tom Rinidf6a2152022-11-16 13:10:28 -0500113#define CFG_SYS_NS16550_COM1 IOADDR(0x0D050020) /* Base address */
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300114
115/* Input clk to NS16550 (in Hz; the SYS_CLK_FREQ is in kHz) */
Tom Rinidf6a2152022-11-16 13:10:28 -0500116#define CFG_SYS_NS16550_CLK get_board_sys_clk()
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300117
118/*======================*/
119/* Ethernet Driver Info */
120/*======================*/
121
Tom Rini7d03ce62022-12-04 10:03:49 -0500122#define CFG_ETHBASE 00:50:C2:13:6f:00
Tom Rini6a5dccc2022-11-16 13:10:41 -0500123#define CFG_SYS_ETHOC_BASE IOADDR(0x0d030000)
124#define CFG_SYS_ETHOC_BUFFER_ADDR IOADDR(0x0D800000)
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300125
126/*=====================*/
127/* Flash & Environment */
128/*=====================*/
129
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300130#ifdef CONFIG_XTFPGA_LX60
Tom Rini6a5dccc2022-11-16 13:10:41 -0500131# define CFG_SYS_FLASH_SIZE 0x0040000 /* 4MB */
132# define CFG_SYS_FLASH_PARMSECT_SZ 0x2000 /* param size 8KB */
133# define CFG_SYS_FLASH_BASE IOADDR(0x08000000)
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300134#elif defined(CONFIG_XTFPGA_KC705)
Tom Rini6a5dccc2022-11-16 13:10:41 -0500135# define CFG_SYS_FLASH_SIZE 0x8000000 /* 128MB */
136# define CFG_SYS_FLASH_PARMSECT_SZ 0x8000 /* param size 32KB */
137# define CFG_SYS_FLASH_BASE IOADDR(0x00000000)
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300138#else
Tom Rini6a5dccc2022-11-16 13:10:41 -0500139# define CFG_SYS_FLASH_SIZE 0x1000000 /* 16MB */
140# define CFG_SYS_FLASH_PARMSECT_SZ 0x8000 /* param size 32KB */
141# define CFG_SYS_FLASH_BASE IOADDR(0x08000000)
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300142#endif
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300143
144/*
145 * Put environment in top block (64kB)
146 * Another option would be to put env. in 2nd param block offs 8KB, size 8KB
147 */
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300148
149/* print 'E' for empty sector on flinfo */
Chris Zankel05d0c5d2016-08-10 18:36:48 +0300150
151#endif /* __CONFIG_H */