diff options
-rw-r--r-- | Documentation/devicetree/bindings/usb/usb3503.txt | 2 | ||||
-rw-r--r-- | drivers/usb/misc/usb3503.c | 25 | ||||
-rw-r--r-- | include/linux/platform_data/usb3503.h | 1 |
3 files changed, 28 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/usb/usb3503.txt b/Documentation/devicetree/bindings/usb/usb3503.txt index 5157c16d55d1..7ccedf6cc4d5 100644 --- a/Documentation/devicetree/bindings/usb/usb3503.txt +++ b/Documentation/devicetree/bindings/usb/usb3503.txt @@ -14,6 +14,8 @@ Optional properties: '1' or '2' or '3' are available for this property to describe the port number. 1~3 property values are possible to be described. Do not describe this property if all ports have to be enabled. +- non-removable-devices: Should specify the ports going to non removable + devices. See disabled-ports for the syntax. - intn-gpios: Should specify GPIO for interrupt. - reset-gpios: Should specify GPIO for reset. - initial-mode: Should specify initial mode. diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c index 9f655535b0c2..6035cdac5c9c 100644 --- a/drivers/usb/misc/usb3503.c +++ b/drivers/usb/misc/usb3503.c @@ -46,6 +46,7 @@ struct usb3503 { struct regmap *regmap; struct device *dev; struct clk *clk; + u8 port_nrd; u8 port_off_mask; int gpio_bypass; int gpio_intn; @@ -109,6 +110,17 @@ static int usb3503_connect(struct usb3503 *hub) return err; } + /* NRD : Set non removable ports. */ + if (hub->port_nrd) { + err = regmap_update_bits(hub->regmap, USB3503_NRD, + hub->port_nrd, + hub->port_nrd); + if (err < 0) { + dev_err(dev, "NRD failed (%d)\n", err); + return err; + } + } + /* SP_LOCK: clear connect_n, config_n for hub connect */ err = regmap_update_bits(hub->regmap, USB3503_SP_ILOCK, (USB3503_SPILOCK_CONNECT @@ -170,6 +182,7 @@ static int usb3503_probe(struct usb3503 *hub) int len; if (pdata) { + hub->port_nrd = pdata->port_nrd; hub->port_off_mask = pdata->port_off_mask; hub->gpio_bypass = pdata->gpio_bypass; hub->gpio_intn = pdata->gpio_intn; @@ -230,11 +243,23 @@ static int usb3503_probe(struct usb3503 *hub) int i; for (i = 0; i < len / sizeof(u32); i++) { u32 port = be32_to_cpu(property[i]); + dev_dbg(dev, "disabled-ports, port: %d\n", port); if ((1 <= port) && (port <= 3)) hub->port_off_mask |= (1 << port); } } + property = of_get_property(np, "non-removable-devices", &len); + if (property && (len / sizeof(u32)) > 0) { + int i; + for (i = 0; i < len / sizeof(u32); i++) { + u32 port = be32_to_cpu(property[i]); + dev_dbg(dev, "non-removable-devices, port: %d\n", port); + if ((1 <= port) && (port <= 3)) + hub->port_nrd |= (1 << port); + } + } + hub->gpio_intn = of_get_named_gpio(np, "intn-gpios", 0); if (hub->gpio_intn == -EPROBE_DEFER) return -EPROBE_DEFER; diff --git a/include/linux/platform_data/usb3503.h b/include/linux/platform_data/usb3503.h index df1d0f48ca75..435e9edb1bc4 100644 --- a/include/linux/platform_data/usb3503.h +++ b/include/linux/platform_data/usb3503.h @@ -16,6 +16,7 @@ enum usb3503_mode { struct usb3503_platform_data { enum usb3503_mode initial_mode; + u8 port_nrd; u8 port_off_mask; int gpio_bypass; int gpio_intn; |