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
19 #include <asm/global_data.h>
22 #include <asm/setup.h>
23 #include <asm/arch/imx-regs.h>
24 #include <asm/arch/iomux-mx28.h>
25 #include <asm/arch/clock.h>
26 #include <asm/arch/sys_proto.h>
28 #include <linux/mii.h>
33 DECLARE_GLOBAL_DATA_PTR;
36 int board_early_init_f(void)
38 /* IO0 clock at 480MHz */
39 mxs_set_ioclk(MXC_IOCLK0, 480000);
40 /* IO1 clock at 480MHz */
41 mxs_set_ioclk(MXC_IOCLK1, 480000);
43 /* SSP0 clock at 96MHz */
44 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
51 return mxs_dram_init();
56 /* Adress of boot parameters */
57 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
63 int board_mmc_init(struct bd_info *bis)
65 return mxsmmc_initialize(bis, 0, NULL, NULL);
72 #define MII_PHY_CTRL2 0x1f
73 int fecmxc_mii_postcall(int phy)
75 /* change PHY RMII clock to 50MHz */
76 miiphy_write("FEC", 0, MII_PHY_CTRL2, 0x8180);
81 int board_eth_init(struct bd_info *bis)
84 struct eth_device *dev;
86 ret = cpu_eth_init(bis);
88 printf("FEC MXS: Unable to init FEC clocks\n");
92 ret = fecmxc_initialize(bis);
94 printf("FEC MXS: Unable to init FEC\n");
98 dev = eth_get_dev_by_name("FEC");
100 printf("FEC MXS: Unable to get FEC device entry\n");
104 ret = fecmxc_register_mii_postcall(dev, fecmxc_mii_postcall);
106 printf("FEC MXS: Unable to register FEC MII postcall\n");
114 #ifdef CONFIG_SERIAL_TAG
115 #define MXS_OCOTP_MAX_TIMEOUT 1000000
116 void get_board_serial(struct tag_serialnr *serialnr)
118 struct mxs_ocotp_regs *ocotp_regs =
119 (struct mxs_ocotp_regs *)MXS_OCOTP_BASE;
124 writel(OCOTP_CTRL_RD_BANK_OPEN, &ocotp_regs->hw_ocotp_ctrl_set);
126 if (mxs_wait_mask_clr(&ocotp_regs->hw_ocotp_ctrl_reg, OCOTP_CTRL_BUSY,
127 MXS_OCOTP_MAX_TIMEOUT)) {
128 printf("MXS: Can't get serial number from OCOTP\n");
132 serialnr->low = readl(&ocotp_regs->hw_ocotp_cust3);
136 #ifdef CONFIG_REVISION_TAG
137 u32 get_board_rev(void)
139 if (env_get("revision#") != NULL)
140 return simple_strtoul(env_get("revision#"), NULL, 10);