File tree Expand file tree Collapse file tree 6 files changed +28
-27
lines changed
Documentation/devicetree/bindings/net/dsa Expand file tree Collapse file tree 6 files changed +28
-27
lines changed Original file line number Diff line number Diff line change @@ -31,8 +31,6 @@ A switch child node has the following optional property:
31
31
switch. Must be set if the switch can not detect
32
32
the presence and/or size of a connected EEPROM,
33
33
otherwise optional.
34
- - reset-gpios : phandle and specifier to a gpio line connected to
35
- reset pin of the switch chip.
36
34
37
35
A switch may have multiple "port" children nodes
38
36
Original file line number Diff line number Diff line change @@ -10,10 +10,17 @@ If you need a stable binding, use the old dsa.txt binding.
10
10
Marvell Switches are MDIO devices. The following properties should be
11
11
placed as a child node of an mdio device.
12
12
13
+ The properties described here are those specific to Marvell devices.
14
+ Additional required and optional properties can be found in dsa.txt.
15
+
13
16
Required properties:
14
17
- compatible : Should be one of "marvell,mv88e6085",
15
18
- reg : Address on the MII bus for the switch.
16
19
20
+ Optional properties:
21
+
22
+ - reset-gpios : Should be a gpio specifier for a reset line
23
+
17
24
Example:
18
25
19
26
mdio {
@@ -23,5 +30,6 @@ Example:
23
30
switch0: switch@0 {
24
31
compatible = "marvell,mv88e6085";
25
32
reg = <0>;
33
+ reset-gpios = <&gpio5 1 GPIO_ACTIVE_LOW>;
26
34
};
27
35
};
Original file line number Diff line number Diff line change @@ -2582,7 +2582,7 @@ static int mv88e6xxx_switch_reset(struct mv88e6xxx_priv_state *ps)
2582
2582
{
2583
2583
bool ppu_active = mv88e6xxx_has (ps , MV88E6XXX_FLAG_PPU_ACTIVE );
2584
2584
u16 is_reset = (ppu_active ? 0x8800 : 0xc800 );
2585
- struct gpio_desc * gpiod = ps -> ds -> pd -> reset ;
2585
+ struct gpio_desc * gpiod = ps -> reset ;
2586
2586
unsigned long timeout ;
2587
2587
int ret ;
2588
2588
int i ;
@@ -3634,6 +3634,7 @@ int mv88e6xxx_probe(struct mdio_device *mdiodev)
3634
3634
struct mv88e6xxx_priv_state * ps ;
3635
3635
int id , prod_num , rev ;
3636
3636
struct dsa_switch * ds ;
3637
+ int err ;
3637
3638
3638
3639
ds = devm_kzalloc (dev , sizeof (* ds ) + sizeof (* ps ), GFP_KERNEL );
3639
3640
if (!ds )
@@ -3663,6 +3664,17 @@ int mv88e6xxx_probe(struct mdio_device *mdiodev)
3663
3664
if (!ps -> info )
3664
3665
return - ENODEV ;
3665
3666
3667
+ ps -> reset = devm_gpiod_get (& mdiodev -> dev , "reset" , GPIOD_ASIS );
3668
+ if (IS_ERR (ps -> reset )) {
3669
+ err = PTR_ERR (ps -> reset );
3670
+ if (err == - ENOENT ) {
3671
+ /* Optional, so not an error */
3672
+ ps -> reset = NULL ;
3673
+ } else {
3674
+ return err ;
3675
+ }
3676
+ }
3677
+
3666
3678
dev_set_drvdata (dev , ds );
3667
3679
3668
3680
dev_info (dev , "switch 0x%x probed: %s, revision %u\n" ,
Original file line number Diff line number Diff line change 12
12
#define __MV88E6XXX_H
13
13
14
14
#include <linux/if_vlan.h>
15
+ #include <linux/gpio/consumer.h>
15
16
16
17
#ifndef UINT64_MAX
17
18
#define UINT64_MAX (u64)(~((u64)0))
@@ -595,6 +596,12 @@ struct mv88e6xxx_priv_state {
595
596
DECLARE_BITMAP (port_state_update_mask , DSA_MAX_PORTS );
596
597
597
598
struct work_struct bridge_work ;
599
+
600
+ /* A switch may have a GPIO line tied to its reset pin. Parse
601
+ * this from the device tree, and use it before performing
602
+ * switch soft reset.
603
+ */
604
+ struct gpio_desc * reset ;
598
605
};
599
606
600
607
enum stat_type {
Original file line number Diff line number Diff line change 16
16
#include <linux/timer.h>
17
17
#include <linux/workqueue.h>
18
18
#include <linux/of.h>
19
- #include <linux/of_gpio.h>
20
19
#include <linux/phy.h>
21
20
#include <linux/phy_fixed.h>
22
21
#include <linux/ethtool.h>
@@ -65,13 +64,6 @@ struct dsa_chip_data {
65
64
* NULL if there is only one switch chip.
66
65
*/
67
66
s8 * rtable ;
68
-
69
- /*
70
- * A switch may have a GPIO line tied to its reset pin. Parse
71
- * this from the device tree, and use it before performing
72
- * switch soft reset.
73
- */
74
- struct gpio_desc * reset ;
75
67
};
76
68
77
69
struct dsa_platform_data {
Original file line number Diff line number Diff line change @@ -659,9 +659,6 @@ static int dsa_of_probe(struct device *dev)
659
659
const char * port_name ;
660
660
int chip_index , port_index ;
661
661
const unsigned int * sw_addr , * port_reg ;
662
- int gpio ;
663
- enum of_gpio_flags of_flags ;
664
- unsigned long flags ;
665
662
u32 eeprom_len ;
666
663
int ret ;
667
664
@@ -740,19 +737,6 @@ static int dsa_of_probe(struct device *dev)
740
737
put_device (cd -> host_dev );
741
738
cd -> host_dev = & mdio_bus_switch -> dev ;
742
739
}
743
- gpio = of_get_named_gpio_flags (child , "reset-gpios" , 0 ,
744
- & of_flags );
745
- if (gpio_is_valid (gpio )) {
746
- flags = (of_flags == OF_GPIO_ACTIVE_LOW ?
747
- GPIOF_ACTIVE_LOW : 0 );
748
- ret = devm_gpio_request_one (dev , gpio , flags ,
749
- "switch_reset" );
750
- if (ret )
751
- goto out_free_chip ;
752
-
753
- cd -> reset = gpio_to_desc (gpio );
754
- gpiod_direction_output (cd -> reset , 0 );
755
- }
756
740
757
741
for_each_available_child_of_node (child , port ) {
758
742
port_reg = of_get_property (port , "reg" , NULL );
You can’t perform that action at this time.
0 commit comments