1 // SPDX-License-Identifier: GPL-2.0+
3 * Bluegiga APX4 Development Kit
5 * Copyright (C) 2012 Bluegiga Technologies Oy
8 * Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
9 * Lauri Hintsala <lauri.hintsala@bluegiga.com>
12 * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
13 * on behalf of DENX Software Engineering GmbH
21 #include <asm/setup.h>
22 #include <asm/arch/imx-regs.h>
23 #include <asm/arch/iomux-mx28.h>
24 #include <asm/arch/clock.h>
25 #include <asm/arch/sys_proto.h>
27 #include <linux/mii.h>
32 DECLARE_GLOBAL_DATA_PTR;
35 int board_early_init_f(void)
37 /* IO0 clock at 480MHz */
38 mxs_set_ioclk(MXC_IOCLK0, 480000);
39 /* IO1 clock at 480MHz */
40 mxs_set_ioclk(MXC_IOCLK1, 480000);
42 /* SSP0 clock at 96MHz */
43 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
50 return mxs_dram_init();
55 /* Adress of boot parameters */
56 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
62 int board_mmc_init(bd_t *bis)
64 return mxsmmc_initialize(bis, 0, NULL, NULL);
71 #define MII_PHY_CTRL2 0x1f
72 int fecmxc_mii_postcall(int phy)
74 /* change PHY RMII clock to 50MHz */
75 miiphy_write("FEC", 0, MII_PHY_CTRL2, 0x8180);
80 int board_eth_init(bd_t *bis)
83 struct eth_device *dev;
85 ret = cpu_eth_init(bis);
87 printf("FEC MXS: Unable to init FEC clocks\n");
91 ret = fecmxc_initialize(bis);
93 printf("FEC MXS: Unable to init FEC\n");
97 dev = eth_get_dev_by_name("FEC");
99 printf("FEC MXS: Unable to get FEC device entry\n");
103 ret = fecmxc_register_mii_postcall(dev, fecmxc_mii_postcall);
105 printf("FEC MXS: Unable to register FEC MII postcall\n");
113 #ifdef CONFIG_SERIAL_TAG
114 #define MXS_OCOTP_MAX_TIMEOUT 1000000
115 void get_board_serial(struct tag_serialnr *serialnr)
117 struct mxs_ocotp_regs *ocotp_regs =
118 (struct mxs_ocotp_regs *)MXS_OCOTP_BASE;
123 writel(OCOTP_CTRL_RD_BANK_OPEN, &ocotp_regs->hw_ocotp_ctrl_set);
125 if (mxs_wait_mask_clr(&ocotp_regs->hw_ocotp_ctrl_reg, OCOTP_CTRL_BUSY,
126 MXS_OCOTP_MAX_TIMEOUT)) {
127 printf("MXS: Can't get serial number from OCOTP\n");
131 serialnr->low = readl(&ocotp_regs->hw_ocotp_cust3);
135 #ifdef CONFIG_REVISION_TAG
136 u32 get_board_rev(void)
138 if (env_get("revision#") != NULL)
139 return simple_strtoul(env_get("revision#"), NULL, 10);