aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2016-06-04 15:16:58 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-04 17:29:53 -0400
commit189b0d93ec61e1f991e96d7bc03b03cf929d164c (patch)
tree38e7f6d3ba4a9916314afc85456d2b3050655269 /net/dsa
parentc8b098086b4c744084350d2757a637ad756adf34 (diff)
net: dsa: Move port device node into port structure
Move the port device node structure into the port structure, from the chip data. This information is needed in the next step of implementing the new binding. The chip data structure is used while parsing the whole old binding, before the individual switch structures exist. With the new bindings, this is reversed, the switches exist first, and the interconnections between the switches is derived from the individual switch bindings. Thus this chip data structure becomes unneeded. Signed-off-by: Andrew Lunn <andrew@lunn.ch> eviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r--net/dsa/dsa.c8
-rw-r--r--net/dsa/slave.c5
2 files changed, 6 insertions, 7 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 18086e0cc617..5907f8cd13b6 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -182,7 +182,6 @@ __ATTRIBUTE_GROUPS(dsa_hwmon);
182/* basic switch operations **************************************************/ 182/* basic switch operations **************************************************/
183static int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct net_device *master) 183static int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct net_device *master)
184{ 184{
185 struct dsa_chip_data *cd = ds->cd;
186 struct device_node *port_dn; 185 struct device_node *port_dn;
187 struct phy_device *phydev; 186 struct phy_device *phydev;
188 int ret, port, mode; 187 int ret, port, mode;
@@ -191,7 +190,7 @@ static int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct net_device *master)
191 if (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port))) 190 if (!(dsa_is_cpu_port(ds, port) || dsa_is_dsa_port(ds, port)))
192 continue; 191 continue;
193 192
194 port_dn = cd->port_dn[port]; 193 port_dn = ds->ports[port].dn;
195 if (of_phy_is_fixed_link(port_dn)) { 194 if (of_phy_is_fixed_link(port_dn)) {
196 ret = of_phy_register_fixed_link(port_dn); 195 ret = of_phy_register_fixed_link(port_dn);
197 if (ret) { 196 if (ret) {
@@ -325,6 +324,8 @@ static int dsa_switch_setup_one(struct dsa_switch *ds, struct device *parent)
325 * Create network devices for physical switch ports. 324 * Create network devices for physical switch ports.
326 */ 325 */
327 for (i = 0; i < DSA_MAX_PORTS; i++) { 326 for (i = 0; i < DSA_MAX_PORTS; i++) {
327 ds->ports[i].dn = cd->port_dn[i];
328
328 if (!(ds->enabled_port_mask & (1 << i))) 329 if (!(ds->enabled_port_mask & (1 << i)))
329 continue; 330 continue;
330 331
@@ -424,7 +425,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
424{ 425{
425 struct device_node *port_dn; 426 struct device_node *port_dn;
426 struct phy_device *phydev; 427 struct phy_device *phydev;
427 struct dsa_chip_data *cd = ds->cd;
428 int port; 428 int port;
429 429
430#ifdef CONFIG_NET_DSA_HWMON 430#ifdef CONFIG_NET_DSA_HWMON
@@ -445,7 +445,7 @@ static void dsa_switch_destroy(struct dsa_switch *ds)
445 445
446 /* Remove any fixed link PHYs */ 446 /* Remove any fixed link PHYs */
447 for (port = 0; port < DSA_MAX_PORTS; port++) { 447 for (port = 0; port < DSA_MAX_PORTS; port++) {
448 port_dn = cd->port_dn[port]; 448 port_dn = ds->ports[port].dn;
449 if (of_phy_is_fixed_link(port_dn)) { 449 if (of_phy_is_fixed_link(port_dn)) {
450 phydev = of_phy_find_device(port_dn); 450 phydev = of_phy_find_device(port_dn);
451 if (phydev) { 451 if (phydev) {
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 169abacbc6ce..52f1183c42a0 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -998,13 +998,12 @@ static int dsa_slave_phy_setup(struct dsa_slave_priv *p,
998 struct net_device *slave_dev) 998 struct net_device *slave_dev)
999{ 999{
1000 struct dsa_switch *ds = p->parent; 1000 struct dsa_switch *ds = p->parent;
1001 struct dsa_chip_data *cd = ds->cd;
1002 struct device_node *phy_dn, *port_dn; 1001 struct device_node *phy_dn, *port_dn;
1003 bool phy_is_fixed = false; 1002 bool phy_is_fixed = false;
1004 u32 phy_flags = 0; 1003 u32 phy_flags = 0;
1005 int mode, ret; 1004 int mode, ret;
1006 1005
1007 port_dn = cd->port_dn[p->port]; 1006 port_dn = ds->ports[p->port].dn;
1008 mode = of_get_phy_mode(port_dn); 1007 mode = of_get_phy_mode(port_dn);
1009 if (mode < 0) 1008 if (mode < 0)
1010 mode = PHY_INTERFACE_MODE_NA; 1009 mode = PHY_INTERFACE_MODE_NA;
@@ -1146,7 +1145,7 @@ int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
1146 NULL); 1145 NULL);
1147 1146
1148 SET_NETDEV_DEV(slave_dev, parent); 1147 SET_NETDEV_DEV(slave_dev, parent);
1149 slave_dev->dev.of_node = ds->cd->port_dn[port]; 1148 slave_dev->dev.of_node = ds->ports[port].dn;
1150 slave_dev->vlan_features = master->vlan_features; 1149 slave_dev->vlan_features = master->vlan_features;
1151 1150
1152 p = netdev_priv(slave_dev); 1151 p = netdev_priv(slave_dev);