Changeset 457b4fc in rtems-libbsd
- Timestamp:
- 09/12/18 13:15:12 (6 years ago)
- Branches:
- 5, 5-freebsd-12, 6-freebsd-12, master
- Children:
- d101ed8
- Parents:
- 860d833
- git-author:
- Sebastian Huber <sebastian.huber@…> (09/12/18 13:15:12)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (09/21/18 08:29:43)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libbsd.py
r860d833 r457b4fc 314 314 'sys/dev/dw_mmc/dw_mmc.c', 315 315 'sys/dev/ffec/if_ffec_mcf548x.c', 316 'sys/dev/ffec/if_ffec_mpc8xx.c', 316 317 'sys/dev/input/touchscreen/tsc_lpc32xx.c', 317 318 'sys/dev/smc/if_smc_nexus.c', -
rtemsbsd/include/bsp/nexus-devices.h
r860d833 r457b4fc 176 176 #endif /* QORIQ_CHIP_IS_T_VARIANT(QORIQ_CHIP_VARIANT) */ 177 177 178 #elif defined(LIBBSP_POWERPC_TQM8XX_BSP_H) 179 180 RTEMS_BSD_DEFINE_NEXUS_DEVICE(fec, 0, 0, NULL); 181 178 182 #endif 179 183 -
rtemsbsd/sys/dev/ffec/if_ffec_mpc8xx.c
r860d833 r457b4fc 52 52 53 53 #include <bsp.h> 54 55 #ifdef LIBBSP_POWERPC_TQM8XX_BSP_H 56 54 57 #include <stdio.h> 55 #include <errno.h>56 #include <rtems/error.h>57 #include <rtems/rtems_bsdnet.h>58 #include <rtems/rtems_mii_ioctl.h>59 58 60 59 #include <sys/param.h> 60 #include <sys/types.h> 61 61 #include <sys/mbuf.h> 62 #include <sys/malloc.h> 63 #include <sys/kernel.h> 64 #include <sys/module.h> 62 65 #include <sys/socket.h> 63 66 #include <sys/sockio.h> 64 67 68 #include <sys/bus.h> 69 #include <machine/bus.h> 70 65 71 #include <net/if.h> 66 67 #include <netinet/in.h> 68 #include <netinet/if_ether.h> 72 #include <net/ethernet.h> 73 #include <net/if_arp.h> 74 #include <net/if_dl.h> 75 #include <net/if_media.h> 76 #include <net/if_types.h> 77 #include <net/if_var.h> 78 69 79 #include <bsp/irq.h> 70 71 #include <sys/types.h> 72 #include <sys/socket.h> 80 #include <rtems/rtems_mii_ioctl.h> 81 #include <rtems/bsd/bsd.h> 82 #include <errno.h> 83 84 /* FIXME */ 85 rtems_id 86 rtems_bsdnet_newproc (char *name, int stacksize, void(*entry)(void *), void *arg); 87 #define SIO_RTEMS_SHOW_STATS _IO('i', 250) 73 88 74 89 /* … … 117 132 */ 118 133 struct m8xx_fec_enet_struct { 119 struct arpcom arpcom; 134 device_t dev; 135 struct ifnet *ifp; 136 struct mtx mtx; 120 137 struct mbuf **rxMbuf; 121 138 struct mbuf **txMbuf; 122 int acceptBroadcast;123 139 int rxBdCount; 124 140 int txBdCount; … … 126 142 int txBdTail; 127 143 int txBdActiveCount; 144 struct callout watchdogCallout; 128 145 m8xxBufferDescriptor_t *rxBdBase; 129 146 m8xxBufferDescriptor_t *txBdBase; 130 147 rtems_id rxDaemonTid; 131 148 rtems_id txDaemonTid; 149 int if_flags; 132 150 133 151 /* … … 159 177 unsigned long txRawWait; 160 178 }; 161 static struct m8xx_fec_enet_struct enet_driver[NIFACES]; 179 180 int fec_mode_adapt (struct ifnet *ifp); 181 182 #define FEC_LOCK(sc) mtx_lock(&(sc)->mtx) 183 184 #define FEC_UNLOCK(sc) mtx_unlock(&(sc)->mtx) 185 186 #define FEC_EVENT RTEMS_EVENT_0 187 188 static void fec_send_event(rtems_id task, rtems_event_set out) 189 { 190 rtems_event_send(task, out); 191 } 192 193 static void fec_wait_for_event(struct m8xx_fec_enet_struct *sc, 194 rtems_event_set in) 195 { 196 rtems_event_set out; 197 198 FEC_UNLOCK(sc); 199 rtems_event_receive(in, RTEMS_EVENT_ANY | RTEMS_WAIT, RTEMS_NO_TIMEOUT, 200 &out); 201 FEC_LOCK(sc); 202 } 162 203 163 204 /* declare ioctl function for internal use */ … … 325 366 * FEC interrupt handler 326 367 */ 327 static void m8xx_fec_interrupt_handler (void *unused) 328 { 368 static void m8xx_fec_interrupt_handler (void *arg) 369 { 370 struct m8xx_fec_enet_struct *sc = arg; 371 329 372 /* 330 373 * Frame received? … … 332 375 if (m8xx.fec.ievent & M8xx_FEC_IEVENT_RFINT) { 333 376 m8xx.fec.ievent = M8xx_FEC_IEVENT_RFINT; 334 enet_driver[0].rxInterrupts++;335 rtems_bsdnet_event_send (enet_driver[0].rxDaemonTid, INTERRUPT_EVENT);377 sc->rxInterrupts++; 378 fec_send_event (sc->rxDaemonTid, INTERRUPT_EVENT); 336 379 } 337 380 … … 341 384 if (m8xx.fec.ievent & M8xx_FEC_IEVENT_TFINT) { 342 385 m8xx.fec.ievent = M8xx_FEC_IEVENT_TFINT; 343 enet_driver[0].txInterrupts++; 344 rtems_bsdnet_event_send (enet_driver[0].txDaemonTid, INTERRUPT_EVENT); 345 } 346 } 347 348 /* 349 * Please organize FEC controller code better by moving code from 350 * m860_fec_initialize_hardware to m8xx_fec_ethernet_on 351 */ 352 static void m8xx_fec_ethernet_on(const rtems_irq_connect_data* ptr){}; 353 static void m8xx_fec_ethernet_off(const rtems_irq_connect_data* ptr){}; 354 static int m8xx_fec_ethernet_isOn (const rtems_irq_connect_data* ptr) 355 { 356 return 1; 357 } 358 359 static rtems_irq_connect_data ethernetFECIrqData = { 360 BSP_FAST_ETHERNET_CTRL, 361 m8xx_fec_interrupt_handler, 362 NULL, 363 m8xx_fec_ethernet_on, 364 m8xx_fec_ethernet_off, 365 m8xx_fec_ethernet_isOn 366 }; 386 sc->txInterrupts++; 387 fec_send_event (sc->txDaemonTid, INTERRUPT_EVENT); 388 } 389 } 367 390 368 391 static void … … 371 394 int i; 372 395 unsigned char *hwaddr; 396 rtems_status_code status; 373 397 374 398 /* … … 410 434 * Set our physical address 411 435 */ 412 hwaddr = sc->arpcom.ac_enaddr;436 hwaddr = IF_LLADDR(sc->ifp); 413 437 414 438 m8xx.fec.addr_low = (hwaddr[0] << 24) | (hwaddr[1] << 16) | … … 431 455 */ 432 456 sc->rxMbuf = malloc (sc->rxBdCount * sizeof *sc->rxMbuf, 433 M_ MBUF, M_NOWAIT);457 M_TEMP, M_NOWAIT); 434 458 sc->txMbuf = malloc (sc->txBdCount * sizeof *sc->txMbuf, 435 M_ MBUF, M_NOWAIT);459 M_TEMP, M_NOWAIT); 436 460 if (!sc->rxMbuf || !sc->txMbuf) 437 461 rtems_panic ("No memory for mbuf pointers"); … … 503 527 * Set up interrupts 504 528 */ 505 if (!BSP_install_rtems_irq_handler (ðernetFECIrqData)) 529 status = rtems_interrupt_handler_install(BSP_FAST_ETHERNET_CTRL, "FEC", 530 RTEMS_INTERRUPT_UNIQUE, 531 m8xx_fec_interrupt_handler, sc); 532 if (status != RTEMS_SUCCESSFUL) 506 533 rtems_panic ("Can't attach M860 FEC interrupt handler\n"); 507 534 … … 510 537 { 511 538 struct m8xx_fec_enet_struct *sc = (struct m8xx_fec_enet_struct *)arg; 512 struct ifnet *ifp = &sc->arpcom.ac_if;539 struct ifnet *ifp = sc->ifp; 513 540 struct mbuf *m; 514 541 uint16_t status; … … 516 543 int rxBdIndex; 517 544 545 FEC_LOCK(sc); 546 518 547 /* 519 548 * Allocate space for incoming packets and start reception … … 521 550 for (rxBdIndex = 0 ; ;) { 522 551 rxBd = sc->rxBdBase + rxBdIndex; 523 MGETHDR (m, M_WAIT, MT_DATA); 524 MCLGET (m, M_WAIT); 552 m = m_getcl(M_WAITOK, MT_DATA, M_PKTHDR); 525 553 m->m_pkthdr.rcvif = ifp; 526 554 sc->rxMbuf[rxBdIndex] = m; … … 558 586 */ 559 587 while ((status = rxBd->status) & M8xx_BD_EMPTY) { 560 rtems_event_set events;561 562 588 /* 563 589 * Unmask RXF (Full frame received) event … … 565 591 m8xx.fec.ievent |= M8xx_FEC_IEVENT_RFINT; 566 592 567 rtems_bsdnet_event_receive (INTERRUPT_EVENT, 568 RTEMS_WAIT|RTEMS_EVENT_ANY, 569 RTEMS_NO_TIMEOUT, 570 &events); 593 fec_wait_for_event (sc, INTERRUPT_EVENT); 571 594 } 572 595 } … … 580 603 * FIXME: Packet filtering hook could be done here. 581 604 */ 582 struct ether_header *eh;583 605 584 606 /* … … 588 610 589 611 m = sc->rxMbuf[rxBdIndex]; 590 m->m_len = m->m_pkthdr.len = rxBd->length - 591 sizeof(uint32_t) - 592 sizeof(struct ether_header); 593 eh = mtod (m, struct ether_header *); 594 m->m_data += sizeof(struct ether_header); 595 ether_input (ifp, eh, m); 612 m->m_len = m->m_pkthdr.len = rxBd->length - sizeof(uint32_t); 613 FEC_UNLOCK(sc); 614 (*sc->ifp->if_input)(sc->ifp, m); 615 FEC_LOCK(sc); 596 616 597 617 /* 598 618 * Allocate a new mbuf 599 619 */ 600 MGETHDR (m, M_WAIT, MT_DATA); 601 MCLGET (m, M_WAIT); 620 m = m_getcl(M_WAITOK, MT_DATA, M_PKTHDR); 602 621 m->m_pkthdr.rcvif = ifp; 603 622 sc->rxMbuf[rxBdIndex] = m; … … 652 671 int i; 653 672 int nRetired; 654 struct mbuf *m , *n;673 struct mbuf *m; 655 674 656 675 i = sc->txBdTail; … … 674 693 M8xx_BD_UNDERRUN)) { 675 694 if (status & M8xx_BD_LATE_COLLISION) 676 enet_driver[0].txLateCollision++;695 sc->txLateCollision++; 677 696 if (status & M8xx_BD_RETRY_LIMIT) 678 enet_driver[0].txRetryLimit++;697 sc->txRetryLimit++; 679 698 if (status & M8xx_BD_UNDERRUN) 680 enet_driver[0].txUnderrun++;699 sc->txUnderrun++; 681 700 682 701 } 683 702 if (status & M8xx_BD_DEFER) 684 enet_driver[0].txDeferred++;703 sc->txDeferred++; 685 704 if (status & M8xx_BD_HEARTBEAT) 686 enet_driver[0].txHeartbeat++;705 sc->txHeartbeat++; 687 706 if (status & M8xx_BD_CARRIER_LOST) 688 enet_driver[0].txLostCarrier++;707 sc->txLostCarrier++; 689 708 } 690 709 nRetired++; … … 698 717 nRetired--; 699 718 m = sc->txMbuf[sc->txBdTail]; 700 MFREE (m, n);719 m_free(m); 701 720 if (++sc->txBdTail == sc->txBdCount) 702 721 sc->txBdTail = 0; … … 708 727 } 709 728 710 static void fec_sendpacket (struct ifnet *ifp, struct mbuf *m) 711 { 712 struct m8xx_fec_enet_struct *sc = ifp->if_softc; 729 static void fec_sendpacket (struct m8xx_fec_enet_struct *sc, struct mbuf *m) 730 { 713 731 volatile m8xxBufferDescriptor_t *firstTxBd, *txBd; 714 732 /* struct mbuf *l = NULL; */ … … 754 772 m8xx_fec_Enet_retire_tx_bd (sc); 755 773 while ((sc->txBdActiveCount + nAdded) == sc->txBdCount) { 756 rtems_event_set events;757 758 774 /* 759 775 * Unmask TXB (buffer transmitted) and … … 761 777 */ 762 778 m8xx.fec.ievent |= M8xx_FEC_IEVENT_TFINT; 763 rtems_bsdnet_event_receive (INTERRUPT_EVENT, 764 RTEMS_WAIT|RTEMS_EVENT_ANY, 765 RTEMS_NO_TIMEOUT, 766 &events); 779 fec_wait_for_event (sc, INTERRUPT_EVENT); 767 780 m8xx_fec_Enet_retire_tx_bd (sc); 768 781 } … … 808 821 * Just toss empty mbufs 809 822 */ 810 struct mbuf *n; 811 MFREE (m, n); 812 m = n; 823 m = m_free (m); 813 824 /* 814 825 if (l != NULL) … … 838 849 { 839 850 struct m8xx_fec_enet_struct *sc = (struct m8xx_fec_enet_struct *)arg; 840 struct ifnet *ifp = &sc->arpcom.ac_if;851 struct ifnet *ifp = sc->ifp; 841 852 struct mbuf *m; 842 rtems_event_set events; 853 854 FEC_LOCK(sc); 843 855 844 856 for (;;) { … … 846 858 * Wait for packet 847 859 */ 848 rtems_bsdnet_event_receive (START_TRANSMIT_EVENT, 849 RTEMS_EVENT_ANY | RTEMS_WAIT, 850 RTEMS_NO_TIMEOUT, 851 &events); 860 fec_wait_for_event (sc, START_TRANSMIT_EVENT); 852 861 853 862 /* … … 861 870 if (!m) 862 871 break; 863 fec_sendpacket ( ifp, m);872 fec_sendpacket (sc, m); 864 873 } 865 ifp->if_flags &= ~IFF_OACTIVE; 866 } 867 } 874 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; 875 } 876 } 877 878 static void fec_watchdog (void *arg) 879 { 880 struct m8xx_fec_enet_struct *sc = arg; 881 882 fec_mode_adapt(sc->ifp); 883 callout_reset(&sc->watchdogCallout, FEC_WATCHDOG_TIMEOUT * hz, 884 fec_watchdog, sc); 885 } 886 868 887 static void fec_init (void *arg) 869 888 { 870 889 struct m8xx_fec_enet_struct *sc = arg; 871 struct ifnet *ifp = &sc->arpcom.ac_if;890 struct ifnet *ifp = sc->ifp; 872 891 873 892 if (sc->txDaemonTid == 0) { … … 902 921 * init timer so the "watchdog function gets called periodically 903 922 */ 904 ifp->if_timer = 1;923 callout_reset(&sc->watchdogCallout, hz, fec_watchdog, sc); 905 924 906 925 /* 907 926 * Tell the world that we're running. 908 927 */ 909 ifp->if_ flags |= IFF_RUNNING;928 ifp->if_drv_flags |= IFF_DRV_RUNNING; 910 929 911 930 /* … … 923 942 struct m8xx_fec_enet_struct *sc = ifp->if_softc; 924 943 925 rtems_bsdnet_event_send (sc->txDaemonTid, START_TRANSMIT_EVENT);926 ifp->if_ flags |= IFF_OACTIVE;927 } 928 929 static void fec_stop (struct m8xx_fec_enet_struct *sc) 930 { 931 struct ifnet *ifp = &sc->arpcom.ac_if; 932 933 ifp->if_ flags &= ~IFF_RUNNING;944 FEC_LOCK(sc); 945 ifp->if_drv_flags |= IFF_DRV_OACTIVE; 946 FEC_UNLOCK(sc); 947 fec_send_event (sc->txDaemonTid, START_TRANSMIT_EVENT); 948 } 949 950 static void fec_stop (struct ifnet *ifp) 951 { 952 ifp->if_drv_flags &= ~IFF_DRV_RUNNING; 934 953 935 954 /* … … 944 963 static void fec_enet_stats (struct m8xx_fec_enet_struct *sc) 945 964 { 946 int media;947 int result;948 /*949 * fetch/print media info950 */951 media = IFM_MAKEWORD(0,0,0,sc->phy_default); /* fetch from default phy */952 953 result = fec_ioctl(&(sc->arpcom.ac_if),954 SIOCGIFMEDIA,955 (caddr_t)&media);956 if (result == 0) {957 rtems_ifmedia2str(media,NULL,0);958 printf ("\n");959 }960 961 965 printf (" Rx Interrupts:%-8lu", sc->rxInterrupts); 962 966 printf (" Not First:%-8lu", sc->rxNotFirst); … … 993 997 rtems_mii_ioctl (&(sc->mdio_info),sc,command,(void *)data); 994 998 break; 995 case SIOCGIFADDR:996 case SIOCSIFADDR:997 ether_ioctl (ifp, command, data);998 break;999 999 1000 1000 case SIOCSIFFLAGS: 1001 switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) { 1002 case IFF_RUNNING: 1003 fec_stop (sc); 1004 break; 1005 1006 case IFF_UP: 1007 fec_init (sc); 1008 break; 1009 1010 case IFF_UP | IFF_RUNNING: 1011 fec_stop (sc); 1012 fec_init (sc); 1013 break; 1014 1015 default: 1016 break; 1001 FEC_LOCK(sc); 1002 if (ifp->if_flags & IFF_UP) { 1003 if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { 1004 fec_init (sc); 1005 } 1006 } else { 1007 if (ifp->if_drv_flags & IFF_DRV_RUNNING) 1008 fec_stop (ifp); 1017 1009 } 1010 sc->if_flags = ifp->if_flags; 1011 FEC_UNLOCK(sc); 1018 1012 break; 1019 1013 … … 1026 1020 */ 1027 1021 default: 1028 error = EINVAL;1022 error = ether_ioctl(ifp, command, data); 1029 1023 break; 1030 1024 } … … 1119 1113 } 1120 1114 1121 /*=========================================================================*\ 1122 | Function: | 1123 \*-------------------------------------------------------------------------*/ 1124 static void fec_watchdog 1125 ( 1126 /*-------------------------------------------------------------------------*\ 1127 | Purpose: | 1128 | periodically poll the PHY. if mode has changed, | 1129 | then adjust the FEC settings | 1130 +---------------------------------------------------------------------------+ 1131 | Input Parameters: | 1132 \*-------------------------------------------------------------------------*/ 1133 struct ifnet *ifp 1134 ) 1135 /*-------------------------------------------------------------------------*\ 1136 | Return Value: | 1137 | 1, if success | 1138 \*=========================================================================*/ 1139 { 1140 fec_mode_adapt(ifp); 1141 ifp->if_timer = FEC_WATCHDOG_TIMEOUT; 1142 } 1143 1144 int rtems_fec_driver_attach (struct rtems_bsdnet_ifconfig *config) 1115 static int fec_attach (device_t dev) 1145 1116 { 1146 1117 struct m8xx_fec_enet_struct *sc; 1147 1118 struct ifnet *ifp; 1148 int mtu; 1149 int unitNumber; 1150 char *unitName; 1151 static const uint8_t maczero[] ={0,0,0,0,0,0}; 1152 1153 /* 1154 * Parse driver name 1155 */ 1156 if ((unitNumber = rtems_bsdnet_parse_driver_name (config, &unitName)) < 0) 1157 return 0; 1158 1159 /* 1160 * Is driver free? 1161 */ 1162 if ((unitNumber <= 0) || (unitNumber > NIFACES)) { 1163 printk ("Bad FEC unit number.\n"); 1164 return 0; 1165 } 1166 sc = &enet_driver[unitNumber - 1]; 1167 ifp = &sc->arpcom.ac_if; 1168 if (ifp->if_softc != NULL) { 1169 printk ("Driver already in use.\n"); 1170 return 0; 1171 } 1172 1173 /* 1174 * Process options 1175 */ 1176 if (config->hardware_address) { 1177 memcpy (sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); 1178 } 1179 #ifdef BSP_HAS_TQMMON 1180 else if(0 != memcmp(maczero,TQM_BD_INFO.eth_addr,ETHER_ADDR_LEN)) { 1181 memcpy (sc->arpcom.ac_enaddr, TQM_BD_INFO.eth_addr, ETHER_ADDR_LEN); 1182 } 1183 #endif 1184 else { 1185 /* FIXME to read the enaddr from NVRAM */ 1186 } 1187 if (config->mtu) 1188 mtu = config->mtu; 1189 else 1190 mtu = ETHERMTU; 1191 if (config->rbuf_count) 1192 sc->rxBdCount = config->rbuf_count; 1193 else 1194 sc->rxBdCount = RX_BUF_COUNT; 1195 if (config->xbuf_count) 1196 sc->txBdCount = config->xbuf_count; 1197 else 1198 sc->txBdCount = TX_BUF_COUNT * TX_BD_PER_BUF; 1199 sc->acceptBroadcast = !config->ignore_broadcast; 1119 int unitNumber = device_get_unit(dev); 1120 uint8_t hwaddr[ETHER_ADDR_LEN]; 1121 1122 /* 1123 * enable FEC functionality at hardware pins* 1124 * PD[3-15] are FEC pins 1125 */ 1126 m8xx.pdpar |= 0x1fff; 1127 m8xx.pddir |= 0x1fff; 1128 1129 rtems_bsd_get_mac_address(device_get_name(dev), device_get_unit(dev), 1130 hwaddr); 1131 1132 sc = device_get_softc(dev); 1133 sc->dev = dev; 1134 sc->ifp = ifp = if_alloc(IFT_ETHER); 1135 1136 mtx_init(&sc->mtx, device_get_nameunit(sc->dev), MTX_NETWORK_LOCK, MTX_DEF); 1137 callout_init_mtx(&sc->watchdogCallout, &sc->mtx, 0); 1138 1139 sc->rxBdCount = RX_BUF_COUNT; 1140 sc->txBdCount = TX_BUF_COUNT * TX_BD_PER_BUF; 1200 1141 1201 1142 /* … … 1214 1155 */ 1215 1156 ifp->if_softc = sc; 1216 ifp->if_unit = unitNumber; 1217 ifp->if_name = unitName; 1218 ifp->if_mtu = mtu; 1157 if_initname(ifp, device_get_name(dev), device_get_unit(dev)); 1219 1158 ifp->if_init = fec_init; 1220 1159 ifp->if_ioctl = fec_ioctl; 1221 1160 ifp->if_start = m8xx_fec_enet_start; 1222 ifp->if_output = ether_output; 1223 ifp->if_watchdog = fec_watchdog; /* XXX: timer is set in "init" */ 1224 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; 1225 if (ifp->if_snd.ifq_maxlen == 0) 1226 ifp->if_snd.ifq_maxlen = ifqmaxlen; 1161 ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST | IFF_SIMPLEX; 1162 IFQ_SET_MAXLEN(&ifp->if_snd, sc->txBdCount - 1); 1163 ifp->if_snd.ifq_drv_maxlen = sc->txBdCount - 1; 1164 IFQ_SET_READY(&ifp->if_snd); 1227 1165 1228 1166 /* 1229 1167 * Attach the interface 1230 1168 */ 1231 if_attach (ifp); 1232 ether_ifattach (ifp); 1233 return 1; 1169 ether_ifattach (ifp, hwaddr); 1170 return 0; 1234 1171 }; 1235 1172 1236 int rtems_fec_enet_driver_attach(struct rtems_bsdnet_ifconfig *config, 1237 int attaching) 1238 { 1239 /* 1240 * enable FEC functionality at hardware pins* 1241 * PD[3-15] are FEC pins 1242 */ 1243 if (attaching) { 1244 m8xx.pdpar |= 0x1fff; 1245 m8xx.pddir |= 0x1fff; 1246 } 1247 return rtems_fec_driver_attach(config); 1248 } 1173 static int 1174 fec_probe(device_t dev) 1175 { 1176 int unit = device_get_unit(dev); 1177 int error; 1178 1179 if (unit >= 0 && unit < NIFACES) { 1180 error = BUS_PROBE_DEFAULT; 1181 } else { 1182 error = ENXIO; 1183 } 1184 1185 return (error); 1186 } 1187 1188 static device_method_t fec_methods[] = { 1189 /* Device interface */ 1190 DEVMETHOD(device_probe, fec_probe), 1191 DEVMETHOD(device_attach, fec_attach), 1192 1193 DEVMETHOD_END 1194 }; 1195 1196 static driver_t fec_nexus_driver = { 1197 "fec", 1198 fec_methods, 1199 sizeof(struct m8xx_fec_enet_struct) 1200 }; 1201 1202 static devclass_t fec_devclass; 1203 DRIVER_MODULE(fec, nexus, fec_nexus_driver, fec_devclass, 0, 0); 1204 MODULE_DEPEND(fec, nexus, 1, 1, 1); 1205 MODULE_DEPEND(fec, ether, 1, 1, 1); 1206 1207 #endif /* LIBBSP_POWERPC_TQM8XX_BSP_H */
Note: See TracChangeset
for help on using the changeset viewer.