Changeset 31003


Ignore:
Timestamp:
2012-03-18T23:06:33+01:00 (6 years ago)
Author:
juhosg
Message:

generic: ar8216: add caps field to ar8xxx_chip

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/generic/files/drivers/net/phy/ar8216.c

    r31002 r31003  
    3939struct ar8216_priv; 
    4040 
     41#define AR8XXX_CAP_GIGE         BIT(0) 
     42 
    4143struct ar8xxx_chip { 
     44        unsigned long caps; 
     45 
    4246        int (*hw_init)(struct ar8216_priv *priv); 
    4347        void (*init_port)(struct ar8216_priv *priv, int port); 
     
    7478 
    7579#define to_ar8216(_dev) container_of(_dev, struct ar8216_priv, dev) 
     80 
     81static inline bool ar8xxx_has_gige(struct ar8216_priv *priv) 
     82{ 
     83        return priv->chip->caps & AR8XXX_CAP_GIGE; 
     84} 
    7685 
    7786static inline void 
     
    758767                priv->write(priv, AR8216_REG_PORT_STATUS(port), 
    759768                        AR8216_PORT_STATUS_LINK_UP | 
    760                         ((priv->chip_type == AR8316) ? 
    761                                 AR8216_PORT_SPEED_1000M : AR8216_PORT_SPEED_100M) | 
     769                        ar8xxx_has_gige(priv) ? AR8216_PORT_SPEED_1000M : 
     770                                                AR8216_PORT_SPEED_100M | 
    762771                        AR8216_PORT_STATUS_TXMAC | 
    763772                        AR8216_PORT_STATUS_RXMAC | 
     
    790799 
    791800static const struct ar8xxx_chip ar8316_chip = { 
     801        .caps = AR8XXX_CAP_GIGE, 
    792802        .hw_init = ar8316_hw_init, 
    793803        .init_port = ar8216_init_port, 
     
    918928 
    919929        if (pdev->addr != 0) { 
    920                 if (priv->chip_type == AR8316) { 
     930                if (ar8xxx_has_gige(priv)) { 
    921931                        pdev->supported |= SUPPORTED_1000baseT_Full; 
    922932                        pdev->advertising |= ADVERTISED_1000baseT_Full; 
    923  
     933                } 
     934 
     935                if (priv->chip_type == AR8316) { 
    924936                        /* check if we're attaching to the switch twice */ 
    925937                        pdev = pdev->bus->phy_map[0]; 
     
    954966                pdev->attached_dev->name, priv->chip_type); 
    955967 
    956         pdev->supported = priv->chip_type == AR8316 ? 
    957                 SUPPORTED_1000baseT_Full : SUPPORTED_100baseT_Full; 
     968        if (ar8xxx_has_gige(priv)) 
     969                pdev->supported = SUPPORTED_1000baseT_Full; 
     970        else 
     971                pdev->supported = SUPPORTED_100baseT_Full; 
    958972        pdev->advertising = pdev->supported; 
    959973 
Note: See TracChangeset for help on using the changeset viewer.