]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/stmmac/common.h
stmmac: reorganise class operations.
[net-next-2.6.git] / drivers / net / stmmac / common.h
index e49e5188e88724c69212faa8e6f36726e15b1056..95782ccf44b44d54f1917bf42e1852be41b617f3 100644 (file)
@@ -239,25 +239,11 @@ static inline void stmmac_get_mac_addr(unsigned long ioaddr,
        return;
 }
 
-struct stmmac_ops {
-       /* MAC core initialization */
-       void (*core_init) (unsigned long ioaddr) ____cacheline_aligned;
-       /* DMA core initialization */
-       int (*dma_init) (unsigned long ioaddr, int pbl, u32 dma_tx, u32 dma_rx);
-       /* Dump MAC registers */
-       void (*dump_mac_regs) (unsigned long ioaddr);
-       /* Dump DMA registers */
-       void (*dump_dma_regs) (unsigned long ioaddr);
-       /* Set tx/rx threshold in the csr6 register
-        * An invalid value enables the store-and-forward mode */
-       void (*dma_mode) (unsigned long ioaddr, int txmode, int rxmode);
-       /* To track extra statistic (if supported) */
-       void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x,
-                                  unsigned long ioaddr);
-       /* RX descriptor ring initialization */
+struct stmmac_desc_ops {
+       /* DMA RX descriptor ring initialization */
        void (*init_rx_desc) (struct dma_desc *p, unsigned int ring_size,
-                               int disable_rx_ic);
-       /* TX descriptor ring initialization */
+                             int disable_rx_ic);
+       /* DMA TX descriptor ring initialization */
        void (*init_tx_desc) (struct dma_desc *p, unsigned int ring_size);
 
        /* Invoked by the xmit function to prepare the tx descriptor */
@@ -281,7 +267,6 @@ struct stmmac_ops {
        /* Get the buffer size from the descriptor */
        int (*get_tx_len) (struct dma_desc *p);
        /* Handle extra events on specific interrupts hw dependent */
-       void (*host_irq_status) (unsigned long ioaddr);
        int (*get_rx_owner) (struct dma_desc *p);
        void (*set_rx_owner) (struct dma_desc *p);
        /* Get the receive frame size */
@@ -289,6 +274,28 @@ struct stmmac_ops {
        /* Return the reception status looking at the RDES1 */
        int (*rx_status) (void *data, struct stmmac_extra_stats *x,
                          struct dma_desc *p);
+};
+
+struct stmmac_dma_ops {
+       /* DMA core initialization */
+       int (*init) (unsigned long ioaddr, int pbl, u32 dma_tx, u32 dma_rx);
+       /* Dump DMA registers */
+       void (*dump_regs) (unsigned long ioaddr);
+       /* Set tx/rx threshold in the csr6 register
+        * An invalid value enables the store-and-forward mode */
+       void (*dma_mode) (unsigned long ioaddr, int txmode, int rxmode);
+       /* To track extra statistic (if supported) */
+       void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x,
+                                  unsigned long ioaddr);
+};
+
+struct stmmac_ops {
+       /* MAC core initialization */
+       void (*core_init) (unsigned long ioaddr) ____cacheline_aligned;
+       /* Dump MAC registers */
+       void (*dump_regs) (unsigned long ioaddr);
+       /* Handle extra events on specific interrupts hw dependent */
+       void (*host_irq_status) (unsigned long ioaddr);
        /* Multicast filter setting */
        void (*set_filter) (struct net_device *dev);
        /* Flow control setting */
@@ -298,9 +305,9 @@ struct stmmac_ops {
        void (*pmt) (unsigned long ioaddr, unsigned long mode);
        /* Set/Get Unicast MAC addresses */
        void (*set_umac_addr) (unsigned long ioaddr, unsigned char *addr,
-                            unsigned int reg_n);
+                              unsigned int reg_n);
        void (*get_umac_addr) (unsigned long ioaddr, unsigned char *addr,
-                            unsigned int reg_n);
+                              unsigned int reg_n);
 };
 
 struct mac_link {
@@ -314,16 +321,13 @@ struct mii_regs {
        unsigned int data;      /* MII Data */
 };
 
-struct hw_cap {
-       unsigned int version;   /* Core Version register (GMAC) */
-       unsigned int pmt;       /* Power-Down mode (GMAC) */
-       struct mac_link link;
-       struct mii_regs mii;
-};
-
 struct mac_device_info {
-       struct hw_cap hw;
-       struct stmmac_ops *ops;
+       struct stmmac_ops       *mac;
+       struct stmmac_desc_ops  *desc;
+       struct stmmac_dma_ops   *dma;
+       unsigned int pmt;       /* support Power-Down */
+       struct mii_regs mii;    /* MII register Addresses */
+       struct mac_link link;
 };
 
 struct mac_device_info *gmac_setup(unsigned long addr);