Lines Matching +full:self +full:- +full:powered
1 // SPDX-License-Identifier: GPL-1.0+
6 * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
7 * (C) Copyright 2002 Hewlett-Packard Company
14 * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c
28 #include <linux/platform_data/usb-ohci-s3c2410.h>
42 static const char hcd_name[] = "ohci-s3c2410";
57 return dev_get_platdata(hcd->self.controller); in to_s3c2410_info()
62 struct s3c2410_hcd_info *info = dev_get_platdata(&dev->dev); in s3c2410_start_hc()
64 dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); in s3c2410_start_hc()
72 info->hcd = hcd; in s3c2410_start_hc()
73 info->report_oc = s3c2410_hcd_oc; in s3c2410_start_hc()
75 if (info->enable_oc != NULL) in s3c2410_start_hc()
76 (info->enable_oc)(info, 1); in s3c2410_start_hc()
82 struct s3c2410_hcd_info *info = dev_get_platdata(&dev->dev); in s3c2410_stop_hc()
84 dev_dbg(&dev->dev, "s3c2410_stop_hc:\n"); in s3c2410_stop_hc()
87 info->report_oc = NULL; in s3c2410_stop_hc()
88 info->hcd = NULL; in s3c2410_stop_hc()
90 if (info->enable_oc != NULL) in s3c2410_stop_hc()
91 (info->enable_oc)(info, 0); in s3c2410_stop_hc()
117 port = &info->port[0]; in ohci_s3c2410_hub_status_data()
122 if (port->oc_changed == 1 && in ohci_s3c2410_hub_status_data()
123 port->flags & S3C_HCDFLG_USED) { in ohci_s3c2410_hub_status_data()
124 dev_dbg(hcd->self.controller, in ohci_s3c2410_hub_status_data()
149 if (info->power_control != NULL) { in s3c2410_usb_set_power()
150 info->port[port-1].power = to; in s3c2410_usb_set_power()
151 (info->power_control)(port-1, to); in s3c2410_usb_set_power()
158 * to take any action or over-ride the results from the
172 int ret = -EINVAL; in ohci_s3c2410_hub_control()
175 dev_dbg(hcd->self.controller, in ohci_s3c2410_hub_control()
193 dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n"); in ohci_s3c2410_hub_control()
202 dev_dbg(hcd->self.controller, in ohci_s3c2410_hub_control()
206 info->port[wIndex-1].oc_changed = 0; in ohci_s3c2410_hub_control()
207 info->port[wIndex-1].oc_status = 0; in ohci_s3c2410_hub_control()
213 dev_dbg(hcd->self.controller, in ohci_s3c2410_hub_control()
217 info->port[wIndex-1].oc_status = 0; in ohci_s3c2410_hub_control()
222 dev_dbg(hcd->self.controller, in ohci_s3c2410_hub_control()
244 if (info->power_control == NULL) in ohci_s3c2410_hub_control()
247 dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n", in ohci_s3c2410_hub_control()
248 desc->wHubCharacteristics); in ohci_s3c2410_hub_control()
250 /* remove the old configurations for power-switching, and in ohci_s3c2410_hub_control()
251 * over-current protection, and insert our new configuration in ohci_s3c2410_hub_control()
254 desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM); in ohci_s3c2410_hub_control()
255 desc->wHubCharacteristics |= cpu_to_le16( in ohci_s3c2410_hub_control()
258 if (info->enable_oc) { in ohci_s3c2410_hub_control()
259 desc->wHubCharacteristics &= ~cpu_to_le16( in ohci_s3c2410_hub_control()
261 desc->wHubCharacteristics |= cpu_to_le16( in ohci_s3c2410_hub_control()
265 dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n", in ohci_s3c2410_hub_control()
266 desc->wHubCharacteristics); in ohci_s3c2410_hub_control()
273 dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex); in ohci_s3c2410_hub_control()
276 if (info->port[wIndex-1].oc_changed) in ohci_s3c2410_hub_control()
279 if (info->port[wIndex-1].oc_status) in ohci_s3c2410_hub_control()
290 * handle an over-current report
302 port = &info->port[0]; in s3c2410_hcd_oc()
308 port->flags & S3C_HCDFLG_USED) { in s3c2410_hcd_oc()
309 port->oc_status = 1; in s3c2410_hcd_oc()
310 port->oc_changed = 1; in s3c2410_hcd_oc()
312 /* ok, once over-current is detected, in s3c2410_hcd_oc()
313 the port needs to be powered down */ in s3c2410_hcd_oc()
325 * ohci_hcd_s3c2410_remove - shutdown processing for HCD
347 * ohci_hcd_s3c2410_probe - initialize S3C2410-based HCDs
358 struct s3c2410_hcd_info *info = dev_get_platdata(&dev->dev); in ohci_hcd_s3c2410_probe()
364 hcd = usb_create_hcd(&ohci_s3c2410_hc_driver, &dev->dev, "s3c24xx"); in ohci_hcd_s3c2410_probe()
366 return -ENOMEM; in ohci_hcd_s3c2410_probe()
368 hcd->rsrc_start = dev->resource[0].start; in ohci_hcd_s3c2410_probe()
369 hcd->rsrc_len = resource_size(&dev->resource[0]); in ohci_hcd_s3c2410_probe()
371 hcd->regs = devm_ioremap_resource(&dev->dev, &dev->resource[0]); in ohci_hcd_s3c2410_probe()
372 if (IS_ERR(hcd->regs)) { in ohci_hcd_s3c2410_probe()
373 retval = PTR_ERR(hcd->regs); in ohci_hcd_s3c2410_probe()
377 clk = devm_clk_get(&dev->dev, "usb-host"); in ohci_hcd_s3c2410_probe()
379 dev_err(&dev->dev, "cannot get usb-host clock\n"); in ohci_hcd_s3c2410_probe()
384 usb_clk = devm_clk_get(&dev->dev, "usb-bus-host"); in ohci_hcd_s3c2410_probe()
386 dev_err(&dev->dev, "cannot get usb-bus-host clock\n"); in ohci_hcd_s3c2410_probe()
393 retval = usb_add_hcd(hcd, dev->resource[1].start, 0); in ohci_hcd_s3c2410_probe()
397 device_wakeup_enable(hcd->self.controller); in ohci_hcd_s3c2410_probe()
408 /*-------------------------------------------------------------------------*/
449 { .compatible = "samsung,s3c2410-ohci" },
460 .name = "s3c2410-ohci",
469 return -ENODEV; in ohci_s3c2410_init()
476 * Sumsung-specific workarounds. We override certain hc_driver in ohci_s3c2410_init()
498 MODULE_ALIAS("platform:s3c2410-ohci");