| Electronic Components Datasheet Search |
|
UM0851 Datasheet(PDF) 58 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
UM0851 Datasheet(HTML) 58 Page - STMicroelectronics |
|
58 / 245 page ![]() Communication device drivers UM0851 58/245 Doc ID 16604 Rev 2 struct macb* bp = netdev_priv(dev); The MACB driver interfaces to the kernel via the struct net_device data structure. The structure fields are initialized to provide the necessary interface. The below code is a fairly routine initialization of the struct net_device structure; it is mostly a matter of storing pointers to our various driver functions. struct net_device *dev; dev->open = macb_open; dev->stop = macb_close; dev->do_ioctl = macb_ioctl; dev->get_stats = macb_get_stats; dev->hard_start_xmit = macb_start_xmit; dev->set_multicast_list = macb_set_rx_mode; dev->dev_addr[0-5] = MAC ADDRESS; /*The private data structure use by the driver is */ struct macb { void __iomem *regs; unsigned int rx_tail; struct dma_des *rx_ring; void *rx_buffers; unsigned int tx_head, tx_tail; unsigned int lasttx_base; struct dma_desc *tx_ring; struct ring_info *tx_skb; spinlock_t lock; struct platform_device *pdev; struct net_device *dev; struct net_device_stats stats; struct macb_stats hw_stats; dma_addr_t rx_ring_dma; dma_addr_t tx_ring_dma; dma_addr_t rx_buffers_dma; unsigned int rx_pending, tx_pending; struct mii_bus mii_bus; struct mii_if_info mii; struct phy_device *phy_dev; unsigned int link; unsigned int speed; unsigned int duplex; }; PHY framework for SPEAr MACB In the MACB driver, there is a top layer (drivers/net/arm/macb_top.c) whose function is to scan all the PHY chips and to assign each of them to the corresponding MACB drivers. After scanning and verifying all the PHY chips, the top layer driver creates four (or a different number of) platform devices, which matches the MACB platform drivers. The platform contains the struct phy_device and its corresponding MACB base register address. The code below is in the top layer driver driver/net/arm/macb_top.c /* register MDIO bus of MACB */ bp->mii_bus.name = "MACB_mii_bus";bp->mii_bus.read = &macb_mdio_read;bp- >mii_bus.write = &macb_mdio_write;bp->mii_bus.reset = &macb_mdio_reset;bp- >mii_bus.id = bp->pdev->id; |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |