4 * Board functions for TI AM335X based boards
6 * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
8 * SPDX-License-Identifier: GPL-2.0+
14 #include <asm/arch/cpu.h>
15 #include <asm/arch/hardware.h>
16 #include <asm/arch/omap.h>
17 #include <asm/arch/ddr_defs.h>
18 #include <asm/arch/clock.h>
19 #include <asm/arch/gpio.h>
20 #include <asm/arch/mmc_host_def.h>
21 #include <asm/arch/sys_proto.h>
22 #include <asm/arch/mem.h>
29 #include <power/tps65217.h>
30 #include <power/tps65910.h>
31 #include <environment.h>
33 #include <environment.h>
36 DECLARE_GLOBAL_DATA_PTR;
38 /* GPIO that controls power to DDR on EVM-SK */
39 #define GPIO_DDR_VTT_EN 7
41 #if defined(CONFIG_SPL_BUILD) || \
42 (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_DM_ETH))
43 static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
47 * Read header information from EEPROM into global structure.
49 static int read_eeprom(struct am335x_baseboard_id *header)
51 /* Check if baseboard eeprom is available */
52 if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) {
53 puts("Could not probe the EEPROM; something fundamentally "
54 "wrong on the I2C bus.\n");
58 /* read the eeprom using i2c */
59 if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)header,
60 sizeof(struct am335x_baseboard_id))) {
61 puts("Could not read the EEPROM; something fundamentally"
62 " wrong on the I2C bus.\n");
66 if (header->magic != 0xEE3355AA) {
68 * read the eeprom using i2c again,
69 * but use only a 1 byte address
71 if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 1, (uchar *)header,
72 sizeof(struct am335x_baseboard_id))) {
73 puts("Could not read the EEPROM; something "
74 "fundamentally wrong on the I2C bus.\n");
78 if (header->magic != 0xEE3355AA) {
79 printf("Incorrect magic number (0x%x) in EEPROM\n",
88 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
89 static const struct ddr_data ddr2_data = {
90 .datardsratio0 = MT47H128M16RT25E_RD_DQS,
91 .datafwsratio0 = MT47H128M16RT25E_PHY_FIFO_WE,
92 .datawrsratio0 = MT47H128M16RT25E_PHY_WR_DATA,
95 static const struct cmd_control ddr2_cmd_ctrl_data = {
96 .cmd0csratio = MT47H128M16RT25E_RATIO,
98 .cmd1csratio = MT47H128M16RT25E_RATIO,
100 .cmd2csratio = MT47H128M16RT25E_RATIO,
103 static const struct emif_regs ddr2_emif_reg_data = {
104 .sdram_config = MT47H128M16RT25E_EMIF_SDCFG,
105 .ref_ctrl = MT47H128M16RT25E_EMIF_SDREF,
106 .sdram_tim1 = MT47H128M16RT25E_EMIF_TIM1,
107 .sdram_tim2 = MT47H128M16RT25E_EMIF_TIM2,
108 .sdram_tim3 = MT47H128M16RT25E_EMIF_TIM3,
109 .emif_ddr_phy_ctlr_1 = MT47H128M16RT25E_EMIF_READ_LATENCY,
112 static const struct ddr_data ddr3_data = {
113 .datardsratio0 = MT41J128MJT125_RD_DQS,
114 .datawdsratio0 = MT41J128MJT125_WR_DQS,
115 .datafwsratio0 = MT41J128MJT125_PHY_FIFO_WE,
116 .datawrsratio0 = MT41J128MJT125_PHY_WR_DATA,
119 static const struct ddr_data ddr3_beagleblack_data = {
120 .datardsratio0 = MT41K256M16HA125E_RD_DQS,
121 .datawdsratio0 = MT41K256M16HA125E_WR_DQS,
122 .datafwsratio0 = MT41K256M16HA125E_PHY_FIFO_WE,
123 .datawrsratio0 = MT41K256M16HA125E_PHY_WR_DATA,
126 static const struct ddr_data ddr3_evm_data = {
127 .datardsratio0 = MT41J512M8RH125_RD_DQS,
128 .datawdsratio0 = MT41J512M8RH125_WR_DQS,
129 .datafwsratio0 = MT41J512M8RH125_PHY_FIFO_WE,
130 .datawrsratio0 = MT41J512M8RH125_PHY_WR_DATA,
133 static const struct cmd_control ddr3_cmd_ctrl_data = {
134 .cmd0csratio = MT41J128MJT125_RATIO,
135 .cmd0iclkout = MT41J128MJT125_INVERT_CLKOUT,
137 .cmd1csratio = MT41J128MJT125_RATIO,
138 .cmd1iclkout = MT41J128MJT125_INVERT_CLKOUT,
140 .cmd2csratio = MT41J128MJT125_RATIO,
141 .cmd2iclkout = MT41J128MJT125_INVERT_CLKOUT,
144 static const struct cmd_control ddr3_beagleblack_cmd_ctrl_data = {
145 .cmd0csratio = MT41K256M16HA125E_RATIO,
146 .cmd0iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
148 .cmd1csratio = MT41K256M16HA125E_RATIO,
149 .cmd1iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
151 .cmd2csratio = MT41K256M16HA125E_RATIO,
152 .cmd2iclkout = MT41K256M16HA125E_INVERT_CLKOUT,
155 static const struct cmd_control ddr3_evm_cmd_ctrl_data = {
156 .cmd0csratio = MT41J512M8RH125_RATIO,
157 .cmd0iclkout = MT41J512M8RH125_INVERT_CLKOUT,
159 .cmd1csratio = MT41J512M8RH125_RATIO,
160 .cmd1iclkout = MT41J512M8RH125_INVERT_CLKOUT,
162 .cmd2csratio = MT41J512M8RH125_RATIO,
163 .cmd2iclkout = MT41J512M8RH125_INVERT_CLKOUT,
166 static struct emif_regs ddr3_emif_reg_data = {
167 .sdram_config = MT41J128MJT125_EMIF_SDCFG,
168 .ref_ctrl = MT41J128MJT125_EMIF_SDREF,
169 .sdram_tim1 = MT41J128MJT125_EMIF_TIM1,
170 .sdram_tim2 = MT41J128MJT125_EMIF_TIM2,
171 .sdram_tim3 = MT41J128MJT125_EMIF_TIM3,
172 .zq_config = MT41J128MJT125_ZQ_CFG,
173 .emif_ddr_phy_ctlr_1 = MT41J128MJT125_EMIF_READ_LATENCY |
177 static struct emif_regs ddr3_beagleblack_emif_reg_data = {
178 .sdram_config = MT41K256M16HA125E_EMIF_SDCFG,
179 .ref_ctrl = MT41K256M16HA125E_EMIF_SDREF,
180 .sdram_tim1 = MT41K256M16HA125E_EMIF_TIM1,
181 .sdram_tim2 = MT41K256M16HA125E_EMIF_TIM2,
182 .sdram_tim3 = MT41K256M16HA125E_EMIF_TIM3,
183 .zq_config = MT41K256M16HA125E_ZQ_CFG,
184 .emif_ddr_phy_ctlr_1 = MT41K256M16HA125E_EMIF_READ_LATENCY,
187 static struct emif_regs ddr3_evm_emif_reg_data = {
188 .sdram_config = MT41J512M8RH125_EMIF_SDCFG,
189 .ref_ctrl = MT41J512M8RH125_EMIF_SDREF,
190 .sdram_tim1 = MT41J512M8RH125_EMIF_TIM1,
191 .sdram_tim2 = MT41J512M8RH125_EMIF_TIM2,
192 .sdram_tim3 = MT41J512M8RH125_EMIF_TIM3,
193 .zq_config = MT41J512M8RH125_ZQ_CFG,
194 .emif_ddr_phy_ctlr_1 = MT41J512M8RH125_EMIF_READ_LATENCY |
198 #ifdef CONFIG_SPL_OS_BOOT
199 int spl_start_uboot(void)
201 /* break into full u-boot on 'c' */
202 if (serial_tstc() && serial_getc() == 'c')
205 #ifdef CONFIG_SPL_ENV_SUPPORT
208 if (getenv_yesno("boot_os") != 1)
216 #define OSC (V_OSCK/1000000)
217 const struct dpll_params dpll_ddr = {
218 266, OSC-1, 1, -1, -1, -1, -1};
219 const struct dpll_params dpll_ddr_evm_sk = {
220 303, OSC-1, 1, -1, -1, -1, -1};
221 const struct dpll_params dpll_ddr_bone_black = {
222 400, OSC-1, 1, -1, -1, -1, -1};
224 void am33xx_spl_board_init(void)
226 struct am335x_baseboard_id header;
229 if (read_eeprom(&header) < 0)
230 puts("Could not get board ID.\n");
232 /* Get the frequency */
233 dpll_mpu_opp100.m = am335x_get_efuse_mpu_max_freq(cdev);
235 if (board_is_bone(&header) || board_is_bone_lt(&header)) {
236 /* BeagleBone PMIC Code */
240 * Only perform PMIC configurations if board rev > A1
241 * on Beaglebone White
243 if (board_is_bone(&header) && !strncmp(header.version,
247 if (i2c_probe(TPS65217_CHIP_PM))
251 * On Beaglebone White we need to ensure we have AC power
252 * before increasing the frequency.
254 if (board_is_bone(&header)) {
255 uchar pmic_status_reg;
256 if (tps65217_reg_read(TPS65217_STATUS,
259 if (!(pmic_status_reg & TPS65217_PWR_SRC_AC_BITMASK)) {
260 puts("No AC power, disabling frequency switch\n");
266 * Override what we have detected since we know if we have
267 * a Beaglebone Black it supports 1GHz.
269 if (board_is_bone_lt(&header))
270 dpll_mpu_opp100.m = MPUPLL_M_1000;
273 * Increase USB current limit to 1300mA or 1800mA and set
274 * the MPU voltage controller as needed.
276 if (dpll_mpu_opp100.m == MPUPLL_M_1000) {
277 usb_cur_lim = TPS65217_USB_INPUT_CUR_LIMIT_1800MA;
278 mpu_vdd = TPS65217_DCDC_VOLT_SEL_1325MV;
280 usb_cur_lim = TPS65217_USB_INPUT_CUR_LIMIT_1300MA;
281 mpu_vdd = TPS65217_DCDC_VOLT_SEL_1275MV;
284 if (tps65217_reg_write(TPS65217_PROT_LEVEL_NONE,
287 TPS65217_USB_INPUT_CUR_LIMIT_MASK))
288 puts("tps65217_reg_write failure\n");
290 /* Set DCDC3 (CORE) voltage to 1.125V */
291 if (tps65217_voltage_update(TPS65217_DEFDCDC3,
292 TPS65217_DCDC_VOLT_SEL_1125MV)) {
293 puts("tps65217_voltage_update failure\n");
297 /* Set CORE Frequencies to OPP100 */
298 do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);
300 /* Set DCDC2 (MPU) voltage */
301 if (tps65217_voltage_update(TPS65217_DEFDCDC2, mpu_vdd)) {
302 puts("tps65217_voltage_update failure\n");
307 * Set LDO3, LDO4 output voltage to 3.3V for Beaglebone.
308 * Set LDO3 to 1.8V and LDO4 to 3.3V for Beaglebone Black.
310 if (board_is_bone(&header)) {
311 if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
313 TPS65217_LDO_VOLTAGE_OUT_3_3,
315 puts("tps65217_reg_write failure\n");
317 if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
319 TPS65217_LDO_VOLTAGE_OUT_1_8,
321 puts("tps65217_reg_write failure\n");
324 if (tps65217_reg_write(TPS65217_PROT_LEVEL_2,
326 TPS65217_LDO_VOLTAGE_OUT_3_3,
328 puts("tps65217_reg_write failure\n");
333 * The GP EVM, IDK and EVM SK use a TPS65910 PMIC. For all
334 * MPU frequencies we support we use a CORE voltage of
335 * 1.1375V. For MPU voltage we need to switch based on
336 * the frequency we are running at.
338 if (i2c_probe(TPS65910_CTRL_I2C_ADDR))
342 * Depending on MPU clock and PG we will need a different
343 * VDD to drive at that speed.
345 sil_rev = readl(&cdev->deviceid) >> 28;
346 mpu_vdd = am335x_get_tps65910_mpu_vdd(sil_rev,
349 /* Tell the TPS65910 to use i2c */
350 tps65910_set_i2c_control();
352 /* First update MPU voltage. */
353 if (tps65910_voltage_update(MPU, mpu_vdd))
356 /* Second, update the CORE voltage. */
357 if (tps65910_voltage_update(CORE, TPS65910_OP_REG_SEL_1_1_3))
360 /* Set CORE Frequencies to OPP100 */
361 do_setup_dpll(&dpll_core_regs, &dpll_core_opp100);
364 /* Set MPU Frequency to what we detected now that voltages are set */
365 do_setup_dpll(&dpll_mpu_regs, &dpll_mpu_opp100);
368 const struct dpll_params *get_dpll_ddr_params(void)
370 struct am335x_baseboard_id header;
372 enable_i2c0_pin_mux();
373 i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
374 if (read_eeprom(&header) < 0)
375 puts("Could not get board ID.\n");
377 if (board_is_evm_sk(&header))
378 return &dpll_ddr_evm_sk;
379 else if (board_is_bone_lt(&header))
380 return &dpll_ddr_bone_black;
381 else if (board_is_evm_15_or_later(&header))
382 return &dpll_ddr_evm_sk;
387 void set_uart_mux_conf(void)
389 #if CONFIG_CONS_INDEX == 1
390 enable_uart0_pin_mux();
391 #elif CONFIG_CONS_INDEX == 2
392 enable_uart1_pin_mux();
393 #elif CONFIG_CONS_INDEX == 3
394 enable_uart2_pin_mux();
395 #elif CONFIG_CONS_INDEX == 4
396 enable_uart3_pin_mux();
397 #elif CONFIG_CONS_INDEX == 5
398 enable_uart4_pin_mux();
399 #elif CONFIG_CONS_INDEX == 6
400 enable_uart5_pin_mux();
404 void set_mux_conf_regs(void)
406 __maybe_unused struct am335x_baseboard_id header;
408 if (read_eeprom(&header) < 0)
409 puts("Could not get board ID.\n");
411 enable_board_pin_mux(&header);
414 const struct ctrl_ioregs ioregs_evmsk = {
415 .cm0ioctl = MT41J128MJT125_IOCTRL_VALUE,
416 .cm1ioctl = MT41J128MJT125_IOCTRL_VALUE,
417 .cm2ioctl = MT41J128MJT125_IOCTRL_VALUE,
418 .dt0ioctl = MT41J128MJT125_IOCTRL_VALUE,
419 .dt1ioctl = MT41J128MJT125_IOCTRL_VALUE,
422 const struct ctrl_ioregs ioregs_bonelt = {
423 .cm0ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
424 .cm1ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
425 .cm2ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
426 .dt0ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
427 .dt1ioctl = MT41K256M16HA125E_IOCTRL_VALUE,
430 const struct ctrl_ioregs ioregs_evm15 = {
431 .cm0ioctl = MT41J512M8RH125_IOCTRL_VALUE,
432 .cm1ioctl = MT41J512M8RH125_IOCTRL_VALUE,
433 .cm2ioctl = MT41J512M8RH125_IOCTRL_VALUE,
434 .dt0ioctl = MT41J512M8RH125_IOCTRL_VALUE,
435 .dt1ioctl = MT41J512M8RH125_IOCTRL_VALUE,
438 const struct ctrl_ioregs ioregs = {
439 .cm0ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
440 .cm1ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
441 .cm2ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
442 .dt0ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
443 .dt1ioctl = MT47H128M16RT25E_IOCTRL_VALUE,
446 void sdram_init(void)
448 __maybe_unused struct am335x_baseboard_id header;
450 if (read_eeprom(&header) < 0)
451 puts("Could not get board ID.\n");
453 if (board_is_evm_sk(&header)) {
455 * EVM SK 1.2A and later use gpio0_7 to enable DDR3.
456 * This is safe enough to do on older revs.
458 gpio_request(GPIO_DDR_VTT_EN, "ddr_vtt_en");
459 gpio_direction_output(GPIO_DDR_VTT_EN, 1);
462 if (board_is_evm_sk(&header))
463 config_ddr(303, &ioregs_evmsk, &ddr3_data,
464 &ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0);
465 else if (board_is_bone_lt(&header))
466 config_ddr(400, &ioregs_bonelt,
467 &ddr3_beagleblack_data,
468 &ddr3_beagleblack_cmd_ctrl_data,
469 &ddr3_beagleblack_emif_reg_data, 0);
470 else if (board_is_evm_15_or_later(&header))
471 config_ddr(303, &ioregs_evm15, &ddr3_evm_data,
472 &ddr3_evm_cmd_ctrl_data, &ddr3_evm_emif_reg_data, 0);
474 config_ddr(266, &ioregs, &ddr2_data,
475 &ddr2_cmd_ctrl_data, &ddr2_emif_reg_data, 0);
480 * Basic board specific setup. Pinmux has been handled already.
484 #if defined(CONFIG_HW_WATCHDOG)
488 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
489 #if defined(CONFIG_NOR) || defined(CONFIG_NAND)
495 #ifdef CONFIG_BOARD_LATE_INIT
496 int board_late_init(void)
498 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
499 char safe_string[HDR_NAME_LEN + 1];
500 struct am335x_baseboard_id header;
502 if (read_eeprom(&header) < 0)
503 puts("Could not get board ID.\n");
505 /* Now set variables based on the header. */
506 strncpy(safe_string, (char *)header.name, sizeof(header.name));
507 safe_string[sizeof(header.name)] = 0;
508 setenv("board_name", safe_string);
510 /* BeagleBone Green eeprom, board_rev: 0x1a 0x00 0x00 0x00 */
511 if ( (header.version[0] == 0x1a) && (header.version[1] == 0x00) &&
512 (header.version[2] == 0x00) && (header.version[3] == 0x00) ) {
513 setenv("board_rev", "BBG1");
515 strncpy(safe_string, (char *)header.version, sizeof(header.version));
516 safe_string[sizeof(header.version)] = 0;
517 setenv("board_rev", safe_string);
525 #ifndef CONFIG_DM_ETH
527 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
528 (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
529 static void cpsw_control(int enabled)
531 /* VTP can be added here */
536 static struct cpsw_slave_data cpsw_slaves[] = {
538 .slave_reg_ofs = 0x208,
539 .sliver_reg_ofs = 0xd80,
543 .slave_reg_ofs = 0x308,
544 .sliver_reg_ofs = 0xdc0,
549 static struct cpsw_platform_data cpsw_data = {
550 .mdio_base = CPSW_MDIO_BASE,
551 .cpsw_base = CPSW_BASE,
554 .cpdma_reg_ofs = 0x800,
556 .slave_data = cpsw_slaves,
557 .ale_reg_ofs = 0xd00,
559 .host_port_reg_ofs = 0x108,
560 .hw_stats_reg_ofs = 0x900,
561 .bd_ram_ofs = 0x2000,
562 .mac_control = (1 << 5),
563 .control = cpsw_control,
565 .version = CPSW_CTRL_VERSION_2,
570 * This function will:
571 * Read the eFuse for MAC addresses, and set ethaddr/eth1addr/usbnet_devaddr
573 * Perform fixups to the PHY present on certain boards. We only need this
575 * - SPL with either CPSW or USB ethernet support
576 * - Full U-Boot, with either CPSW or USB ethernet
577 * Build in only these cases to avoid warnings about unused variables
578 * when we build an SPL that has neither option but full U-Boot will.
580 #if ((defined(CONFIG_SPL_ETH_SUPPORT) || defined(CONFIG_SPL_USBETH_SUPPORT)) \
581 && defined(CONFIG_SPL_BUILD)) || \
582 ((defined(CONFIG_DRIVER_TI_CPSW) || \
583 defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)) && \
584 !defined(CONFIG_SPL_BUILD))
585 int board_eth_init(bd_t *bis)
589 uint32_t mac_hi, mac_lo;
590 __maybe_unused struct am335x_baseboard_id header;
592 /* try reading mac address from efuse */
593 mac_lo = readl(&cdev->macid0l);
594 mac_hi = readl(&cdev->macid0h);
595 mac_addr[0] = mac_hi & 0xFF;
596 mac_addr[1] = (mac_hi & 0xFF00) >> 8;
597 mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
598 mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
599 mac_addr[4] = mac_lo & 0xFF;
600 mac_addr[5] = (mac_lo & 0xFF00) >> 8;
602 #if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \
603 (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD))
604 if (!getenv("ethaddr")) {
605 printf("<ethaddr> not set. Validating first E-fuse MAC\n");
607 if (is_valid_ethaddr(mac_addr))
608 eth_setenv_enetaddr("ethaddr", mac_addr);
611 #ifdef CONFIG_DRIVER_TI_CPSW
613 mac_lo = readl(&cdev->macid1l);
614 mac_hi = readl(&cdev->macid1h);
615 mac_addr[0] = mac_hi & 0xFF;
616 mac_addr[1] = (mac_hi & 0xFF00) >> 8;
617 mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
618 mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
619 mac_addr[4] = mac_lo & 0xFF;
620 mac_addr[5] = (mac_lo & 0xFF00) >> 8;
622 if (!getenv("eth1addr")) {
623 if (is_valid_ethaddr(mac_addr))
624 eth_setenv_enetaddr("eth1addr", mac_addr);
627 if (read_eeprom(&header) < 0)
628 puts("Could not get board ID.\n");
630 if (board_is_bone(&header) || board_is_bone_lt(&header) ||
631 board_is_idk(&header)) {
632 writel(MII_MODE_ENABLE, &cdev->miisel);
633 cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
634 PHY_INTERFACE_MODE_MII;
636 writel((RGMII_MODE_ENABLE | RGMII_INT_DELAY), &cdev->miisel);
637 cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if =
638 PHY_INTERFACE_MODE_RGMII;
641 rv = cpsw_register(&cpsw_data);
643 printf("Error %d registering CPSW switch\n", rv);
650 * CPSW RGMII Internal Delay Mode is not supported in all PVT
651 * operating points. So we must set the TX clock delay feature
652 * in the AR8051 PHY. Since we only support a single ethernet
653 * device in U-Boot, we only do this for the first instance.
655 #define AR8051_PHY_DEBUG_ADDR_REG 0x1d
656 #define AR8051_PHY_DEBUG_DATA_REG 0x1e
657 #define AR8051_DEBUG_RGMII_CLK_DLY_REG 0x5
658 #define AR8051_RGMII_TX_CLK_DLY 0x100
660 if (board_is_evm_sk(&header) || board_is_gp_evm(&header)) {
662 devname = miiphy_get_current_dev();
664 miiphy_write(devname, 0x0, AR8051_PHY_DEBUG_ADDR_REG,
665 AR8051_DEBUG_RGMII_CLK_DLY_REG);
666 miiphy_write(devname, 0x0, AR8051_PHY_DEBUG_DATA_REG,
667 AR8051_RGMII_TX_CLK_DLY);
670 #if defined(CONFIG_USB_ETHER) && \
671 (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT))
672 if (is_valid_ethaddr(mac_addr))
673 eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
675 rv = usb_eth_initialize(bis);
677 printf("Error %d registering USB_ETHER\n", rv);
685 #endif /* CONFIG_DM_ETH */