ibm_ocp_enet restructuring, third cut
The basics if the MAL<->EMAC separation are now complete. It now needs more helper functions in the MAL code to remove the last MAL frobbing from the EMAC part, and some cleanup of the mess in the process.
Note that in the interrupt handlers (rxeob, txeob, rxde and txde) the MAL code scans a list of COMMACS for one claiming ownership of the relevant channel. I used this approach rather than scanning the channels and having a callback registered per channel because I think this will be better suited for the HDLC adaptors that also use the MAL.
drivers/net/ibm_ocp/Makefile renamed from home/dgibson/kernel/linuxppc-2.5/drivers/net/ibm_ocp/Makefile +3 -1
@@ -13,7 +13,9 @@ obj-$(CONFIG_IBM_OCP_ENET) += ibm_ocp.o -ibm_ocp-objs := ibm_ocp_enet.o ibm_ocp_phy.o ibm_ocp_mal.o +# NB! Link order matters + +ibm_ocp-objs := ibm_ocp_mal.o ibm_ocp_enet.o ibm_ocp_phy.o # Only one of these can ever be set at a time, so this works. ifeq ($(CONFIG_NP405L)$(CONFIG_NP405H)$(CONFIG_440),y)
drivers/net/ibm_ocp/ibm_ocp_debug.c renamed from home/dgibson/kernel/linuxppc-2.5/drivers/net/ibm_ocp/ibm_ocp_debug.c +22 -22
83 lines not on this page · raw message
drivers/net/ibm_ocp/ibm_ocp_enet.c renamed from home/dgibson/kernel/linuxppc-2.5/drivers/net/ibm_ocp/ibm_ocp_enet.c +99 -163
449 lines not on this page · raw message
drivers/net/ibm_ocp/ibm_ocp_enet.h renamed from home/dgibson/kernel/linuxppc-2.5/drivers/net/ibm_ocp/ibm_ocp_enet.h +10 -18
@@ -57,6 +57,7 @@#include <asm/mmu.h> /* For phys_addr_t */ #include "ibm_ocp_emac.h" #include "ibm_ocp_phy.h" +#include "ibm_ocp_mal.h" #ifndef CONFIG_IBM_OCP_ENET_TX_BUFF #define NUM_TX_BUFF 6
@@ -84,8 +85,6 @@#define DESC_BUF_SIZE_REG (DESC_RX_BUF_SIZE / 16) -#define LAST_EMAC EMAC_NUMS -1 -#define MIN_PHY_ADDR 0x00#define MAX_PHY_ADDR 0x1f/* Transmitter timeout. */
@@ -119,24 +118,12 @@ ~EMAC_STACR_CLK_100MHZ) | \ ((VAL & 0xffff) << 16)) -/* MAL Buffer Descriptor structure */ -typedef struct { -volatile unsigned short ctrl;/* MAL / Commac status control bits */ -volatile short data_len;/* Max length is 4K-1 (12 bits) */ -unsigned char *data_ptr;/* pointer to actual data buffer */ -}mal_desc_t ; - - -struct ocp_enet_private { -uint emac_num; -uint txchan; -uint rxchan;struct sk_buff *tx_skb[NUM_TX_BUFF ];struct sk_buff *rx_skb[NUM_RX_BUFF ]; -mal_desc_t *tx_desc; -mal_desc_t *rx_desc; -mal_desc_t *rx_dirty; +struct mal_descriptor *tx_desc; +struct mal_descriptor *rx_desc; +struct mal_descriptor *rx_dirty;struct net_device_stats stats;int tx_cnt;int rx_slot;
@@ -155,9 +142,14 @@int link;int old_link;int full_duplex; +zmii_t *zmii_base;int zmii_mode; -int mal; + +struct ibm_ocp_mal *mal; +int mal_tx_chan, mal_rx_chan; +struct mal_commac commac; +volatile emac_t *emacp;struct ocp_dev ocpdev; };
drivers/net/ibm_ocp/ibm_ocp_mal.c renamed from home/dgibson/kernel/linuxppc-2.5/drivers/net/ibm_ocp/ibm_ocp_mal.c +341 -53
428 lines not on this page · raw message
drivers/net/ibm_ocp/ibm_ocp_mal.h renamed from home/dgibson/kernel/linuxppc-2.5/drivers/net/ibm_ocp/ibm_ocp_mal.h +77 -26
127 lines not on this page · raw message
drivers/net/ibm_ocp/ibm_ocp_phy.c renamed from home/dgibson/kernel/linuxppc-2.5/drivers/net/ibm_ocp/ibm_ocp_phy.c +0 -1
@@ -80,7 +80,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> -#include <linux/ptrace.h> #include <linux/errno.h> #include <linux/delay.h> #include <linux/init.h>
--
David Gibson | For every complex problem there is a
[email protected] | solution which is simple, neat and
| wrong.
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/