xref: /openbmc/u-boot/include/configs/xtfpga.h (revision 2fe88d452268d61b5ca9cb0b1dda2974cc43faeb)
1*83d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
27e270ec3SChris Zankel /*
37e270ec3SChris Zankel  * Copyright (C) 2007-2013 Tensilica, Inc.
47e270ec3SChris Zankel  * Copyright (C) 2014 - 2016 Cadence Design Systems Inc.
57e270ec3SChris Zankel  */
67e270ec3SChris Zankel 
77e270ec3SChris Zankel #ifndef __CONFIG_H
87e270ec3SChris Zankel #define __CONFIG_H
97e270ec3SChris Zankel 
107e270ec3SChris Zankel #include <asm/arch/core.h>
117e270ec3SChris Zankel #include <asm/addrspace.h>
127e270ec3SChris Zankel #include <asm/config.h>
137e270ec3SChris Zankel 
147e270ec3SChris Zankel /*
157e270ec3SChris Zankel  * The 'xtfpga' board describes a set of very similar boards with only minimal
167e270ec3SChris Zankel  * differences.
177e270ec3SChris Zankel  */
187e270ec3SChris Zankel 
197e270ec3SChris Zankel /*=====================*/
207e270ec3SChris Zankel /* Board and Processor */
217e270ec3SChris Zankel /*=====================*/
227e270ec3SChris Zankel 
237e270ec3SChris Zankel #define CONFIG_XTFPGA
247e270ec3SChris Zankel 
257e270ec3SChris Zankel /* FPGA CPU freq after init */
267e270ec3SChris Zankel #define CONFIG_SYS_CLK_FREQ		(gd->cpu_clk)
277e270ec3SChris Zankel 
287e270ec3SChris Zankel /*===================*/
297e270ec3SChris Zankel /* RAM Layout        */
307e270ec3SChris Zankel /*===================*/
317e270ec3SChris Zankel 
327e270ec3SChris Zankel #if XCHAL_HAVE_PTP_MMU
337e270ec3SChris Zankel #define CONFIG_SYS_MEMORY_BASE		\
347e270ec3SChris Zankel 	(XCHAL_VECBASE_RESET_VADDR - XCHAL_VECBASE_RESET_PADDR)
357e270ec3SChris Zankel #define CONFIG_SYS_IO_BASE		0xf0000000
367e270ec3SChris Zankel #else
377e270ec3SChris Zankel #define CONFIG_SYS_MEMORY_BASE		0x60000000
387e270ec3SChris Zankel #define CONFIG_SYS_IO_BASE		0x90000000
397e270ec3SChris Zankel #define CONFIG_MAX_MEM_MAPPED		0x10000000
407e270ec3SChris Zankel #endif
417e270ec3SChris Zankel 
427e270ec3SChris Zankel /* Onboard RAM sizes:
437e270ec3SChris Zankel  *
447e270ec3SChris Zankel  * LX60		0x04000000		  64 MB
457e270ec3SChris Zankel  * LX110	0x03000000		  48 MB
467e270ec3SChris Zankel  * LX200	0x06000000		  96 MB
477e270ec3SChris Zankel  * ML605	0x18000000		 384 MB
487e270ec3SChris Zankel  * KC705	0x38000000		 896 MB
497e270ec3SChris Zankel  *
507e270ec3SChris Zankel  * noMMU configurations can only see first 256MB of onboard memory.
517e270ec3SChris Zankel  */
527e270ec3SChris Zankel 
537e270ec3SChris Zankel #if XCHAL_HAVE_PTP_MMU || CONFIG_BOARD_SDRAM_SIZE < 0x10000000
547e270ec3SChris Zankel #define CONFIG_SYS_SDRAM_SIZE		CONFIG_BOARD_SDRAM_SIZE
557e270ec3SChris Zankel #else
567e270ec3SChris Zankel #define CONFIG_SYS_SDRAM_SIZE		0x10000000
577e270ec3SChris Zankel #endif
587e270ec3SChris Zankel 
597e270ec3SChris Zankel #define CONFIG_SYS_SDRAM_BASE		MEMADDR(0x00000000)
607e270ec3SChris Zankel 
617e270ec3SChris Zankel /* Lx60 can only map 128kb memory (instead of 256kb) when running under OCD */
627e270ec3SChris Zankel #ifdef CONFIG_XTFPGA_LX60
637e270ec3SChris Zankel # define CONFIG_SYS_MONITOR_LEN		0x00020000	/* 128KB */
647e270ec3SChris Zankel #else
657e270ec3SChris Zankel # define CONFIG_SYS_MONITOR_LEN		0x00040000	/* 256KB */
667e270ec3SChris Zankel #endif
677e270ec3SChris Zankel 
687e270ec3SChris Zankel #define CONFIG_SYS_MALLOC_LEN		(256 << 10)	/* heap  256KB */
697e270ec3SChris Zankel 
707e270ec3SChris Zankel /* Linux boot param area in RAM (used only when booting linux) */
717e270ec3SChris Zankel #define CONFIG_SYS_BOOTPARAMS_LEN	(64  << 10)
727e270ec3SChris Zankel 
737e270ec3SChris Zankel /* Memory test is destructive so default must not overlap vectors or U-Boot*/
747e270ec3SChris Zankel #define CONFIG_SYS_MEMTEST_START	MEMADDR(0x01000000)
757e270ec3SChris Zankel #define CONFIG_SYS_MEMTEST_END		MEMADDR(0x02000000)
767e270ec3SChris Zankel 
777e270ec3SChris Zankel /* Load address for stand-alone applications.
787e270ec3SChris Zankel  * MEMADDR cannot be used here, because the definition needs to be
797e270ec3SChris Zankel  * a plain number as it's used as -Ttext argument for ld in standalone
807e270ec3SChris Zankel  * example makefile.
817e270ec3SChris Zankel  * Handle noMMU vs MMUv2 vs MMUv3 distinction here manually.
827e270ec3SChris Zankel  */
837e270ec3SChris Zankel #if XCHAL_HAVE_PTP_MMU
847e270ec3SChris Zankel #if XCHAL_VECBASE_RESET_VADDR == XCHAL_VECBASE_RESET_PADDR
857e270ec3SChris Zankel #define CONFIG_STANDALONE_LOAD_ADDR	0x00800000
867e270ec3SChris Zankel #else
877e270ec3SChris Zankel #define CONFIG_STANDALONE_LOAD_ADDR	0xd0800000
887e270ec3SChris Zankel #endif
897e270ec3SChris Zankel #else
907e270ec3SChris Zankel #define CONFIG_STANDALONE_LOAD_ADDR	0x60800000
917e270ec3SChris Zankel #endif
927e270ec3SChris Zankel 
937e270ec3SChris Zankel #if defined(CONFIG_MAX_MEM_MAPPED) && \
947e270ec3SChris Zankel 	CONFIG_MAX_MEM_MAPPED < CONFIG_SYS_SDRAM_SIZE
957e270ec3SChris Zankel #define CONFIG_SYS_MEMORY_SIZE		CONFIG_MAX_MEM_MAPPED
967e270ec3SChris Zankel #else
977e270ec3SChris Zankel #define CONFIG_SYS_MEMORY_SIZE		CONFIG_SYS_SDRAM_SIZE
987e270ec3SChris Zankel #endif
997e270ec3SChris Zankel 
10010117a29SMax Filippov #define XTENSA_SYS_TEXT_ADDR		\
10110117a29SMax Filippov 	(MEMADDR(CONFIG_SYS_MEMORY_SIZE) - CONFIG_SYS_MONITOR_LEN)
1027e270ec3SChris Zankel 
1037e270ec3SChris Zankel /* Used by tftpboot; env var 'loadaddr' */
1047e270ec3SChris Zankel #define CONFIG_SYS_LOAD_ADDR		MEMADDR(0x02000000)
1057e270ec3SChris Zankel 
1067e270ec3SChris Zankel /*==============================*/
1077e270ec3SChris Zankel /* U-Boot general configuration */
1087e270ec3SChris Zankel /*==============================*/
1097e270ec3SChris Zankel 
1107e270ec3SChris Zankel #define CONFIG_BOARD_POSTCLK_INIT
1117e270ec3SChris Zankel 
1127e270ec3SChris Zankel #define CONFIG_BOOTFILE			"uImage"
1137e270ec3SChris Zankel 	/* Console I/O Buffer Size  */
1147e270ec3SChris Zankel #define CONFIG_SYS_CBSIZE		1024
1157e270ec3SChris Zankel 	/* Boot Argument Buffer Size */
1167e270ec3SChris Zankel #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
1177e270ec3SChris Zankel 
1187e270ec3SChris Zankel /*==============================*/
1197e270ec3SChris Zankel /* U-Boot autoboot configuration */
1207e270ec3SChris Zankel /*==============================*/
1217e270ec3SChris Zankel 
1227e270ec3SChris Zankel #define CONFIG_MX_CYCLIC
1237e270ec3SChris Zankel #define CONFIG_SHOW_BOOT_PROGRESS
1247e270ec3SChris Zankel 
1257e270ec3SChris Zankel 
1267e270ec3SChris Zankel /*=========================================*/
1277e270ec3SChris Zankel /* FPGA Registers (board info and control) */
1287e270ec3SChris Zankel /*=========================================*/
1297e270ec3SChris Zankel 
1307e270ec3SChris Zankel /*
1317e270ec3SChris Zankel  * These assume FPGA bitstreams from Tensilica release RB and up. Earlier
1327e270ec3SChris Zankel  * releases may not provide any/all of these registers or at these offsets.
1337e270ec3SChris Zankel  * Some of the FPGA registers are broken down into bitfields described by
1347e270ec3SChris Zankel  * SHIFT left amount and field WIDTH (bits), and also by a bitMASK.
1357e270ec3SChris Zankel  */
1367e270ec3SChris Zankel 
1377e270ec3SChris Zankel /* Date of FPGA bitstream build in binary coded decimal (BCD) */
1387e270ec3SChris Zankel #define CONFIG_SYS_FPGAREG_DATE		IOADDR(0x0D020000)
1397e270ec3SChris Zankel #define FPGAREG_MTH_SHIFT		24		/* BCD month 1..12 */
1407e270ec3SChris Zankel #define FPGAREG_MTH_WIDTH		8
1417e270ec3SChris Zankel #define FPGAREG_MTH_MASK		0xFF000000
1427e270ec3SChris Zankel #define FPGAREG_DAY_SHIFT		16		/* BCD day 1..31 */
1437e270ec3SChris Zankel #define FPGAREG_DAY_WIDTH		8
1447e270ec3SChris Zankel #define FPGAREG_DAY_MASK		0x00FF0000
1457e270ec3SChris Zankel #define FPGAREG_YEAR_SHIFT		0		/* BCD year 2001..9999*/
1467e270ec3SChris Zankel #define FPGAREG_YEAR_WIDTH		16
1477e270ec3SChris Zankel #define FPGAREG_YEAR_MASK		0x0000FFFF
1487e270ec3SChris Zankel 
1497e270ec3SChris Zankel /* FPGA core clock frequency in Hz (also input to UART) */
1507e270ec3SChris Zankel #define CONFIG_SYS_FPGAREG_FREQ	IOADDR(0x0D020004)	/* CPU clock frequency*/
1517e270ec3SChris Zankel 
1527e270ec3SChris Zankel /*
1537e270ec3SChris Zankel  * DIP switch (left=sw1=lsb=bit0, right=sw8=msb=bit7; off=0, on=1):
1547e270ec3SChris Zankel  *   Bits 0..5 set the lower 6 bits of the default ethernet MAC.
1557e270ec3SChris Zankel  *   Bit 6 is reserved for future use by Tensilica.
1567e270ec3SChris Zankel  *   Bit 7 maps the first 128KB of ROM address space at CONFIG_SYS_ROM_BASE to
1577e270ec3SChris Zankel  *   the base of flash * (when on/1) or to the base of RAM (when off/0).
1587e270ec3SChris Zankel  */
1597e270ec3SChris Zankel #define CONFIG_SYS_FPGAREG_DIPSW	IOADDR(0x0D02000C)
1607e270ec3SChris Zankel #define FPGAREG_MAC_SHIFT		0	/* Ethernet MAC bits 0..5 */
1617e270ec3SChris Zankel #define FPGAREG_MAC_WIDTH		6
1627e270ec3SChris Zankel #define FPGAREG_MAC_MASK		0x3f
1637e270ec3SChris Zankel #define FPGAREG_BOOT_SHIFT		7	/* Boot ROM addr mapping */
1647e270ec3SChris Zankel #define FPGAREG_BOOT_WIDTH		1
1657e270ec3SChris Zankel #define FPGAREG_BOOT_MASK		0x80
1667e270ec3SChris Zankel #define FPGAREG_BOOT_RAM		0
1677e270ec3SChris Zankel #define FPGAREG_BOOT_FLASH		(1<<FPGAREG_BOOT_SHIFT)
1687e270ec3SChris Zankel 
1697e270ec3SChris Zankel /* Force hard reset of board by writing a code to this register */
1707e270ec3SChris Zankel #define CONFIG_SYS_FPGAREG_RESET	IOADDR(0x0D020010) /* Reset board .. */
1717e270ec3SChris Zankel #define CONFIG_SYS_FPGAREG_RESET_CODE	0x0000DEAD   /*  by writing this code */
1727e270ec3SChris Zankel 
1737e270ec3SChris Zankel /*====================*/
1747e270ec3SChris Zankel /* Serial Driver Info */
1757e270ec3SChris Zankel /*====================*/
1767e270ec3SChris Zankel 
1777e270ec3SChris Zankel #define CONFIG_SYS_NS16550_SERIAL
1787e270ec3SChris Zankel #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
1797e270ec3SChris Zankel #define CONFIG_SYS_NS16550_COM1		IOADDR(0x0D050020) /* Base address */
1807e270ec3SChris Zankel 
1817e270ec3SChris Zankel /* Input clk to NS16550 (in Hz; the SYS_CLK_FREQ is in kHz) */
1827e270ec3SChris Zankel #define CONFIG_SYS_NS16550_CLK		CONFIG_SYS_CLK_FREQ
1837e270ec3SChris Zankel #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
1847e270ec3SChris Zankel 
1857e270ec3SChris Zankel /*======================*/
1867e270ec3SChris Zankel /* Ethernet Driver Info */
1877e270ec3SChris Zankel /*======================*/
1887e270ec3SChris Zankel 
1897e270ec3SChris Zankel #define CONFIG_ETHBASE			00:50:C2:13:6f:00
1907e270ec3SChris Zankel #define CONFIG_SYS_ETHOC_BASE		IOADDR(0x0d030000)
1917e270ec3SChris Zankel #define CONFIG_SYS_ETHOC_BUFFER_ADDR	IOADDR(0x0D800000)
1927e270ec3SChris Zankel 
1937e270ec3SChris Zankel /*=====================*/
1947e270ec3SChris Zankel /* Flash & Environment */
1957e270ec3SChris Zankel /*=====================*/
1967e270ec3SChris Zankel 
1977e270ec3SChris Zankel #define CONFIG_SYS_FLASH_CFI_WIDTH	FLASH_CFI_16BIT
1987e270ec3SChris Zankel #define CONFIG_SYS_MAX_FLASH_BANKS	1
1997e270ec3SChris Zankel #ifdef CONFIG_XTFPGA_LX60
2007e270ec3SChris Zankel # define CONFIG_SYS_FLASH_SIZE		0x0040000	/* 4MB */
2017e270ec3SChris Zankel # define CONFIG_SYS_FLASH_SECT_SZ	0x10000		/* block size 64KB */
2027e270ec3SChris Zankel # define CONFIG_SYS_FLASH_PARMSECT_SZ	0x2000		/* param size  8KB */
2037e270ec3SChris Zankel # define CONFIG_SYS_FLASH_BASE		IOADDR(0x08000000)
2047e270ec3SChris Zankel # define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_FLASH_BASE
2057e270ec3SChris Zankel #elif defined(CONFIG_XTFPGA_KC705)
2067e270ec3SChris Zankel # define CONFIG_SYS_FLASH_SIZE		0x8000000	/* 128MB */
2077e270ec3SChris Zankel # define CONFIG_SYS_FLASH_SECT_SZ	0x20000		/* block size 128KB */
2087e270ec3SChris Zankel # define CONFIG_SYS_FLASH_PARMSECT_SZ	0x8000		/* param size 32KB */
2097e270ec3SChris Zankel # define CONFIG_SYS_FLASH_BASE		IOADDR(0x00000000)
2107e270ec3SChris Zankel # define CONFIG_SYS_MONITOR_BASE	IOADDR(0x06000000)
2117e270ec3SChris Zankel #else
2127e270ec3SChris Zankel # define CONFIG_SYS_FLASH_SIZE		0x1000000	/* 16MB */
2137e270ec3SChris Zankel # define CONFIG_SYS_FLASH_SECT_SZ	0x20000		/* block size 128KB */
2147e270ec3SChris Zankel # define CONFIG_SYS_FLASH_PARMSECT_SZ	0x8000		/* param size 32KB */
2157e270ec3SChris Zankel # define CONFIG_SYS_FLASH_BASE		IOADDR(0x08000000)
2167e270ec3SChris Zankel # define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_FLASH_BASE
2177e270ec3SChris Zankel #endif
2187e270ec3SChris Zankel #define CONFIG_SYS_MAX_FLASH_SECT	\
2197e270ec3SChris Zankel 	(CONFIG_SYS_FLASH_SECT_SZ/CONFIG_SYS_FLASH_PARMSECT_SZ + \
2207e270ec3SChris Zankel 	 CONFIG_SYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ - 1)
2217e270ec3SChris Zankel 
2227e270ec3SChris Zankel /*
2237e270ec3SChris Zankel  * Put environment in top block (64kB)
2247e270ec3SChris Zankel  * Another option would be to put env. in 2nd param block offs 8KB, size 8KB
2257e270ec3SChris Zankel  */
2267e270ec3SChris Zankel #define CONFIG_ENV_OFFSET    (CONFIG_SYS_FLASH_SIZE - CONFIG_SYS_FLASH_SECT_SZ)
2277e270ec3SChris Zankel #define CONFIG_ENV_SIZE	     CONFIG_SYS_FLASH_SECT_SZ
2287e270ec3SChris Zankel 
2297e270ec3SChris Zankel /* print 'E' for empty sector on flinfo */
2307e270ec3SChris Zankel #define CONFIG_SYS_FLASH_EMPTY_INFO
2317e270ec3SChris Zankel 
2327e270ec3SChris Zankel #endif /* __CONFIG_H */
233