diff options
Diffstat (limited to 'drivers/usb/phy/phy-gpio-vbus-usb.c')
-rw-r--r-- | drivers/usb/phy/phy-gpio-vbus-usb.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c index f4b14bd97e14..54511725caaf 100644 --- a/drivers/usb/phy/phy-gpio-vbus-usb.c +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c | |||
@@ -121,7 +121,7 @@ static void gpio_vbus_work(struct work_struct *work) | |||
121 | 121 | ||
122 | if (vbus) { | 122 | if (vbus) { |
123 | status = USB_EVENT_VBUS; | 123 | status = USB_EVENT_VBUS; |
124 | gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; | 124 | gpio_vbus->phy.otg->state = OTG_STATE_B_PERIPHERAL; |
125 | gpio_vbus->phy.last_event = status; | 125 | gpio_vbus->phy.last_event = status; |
126 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); | 126 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); |
127 | 127 | ||
@@ -134,6 +134,7 @@ static void gpio_vbus_work(struct work_struct *work) | |||
134 | 134 | ||
135 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, | 135 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, |
136 | status, gpio_vbus->phy.otg->gadget); | 136 | status, gpio_vbus->phy.otg->gadget); |
137 | usb_phy_set_event(&gpio_vbus->phy, USB_EVENT_ENUMERATED); | ||
137 | } else { | 138 | } else { |
138 | /* optionally disable D+ pullup */ | 139 | /* optionally disable D+ pullup */ |
139 | if (gpio_is_valid(gpio)) | 140 | if (gpio_is_valid(gpio)) |
@@ -143,11 +144,12 @@ static void gpio_vbus_work(struct work_struct *work) | |||
143 | 144 | ||
144 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); | 145 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); |
145 | status = USB_EVENT_NONE; | 146 | status = USB_EVENT_NONE; |
146 | gpio_vbus->phy.state = OTG_STATE_B_IDLE; | 147 | gpio_vbus->phy.otg->state = OTG_STATE_B_IDLE; |
147 | gpio_vbus->phy.last_event = status; | 148 | gpio_vbus->phy.last_event = status; |
148 | 149 | ||
149 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, | 150 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, |
150 | status, gpio_vbus->phy.otg->gadget); | 151 | status, gpio_vbus->phy.otg->gadget); |
152 | usb_phy_set_event(&gpio_vbus->phy, USB_EVENT_NONE); | ||
151 | } | 153 | } |
152 | } | 154 | } |
153 | 155 | ||
@@ -180,7 +182,7 @@ static int gpio_vbus_set_peripheral(struct usb_otg *otg, | |||
180 | struct platform_device *pdev; | 182 | struct platform_device *pdev; |
181 | int gpio; | 183 | int gpio; |
182 | 184 | ||
183 | gpio_vbus = container_of(otg->phy, struct gpio_vbus_data, phy); | 185 | gpio_vbus = container_of(otg->usb_phy, struct gpio_vbus_data, phy); |
184 | pdev = to_platform_device(gpio_vbus->dev); | 186 | pdev = to_platform_device(gpio_vbus->dev); |
185 | pdata = dev_get_platdata(gpio_vbus->dev); | 187 | pdata = dev_get_platdata(gpio_vbus->dev); |
186 | gpio = pdata->gpio_pullup; | 188 | gpio = pdata->gpio_pullup; |
@@ -196,7 +198,7 @@ static int gpio_vbus_set_peripheral(struct usb_otg *otg, | |||
196 | set_vbus_draw(gpio_vbus, 0); | 198 | set_vbus_draw(gpio_vbus, 0); |
197 | 199 | ||
198 | usb_gadget_vbus_disconnect(otg->gadget); | 200 | usb_gadget_vbus_disconnect(otg->gadget); |
199 | otg->phy->state = OTG_STATE_UNDEFINED; | 201 | otg->state = OTG_STATE_UNDEFINED; |
200 | 202 | ||
201 | otg->gadget = NULL; | 203 | otg->gadget = NULL; |
202 | return 0; | 204 | return 0; |
@@ -218,7 +220,7 @@ static int gpio_vbus_set_power(struct usb_phy *phy, unsigned mA) | |||
218 | 220 | ||
219 | gpio_vbus = container_of(phy, struct gpio_vbus_data, phy); | 221 | gpio_vbus = container_of(phy, struct gpio_vbus_data, phy); |
220 | 222 | ||
221 | if (phy->state == OTG_STATE_B_PERIPHERAL) | 223 | if (phy->otg->state == OTG_STATE_B_PERIPHERAL) |
222 | set_vbus_draw(gpio_vbus, mA); | 224 | set_vbus_draw(gpio_vbus, mA); |
223 | return 0; | 225 | return 0; |
224 | } | 226 | } |
@@ -269,9 +271,9 @@ static int gpio_vbus_probe(struct platform_device *pdev) | |||
269 | gpio_vbus->phy.dev = gpio_vbus->dev; | 271 | gpio_vbus->phy.dev = gpio_vbus->dev; |
270 | gpio_vbus->phy.set_power = gpio_vbus_set_power; | 272 | gpio_vbus->phy.set_power = gpio_vbus_set_power; |
271 | gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; | 273 | gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; |
272 | gpio_vbus->phy.state = OTG_STATE_UNDEFINED; | ||
273 | 274 | ||
274 | gpio_vbus->phy.otg->phy = &gpio_vbus->phy; | 275 | gpio_vbus->phy.otg->state = OTG_STATE_UNDEFINED; |
276 | gpio_vbus->phy.otg->usb_phy = &gpio_vbus->phy; | ||
275 | gpio_vbus->phy.otg->set_peripheral = gpio_vbus_set_peripheral; | 277 | gpio_vbus->phy.otg->set_peripheral = gpio_vbus_set_peripheral; |
276 | 278 | ||
277 | err = devm_gpio_request(&pdev->dev, gpio, "vbus_detect"); | 279 | err = devm_gpio_request(&pdev->dev, gpio, "vbus_detect"); |