diff options
author | Dongjin Kim <tobetter@gmail.com> | 2013-05-21 16:20:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-05-30 08:32:52 -0400 |
commit | e8b58b49130f40c29bb95cd5d9b36955ff703822 (patch) | |
tree | 9eff3e37324b5b76dd0aefb992d71fb193a77abb /drivers/usb/misc/usb3503.c | |
parent | e8e44a4896a5f0bde1af36a31b7ec662bdaa44ef (diff) |
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>
Diffstat (limited to 'drivers/usb/misc/usb3503.c')
-rw-r--r-- | drivers/usb/misc/usb3503.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/misc/usb3503.c b/drivers/usb/misc/usb3503.c index ab24bb345979..1908ec65c55b 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) | |||
186 | struct usb3503 *hub; | 186 | struct usb3503 *hub; |
187 | int err = -ENOMEM; | 187 | int err = -ENOMEM; |
188 | u32 mode = USB3503_MODE_UNKNOWN; | 188 | u32 mode = USB3503_MODE_UNKNOWN; |
189 | const u32 *property; | ||
190 | int len; | ||
189 | 191 | ||
190 | hub = kzalloc(sizeof(struct usb3503), GFP_KERNEL); | 192 | hub = kzalloc(sizeof(struct usb3503), GFP_KERNEL); |
191 | if (!hub) { | 193 | if (!hub) { |
@@ -203,6 +205,18 @@ static int usb3503_probe(struct i2c_client *i2c, const struct i2c_device_id *id) | |||
203 | hub->gpio_reset = pdata->gpio_reset; | 205 | hub->gpio_reset = pdata->gpio_reset; |
204 | hub->mode = pdata->initial_mode; | 206 | hub->mode = pdata->initial_mode; |
205 | } else if (np) { | 207 | } else if (np) { |
208 | hub->port_off_mask = 0; | ||
209 | |||
210 | property = of_get_property(np, "disabled-ports", &len); | ||
211 | if (property && (len / sizeof(u32)) > 0) { | ||
212 | int i; | ||
213 | for (i = 0; i < len / sizeof(u32); i++) { | ||
214 | u32 port = be32_to_cpu(property[i]); | ||
215 | if ((1 <= port) && (port <= 3)) | ||
216 | hub->port_off_mask |= (1 << port); | ||
217 | } | ||
218 | } | ||
219 | |||
206 | hub->gpio_intn = of_get_named_gpio(np, "connect-gpios", 0); | 220 | hub->gpio_intn = of_get_named_gpio(np, "connect-gpios", 0); |
207 | if (hub->gpio_intn == -EPROBE_DEFER) | 221 | if (hub->gpio_intn == -EPROBE_DEFER) |
208 | return -EPROBE_DEFER; | 222 | return -EPROBE_DEFER; |