Skip to content

Commit 44ded7c

Browse files
committed
Merge branch 'net-dsa-b53-clean-up-cpu-imp-ports'
Rafał Miłecki says: ==================== net: dsa: b53: Clean up CPU/IMP ports This has been tested on: 1. Luxul XBR-4500 with used CPU port 5 [ 8.361438] b53-srab-switch 18007000.ethernet-switch: found switch: BCM53012, rev 0 2. Netgear R8000 with used CPU port 8 [ 4.453858] b53-srab-switch 18007000.ethernet-switch: found switch: BCM53012, rev 5 ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 561bed6 + 7d5af56 commit 44ded7c

File tree

2 files changed

+12
-48
lines changed

2 files changed

+12
-48
lines changed

drivers/net/dsa/b53/b53_common.c

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,
12221222
return;
12231223

12241224
/* Enable flow control on BCM5301x's CPU port */
1225-
if (is5301x(dev) && port == dev->cpu_port)
1225+
if (is5301x(dev) && dsa_is_cpu_port(ds, port))
12261226
tx_pause = rx_pause = true;
12271227

12281228
if (phydev->pause) {
@@ -1291,12 +1291,6 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,
12911291
return;
12921292
}
12931293
}
1294-
} else if (is5301x(dev)) {
1295-
if (port != dev->cpu_port) {
1296-
b53_force_port_config(dev, dev->cpu_port, 2000,
1297-
DUPLEX_FULL, true, true);
1298-
b53_force_link(dev, dev->cpu_port, 1);
1299-
}
13001294
}
13011295

