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/setup.h>
21 #include <asm/arch/imx-regs.h>
22 #include <asm/arch/iomux-mx28.h>
23 #include <asm/arch/clock.h>
24 #include <asm/arch/sys_proto.h>
25 #include <linux/mii.h>
30 DECLARE_GLOBAL_DATA_PTR;
33 int board_early_init_f(void)
35 /* IO0 clock at 480MHz */
36 mxs_set_ioclk(MXC_IOCLK0, 480000);
37 /* IO1 clock at 480MHz */
38 mxs_set_ioclk(MXC_IOCLK1, 480000);
40 /* SSP0 clock at 96MHz */
41 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
48 return mxs_dram_init();
53 /* Adress of boot parameters */
54 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
60 int board_mmc_init(bd_t *bis)
62 return mxsmmc_initialize(bis, 0, NULL, NULL);
69 #define MII_PHY_CTRL2 0x1f
70 int fecmxc_mii_postcall(int phy)
72 /* change PHY RMII clock to 50MHz */
73 miiphy_write("FEC", 0, MII_PHY_CTRL2, 0x8180);
78 int board_eth_init(bd_t *bis)
81 struct eth_device *dev;
83 ret = cpu_eth_init(bis);
85 printf("FEC MXS: Unable to init FEC clocks\n");
89 ret = fecmxc_initialize(bis);
91 printf("FEC MXS: Unable to init FEC\n");
95 dev = eth_get_dev_by_name("FEC");
97 printf("FEC MXS: Unable to get FEC device entry\n");
101 ret = fecmxc_register_mii_postcall(dev, fecmxc_mii_postcall);
103 printf("FEC MXS: Unable to register FEC MII postcall\n");
111 #ifdef CONFIG_SERIAL_TAG
112 #define MXS_OCOTP_MAX_TIMEOUT 1000000
113 void get_board_serial(struct tag_serialnr *serialnr)
115 struct mxs_ocotp_regs *ocotp_regs =
116 (struct mxs_ocotp_regs *)MXS_OCOTP_BASE;
121 writel(OCOTP_CTRL_RD_BANK_OPEN, &ocotp_regs->hw_ocotp_ctrl_set);
123 if (mxs_wait_mask_clr(&ocotp_regs->hw_ocotp_ctrl_reg, OCOTP_CTRL_BUSY,
124 MXS_OCOTP_MAX_TIMEOUT)) {
125 printf("MXS: Can't get serial number from OCOTP\n");
129 serialnr->low = readl(&ocotp_regs->hw_ocotp_cust3);
133 #ifdef CONFIG_REVISION_TAG
134 u32 get_board_rev(void)
136 if (getenv("revision#") != NULL)
137 return simple_strtoul(getenv("revision#"), NULL, 10);