1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2007 - 2013 Tensilica Inc.
4 * (C) Copyright 2014 - 2016 Cadence Design Systems Inc.
8 #include <clock_legacy.h>
12 #include <dm/platform_data/net_ethoc.h>
14 #include <linux/ctype.h>
15 #include <linux/string.h>
16 #include <linux/stringify.h>
17 #include <asm/global_data.h>
19 DECLARE_GLOBAL_DATA_PTR;
22 * Check board idendity.
23 * (Print information about the board to stdout.)
27 #if defined(CONFIG_XTFPGA_LX60)
28 const char *board = "XT_AV60";
29 const char *description = "Avnet Xilinx LX60 FPGA Evaluation Board / ";
30 #elif defined(CONFIG_XTFPGA_LX110)
31 const char *board = "XT_AV110";
32 const char *description = "Avnet Xilinx Virtex-5 LX110 Evaluation Kit / ";
33 #elif defined(CONFIG_XTFPGA_LX200)
34 const char *board = "XT_AV200";
35 const char *description = "Avnet Xilinx Virtex-4 LX200 Evaluation Kit / ";
36 #elif defined(CONFIG_XTFPGA_ML605)
37 const char *board = "XT_ML605";
38 const char *description = "Xilinx Virtex-6 FPGA ML605 Evaluation Kit / ";
39 #elif defined(CONFIG_XTFPGA_KC705)
40 const char *board = "XT_KC705";
41 const char *description = "Xilinx Kintex-7 FPGA KC705 Evaluation Kit / ";
43 const char *board = "<unknown>";
44 const char *description = "";
49 printf("Board: %s: %sTensilica bitstream\n", board, description);
53 unsigned long get_board_sys_clk(void)
56 * Obtain CPU clock frequency from board and cache in global
57 * data structure (Hz). Return 0 on success (OK to continue),
58 * else non-zero (hang).
61 #ifdef CFG_SYS_FPGAREG_FREQ
62 return (*(volatile unsigned long *)CFG_SYS_FPGAREG_FREQ);
64 /* early Tensilica bitstreams lack this reg, but most run at 50 MHz */
69 int board_postclk_init(void)
71 gd->cpu_clk = get_board_sys_clk();
77 * Miscellaneous late initializations.
78 * The environment has been set up, so we can set the Ethernet address.
85 * Initialize ethernet environment variables and board info.
86 * Default MAC address comes from CONFIG_ETHADDR + DIP switches 1-6.
89 char *s = env_get("ethaddr");
92 char s[] = __stringify(CFG_ETHBASE);
93 x = (*(volatile u32 *)CFG_SYS_FPGAREG_DIPSW)
95 sprintf(&s[15], "%02x", x);
96 env_set("ethaddr", s);
98 #endif /* CONFIG_CMD_NET */
103 U_BOOT_DRVINFO(sysreset) = {
104 .name = "xtfpga_sysreset",
107 static struct ethoc_eth_pdata ethoc_pdata = {
109 .iobase = CFG_SYS_ETHOC_BASE,
111 .packet_base = CFG_SYS_ETHOC_BUFFER_ADDR,
114 U_BOOT_DRVINFO(ethoc) = {
116 .plat = ðoc_pdata,