2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2016-08-10 15:36:48 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2007 - 2013 Tensilica Inc.
|
|
|
|
* (C) Copyright 2014 - 2016 Cadence Design Systems Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2021-12-14 18:36:40 +00:00
|
|
|
#include <clock_legacy.h>
|
2016-08-10 15:36:48 +00:00
|
|
|
#include <command.h>
|
2017-05-17 23:18:03 +00:00
|
|
|
#include <dm.h>
|
2019-11-14 19:57:46 +00:00
|
|
|
#include <init.h>
|
2016-08-10 15:36:48 +00:00
|
|
|
#include <dm/platform_data/net_ethoc.h>
|
2019-08-01 15:46:51 +00:00
|
|
|
#include <env.h>
|
2016-08-10 15:36:48 +00:00
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/stringify.h>
|
|
|
|
#include <asm/global_data.h>
|
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check board idendity.
|
|
|
|
* (Print information about the board to stdout.)
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(CONFIG_XTFPGA_LX60)
|
|
|
|
const char *board = "XT_AV60";
|
|
|
|
const char *description = "Avnet Xilinx LX60 FPGA Evaluation Board / ";
|
|
|
|
#elif defined(CONFIG_XTFPGA_LX110)
|
|
|
|
const char *board = "XT_AV110";
|
|
|
|
const char *description = "Avnet Xilinx Virtex-5 LX110 Evaluation Kit / ";
|
|
|
|
#elif defined(CONFIG_XTFPGA_LX200)
|
|
|
|
const char *board = "XT_AV200";
|
|
|
|
const char *description = "Avnet Xilinx Virtex-4 LX200 Evaluation Kit / ";
|
|
|
|
#elif defined(CONFIG_XTFPGA_ML605)
|
|
|
|
const char *board = "XT_ML605";
|
|
|
|
const char *description = "Xilinx Virtex-6 FPGA ML605 Evaluation Kit / ";
|
|
|
|
#elif defined(CONFIG_XTFPGA_KC705)
|
|
|
|
const char *board = "XT_KC705";
|
|
|
|
const char *description = "Xilinx Kintex-7 FPGA KC705 Evaluation Kit / ";
|
|
|
|
#else
|
|
|
|
const char *board = "<unknown>";
|
|
|
|
const char *description = "";
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int checkboard(void)
|
|
|
|
{
|
|
|
|
printf("Board: %s: %sTensilica bitstream\n", board, description);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-12-14 18:36:39 +00:00
|
|
|
unsigned long get_board_sys_clk(void)
|
2016-08-10 15:36:48 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Obtain CPU clock frequency from board and cache in global
|
|
|
|
* data structure (Hz). Return 0 on success (OK to continue),
|
|
|
|
* else non-zero (hang).
|
|
|
|
*/
|
|
|
|
|
2022-11-16 18:10:41 +00:00
|
|
|
#ifdef CFG_SYS_FPGAREG_FREQ
|
|
|
|
return (*(volatile unsigned long *)CFG_SYS_FPGAREG_FREQ);
|
2016-08-10 15:36:48 +00:00
|
|
|
#else
|
|
|
|
/* early Tensilica bitstreams lack this reg, but most run at 50 MHz */
|
2021-12-14 18:36:39 +00:00
|
|
|
return 50000000;
|
2016-08-10 15:36:48 +00:00
|
|
|
#endif
|
2021-12-14 18:36:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int board_postclk_init(void)
|
|
|
|
{
|
|
|
|
gd->cpu_clk = get_board_sys_clk();
|
|
|
|
|
2016-08-10 15:36:48 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Miscellaneous late initializations.
|
|
|
|
* The environment has been set up, so we can set the Ethernet address.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int misc_init_r(void)
|
|
|
|
{
|
|
|
|
#ifdef CONFIG_CMD_NET
|
|
|
|
/*
|
|
|
|
* Initialize ethernet environment variables and board info.
|
|
|
|
* Default MAC address comes from CONFIG_ETHADDR + DIP switches 1-6.
|
|
|
|
*/
|
|
|
|
|
2017-08-03 18:22:12 +00:00
|
|
|
char *s = env_get("ethaddr");
|
2016-08-10 15:36:48 +00:00
|
|
|
if (s == 0) {
|
|
|
|
unsigned int x;
|
2022-12-04 15:03:49 +00:00
|
|
|
char s[] = __stringify(CFG_ETHBASE);
|
2022-11-16 18:10:41 +00:00
|
|
|
x = (*(volatile u32 *)CFG_SYS_FPGAREG_DIPSW)
|
2016-08-10 15:36:48 +00:00
|
|
|
& FPGAREG_MAC_MASK;
|
|
|
|
sprintf(&s[15], "%02x", x);
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("ethaddr", s);
|
2016-08-10 15:36:48 +00:00
|
|
|
}
|
|
|
|
#endif /* CONFIG_CMD_NET */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-12-29 03:34:54 +00:00
|
|
|
U_BOOT_DRVINFO(sysreset) = {
|
2016-08-10 15:36:48 +00:00
|
|
|
.name = "xtfpga_sysreset",
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct ethoc_eth_pdata ethoc_pdata = {
|
|
|
|
.eth_pdata = {
|
2022-11-16 18:10:41 +00:00
|
|
|
.iobase = CFG_SYS_ETHOC_BASE,
|
2016-08-10 15:36:48 +00:00
|
|
|
},
|
2022-11-16 18:10:41 +00:00
|
|
|
.packet_base = CFG_SYS_ETHOC_BUFFER_ADDR,
|
2016-08-10 15:36:48 +00:00
|
|
|
};
|
|
|
|
|
2020-12-29 03:34:54 +00:00
|
|
|
U_BOOT_DRVINFO(ethoc) = {
|
2016-08-10 15:36:48 +00:00
|
|
|
.name = "ethoc",
|
2020-12-03 23:55:18 +00:00
|
|
|
.plat = ðoc_pdata,
|
2016-08-10 15:36:48 +00:00
|
|
|
};
|