Lines Matching refs:fhci
24 #include "fhci.h"
39 static void fhci_gpio_set_value(struct fhci_hcd *fhci, int gpio_nr, bool on)
41 int gpio = fhci->gpios[gpio_nr];
42 bool alow = fhci->alow_gpios[gpio_nr];
51 void fhci_config_transceiver(struct fhci_hcd *fhci,
54 fhci_dbg(fhci, "-> %s: %d\n", __func__, status);
58 fhci_gpio_set_value(fhci, GPIO_POWER, false);
62 fhci_gpio_set_value(fhci, GPIO_POWER, true);
65 fhci_gpio_set_value(fhci, GPIO_SPEED, false);
68 fhci_gpio_set_value(fhci, GPIO_SPEED, true);
75 fhci_dbg(fhci, "<- %s: %d\n", __func__, status);
79 void fhci_port_disable(struct fhci_hcd *fhci)
81 struct fhci_usb *usb = (struct fhci_usb *)fhci->usb_lld;
84 fhci_dbg(fhci, "-> %s\n", __func__);
86 fhci_stop_sof_timer(fhci);
90 fhci_usb_disable_interrupt((struct fhci_usb *)fhci->usb_lld);
96 out_be16(&usb->fhci->regs->usb_usbmr, usb->saved_msk);
100 fhci_device_connected_interrupt(fhci);
103 fhci_usb_enable_interrupt((struct fhci_usb *)fhci->usb_lld);
105 fhci_dbg(fhci, "<- %s\n", __func__);
112 struct fhci_hcd *fhci = usb->fhci;
114 fhci_dbg(fhci, "-> %s\n", __func__);
116 fhci_config_transceiver(fhci, usb->port_status);
120 fhci_start_sof_timer(fhci);
125 fhci_dbg(fhci, "<- %s\n", __func__);
128 void fhci_io_port_generate_reset(struct fhci_hcd *fhci)
130 fhci_dbg(fhci, "-> %s\n", __func__);
132 gpio_direction_output(fhci->gpios[GPIO_USBOE], 0);
133 gpio_direction_output(fhci->gpios[GPIO_USBTP], 0);
134 gpio_direction_output(fhci->gpios[GPIO_USBTN], 0);
138 qe_pin_set_dedicated(fhci->pins[PIN_USBOE]);
139 qe_pin_set_dedicated(fhci->pins[PIN_USBTP]);
140 qe_pin_set_dedicated(fhci->pins[PIN_USBTN]);
142 fhci_dbg(fhci, "<- %s\n", __func__);
149 struct fhci_hcd *fhci = usb->fhci;
153 fhci_dbg(fhci, "-> %s\n", __func__);
155 fhci_stop_sof_timer(fhci);
157 mode = in_8(&fhci->regs->usb_usmod);
158 out_8(&fhci->regs->usb_usmod, mode & (~USB_MODE_EN));
161 mask = in_be16(&fhci->regs->usb_usbmr);
162 out_be16(&fhci->regs->usb_usbmr, mask & (~USB_E_IDLE_MASK));
164 fhci_io_port_generate_reset(fhci);
167 out_be16(&fhci->regs->usb_usbmr, mask);
170 mode = in_8(&fhci->regs->usb_usmod);
171 out_8(&fhci->regs->usb_usmod, mode | USB_MODE_EN);
172 fhci_start_sof_timer(fhci);
174 fhci_dbg(fhci, "<- %s\n", __func__);
179 struct fhci_hcd *fhci = hcd_to_fhci(hcd);
183 fhci_dbg(fhci, "-> %s\n", __func__);
185 spin_lock_irqsave(&fhci->lock, flags);
187 if (fhci->vroot_hub->port.wPortChange & (USB_PORT_STAT_C_CONNECTION |
192 fhci_dbg(fhci, "-- %s\n", __func__);
195 spin_unlock_irqrestore(&fhci->lock, flags);
197 fhci_dbg(fhci, "<- %s\n", __func__);
205 struct fhci_hcd *fhci = hcd_to_fhci(hcd);
211 spin_lock_irqsave(&fhci->lock, flags);
213 fhci_dbg(fhci, "-> %s\n", __func__);
226 fhci->vroot_hub->feature &= (1 << wValue);
230 fhci->vroot_hub->port.wPortStatus &=
232 fhci_port_disable(fhci);
235 fhci->vroot_hub->port.wPortChange &=
239 fhci->vroot_hub->port.wPortStatus &=
241 fhci_stop_sof_timer(fhci);
244 fhci->vroot_hub->port.wPortChange &=
248 fhci->vroot_hub->port.wPortStatus &=
250 fhci_config_transceiver(fhci, FHCI_PORT_POWER_OFF);
253 fhci->vroot_hub->port.wPortChange &=
257 fhci->vroot_hub->port.wPortChange &=
261 fhci->vroot_hub->port.wPortChange &=
274 cpu_to_le16(fhci->vroot_hub->hub.wHubStatus);
276 cpu_to_le16(fhci->vroot_hub->hub.wHubChange);
281 cpu_to_le16(fhci->vroot_hub->port.wPortStatus);
283 cpu_to_le16(fhci->vroot_hub->port.wPortChange);
295 fhci->vroot_hub->feature |= (1 << wValue);
299 fhci->vroot_hub->port.wPortStatus |=
301 fhci_port_enable(fhci->usb_lld);
304 fhci->vroot_hub->port.wPortStatus |=
306 fhci_stop_sof_timer(fhci);
309 fhci->vroot_hub->port.wPortStatus |=
311 fhci_port_reset(fhci->usb_lld);
312 fhci->vroot_hub->port.wPortStatus |=
314 fhci->vroot_hub->port.wPortStatus &=
318 fhci->vroot_hub->port.wPortStatus |=
320 fhci_config_transceiver(fhci, FHCI_PORT_WAITING);
331 fhci_dbg(fhci, "<- %s\n", __func__);
333 spin_unlock_irqrestore(&fhci->lock, flags);