Changeset 14586


Ignore:
Timestamp:
06/11/10 04:26:30 (3 years ago)
Author:
BrainSlayer
Message:

final fixes for marvell switch on wr941

Location:
src/linux/pb42/linux-2.6.23/drivers/net
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • src/linux/pb42/linux-2.6.23/drivers/net/Kconfig

    r14511 r14586  
    23212321config ADM6996FC_PHY 
    23222322    bool "AdmTek 6996FC" 
     2323 
     2324config MV6060 
     2325    bool "AdmTek 6996FC" 
     2326    depends on ADM6996FC_PHY 
    23232327 
    23242328endchoice 
  • src/linux/pb42/linux-2.6.23/drivers/net/ag7100/Makefile

    r13517 r14586  
    66obj-phy-$(CONFIG_VITESSE_PHY)   =       vsc_phy.o 
    77obj-phy-$(CONFIG_ICPLUS_PHY)    =       ipPhy.o 
     8#obj-phy-$(CONFIG_NET_DSA)      =       dev-dsa.o 
    89obj-phy-$(CONFIG_REALTEK_PHY)   =       rtPhy.o 
    910obj-phy-$(CONFIG_ADM6996FC_PHY) =       adm_phy.o 
  • src/linux/pb42/linux-2.6.23/drivers/net/ag7100/adm_phy.c

    r13356 r14586  
    343343    } 
    344344 
     345#ifdef CONFIG_MV6060 
     346        /* added by lsz 30Apri07 to configure port vlan registers */ 
     347         
     348/**************************************************************************** 
     349        Port VLan: 
     350         
     351         --------------------------------------------------------------- 
     352        |       | Port6          | Port5        | Port4         | Port3         | Port2         | Port1         | Port0 | 
     353         --------------------------------------------------------------- 
     354        | Port0 |       0       |       1       |       0       |       0       |       0       |       0       |       0       | 
     355         --------------------------------------------------------------- 
     356        | Port1 |       0       |       1       |       1       |       1       |       1       |       0       |       0       | 
     357         --------------------------------------------------------------- 
     358        | Port2 |       0       |       1       |       1       |       1       |       0       |       1       |       0       | 
     359         --------------------------------------------------------------- 
     360        | Port3 |       0       |       1       |       1       |       0       |       1       |       1       |       0       | 
     361         --------------------------------------------------------------- 
     362        | Port4 |       0       |       1       |       0       |       1       |       1       |       1       |       0       | 
     363         --------------------------------------------------------------- 
     364        | Port5 |       0       |       0       |       1       |       1       |       1       |       1       |       1       | 
     365         --------------------------------------------------------------- 
     366        | Port6 |       0       |       0       |       0       |       0       |       0       |       0       |       0       | 
     367         --------------------------------------------------------------- 
     368          
     369        Port 0:         Wan 
     370        Port 1~4:       Lan 
     371 
     372        e.g. Port 0 is 010 0000, i.e. 0x20. 
     373****************************************************************************/ 
     374        #define PORT_VALN_MAP_REG       0x06 
     375        uint32_t portAddr[7] = {0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE}; 
     376         
     377        phy_reg_write(0, portAddr[0], PORT_VALN_MAP_REG, 0x103E); 
     378        phy_reg_write(0, portAddr[1], PORT_VALN_MAP_REG, 0x103D); 
     379        phy_reg_write(0, portAddr[2], PORT_VALN_MAP_REG, 0x103B); 
     380        phy_reg_write(0, portAddr[3], PORT_VALN_MAP_REG, 0x1037); 
     381        phy_reg_write(0, portAddr[4], PORT_VALN_MAP_REG, 0x102F); 
     382        phy_reg_write(0, portAddr[5], PORT_VALN_MAP_REG, 0x101F); 
     383 
     384/*      phy_reg_write(0, portAddr[0], PORT_VALN_MAP_REG, 0x1020); 
     385        phy_reg_write(0, portAddr[1], PORT_VALN_MAP_REG, 0x103C); 
     386        phy_reg_write(0, portAddr[2], PORT_VALN_MAP_REG, 0x103A); 
     387        phy_reg_write(0, portAddr[3], PORT_VALN_MAP_REG, 0x1036); 
     388        phy_reg_write(0, portAddr[4], PORT_VALN_MAP_REG, 0x102E); 
     389        phy_reg_write(0, portAddr[5], PORT_VALN_MAP_REG, 0x101F);*/ 
     390        //phy_reg_write(0, portAddr[6], PORT_VALN_MAP_REG, 0x0000); 
     391         
     392        /* added by lsz to configure header mode registers */ 
     393        #define PORT_CONTROL_REG        0x04 
     394        uint16_t reg_data = 0x8803;     /* Flow Control | Header Mode | Forwarding */ 
     395         
     396        phy_reg_write(0, portAddr[0], PORT_CONTROL_REG, 0x8003); 
     397        phy_reg_write(0, portAddr[1], PORT_CONTROL_REG, 0x8003); 
     398        phy_reg_write(0, portAddr[2], PORT_CONTROL_REG, 0x8003); 
     399        phy_reg_write(0, portAddr[3], PORT_CONTROL_REG, 0x8003); 
     400        phy_reg_write(0, portAddr[4], PORT_CONTROL_REG, 0x8003); 
     401        phy_reg_write(0, portAddr[5], PORT_CONTROL_REG, 0x8003); 
     402        phy_reg_write(0, 0x1E, PORT_CONTROL_REG, reg_data); 
     403 
     404#else 
    345405    /* 
    346406     * XXX 
    347407     */ 
    348408    phy_reg_write(0, 0, 0x10, 0x50); 
     409#endif 
    349410    return (liveLinks > 0); 
    350411} 
  • src/linux/pb42/linux-2.6.23/drivers/net/ag7100/ag7100.c

    r14516 r14586  
    16661666        * also pulls the ether header 
    16671667        */ 
    1668         skb->protocol       = eth_type_trans(skb, dev); 
    16691668        skb->dev            = dev; 
    16701669        bp->buf_pkt         = NULL; 
     
    16731672        quota--; 
    16741673 
    1675         netif_receive_skb(skb); 
     1674        if (mac->rx) 
     1675            mac->rx(skb); 
     1676        else 
     1677            { 
     1678            skb->protocol       = eth_type_trans(skb, dev); 
     1679            netif_receive_skb(skb); 
     1680            } 
    16761681#endif 
    16771682 
     
    21492154} 
    21502155 
     2156#ifdef CONFIG_NET_DSA_MV88E6060 
     2157 
     2158#include "dev-dsa.h" 
     2159 
     2160static struct dsa_chip_data tl_wr941nd_dsa_chip = { 
     2161        .port_names[0]  = "wan", 
     2162        .port_names[1]  = "lan1", 
     2163        .port_names[2]  = "lan2", 
     2164        .port_names[3]  = "lan3", 
     2165        .port_names[4]  = "lan4", 
     2166        .port_names[5]  = "cpu", 
     2167}; 
     2168 
     2169static struct dsa_platform_data tl_wr941nd_dsa_data = { 
     2170        .nr_chips       = 1, 
     2171        .chip           = &tl_wr941nd_dsa_chip, 
     2172}; 
     2173#endif 
    21512174/* 
    21522175 * All allocations (except irq and rings). 
     
    23282351            goto failed; 
    23292352        } 
    2330 #ifdef CONFIG_PHY_LAYER 
     2353 
     2354#ifdef CONFIG_NET_DSA_MV88E6060 
     2355        if (i==0) 
     2356                { 
     2357                struct mii_bus *bus = ag7100_mdiobus_setup(i,dev); 
     2358                ar71xx_add_device_dsa(0, &tl_wr941nd_dsa_data,dev,bus); 
     2359                } 
     2360#elif CONFIG_PHY_LAYER 
    23312361        ag7100_mdiobus_setup(i,dev); 
    23322362#endif 
     2363 
    23332364 
    23342365        netif_carrier_off(dev); 
     
    23512382        mdelay(100); 
    23522383 
     2384 
     2385 
    23532386    } 
    23542387    ag7100_trc_init(); 
  • src/linux/pb42/linux-2.6.23/drivers/net/ag7100/ag7100.h

    r14517 r14586  
    7171typedef struct { 
    7272    struct net_device      *mac_dev; 
     73    int (*rx)(struct sk_buff *skb); 
    7374#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) 
    7475    struct napi_struct mac_napi; 
     
    188189                                        AR7100_RESET_GE0_PHY) 
    189190 
     191#elif CONFIG_MVSWITCH_PHY 
     192#define ag7100_reset_mask(_no) (_no) ? (AR7100_RESET_GE1_MAC)   \ 
     193                                     : (AR7100_RESET_GE0_MAC) 
    190194#else 
    191195#define ag7100_reset_mask(_no) (_no) ? (AR7100_RESET_GE1_MAC |  \ 
  • src/linux/pb42/linux-2.6.23/drivers/net/ag7100/ag7100_phy.h

    r13863 r14586  
    228228} 
    229229 
    230 static inline int ag7100_mdiobus_setup(int unit,struct net_device *dev) 
     230static inline struct mii_bus *ag7100_mdiobus_setup(int unit,struct net_device *dev) 
    231231{ 
    232232  int i; 
    233233  struct phy_device *phydev = NULL; 
     234  ag7100_mac_t *mac = (ag7100_mac_t *)dev->priv; 
    234235  struct mii_bus *mii_bus = kzalloc(sizeof(struct mii_bus),GFP_KERNEL); 
    235236  mii_bus->id=unit; 
     
    244245  mdiobus_register(mii_bus); 
    245246   if (unit==0) 
     247   { 
     248//   #ifdef CONFIG_MVSWITCH_PHY 
     249//    phydev = mii_bus->phy_map[31]; 
     250//    #else 
    246251    phydev = mii_bus->phy_map[0]; 
     252//    #endif 
     253   } 
    247254   else 
    248255    phydev = mii_bus->phy_map[4]; 
     256 
    249257    if (phydev!=NULL) 
    250258    { 
    251259    phydev = phy_connect(dev, phydev->dev.bus_id, &ag7100_adjust_link, 0,PHY_INTERFACE_MODE_RMII); 
     260    mac->rx = phydev->netif_receive_skb; 
    252261    phydev->supported &= PHY_BASIC_FEATURES; 
    253262    phydev->advertising = phydev->supported; 
     
    256265    } 
    257266 
    258   return (0); 
     267  return mii_bus; 
    259268} 
    260269 
  • src/linux/pb42/linux-2.6.23/drivers/net/phy/mvswitch.c

    r13356 r14586  
    4444        int (*hardstart)(struct sk_buff *skb, struct net_device *dev); 
    4545        struct vlan_group *grp; 
    46         u8 vlans[16]; 
     46        u8 vlans[2]; 
    4747}; 
    4848 
     
    129129        *((__be32 *) buf) = cpu_to_be32(( 
    130130                (MV_TRAILER_OVERRIDE << MV_TRAILER_FLAGS_S) | 
    131                 ((priv->vlans[vid] & MV_TRAILER_PORTS_M) << MV_TRAILER_PORTS_S) 
     131                ((priv->vlans[vid] & MV_TRAILER_PORTS_M) << MV_TRAILER_PORTS_S)//|(0x10<<8) 
    132132        )); 
    133133#endif 
     
    153153        unsigned char *buf; 
    154154        int i; 
    155  
    156155        dev = skb->dev; 
    157156        if (!dev) 
     
    177176        for (i = 0; i < ARRAY_SIZE(priv->vlans); i++) { 
    178177                if ((1 << buf[1]) & priv->vlans[i]) 
     178                        { 
    179179                        vlan = i; 
     180                        goto receive; 
     181                        } 
     182                         
    180183        } 
    181184 
    182185        if (vlan == -1) 
    183186                goto error; 
    184  
     187        receive:; 
    185188        skb->protocol = eth_type_trans(skb, skb->dev); 
    186  
    187189        if (napi) 
    188190                return vlan_hwaccel_receive_skb(skb, priv->grp, vlan); 
     
    221223mvswitch_wait_mask(struct phy_device *pdev, int addr, int reg, u16 mask, u16 val) 
    222224{ 
    223         int i = 100; 
     225        int i = 1000; 
    224226        u16 r; 
    225227 
     
    293295                emask 
    294296        ); 
     297 
    295298        /* wait for the phy change to settle in */ 
    296299        msleep(2); 
     
    327330                w16(pdev, MV_PORTREG(CONTROL, i),emask); 
    328331        } 
     332//      w16(pdev, MV_PORTREG(VLANMAP, MV_CPUPORT), 
     333//                      MV_PORTVLAN_PORTS(0x1f) | 
     334//                      MV_PORTVLAN_ID(MV_CPUPORT) 
     335//              ); 
    329336 
    330337        w16(pdev, MV_PORTREG(VLANMAP, MV_CPUPORT), 
    331338                MV_PORTVLAN_ID(MV_CPUPORT) 
    332339        ); 
    333  
    334340        /* set the port association vector */ 
    335341        for (i = 0; i <= MV_PORTS; i++) { 
     
    439445        u16 reg; 
    440446        int i; 
    441  
    442447        /* we attach to phy id 31 to make sure that the late probe works */ 
    443         if (addr != 31) 
     448        if (addr != 0) 
    444449                return false; 
    445  
    446450        /* look for the switch on the bus */ 
    447451        reg = bus->read(bus, MV_PORTREG(IDENT, 0)) & MV_IDENT_MASK; 
     
    453457         * get rid of the competition :) 
    454458         */ 
    455         for (i = 0; i < 31; i++) { 
     459/*      for (i = 0; i < 31; i++) { 
    456460                if (!bus->phy_map[i]) 
    457461                        continue; 
     
    460464                kfree(bus->phy_map[i]); 
    461465                bus->phy_map[i] = NULL; 
    462         } 
     466        }*/ 
    463467 
    464468        return true; 
  • src/linux/pb42/linux-2.6.23/drivers/net/phy/mvswitch.h

    r13356 r14586  
    2828 
    2929#define MV_PORTS        5 
    30 #ifdef CONFIG_MTD_AR531X 
    3130#define MV_WANPORT      0 
    32 #else 
    33 #define MV_WANPORT      4 
    34 #endif 
    3531#define MV_CPUPORT      5 
    3632 
    37 #define MV_BASE         0x10 
     33#define MV_BASE         0 
    3834 
    3935#define MV_PHYPORT_BASE         (MV_BASE + 0x0) 
Note: See TracChangeset for help on using the changeset viewer.