blob: 772a58ed9e84855bc409ecd5d3567b1af521de85 [file] [log] [blame]
Dinh Nguyen77754402012-10-04 06:46:02 +00001/*
2 * Copyright (C) 2012 Altera Corporation <www.altera.com>
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Dinh Nguyen77754402012-10-04 06:46:02 +00005 */
6
7#include <common.h>
8#include <asm/arch/reset_manager.h>
9#include <asm/io.h>
10
Marek Vasut0223a952014-11-04 04:25:09 +010011#include <usb.h>
12#include <usb/s3c_udc.h>
13#include <usb_mass_storage.h>
14
Dinh Nguyen74ae12e2014-11-13 11:23:41 -060015#include <micrel.h>
Dinh Nguyen77754402012-10-04 06:46:02 +000016#include <netdev.h>
Dinh Nguyen74ae12e2014-11-13 11:23:41 -060017#include <phy.h>
Dinh Nguyen77754402012-10-04 06:46:02 +000018
19DECLARE_GLOBAL_DATA_PTR;
20
Dinh Nguyen77754402012-10-04 06:46:02 +000021/*
22 * Print Board information
23 */
24int checkboard(void)
25{
Marek Vasut604364e2014-09-08 14:08:45 +020026 puts("BOARD: Altera SoCFPGA Cyclone5 Board\n");
Dinh Nguyen77754402012-10-04 06:46:02 +000027 return 0;
28}
29
30/*
31 * Initialization function which happen at early stage of c code
32 */
33int board_early_init_f(void)
34{
35 return 0;
36}
37
38/*
39 * Miscellaneous platform dependent initialisations
40 */
41int board_init(void)
42{
Pavel Machek868749a2014-09-08 14:08:45 +020043 /* Address of boot parameters for ATAG (if ATAG is used) */
44 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
45
Dinh Nguyen77754402012-10-04 06:46:02 +000046 return 0;
47}
Marek Vasut0223a952014-11-04 04:25:09 +010048
Dinh Nguyen74ae12e2014-11-13 11:23:41 -060049int board_phy_config(struct phy_device *phydev)
50{
51 /*
52 * These skew settings for the KSZ9021 ethernet phy is required for ethernet
53 * to work reliably on most flavors of cyclone5 boards.
54 */
55 ksz9021_phy_extended_write(phydev, MII_KSZ9021_EXT_RGMII_RX_DATA_SKEW,
56 0x0);
57 ksz9021_phy_extended_write(phydev, MII_KSZ9021_EXT_RGMII_TX_DATA_SKEW,
58 0x0);
59 ksz9021_phy_extended_write(phydev, MII_KSZ9021_EXT_RGMII_CLOCK_SKEW,
60 0xf0f0);
61}
62
Marek Vasut0223a952014-11-04 04:25:09 +010063#ifdef CONFIG_USB_GADGET
64struct s3c_plat_otg_data socfpga_otg_data = {
65 .regs_otg = CONFIG_USB_DWC2_REG_ADDR,
66 .usb_gusbcfg = 0x1417,
67};
68
69int board_usb_init(int index, enum usb_init_type init)
70{
71 return s3c_udc_probe(&socfpga_otg_data);
72}
73
74int g_dnl_board_usb_cable_connected(void)
75{
76 return 1;
77}
78#endif