From 846eca673f818300a3c1729158b4c110cf316e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 27 Jul 2016 14:15:32 +0200 Subject: [PATCH] b53: allow ports with higher numbers than CPU port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our code was assuming CPU port uses the highest number. My BCM53573 device has eth0 connected to port 8 and eth1 connected to port 5. While working on support for it I tried to: 1) Enable all ports (including port 8) 2) Set CPU port to 5 I noticed port 8 is not accessible anymore. It was just a development process but it seems like something worth fixing anyway. Signed-off-by: Rafał Miłecki Acked-by: Jonas Gorski --- target/linux/generic/files/drivers/net/phy/b53/b53_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c index 676e301559..d96d8b8b6d 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c @@ -1370,9 +1370,8 @@ static int b53_switch_init(struct b53_device *dev) sw_dev->cpu_port = 5; } - /* cpu port is always last */ - sw_dev->ports = sw_dev->cpu_port + 1; dev->enabled_ports |= BIT(sw_dev->cpu_port); + sw_dev->ports = fls(dev->enabled_ports); dev->ports = devm_kzalloc(dev->dev, sizeof(struct b53_port) * sw_dev->ports,