2 * Ethernet driver for TI TMS320DM644x (DaVinci) chips.
4 * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
6 * Parts shamelessly stolen from TI's dm644x_emac.c. Original copyright
9 * ----------------------------------------------------------------------------
13 * TI DaVinci (DM644X) EMAC peripheral driver source for DV-EVM
15 * Copyright (C) 2005 Texas Instruments.
17 * ----------------------------------------------------------------------------
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 * ----------------------------------------------------------------------------
35 * ver. 1.0: Sep 2005, Anant Gole - Created EMAC version for uBoot.
36 * ver 1.1: Nov 2005, Anant Gole - Extended the RX logic for multiple descriptors
44 #include <asm/arch/emac_defs.h>
47 unsigned int emac_dbg = 0;
48 #define debug_emac(fmt,args...) if (emac_dbg) printf(fmt,##args)
50 #ifdef DAVINCI_EMAC_GIG_ENABLE
51 #define emac_gigabit_enable() davinci_eth_gigabit_enable()
53 #define emac_gigabit_enable() /* no gigabit to enable */
56 static void davinci_eth_mdio_enable(void);
58 static int gen_init_phy(int phy_addr);
59 static int gen_is_phy_connected(int phy_addr);
60 static int gen_get_link_speed(int phy_addr);
61 static int gen_auto_negotiate(int phy_addr);
63 void eth_mdio_enable(void)
65 davinci_eth_mdio_enable();
69 static volatile emac_regs *adap_emac = (emac_regs *)EMAC_BASE_ADDR;
70 static volatile ewrap_regs *adap_ewrap = (ewrap_regs *)EMAC_WRAPPER_BASE_ADDR;
71 static volatile mdio_regs *adap_mdio = (mdio_regs *)EMAC_MDIO_BASE_ADDR;
73 /* EMAC descriptors */
74 static volatile emac_desc *emac_rx_desc = (emac_desc *)(EMAC_WRAPPER_RAM_ADDR + EMAC_RX_DESC_BASE);
75 static volatile emac_desc *emac_tx_desc = (emac_desc *)(EMAC_WRAPPER_RAM_ADDR + EMAC_TX_DESC_BASE);
76 static volatile emac_desc *emac_rx_active_head = 0;
77 static volatile emac_desc *emac_rx_active_tail = 0;
78 static int emac_rx_queue_active = 0;
80 /* Receive packet buffers */
81 static unsigned char emac_rx_buffers[EMAC_MAX_RX_BUFFERS * (EMAC_MAX_ETHERNET_PKT_SIZE + EMAC_PKT_ALIGN)];
85 /* PHY address for a discovered PHY (0xff - not found) */
86 static u_int8_t active_phy_addr[MAX_PHY] = { 0xff, 0xff, 0xff };
88 /* number of PHY found active */
89 static u_int8_t num_phy;
93 static int davinci_eth_set_mac_addr(struct eth_device *dev)
99 * Set MAC Addresses & Init multicast Hash to 0 (disable any multicast
101 * Using channel 0 only - other channels are disabled
103 writel(0, &adap_emac->MACINDEX);
104 mac_hi = (dev->enetaddr[3] << 24) |
105 (dev->enetaddr[2] << 16) |
106 (dev->enetaddr[1] << 8) |
108 mac_lo = (dev->enetaddr[5] << 8) |
111 writel(mac_hi, &adap_emac->MACADDRHI);
112 #if defined(DAVINCI_EMAC_VERSION2)
113 writel(mac_lo | EMAC_MAC_ADDR_IS_VALID | EMAC_MAC_ADDR_MATCH,
114 &adap_emac->MACADDRLO);
116 writel(mac_lo, &adap_emac->MACADDRLO);
119 writel(0, &adap_emac->MACHASH1);
120 writel(0, &adap_emac->MACHASH2);
122 /* Set source MAC address - REQUIRED */
123 writel(mac_hi, &adap_emac->MACSRCADDRHI);
124 writel(mac_lo, &adap_emac->MACSRCADDRLO);
130 static void davinci_eth_mdio_enable(void)
134 clkdiv = (EMAC_MDIO_BUS_FREQ / EMAC_MDIO_CLOCK_FREQ) - 1;
136 writel((clkdiv & 0xff) |
137 MDIO_CONTROL_ENABLE |
139 MDIO_CONTROL_FAULT_ENABLE,
140 &adap_mdio->CONTROL);
142 while (readl(&adap_mdio->CONTROL) & MDIO_CONTROL_IDLE)
147 * Tries to find an active connected PHY. Returns 1 if address if found.
148 * If no active PHY (or more than one PHY) found returns 0.
149 * Sets active_phy_addr variable.
151 static int davinci_eth_phy_detect(void)
153 u_int32_t phy_act_state;
156 unsigned int count = 0;
158 active_phy_addr[0] = 0xff;
159 active_phy_addr[1] = 0xff;
160 active_phy_addr[2] = 0xff;
163 phy_act_state = readl(&adap_mdio->ALIVE);
165 if (phy_act_state == 0)
166 return 0; /* No active PHYs */
168 debug_emac("davinci_eth_phy_detect(), ALIVE = 0x%08x\n", phy_act_state);
170 for (i = 0, j = 0; i < 32; i++)
171 if (phy_act_state & (1 << i)) {
173 active_phy_addr[j++] = i;
182 /* Read a PHY register via MDIO inteface. Returns 1 on success, 0 otherwise */
183 int davinci_eth_phy_read(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t *data)
187 while (readl(&adap_mdio->USERACCESS0) & MDIO_USERACCESS0_GO)
190 writel(MDIO_USERACCESS0_GO |
191 MDIO_USERACCESS0_WRITE_READ |
192 ((reg_num & 0x1f) << 21) |
193 ((phy_addr & 0x1f) << 16),
194 &adap_mdio->USERACCESS0);
196 /* Wait for command to complete */
197 while ((tmp = readl(&adap_mdio->USERACCESS0)) & MDIO_USERACCESS0_GO)
200 if (tmp & MDIO_USERACCESS0_ACK) {
201 *data = tmp & 0xffff;
209 /* Write to a PHY register via MDIO inteface. Blocks until operation is complete. */
210 int davinci_eth_phy_write(u_int8_t phy_addr, u_int8_t reg_num, u_int16_t data)
213 while (readl(&adap_mdio->USERACCESS0) & MDIO_USERACCESS0_GO)
216 writel(MDIO_USERACCESS0_GO |
217 MDIO_USERACCESS0_WRITE_WRITE |
218 ((reg_num & 0x1f) << 21) |
219 ((phy_addr & 0x1f) << 16) |
221 &adap_mdio->USERACCESS0);
223 /* Wait for command to complete */
224 while (readl(&adap_mdio->USERACCESS0) & MDIO_USERACCESS0_GO)
230 /* PHY functions for a generic PHY */
231 static int gen_init_phy(int phy_addr)
235 if (gen_get_link_speed(phy_addr)) {
236 /* Try another time */
237 ret = gen_get_link_speed(phy_addr);
243 static int gen_is_phy_connected(int phy_addr)
247 return davinci_eth_phy_read(phy_addr, MII_PHYSID1, &dummy);
250 static int get_active_phy(void)
254 for (i = 0; i < num_phy; i++)
255 if (phy[i].get_link_speed(active_phy_addr[i]))
258 return -1; /* Return error if no link */
261 static int gen_get_link_speed(int phy_addr)
265 if (davinci_eth_phy_read(phy_addr, MII_STATUS_REG, &tmp) &&
267 #if defined(CONFIG_DRIVER_TI_EMAC_USE_RMII) && \
268 defined(CONFIG_MACH_DAVINCI_DA850_EVM)
269 davinci_eth_phy_read(phy_addr, MII_LPA, &tmp);
271 /* Speed doesn't matter, there is no setting for it in EMAC. */
272 if (tmp & (LPA_100FULL | LPA_10FULL)) {
273 /* set EMAC for Full Duplex */
274 writel(EMAC_MACCONTROL_MIIEN_ENABLE |
275 EMAC_MACCONTROL_FULLDUPLEX_ENABLE,
276 &adap_emac->MACCONTROL);
278 /*set EMAC for Half Duplex */
279 writel(EMAC_MACCONTROL_MIIEN_ENABLE,
280 &adap_emac->MACCONTROL);
283 if (tmp & (LPA_100FULL | LPA_100HALF))
284 writel(readl(&adap_emac->MACCONTROL) |
285 EMAC_MACCONTROL_RMIISPEED_100,
286 &adap_emac->MACCONTROL);
288 writel(readl(&adap_emac->MACCONTROL) &
289 ~EMAC_MACCONTROL_RMIISPEED_100,
290 &adap_emac->MACCONTROL);
298 static int gen_auto_negotiate(int phy_addr)
302 unsigned long cntr = 0;
304 if (!davinci_eth_phy_read(phy_addr, MII_BMCR, &tmp))
307 val = tmp | BMCR_FULLDPLX | BMCR_ANENABLE |
309 davinci_eth_phy_write(phy_addr, MII_BMCR, val);
311 if (!davinci_eth_phy_read(phy_addr, MII_ADVERTISE, &val))
314 val |= (ADVERTISE_100FULL | ADVERTISE_100HALF | ADVERTISE_10FULL |
316 davinci_eth_phy_write(phy_addr, MII_ADVERTISE, val);
318 if (!davinci_eth_phy_read(phy_addr, MII_BMCR, &tmp))
321 /* Restart Auto_negotiation */
322 tmp |= BMCR_ANRESTART;
323 davinci_eth_phy_write(phy_addr, MII_BMCR, tmp);
325 /*check AutoNegotiate complete */
328 if (!davinci_eth_phy_read(phy_addr, MII_BMSR, &tmp))
331 if (tmp & BMSR_ANEGCOMPLETE)
335 } while (cntr < 200);
337 if (!davinci_eth_phy_read(phy_addr, MII_BMSR, &tmp))
340 if (!(tmp & BMSR_ANEGCOMPLETE))
343 return(gen_get_link_speed(phy_addr));
345 /* End of generic PHY functions */
348 #if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
349 static int davinci_mii_phy_read(const char *devname, unsigned char addr, unsigned char reg, unsigned short *value)
351 return(davinci_eth_phy_read(addr, reg, value) ? 0 : 1);
354 static int davinci_mii_phy_write(const char *devname, unsigned char addr, unsigned char reg, unsigned short value)
356 return(davinci_eth_phy_write(addr, reg, value) ? 0 : 1);
360 static void __attribute__((unused)) davinci_eth_gigabit_enable(void)
364 if (davinci_eth_phy_read(EMAC_MDIO_PHY_NUM, 0, &data)) {
365 if (data & (1 << 6)) { /* speed selection MSB */
367 * Check if link detected is giga-bit
368 * If Gigabit mode detected, enable gigbit in MAC
370 writel(readl(&adap_emac->MACCONTROL) |
371 EMAC_MACCONTROL_GIGFORCE |
372 EMAC_MACCONTROL_GIGABIT_ENABLE,
373 &adap_emac->MACCONTROL);
378 /* Eth device open */
379 static int davinci_eth_open(struct eth_device *dev, bd_t *bis)
382 u_int32_t clkdiv, cnt;
383 volatile emac_desc *rx_desc;
386 debug_emac("+ emac_open\n");
388 /* Reset EMAC module and disable interrupts in wrapper */
389 writel(1, &adap_emac->SOFTRESET);
390 while (readl(&adap_emac->SOFTRESET) != 0)
392 #if defined(DAVINCI_EMAC_VERSION2)
393 writel(1, &adap_ewrap->softrst);
394 while (readl(&adap_ewrap->softrst) != 0)
397 writel(0, &adap_ewrap->EWCTL);
398 for (cnt = 0; cnt < 5; cnt++) {
399 clkdiv = readl(&adap_ewrap->EWCTL);
403 #if defined(CONFIG_DRIVER_TI_EMAC_USE_RMII) && \
404 defined(CONFIG_MACH_DAVINCI_DA850_EVM)
405 adap_ewrap->c0rxen = adap_ewrap->c1rxen = adap_ewrap->c2rxen = 0;
406 adap_ewrap->c0txen = adap_ewrap->c1txen = adap_ewrap->c2txen = 0;
407 adap_ewrap->c0miscen = adap_ewrap->c1miscen = adap_ewrap->c2miscen = 0;
409 rx_desc = emac_rx_desc;
411 writel(1, &adap_emac->TXCONTROL);
412 writel(1, &adap_emac->RXCONTROL);
414 davinci_eth_set_mac_addr(dev);
416 /* Set DMA 8 TX / 8 RX Head pointers to 0 */
417 addr = &adap_emac->TX0HDP;
418 for(cnt = 0; cnt < 16; cnt++)
421 addr = &adap_emac->RX0HDP;
422 for(cnt = 0; cnt < 16; cnt++)
425 /* Clear Statistics (do this before setting MacControl register) */
426 addr = &adap_emac->RXGOODFRAMES;
427 for(cnt = 0; cnt < EMAC_NUM_STATS; cnt++)
430 /* No multicast addressing */
431 writel(0, &adap_emac->MACHASH1);
432 writel(0, &adap_emac->MACHASH2);
434 /* Create RX queue and set receive process in place */
435 emac_rx_active_head = emac_rx_desc;
436 for (cnt = 0; cnt < EMAC_MAX_RX_BUFFERS; cnt++) {
437 rx_desc->next = (u_int32_t)(rx_desc + 1);
438 rx_desc->buffer = &emac_rx_buffers[cnt * (EMAC_MAX_ETHERNET_PKT_SIZE + EMAC_PKT_ALIGN)];
439 rx_desc->buff_off_len = EMAC_MAX_ETHERNET_PKT_SIZE;
440 rx_desc->pkt_flag_len = EMAC_CPPI_OWNERSHIP_BIT;
444 /* Finalize the rx desc list */
447 emac_rx_active_tail = rx_desc;
448 emac_rx_queue_active = 1;
451 writel(EMAC_MAX_ETHERNET_PKT_SIZE, &adap_emac->RXMAXLEN);
452 writel(0, &adap_emac->RXBUFFEROFFSET);
455 * No fancy configs - Use this for promiscous debug
456 * - EMAC_RXMBPENABLE_RXCAFEN_ENABLE
458 writel(EMAC_RXMBPENABLE_RXBROADEN, &adap_emac->RXMBPENABLE);
460 /* Enable ch 0 only */
461 writel(1, &adap_emac->RXUNICASTSET);
463 /* Enable MII interface and Full duplex mode */
464 #ifdef CONFIG_SOC_DA8XX
465 writel((EMAC_MACCONTROL_MIIEN_ENABLE |
466 EMAC_MACCONTROL_FULLDUPLEX_ENABLE |
467 EMAC_MACCONTROL_RMIISPEED_100),
468 &adap_emac->MACCONTROL);
470 writel((EMAC_MACCONTROL_MIIEN_ENABLE |
471 EMAC_MACCONTROL_FULLDUPLEX_ENABLE),
472 &adap_emac->MACCONTROL);
475 /* Init MDIO & get link state */
476 clkdiv = (EMAC_MDIO_BUS_FREQ / EMAC_MDIO_CLOCK_FREQ) - 1;
477 writel((clkdiv & 0xff) | MDIO_CONTROL_ENABLE | MDIO_CONTROL_FAULT,
478 &adap_mdio->CONTROL);
480 /* We need to wait for MDIO to start */
483 index = get_active_phy();
487 emac_gigabit_enable();
489 /* Start receive process */
490 writel((u_int32_t)emac_rx_desc, &adap_emac->RX0HDP);
492 debug_emac("- emac_open\n");
497 /* EMAC Channel Teardown */
498 static void davinci_eth_ch_teardown(int ch)
503 debug_emac("+ emac_ch_teardown\n");
505 if (ch == EMAC_CH_TX) {
506 /* Init TX channel teardown */
507 writel(0, &adap_emac->TXTEARDOWN);
510 * Wait here for Tx teardown completion interrupt to
511 * occur. Note: A task delay can be called here to pend
512 * rather than occupying CPU cycles - anyway it has
513 * been found that teardown takes very few cpu cycles
514 * and does not affect functionality
520 cnt = readl(&adap_emac->TX0CP);
521 } while (cnt != 0xfffffffc);
522 writel(cnt, &adap_emac->TX0CP);
523 writel(0, &adap_emac->TX0HDP);
525 /* Init RX channel teardown */
526 writel(0, &adap_emac->RXTEARDOWN);
529 * Wait here for Rx teardown completion interrupt to
530 * occur. Note: A task delay can be called here to pend
531 * rather than occupying CPU cycles - anyway it has
532 * been found that teardown takes very few cpu cycles
533 * and does not affect functionality
539 cnt = readl(&adap_emac->RX0CP);
540 } while (cnt != 0xfffffffc);
541 writel(cnt, &adap_emac->RX0CP);
542 writel(0, &adap_emac->RX0HDP);
545 debug_emac("- emac_ch_teardown\n");
548 /* Eth device close */
549 static void davinci_eth_close(struct eth_device *dev)
551 debug_emac("+ emac_close\n");
553 davinci_eth_ch_teardown(EMAC_CH_TX); /* TX Channel teardown */
554 davinci_eth_ch_teardown(EMAC_CH_RX); /* RX Channel teardown */
556 /* Reset EMAC module and disable interrupts in wrapper */
557 writel(1, &adap_emac->SOFTRESET);
558 #if defined(DAVINCI_EMAC_VERSION2)
559 writel(1, &adap_ewrap->softrst);
561 writel(0, &adap_ewrap->EWCTL);
564 #if defined(CONFIG_DRIVER_TI_EMAC_USE_RMII) && \
565 defined(CONFIG_MACH_DAVINCI_DA850_EVM)
566 adap_ewrap->c0rxen = adap_ewrap->c1rxen = adap_ewrap->c2rxen = 0;
567 adap_ewrap->c0txen = adap_ewrap->c1txen = adap_ewrap->c2txen = 0;
568 adap_ewrap->c0miscen = adap_ewrap->c1miscen = adap_ewrap->c2miscen = 0;
570 debug_emac("- emac_close\n");
573 static int tx_send_loop = 0;
576 * This function sends a single packet on the network and returns
577 * positive number (number of bytes transmitted) or negative for error
579 static int davinci_eth_send_packet (struct eth_device *dev,
580 volatile void *packet, int length)
586 index = get_active_phy();
588 printf(" WARN: emac_send_packet: No link\n");
592 emac_gigabit_enable();
594 /* Check packet size and if < EMAC_MIN_ETHERNET_PKT_SIZE, pad it up */
595 if (length < EMAC_MIN_ETHERNET_PKT_SIZE) {
596 length = EMAC_MIN_ETHERNET_PKT_SIZE;
599 /* Populate the TX descriptor */
600 emac_tx_desc->next = 0;
601 emac_tx_desc->buffer = (u_int8_t *) packet;
602 emac_tx_desc->buff_off_len = (length & 0xffff);
603 emac_tx_desc->pkt_flag_len = ((length & 0xffff) |
605 EMAC_CPPI_OWNERSHIP_BIT |
607 /* Send the packet */
608 writel((unsigned long)emac_tx_desc, &adap_emac->TX0HDP);
610 /* Wait for packet to complete or link down */
612 if (!phy[index].get_link_speed(active_phy_addr[index])) {
613 davinci_eth_ch_teardown (EMAC_CH_TX);
617 emac_gigabit_enable();
619 if (readl(&adap_emac->TXINTSTATRAW) & 0x01) {
630 * This function handles receipt of a packet from the network
632 static int davinci_eth_rcv_packet (struct eth_device *dev)
634 volatile emac_desc *rx_curr_desc;
635 volatile emac_desc *curr_desc;
636 volatile emac_desc *tail_desc;
637 int status, ret = -1;
639 rx_curr_desc = emac_rx_active_head;
640 status = rx_curr_desc->pkt_flag_len;
641 if ((rx_curr_desc) && ((status & EMAC_CPPI_OWNERSHIP_BIT) == 0)) {
642 if (status & EMAC_CPPI_RX_ERROR_FRAME) {
643 /* Error in packet - discard it and requeue desc */
644 printf ("WARN: emac_rcv_pkt: Error in packet\n");
646 NetReceive (rx_curr_desc->buffer,
647 (rx_curr_desc->buff_off_len & 0xffff));
648 ret = rx_curr_desc->buff_off_len & 0xffff;
651 /* Ack received packet descriptor */
652 writel((unsigned long)rx_curr_desc, &adap_emac->RX0CP);
653 curr_desc = rx_curr_desc;
654 emac_rx_active_head =
655 (volatile emac_desc *) rx_curr_desc->next;
657 if (status & EMAC_CPPI_EOQ_BIT) {
658 if (emac_rx_active_head) {
659 writel((unsigned long)emac_rx_active_head,
662 emac_rx_queue_active = 0;
663 printf ("INFO:emac_rcv_packet: RX Queue not active\n");
667 /* Recycle RX descriptor */
668 rx_curr_desc->buff_off_len = EMAC_MAX_ETHERNET_PKT_SIZE;
669 rx_curr_desc->pkt_flag_len = EMAC_CPPI_OWNERSHIP_BIT;
670 rx_curr_desc->next = 0;
672 if (emac_rx_active_head == 0) {
673 printf ("INFO: emac_rcv_pkt: active queue head = 0\n");
674 emac_rx_active_head = curr_desc;
675 emac_rx_active_tail = curr_desc;
676 if (emac_rx_queue_active != 0) {
677 writel((unsigned long)emac_rx_active_head,
679 printf ("INFO: emac_rcv_pkt: active queue head = 0, HDP fired\n");
680 emac_rx_queue_active = 1;
683 tail_desc = emac_rx_active_tail;
684 emac_rx_active_tail = curr_desc;
685 tail_desc->next = (unsigned int) curr_desc;
686 status = tail_desc->pkt_flag_len;
687 if (status & EMAC_CPPI_EOQ_BIT) {
688 writel((unsigned long)curr_desc,
690 status &= ~EMAC_CPPI_EOQ_BIT;
691 tail_desc->pkt_flag_len = status;
700 * This function initializes the emac hardware. It does NOT initialize
701 * EMAC modules power or pin multiplexors, that is done by board_init()
702 * much earlier in bootup process. Returns 1 on success, 0 otherwise.
704 int davinci_emac_initialize(void)
710 struct eth_device *dev;
712 dev = malloc(sizeof *dev);
717 memset(dev, 0, sizeof *dev);
718 sprintf(dev->name, "DaVinci-EMAC");
721 dev->init = davinci_eth_open;
722 dev->halt = davinci_eth_close;
723 dev->send = davinci_eth_send_packet;
724 dev->recv = davinci_eth_rcv_packet;
725 dev->write_hwaddr = davinci_eth_set_mac_addr;
729 davinci_eth_mdio_enable();
731 /* let the EMAC detect the PHYs */
734 for (i = 0; i < 256; i++) {
735 if (readl(&adap_mdio->ALIVE))
741 printf("No ETH PHY detected!!!\n");
745 /* Find if PHY(s) is/are connected */
746 ret = davinci_eth_phy_detect();
750 printf(" %d ETH PHY detected\n", ret);
752 /* Get PHY ID and initialize phy_ops for a detected PHY */
753 for (i = 0; i < num_phy; i++) {
754 if (!davinci_eth_phy_read(active_phy_addr[i], MII_PHYSID1,
756 active_phy_addr[i] = 0xff;
760 phy_id = (tmp << 16) & 0xffff0000;
762 if (!davinci_eth_phy_read(active_phy_addr[i], MII_PHYSID2,
764 active_phy_addr[i] = 0xff;
768 phy_id |= tmp & 0x0000ffff;
772 sprintf(phy[i].name, "KSZ8873 @ 0x%02x",
774 phy[i].init = ksz8873_init_phy;
775 phy[i].is_phy_connected = ksz8873_is_phy_connected;
776 phy[i].get_link_speed = ksz8873_get_link_speed;
777 phy[i].auto_negotiate = ksz8873_auto_negotiate;
780 sprintf(phy[i].name, "LXT972 @ 0x%02x",
782 phy[i].init = lxt972_init_phy;
783 phy[i].is_phy_connected = lxt972_is_phy_connected;
784 phy[i].get_link_speed = lxt972_get_link_speed;
785 phy[i].auto_negotiate = lxt972_auto_negotiate;
788 sprintf(phy[i].name, "DP83848 @ 0x%02x",
790 phy[i].init = dp83848_init_phy;
791 phy[i].is_phy_connected = dp83848_is_phy_connected;
792 phy[i].get_link_speed = dp83848_get_link_speed;
793 phy[i].auto_negotiate = dp83848_auto_negotiate;
796 sprintf(phy[i].name, "ET1011C @ 0x%02x",
798 phy[i].init = gen_init_phy;
799 phy[i].is_phy_connected = gen_is_phy_connected;
800 phy[i].get_link_speed = et1011c_get_link_speed;
801 phy[i].auto_negotiate = gen_auto_negotiate;
804 sprintf(phy[i].name, "GENERIC @ 0x%02x",
806 phy[i].init = gen_init_phy;
807 phy[i].is_phy_connected = gen_is_phy_connected;
808 phy[i].get_link_speed = gen_get_link_speed;
809 phy[i].auto_negotiate = gen_auto_negotiate;
812 debug("Ethernet PHY: %s\n", phy.name);
814 miiphy_register(phy[i].name, davinci_mii_phy_read,
815 davinci_mii_phy_write);