Lines Matching +full:en +full:- +full:usb
1 // SPDX-License-Identifier: GPL-2.0+
3 * Freescale QUICC Engine USB Host Controller Driver
7 * Jerry Huang <Chang-Ming.Huang@freescale.com>
20 #include <linux/usb.h>
21 #include <linux/usb/hcd.h>
29 USB_DT_HUB, /* bDescriptorType;hub-descriptor */
32 0x00, /* per-port power, no overcurrent */
41 int gpio = fhci->gpios[gpio_nr]; in fhci_gpio_set_value()
42 bool alow = fhci->alow_gpios[gpio_nr]; in fhci_gpio_set_value()
54 fhci_dbg(fhci, "-> %s: %d\n", __func__, status); in fhci_config_transceiver()
75 fhci_dbg(fhci, "<- %s: %d\n", __func__, status); in fhci_config_transceiver()
78 /* disable the USB port by clearing the EN bit in the USBMOD register */
81 struct fhci_usb *usb = (struct fhci_usb *)fhci->usb_lld; in fhci_port_disable() local
84 fhci_dbg(fhci, "-> %s\n", __func__); in fhci_port_disable()
88 fhci_flush_all_transmissions(usb); in fhci_port_disable()
90 fhci_usb_disable_interrupt((struct fhci_usb *)fhci->usb_lld); in fhci_port_disable()
91 port_status = usb->port_status; in fhci_port_disable()
92 usb->port_status = FHCI_PORT_DISABLED; in fhci_port_disable()
95 usb->saved_msk |= USB_E_IDLE_MASK; in fhci_port_disable()
96 out_be16(&usb->fhci->regs->usb_usbmr, usb->saved_msk); in fhci_port_disable()
101 usb->vroot_hub->port.wPortStatus &= ~USB_PORT_STAT_ENABLE; in fhci_port_disable()
102 usb->vroot_hub->port.wPortChange |= USB_PORT_STAT_C_ENABLE; in fhci_port_disable()
103 fhci_usb_enable_interrupt((struct fhci_usb *)fhci->usb_lld); in fhci_port_disable()
105 fhci_dbg(fhci, "<- %s\n", __func__); in fhci_port_disable()
108 /* enable the USB port by setting the EN bit in the USBMOD register */
111 struct fhci_usb *usb = (struct fhci_usb *)lld; in fhci_port_enable() local
112 struct fhci_hcd *fhci = usb->fhci; in fhci_port_enable()
114 fhci_dbg(fhci, "-> %s\n", __func__); in fhci_port_enable()
116 fhci_config_transceiver(fhci, usb->port_status); in fhci_port_enable()
118 if ((usb->port_status != FHCI_PORT_FULL) && in fhci_port_enable()
119 (usb->port_status != FHCI_PORT_LOW)) in fhci_port_enable()
122 usb->vroot_hub->port.wPortStatus |= USB_PORT_STAT_ENABLE; in fhci_port_enable()
123 usb->vroot_hub->port.wPortChange |= USB_PORT_STAT_C_ENABLE; in fhci_port_enable()
125 fhci_dbg(fhci, "<- %s\n", __func__); in fhci_port_enable()
130 fhci_dbg(fhci, "-> %s\n", __func__); in fhci_io_port_generate_reset()
132 gpio_direction_output(fhci->gpios[GPIO_USBOE], 0); in fhci_io_port_generate_reset()
133 gpio_direction_output(fhci->gpios[GPIO_USBTP], 0); in fhci_io_port_generate_reset()
134 gpio_direction_output(fhci->gpios[GPIO_USBTN], 0); in fhci_io_port_generate_reset()
138 qe_pin_set_dedicated(fhci->pins[PIN_USBOE]); in fhci_io_port_generate_reset()
139 qe_pin_set_dedicated(fhci->pins[PIN_USBTP]); in fhci_io_port_generate_reset()
140 qe_pin_set_dedicated(fhci->pins[PIN_USBTN]); in fhci_io_port_generate_reset()
142 fhci_dbg(fhci, "<- %s\n", __func__); in fhci_io_port_generate_reset()
148 struct fhci_usb *usb = (struct fhci_usb *)lld; in fhci_port_reset() local
149 struct fhci_hcd *fhci = usb->fhci; in fhci_port_reset()
153 fhci_dbg(fhci, "-> %s\n", __func__); in fhci_port_reset()
156 /* disable the USB controller */ in fhci_port_reset()
157 mode = in_8(&fhci->regs->usb_usmod); in fhci_port_reset()
158 out_8(&fhci->regs->usb_usmod, mode & (~USB_MODE_EN)); in fhci_port_reset()
161 mask = in_be16(&fhci->regs->usb_usbmr); in fhci_port_reset()
162 out_be16(&fhci->regs->usb_usbmr, mask & (~USB_E_IDLE_MASK)); in fhci_port_reset()
167 out_be16(&fhci->regs->usb_usbmr, mask); in fhci_port_reset()
169 /* enable the USB controller */ in fhci_port_reset()
170 mode = in_8(&fhci->regs->usb_usmod); in fhci_port_reset()
171 out_8(&fhci->regs->usb_usmod, mode | USB_MODE_EN); in fhci_port_reset()
174 fhci_dbg(fhci, "<- %s\n", __func__); in fhci_port_reset()
183 fhci_dbg(fhci, "-> %s\n", __func__); in fhci_hub_status_data()
185 spin_lock_irqsave(&fhci->lock, flags); in fhci_hub_status_data()
187 if (fhci->vroot_hub->port.wPortChange & (USB_PORT_STAT_C_CONNECTION | in fhci_hub_status_data()
192 fhci_dbg(fhci, "-- %s\n", __func__); in fhci_hub_status_data()
195 spin_unlock_irqrestore(&fhci->lock, flags); in fhci_hub_status_data()
197 fhci_dbg(fhci, "<- %s\n", __func__); in fhci_hub_status_data()
211 spin_lock_irqsave(&fhci->lock, flags); in fhci_hub_control()
213 fhci_dbg(fhci, "-> %s\n", __func__); in fhci_hub_control()
226 fhci->vroot_hub->feature &= (1 << wValue); in fhci_hub_control()
230 fhci->vroot_hub->port.wPortStatus &= in fhci_hub_control()
235 fhci->vroot_hub->port.wPortChange &= in fhci_hub_control()
239 fhci->vroot_hub->port.wPortStatus &= in fhci_hub_control()
244 fhci->vroot_hub->port.wPortChange &= in fhci_hub_control()
248 fhci->vroot_hub->port.wPortStatus &= in fhci_hub_control()
253 fhci->vroot_hub->port.wPortChange &= in fhci_hub_control()
257 fhci->vroot_hub->port.wPortChange &= in fhci_hub_control()
261 fhci->vroot_hub->port.wPortChange &= in fhci_hub_control()
273 hub_status->wHubStatus = in fhci_hub_control()
274 cpu_to_le16(fhci->vroot_hub->hub.wHubStatus); in fhci_hub_control()
275 hub_status->wHubChange = in fhci_hub_control()
276 cpu_to_le16(fhci->vroot_hub->hub.wHubChange); in fhci_hub_control()
280 port_status->wPortStatus = in fhci_hub_control()
281 cpu_to_le16(fhci->vroot_hub->port.wPortStatus); in fhci_hub_control()
282 port_status->wPortChange = in fhci_hub_control()
283 cpu_to_le16(fhci->vroot_hub->port.wPortChange); in fhci_hub_control()
295 fhci->vroot_hub->feature |= (1 << wValue); in fhci_hub_control()
299 fhci->vroot_hub->port.wPortStatus |= in fhci_hub_control()
301 fhci_port_enable(fhci->usb_lld); in fhci_hub_control()
304 fhci->vroot_hub->port.wPortStatus |= in fhci_hub_control()
309 fhci->vroot_hub->port.wPortStatus |= in fhci_hub_control()
311 fhci_port_reset(fhci->usb_lld); in fhci_hub_control()
312 fhci->vroot_hub->port.wPortStatus |= in fhci_hub_control()
314 fhci->vroot_hub->port.wPortStatus &= in fhci_hub_control()
318 fhci->vroot_hub->port.wPortStatus |= in fhci_hub_control()
328 retval = -EPIPE; in fhci_hub_control()
331 fhci_dbg(fhci, "<- %s\n", __func__); in fhci_hub_control()
333 spin_unlock_irqrestore(&fhci->lock, flags); in fhci_hub_control()