summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2016-07-27 14:15:32 +0200
committerJohn Crispin <john@phrozen.org>2016-07-24 06:38:30 +0200
commit846eca673f818300a3c1729158b4c110cf316e38 (patch)
tree78fe4d7f6f894b03eb5bf37a3d03956e20ffbf19
parentcea917c30b26e59de11e3bc26b35b6d816ace1da (diff)
downloadmtk-20170518-846eca673f818300a3c1729158b4c110cf316e38.zip
mtk-20170518-846eca673f818300a3c1729158b4c110cf316e38.tar.gz
mtk-20170518-846eca673f818300a3c1729158b4c110cf316e38.tar.bz2
b53: allow ports with higher numbers than CPU port
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 <zajec5@gmail.com> Acked-by: Jonas Gorski <jonas.gorski@gmail.com>
-rw-r--r--target/linux/generic/files/drivers/net/phy/b53/b53_common.c3
1 files changed, 1 insertions, 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 676e301..d96d8b8 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,