summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorDongjin Kim <tobetter@gmail.com>2013-05-22 05:20:09 +0900
committerChanho Park <chanho61.park@samsung.com>2014-03-20 17:44:01 +0900
commit0cedc6505774f1f8fc7c2f23ff9036049ff4dae7 (patch)
tree16e8ee6b0b5a133bb2a166b14eea4953c6f9eef6 /drivers/usb
parent65d9ad4424e47579606ae76b4e64bae0f9f4c92d (diff)
downloadlinux-3.10-0cedc6505774f1f8fc7c2f23ff9036049ff4dae7.tar.gz
linux-3.10-0cedc6505774f1f8fc7c2f23ff9036049ff4dae7.tar.bz2
linux-3.10-0cedc6505774f1f8fc7c2f23ff9036049ff4dae7.zip
usb: misc: usb3503: Adding device tree entry 'disabled-ports'
This patch is to add a property 'disabled-ports' representing the unused port of USB3503. USB3503 can support up to 3 USB host port and each ports can be controlled to be enabled or disabled. Do not describe this property if all ports must be enabled. You can represent the ports to disable in the device tree. usb3503@08{ ... disabled-ports = <2 3>; ... }; Signed-off-by: Dongjin Kim <tobetter@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> [mszyprow: mainline commit e8b58b49130f40c29bb95cd5d9b36955ff703822] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Change-Id: Ie8b58b49130f40c29bb95cd5d9b36955ff703822
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/misc/usb3503.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c
index ab24bb34597..1908ec65c55 100644
--- a/drivers/usb/misc/usb3503.c
+++ b/drivers/usb/misc/usb3503.c
@@ -186,6 +186,8 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
struct usb3503 *hub;
int err = -ENOMEM;
u32 mode = USB3503_MODE_UNKNOWN;
+ const u32 *property;
+ int len;
hub = kzalloc(sizeof(struct usb3503), GFP_KERNEL);
if (!hub) {
@@ -203,6 +205,18 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
hub->gpio_reset = pdata->gpio_reset;
hub->mode = pdata->initial_mode;
} else if (np) {
+ hub->port_off_mask = 0;
+
+ property = of_get_property(np, "disabled-ports", &len);
+ if (property && (len / sizeof(u32)) > 0) {
+ int i;
+ for (i = 0; i < len / sizeof(u32); i++) {
+ u32 port = be32_to_cpu(property[i]);
+ if ((1 <= port) && (port <= 3))
+ hub->port_off_mask |= (1 << port);
+ }
+ }
+
hub->gpio_intn = of_get_named_gpio(np, "connect-gpios", 0);
if (hub->gpio_intn == -EPROBE_DEFER)
return -EPROBE_DEFER;