Skip to content

Commit

Permalink
net: dsa: provide a switch device device tree node pointer
Browse files Browse the repository at this point in the history
We might need to fetch additional resources from the device tree node
pointer, such as register ranges or other properties. Keep a device_node
pointer around for this.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Aug 28, 2014
1 parent 464c366 commit fa981d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/net/dsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/of.h>

#define DSA_MAX_SWITCHES 4
#define DSA_MAX_PORTS 12
Expand All @@ -26,6 +27,12 @@ struct dsa_chip_data {
struct device *mii_bus;
int sw_addr;

/* Device tree node pointer for this specific switch chip
* used during switch setup in case additional properties
* and resources needs to be used
*/
struct device_node *of_node;

/*
* The names of the switch's ports. Use "cpu" to
* designate the switch port that the cpu is connected to,
Expand Down
1 change: 1 addition & 0 deletions net/dsa/dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ static int dsa_of_probe(struct platform_device *pdev)
chip_index++;
cd = &pd->chip[chip_index];

cd->of_node = child;
cd->mii_bus = &mdio_bus->dev;

sw_addr = of_get_property(child, "reg", NULL);
Expand Down

0 comments on commit fa981d9

Please sign in to comment.