Commit fdc17a1b authored by Jeff Garzik's avatar Jeff Garzik

Merge pobox.com:/garz/repo/netdev-2.6/emac

into pobox.com:/garz/repo/net-drivers-2.6
parents d103bdb4 1bdd99e3
...@@ -237,6 +237,10 @@ typedef struct emac_regs { ...@@ -237,6 +237,10 @@ typedef struct emac_regs {
#define EMAC_RWMR_DEFAULT 0x1000a200 #define EMAC_RWMR_DEFAULT 0x1000a200
#define EMAC_TMR0_DEFAULT EMAC_TMR0_TFAE_2_32 #define EMAC_TMR0_DEFAULT EMAC_TMR0_TFAE_2_32
#define EMAC_TMR1_DEFAULT 0xa00f0000 #define EMAC_TMR1_DEFAULT 0xa00f0000
#elif defined(CONFIG_440SP)
#define EMAC_RWMR_DEFAULT 0x08002000
#define EMAC_TMR0_DEFAULT EMAC_TMR0_TFAE_128_2048
#define EMAC_TMR1_DEFAULT 0xf8200000
#else #else
#define EMAC_RWMR_DEFAULT 0x0f002000 #define EMAC_RWMR_DEFAULT 0x0f002000
#define EMAC_TMR0_DEFAULT 0x00000000 #define EMAC_TMR0_DEFAULT 0x00000000
......
...@@ -1041,7 +1041,7 @@ static int emac_adjust_to_link(struct ocp_enet_private *fep) ...@@ -1041,7 +1041,7 @@ static int emac_adjust_to_link(struct ocp_enet_private *fep)
/* set speed (default is 10Mb) */ /* set speed (default is 10Mb) */
switch (speed) { switch (speed) {
case SPEED_1000: case SPEED_1000:
mode_reg |= EMAC_M1_JUMBO_ENABLE | EMAC_M1_RFS_16K; mode_reg |= EMAC_M1_RFS_16K;
if (fep->rgmii_dev) { if (fep->rgmii_dev) {
struct ibm_ocp_rgmii *rgmii = RGMII_PRIV(fep->rgmii_dev); struct ibm_ocp_rgmii *rgmii = RGMII_PRIV(fep->rgmii_dev);
...@@ -1118,6 +1118,7 @@ static int emac_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1118,6 +1118,7 @@ static int emac_change_mtu(struct net_device *dev, int new_mtu)
{ {
struct ocp_enet_private *fep = dev->priv; struct ocp_enet_private *fep = dev->priv;
int old_mtu = dev->mtu; int old_mtu = dev->mtu;
unsigned long mode_reg;
emac_t *emacp = fep->emacp; emac_t *emacp = fep->emacp;
u32 em0mr0; u32 em0mr0;
int i, full; int i, full;
...@@ -1160,10 +1161,17 @@ static int emac_change_mtu(struct net_device *dev, int new_mtu) ...@@ -1160,10 +1161,17 @@ static int emac_change_mtu(struct net_device *dev, int new_mtu)
fep->rx_skb[i] = NULL; fep->rx_skb[i] = NULL;
} }
/* Set new rx_buffer_size and advertise new mtu */ /* Set new rx_buffer_size, jumbo cap, and advertise new mtu */
fep->rx_buffer_size = mode_reg = in_be32(&emacp->em0mr1);
new_mtu + ENET_HEADER_SIZE + ENET_FCS_SIZE; if (new_mtu > ENET_DEF_MTU_SIZE) {
mode_reg |= EMAC_M1_JUMBO_ENABLE;
fep->rx_buffer_size = EMAC_MAX_FRAME;
} else {
mode_reg &= ~EMAC_M1_JUMBO_ENABLE;
fep->rx_buffer_size = ENET_DEF_BUF_SIZE;
}
dev->mtu = new_mtu; dev->mtu = new_mtu;
out_be32(&emacp->em0mr1, mode_reg);
/* Re-init rx skbs */ /* Re-init rx skbs */
fep->rx_slot = 0; fep->rx_slot = 0;
......
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
#define ENET_HEADER_SIZE 14 #define ENET_HEADER_SIZE 14
#define ENET_FCS_SIZE 4 #define ENET_FCS_SIZE 4
#define ENET_DEF_MTU_SIZE 1500
#define ENET_DEF_BUF_SIZE (ENET_DEF_MTU_SIZE + ENET_HEADER_SIZE + ENET_FCS_SIZE)
#define EMAC_MIN_FRAME 64 #define EMAC_MIN_FRAME 64
#define EMAC_MAX_FRAME 9018 #define EMAC_MAX_FRAME 9018
#define EMAC_MIN_MTU (EMAC_MIN_FRAME - ENET_HEADER_SIZE - ENET_FCS_SIZE) #define EMAC_MIN_MTU (EMAC_MIN_FRAME - ENET_HEADER_SIZE - ENET_FCS_SIZE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment