b53: Make b53_switch_init static
[openwrt/svn-archive/archive.git] / target / linux / generic / files / drivers / net / phy / b53 / b53_common.c
index d911ab7fb539f946c923b45df6f413f7e29a2fff..b82bc9378d9ca8d72edaafff798680c7b9bc6ecc 100644 (file)
@@ -189,7 +189,8 @@ static void b53_set_vlan_entry(struct b53_device *dev, u16 vid, u16 members,
                u32 entry = 0;
 
                if (members) {
-                       entry = (untag << VA_UNTAG_S) | members;
+                       entry = ((untag & VA_UNTAG_MASK_25) << VA_UNTAG_S_25) |
+                               members;
                        if (dev->core_rev >= 3)
                                entry |= VA_VALID_25_R4 | vid << VA_VID_HIGH_S;
                        else
@@ -203,7 +204,8 @@ static void b53_set_vlan_entry(struct b53_device *dev, u16 vid, u16 members,
                u16 entry = 0;
 
                if (members)
-                       entry = (untag << VA_UNTAG_S) | members | VA_VALID_65;
+                       entry = ((untag & VA_UNTAG_MASK_65) << VA_UNTAG_S_65) |
+                               members | VA_VALID_65;
 
                b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_WRITE_65, entry);
                b53_write16(dev, B53_VLAN_PAGE, B53_VLAN_TABLE_ACCESS_65, vid |
@@ -372,7 +374,7 @@ static void b53_enable_ports(struct b53_device *dev)
                 */
                if (dev->enable_vlan || is_cpu_port(dev, i))
                        pvlan_mask = 0x1ff;
-               else if (is531x5(dev))
+               else if (is531x5(dev) || is5301x(dev))
                        /* BCM53115 may use a different port as cpu port */
                        pvlan_mask = BIT(dev->sw_dev.cpu_port);
                else
@@ -396,7 +398,7 @@ static void b53_enable_ports(struct b53_device *dev)
                            pvlan_mask);
 
                /* port state is handled by bcm63xx_enet driver */
-               if (!is63xx(dev))
+               if (!is63xx(dev) && !(is5301x(dev) && i == 6))
                        b53_write8(dev, B53_CTRL_PAGE, B53_PORT_CTRL(i),
                                   port_ctrl);
        }
@@ -457,7 +459,7 @@ static int b53_apply(struct b53_device *dev)
        return 0;
 }
 
-void b53_switch_reset_gpio(struct b53_device *dev)
+static void b53_switch_reset_gpio(struct b53_device *dev)
 {
        int gpio = dev->reset_gpio;
 
@@ -523,7 +525,7 @@ static int b53_switch_reset(struct b53_device *dev)
                                return -EINVAL;
                        }
                }
-       } else if (is531x5(dev) && dev->sw_dev.cpu_port == B53_CPU_PORT) {
+       } else if ((is531x5(dev) || is5301x(dev)) && dev->sw_dev.cpu_port == B53_CPU_PORT) {
                u8 mii_port_override;
 
                b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL,
@@ -1127,6 +1129,19 @@ static const struct b53_chip_data b53_switch_chips[] = {
                .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
                .sw_ops = &b53_switch_ops,
        },
+       {
+               .chip_id = BCM53128_DEVICE_ID,
+               .dev_name = "BCM53128",
+               .alias = "bcm53128",
+               .vlans = 4096,
+               .enabled_ports = 0x1ff,
+               .cpu_port = B53_CPU_PORT,
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+               .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+               .sw_ops = &b53_switch_ops,
+       },
        {
                .chip_id = BCM63XX_DEVICE_ID,
                .dev_name = "BCM63xx",
@@ -1140,9 +1155,74 @@ static const struct b53_chip_data b53_switch_chips[] = {
                .jumbo_size_reg = B53_JUMBO_MAX_SIZE_63XX,
                .sw_ops = &b53_switch_ops,
        },
+       {
+               .chip_id = BCM53010_DEVICE_ID,
+               .dev_name = "BCM53010",
+               .alias = "bcm53011",
+               .vlans = 4096,
+               .enabled_ports = 0x1f,
+               .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+               .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+               .sw_ops = &b53_switch_ops,
+       },
+       {
+               .chip_id = BCM53011_DEVICE_ID,
+               .dev_name = "BCM53011",
+               .alias = "bcm53011",
+               .vlans = 4096,
+               .enabled_ports = 0x1f,
+               .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+               .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+               .sw_ops = &b53_switch_ops,
+       },
+       {
+               .chip_id = BCM53012_DEVICE_ID,
+               .dev_name = "BCM53012",
+               .alias = "bcm53011",
+               .vlans = 4096,
+               .enabled_ports = 0x1f,
+               .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+               .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+               .sw_ops = &b53_switch_ops,
+       },
+       {
+               .chip_id = BCM53018_DEVICE_ID,
+               .dev_name = "BCM53018",
+               .alias = "bcm53018",
+               .vlans = 4096,
+               .enabled_ports = 0x1f,
+               .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+               .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+               .sw_ops = &b53_switch_ops,
+       },
+       {
+               .chip_id = BCM53019_DEVICE_ID,
+               .dev_name = "BCM53019",
+               .alias = "bcm53019",
+               .vlans = 4096,
+               .enabled_ports = 0x1f,
+               .cpu_port = B53_CPU_PORT_25, // TODO: auto detect
+               .vta_regs = B53_VTA_REGS,
+               .duplex_reg = B53_DUPLEX_STAT_GE,
+               .jumbo_pm_reg = B53_JUMBO_PORT_MASK,
+               .jumbo_size_reg = B53_JUMBO_MAX_SIZE,
+               .sw_ops = &b53_switch_ops,
+       },
 };
 
-int b53_switch_init(struct b53_device *dev)
+static int b53_switch_init(struct b53_device *dev)
 {
        struct switch_dev *sw_dev = &dev->sw_dev;
        unsigned i;
@@ -1296,6 +1376,12 @@ int b53_switch_detect(struct b53_device *dev)
                switch (id32) {
                case BCM53115_DEVICE_ID:
                case BCM53125_DEVICE_ID:
+               case BCM53128_DEVICE_ID:
+               case BCM53010_DEVICE_ID:
+               case BCM53011_DEVICE_ID:
+               case BCM53012_DEVICE_ID:
+               case BCM53018_DEVICE_ID:
+               case BCM53019_DEVICE_ID:
                        dev->chip_id = id32;
                        break;
                default: