2 * Bluegiga APX4 Development Kit
4 * Copyright (C) 2012 Bluegiga Technologies Oy
7 * Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
8 * Lauri Hintsala <lauri.hintsala@bluegiga.com>
11 * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
12 * on behalf of DENX Software Engineering GmbH
14 * SPDX-License-Identifier: GPL-2.0+
20 #include <asm/arch/imx-regs.h>
21 #include <asm/arch/iomux-mx28.h>
22 #include <asm/arch/clock.h>
23 #include <asm/arch/sys_proto.h>
24 #include <linux/mii.h>
29 DECLARE_GLOBAL_DATA_PTR;
32 int board_early_init_f(void)
34 /* IO0 clock at 480MHz */
35 mxs_set_ioclk(MXC_IOCLK0, 480000);
36 /* IO1 clock at 480MHz */
37 mxs_set_ioclk(MXC_IOCLK1, 480000);
39 /* SSP0 clock at 96MHz */
40 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
47 return mxs_dram_init();
52 /* Adress of boot parameters */
53 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
59 int board_mmc_init(bd_t *bis)
61 return mxsmmc_initialize(bis, 0, NULL, NULL);
68 #define MII_PHY_CTRL2 0x1f
69 int fecmxc_mii_postcall(int phy)
71 /* change PHY RMII clock to 50MHz */
72 miiphy_write("FEC", 0, MII_PHY_CTRL2, 0x8180);
77 int board_eth_init(bd_t *bis)
80 struct eth_device *dev;
82 ret = cpu_eth_init(bis);
84 printf("FEC MXS: Unable to init FEC clocks\n");
88 ret = fecmxc_initialize(bis);
90 printf("FEC MXS: Unable to init FEC\n");
94 dev = eth_get_dev_by_name("FEC");
96 printf("FEC MXS: Unable to get FEC device entry\n");
100 ret = fecmxc_register_mii_postcall(dev, fecmxc_mii_postcall);
102 printf("FEC MXS: Unable to register FEC MII postcall\n");
110 #ifdef CONFIG_SERIAL_TAG
111 #define MXS_OCOTP_MAX_TIMEOUT 1000000
112 void get_board_serial(struct tag_serialnr *serialnr)
114 struct mxs_ocotp_regs *ocotp_regs =
115 (struct mxs_ocotp_regs *)MXS_OCOTP_BASE;
120 writel(OCOTP_CTRL_RD_BANK_OPEN, &ocotp_regs->hw_ocotp_ctrl_set);
122 if (mxs_wait_mask_clr(&ocotp_regs->hw_ocotp_ctrl_reg, OCOTP_CTRL_BUSY,
123 MXS_OCOTP_MAX_TIMEOUT)) {
124 printf("MXS: Can't get serial number from OCOTP\n");
128 serialnr->low = readl(&ocotp_regs->hw_ocotp_cust3);
132 #ifdef CONFIG_REVISION_TAG
133 u32 get_board_rev(void)
135 if (getenv("revision#") != NULL)
136 return simple_strtoul(getenv("revision#"), NULL, 10);