13021296
/* Re-negotiate EEE if it was enabled already */
@@ -2302,33 +2296,30 @@ static const struct b53_chip_data b53_switch_chips[] = {
23022296
.chip_id = BCM5325_DEVICE_ID,
23032297
.dev_name = "BCM5325",
23042298
.vlans = 16,
2305-
.enabled_ports = 0x1f,
2299+
.enabled_ports = 0x3f,
23062300
.arl_bins = 2,
23072301
.arl_buckets = 1024,
23082302
.imp_port = 5,
2309-
.cpu_port = B53_CPU_PORT_25,
23102303
.duplex_reg = B53_DUPLEX_STAT_FE,
23112304
},
23122305
{
23132306
.chip_id = BCM5365_DEVICE_ID,
23142307
.dev_name = "BCM5365",
23152308
.vlans = 256,
2316-
.enabled_ports = 0x1f,
2309+
.enabled_ports = 0x3f,
23172310
.arl_bins = 2,
23182311
.arl_buckets = 1024,
23192312
.imp_port = 5,
2320-
.cpu_port = B53_CPU_PORT_25,
23212313
.duplex_reg = B53_DUPLEX_STAT_FE,
23222314
},
23232315
{
23242316
.chip_id = BCM5389_DEVICE_ID,
23252317
.dev_name = "BCM5389",
23262318
.vlans = 4096,
2327-
.enabled_ports = 0x1f,
2319+
.enabled_ports = 0x11f,
23282320
.arl_bins = 4,
23292321
.arl_buckets = 1024,
23302322
.imp_port = 8,
2331-
.cpu_port = B53_CPU_PORT,
23322323
.vta_regs = B53_VTA_REGS,
23332324
.duplex_reg = B53_DUPLEX_STAT_GE,
23342325
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2338,11 +2329,10 @@ static const struct b53_chip_data b53_switch_chips[] = {
23382329
.chip_id = BCM5395_DEVICE_ID,
23392330
.dev_name = "BCM5395",
23402331
.vlans = 4096,
2341-
.enabled_ports = 0x1f,
2332+
.enabled_ports = 0x11f,
23422333
.arl_bins = 4,
23432334
.arl_buckets = 1024,
23442335
.imp_port = 8,
2345-
.cpu_port = B53_CPU_PORT,
23462336
.vta_regs = B53_VTA_REGS,
23472337
.duplex_reg = B53_DUPLEX_STAT_GE,
23482338
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2352,11 +2342,10 @@ static const struct b53_chip_data b53_switch_chips[] = {
23522342
.chip_id = BCM5397_DEVICE_ID,
23532343
.dev_name = "BCM5397",
23542344
.vlans = 4096,
2355-
.enabled_ports = 0x1f,
2345+
.enabled_ports = 0x11f,
23562346
.arl_bins = 4,
23572347
.arl_buckets = 1024,
23582348
.imp_port = 8,
2359-
.cpu_port = B53_CPU_PORT,
23602349
.vta_regs = B53_VTA_REGS_9798,
23612350
.duplex_reg = B53_DUPLEX_STAT_GE,
23622351
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2366,11 +2355,10 @@ static const struct b53_chip_data b53_switch_chips[] = {
23662355
.chip_id = BCM5398_DEVICE_ID,
23672356
.dev_name = "BCM5398",
23682357
.vlans = 4096,
2369-
.enabled_ports = 0x7f,
2358+
.enabled_ports = 0x17f,
23702359
.arl_bins = 4,
23712360
.arl_buckets = 1024,
23722361
.imp_port = 8,
2373-
.cpu_port = B53_CPU_PORT,
23742362
.vta_regs = B53_VTA_REGS_9798,
23752363
.duplex_reg = B53_DUPLEX_STAT_GE,
23762364
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2380,12 +2368,11 @@ static const struct b53_chip_data b53_switch_chips[] = {
23802368
.chip_id = BCM53115_DEVICE_ID,
23812369
.dev_name = "BCM53115",
23822370
.vlans = 4096,
2383-
.enabled_ports = 0x1f,
2371+
.enabled_ports = 0x11f,
23842372
.arl_bins = 4,
23852373
.arl_buckets = 1024,
23862374
.vta_regs = B53_VTA_REGS,
23872375
.imp_port = 8,
2388-
.cpu_port = B53_CPU_PORT,
23892376
.duplex_reg = B53_DUPLEX_STAT_GE,
23902377
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
23912378
.jumbo_size_reg = B53_JUMBO_MAX_SIZE,
@@ -2394,11 +2381,10 @@ static const struct b53_chip_data b53_switch_chips[] = {
23942381
.chip_id = BCM53125_DEVICE_ID,
23952382
.dev_name = "BCM53125",
23962383
.vlans = 4096,
2397-
.enabled_ports = 0xff,
2384+
.enabled_ports = 0x1ff,
23982385
.arl_bins = 4,
23992386
.arl_buckets = 1024,
24002387
.imp_port = 8,
2401-
.cpu_port = B53_CPU_PORT,
24022388
.vta_regs = B53_VTA_REGS,
24032389
.duplex_reg = B53_DUPLEX_STAT_GE,
24042390
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2412,7 +2398,6 @@ static const struct b53_chip_data b53_switch_chips[] = {
24122398
.arl_bins = 4,
24132399
.arl_buckets = 1024,
24142400
.imp_port = 8,
2415-
.cpu_port = B53_CPU_PORT,
24162401
.vta_regs = B53_VTA_REGS,
24172402
.duplex_reg = B53_DUPLEX_STAT_GE,
24182403
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2426,7 +2411,6 @@ static const struct b53_chip_data b53_switch_chips[] = {
24262411
.arl_bins = 4,
24272412
.arl_buckets = 1024,
24282413
.imp_port = 8,
2429-
.cpu_port = B53_CPU_PORT,
24302414
.vta_regs = B53_VTA_REGS_63XX,
24312415
.duplex_reg = B53_DUPLEX_STAT_63XX,
24322416
.jumbo_pm_reg = B53_JUMBO_PORT_MASK_63XX,
@@ -2436,11 +2420,10 @@ static const struct b53_chip_data b53_switch_chips[] = {
24362420
.chip_id = BCM53010_DEVICE_ID,
24372421
.dev_name = "BCM53010",
24382422
.vlans = 4096,
2439-
.enabled_ports = 0x1f,
2423+
.enabled_ports = 0x1bf,
24402424
.arl_bins = 4,
24412425
.arl_buckets = 1024,
24422426
.imp_port = 8,
2443-
.cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
24442427
.vta_regs = B53_VTA_REGS,
24452428
.duplex_reg = B53_DUPLEX_STAT_GE,
24462429
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2454,7 +2437,6 @@ static const struct b53_chip_data b53_switch_chips[] = {
24542437
.arl_bins = 4,
24552438
.arl_buckets = 1024,
24562439
.imp_port = 8,
2457-
.cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
24582440
.vta_regs = B53_VTA_REGS,
24592441
.duplex_reg = B53_DUPLEX_STAT_GE,
24602442
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2468,7 +2450,6 @@ static const struct b53_chip_data b53_switch_chips[] = {
24682450
.arl_bins = 4,
24692451
.arl_buckets = 1024,
24702452
.imp_port = 8,
2471-
.cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
24722453
.vta_regs = B53_VTA_REGS,
24732454
.duplex_reg = B53_DUPLEX_STAT_GE,
24742455
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2478,11 +2459,10 @@ static const struct b53_chip_data b53_switch_chips[] = {
24782459
.chip_id = BCM53018_DEVICE_ID,
24792460
.dev_name = "BCM53018",
24802461
.vlans = 4096,
2481-
.enabled_ports = 0x1f,
2462+
.enabled_ports = 0x1bf,
24822463
.arl_bins = 4,
24832464
.arl_buckets = 1024,
24842465
.imp_port = 8,
2485-
.cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
24862466
.vta_regs = B53_VTA_REGS,
24872467
.duplex_reg = B53_DUPLEX_STAT_GE,
24882468
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2492,11 +2472,10 @@ static const struct b53_chip_data b53_switch_chips[] = {
24922472
.chip_id = BCM53019_DEVICE_ID,
24932473
.dev_name = "BCM53019",
24942474
.vlans = 4096,
2495-
.enabled_ports = 0x1f,
2475+
.enabled_ports = 0x1bf,
24962476
.arl_bins = 4,
24972477
.arl_buckets = 1024,
24982478
.imp_port = 8,
2499-
.cpu_port = B53_CPU_PORT_25, /* TODO: auto detect */
25002479
.vta_regs = B53_VTA_REGS,
25012480
.duplex_reg = B53_DUPLEX_STAT_GE,
25022481
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2510,7 +2489,6 @@ static const struct b53_chip_data b53_switch_chips[] = {
25102489
.arl_bins = 4,
25112490
.arl_buckets = 1024,
25122491
.imp_port = 8,
2513-
.cpu_port = B53_CPU_PORT,
25142492
.vta_regs = B53_VTA_REGS,
25152493
.duplex_reg = B53_DUPLEX_STAT_GE,
25162494
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2524,7 +2502,6 @@ static const struct b53_chip_data b53_switch_chips[] = {
25242502
.arl_bins = 4,
25252503
.arl_buckets = 1024,
25262504
.imp_port = 8,
2527-
.cpu_port = B53_CPU_PORT,
25282505
.vta_regs = B53_VTA_REGS,
25292506
.duplex_reg = B53_DUPLEX_STAT_GE,
25302507
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2539,7 +2516,6 @@ static const struct b53_chip_data b53_switch_chips[] = {
25392516
.arl_bins = 4,
25402517
.arl_buckets = 256,
25412518
.imp_port = 8,
2542-
.cpu_port = 8, /* TODO: ports 4, 5, 8 */
25432519
.vta_regs = B53_VTA_REGS,
25442520
.duplex_reg = B53_DUPLEX_STAT_GE,
25452521
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2553,7 +2529,6 @@ static const struct b53_chip_data b53_switch_chips[] = {
25532529
.arl_bins = 4,
25542530
.arl_buckets = 1024,
25552531
.imp_port = 8,
2556-
.cpu_port = B53_CPU_PORT,
25572532
.vta_regs = B53_VTA_REGS,
25582533
.duplex_reg = B53_DUPLEX_STAT_GE,
25592534
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2567,7 +2542,6 @@ static const struct b53_chip_data b53_switch_chips[] = {
25672542
.arl_bins = 4,
25682543
.arl_buckets = 256,
25692544
.imp_port = 8,
2570-
.cpu_port = B53_CPU_PORT,
25712545
.vta_regs = B53_VTA_REGS,
25722546
.duplex_reg = B53_DUPLEX_STAT_GE,
25732547
.jumbo_pm_reg = B53_JUMBO_PORT_MASK,
@@ -2593,7 +2567,6 @@ static int b53_switch_init(struct b53_device *dev)
25932567
dev->vta_regs[2] = chip->vta_regs[2];
25942568
dev->jumbo_pm_reg = chip->jumbo_pm_reg;
25952569
dev->imp_port = chip->imp_port;
2596-
dev->cpu_port = chip->cpu_port;
25972570
dev->num_vlans = chip->vlans;
25982571
dev->num_arl_bins = chip->arl_bins;
25992572
dev->num_arl_buckets = chip->arl_buckets;
@@ -2625,16 +2598,8 @@ static int b53_switch_init(struct b53_device *dev)
26252598
break;
26262599
#endif
26272600
}
2628-
} else if (dev->chip_id == BCM53115_DEVICE_ID) {
2629-
u64 strap_value;
2630-
2631-
b53_read48(dev, B53_STAT_PAGE, B53_STRAP_VALUE, &strap_value);
2632-
/* use second IMP port if GMII is enabled */
2633-
if (strap_value & SV_GMII_CTRL_115)
2634-
dev->cpu_port = 5;
26352601
}
26362602

2637-
dev->enabled_ports |= BIT(dev->cpu_port);
26382603
dev->num_ports = fls(dev->enabled_ports);
26392604

26402605
dev->ds->num_ports = min_t(unsigned int, dev->num_ports, DSA_MAX_PORTS);

drivers/net/dsa/b53/b53_priv.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ struct b53_device {
124124
/* used ports mask */
125125
u16 enabled_ports;
126126
unsigned int imp_port;
127-
unsigned int cpu_port;
128127

129128
/* connect specific data */
130129
u8 current_page;

0 commit comments

Comments
 (0)