^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-1.0+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * OHCI HCD (Host Controller Driver) for USB.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * (C) Copyright 2002 Hewlett-Packard Company
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * USB Bus Glue for Samsung S3C2410
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Written by Christopher Hoover <ch@hpl.hp.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Based on fragments of previous driver by Russell King et al.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * by Ben Dooks, <ben@simtec.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * Copyright (C) 2004 Simtec Electronics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * Thanks to basprog@mail.ru for updates to newer kernels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * This file is licenced under the GPL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/clk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include <linux/platform_data/usb-ohci-s3c2410.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include <linux/usb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #include <linux/usb/hcd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #include "ohci.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define valid_port(idx) ((idx) == 1 || (idx) == 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* clock device associated with the hcd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define DRIVER_DESC "OHCI S3C2410 driver"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) static const char hcd_name[] = "ohci-s3c2410";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static struct clk *clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static struct clk *usb_clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) static struct hc_driver __read_mostly ohci_s3c2410_hc_driver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /* forward definitions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* conversion functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) return dev_get_platdata(hcd->self.controller);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) struct s3c2410_hcd_info *info = dev_get_platdata(&dev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) dev_dbg(&dev->dev, "s3c2410_start_hc:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) clk_prepare_enable(usb_clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) mdelay(2); /* let the bus clock stabilise */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) clk_prepare_enable(clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) if (info != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) info->hcd = hcd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) info->report_oc = s3c2410_hcd_oc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) if (info->enable_oc != NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) (info->enable_oc)(info, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) static void s3c2410_stop_hc(struct platform_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) struct s3c2410_hcd_info *info = dev_get_platdata(&dev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) dev_dbg(&dev->dev, "s3c2410_stop_hc:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) if (info != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) info->report_oc = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) info->hcd = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) if (info->enable_oc != NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) (info->enable_oc)(info, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) clk_disable_unprepare(clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) clk_disable_unprepare(usb_clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /* ohci_s3c2410_hub_status_data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * update the status data from the hub with anything that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) * has been detected by our system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) ohci_s3c2410_hub_status_data(struct usb_hcd *hcd, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) struct s3c2410_hcd_info *info = to_s3c2410_info(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) struct s3c2410_hcd_port *port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) int orig;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) int portno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) orig = ohci_hub_status_data(hcd, buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) if (info == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) return orig;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) port = &info->port[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /* mark any changed port as changed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) for (portno = 0; portno < 2; port++, portno++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if (port->oc_changed == 1 &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) port->flags & S3C_HCDFLG_USED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) dev_dbg(hcd->self.controller,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) "oc change on port %d\n", portno);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) if (orig < 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) orig = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) buf[0] |= 1<<(portno+1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) return orig;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) /* s3c2410_usb_set_power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * configure the power on a port, by calling the platform device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * routine registered with the platform device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static void s3c2410_usb_set_power(struct s3c2410_hcd_info *info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) int port, int to)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) if (info == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) if (info->power_control != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) info->port[port-1].power = to;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) (info->power_control)(port-1, to);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) /* ohci_s3c2410_hub_control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * look at control requests to the hub, and see if we need
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * to take any action or over-ride the results from the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) static int ohci_s3c2410_hub_control(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) struct usb_hcd *hcd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) u16 typeReq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) u16 wValue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) u16 wIndex,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) char *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) u16 wLength)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) struct s3c2410_hcd_info *info = to_s3c2410_info(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) struct usb_hub_descriptor *desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) int ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) u32 *data = (u32 *)buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) dev_dbg(hcd->self.controller,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) "s3c2410_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) hcd, typeReq, wValue, wIndex, buf, wLength);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) /* if we are only an humble host without any special capabilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * process the request straight away and exit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) if (info == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) ret = ohci_hub_control(hcd, typeReq, wValue,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) wIndex, buf, wLength);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) /* check the request to see if it needs handling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) switch (typeReq) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) case SetPortFeature:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) if (wValue == USB_PORT_FEAT_POWER) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) s3c2410_usb_set_power(info, wIndex, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) case ClearPortFeature:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) switch (wValue) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) case USB_PORT_FEAT_C_OVER_CURRENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) dev_dbg(hcd->self.controller,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) "ClearPortFeature: C_OVER_CURRENT\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if (valid_port(wIndex)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) info->port[wIndex-1].oc_changed = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) info->port[wIndex-1].oc_status = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) case USB_PORT_FEAT_OVER_CURRENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) dev_dbg(hcd->self.controller,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) "ClearPortFeature: OVER_CURRENT\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) if (valid_port(wIndex))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) info->port[wIndex-1].oc_status = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) case USB_PORT_FEAT_POWER:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) dev_dbg(hcd->self.controller,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) "ClearPortFeature: POWER\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) if (valid_port(wIndex)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) s3c2410_usb_set_power(info, wIndex, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) switch (typeReq) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) case GetHubDescriptor:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) /* update the hub's descriptor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) desc = (struct usb_hub_descriptor *)buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) if (info->power_control == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) desc->wHubCharacteristics);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) /* remove the old configurations for power-switching, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) * over-current protection, and insert our new configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) desc->wHubCharacteristics |= cpu_to_le16(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) HUB_CHAR_INDV_PORT_LPSM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) if (info->enable_oc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) desc->wHubCharacteristics &= ~cpu_to_le16(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) HUB_CHAR_OCPM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) desc->wHubCharacteristics |= cpu_to_le16(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) HUB_CHAR_INDV_PORT_OCPM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) desc->wHubCharacteristics);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) case GetPortStatus:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) /* check port status */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) if (valid_port(wIndex)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) if (info->port[wIndex-1].oc_changed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) *data |= cpu_to_le32(RH_PS_OCIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) if (info->port[wIndex-1].oc_status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) *data |= cpu_to_le32(RH_PS_POCI);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) /* s3c2410_hcd_oc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) * handle an over-current report
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) struct s3c2410_hcd_port *port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) int portno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) if (info == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) port = &info->port[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) for (portno = 0; portno < 2; port++, portno++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) if (port_oc & (1<<portno) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) port->flags & S3C_HCDFLG_USED) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) port->oc_status = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) port->oc_changed = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) /* ok, once over-current is detected,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) the port needs to be powered down */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) s3c2410_usb_set_power(info, portno+1, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) /* may be called without controller electrically present */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) /* may be called with controller, bus, and devices active */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) * ohci_hcd_s3c2410_remove - shutdown processing for HCD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) * @dev: USB Host Controller being removed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) * Context: !in_interrupt()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) * Reverses the effect of ohci_hcd_3c2410_probe(), first invoking
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) * the HCD's stop() method. It is always called from a thread
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) * context, normally "rmmod", "apmd", or something similar.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) ohci_hcd_s3c2410_remove(struct platform_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) struct usb_hcd *hcd = platform_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) usb_remove_hcd(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) s3c2410_stop_hc(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) usb_put_hcd(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) * ohci_hcd_s3c2410_probe - initialize S3C2410-based HCDs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) * Context: !in_interrupt()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) * Allocates basic resources for this USB host controller, and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) * then invokes the start() method for the HCD associated with it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) * through the hotplug entry's driver_data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) static int ohci_hcd_s3c2410_probe(struct platform_device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) struct usb_hcd *hcd = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) struct s3c2410_hcd_info *info = dev_get_platdata(&dev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) int retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) s3c2410_usb_set_power(info, 1, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) s3c2410_usb_set_power(info, 2, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) hcd = usb_create_hcd(&ohci_s3c2410_hc_driver, &dev->dev, "s3c24xx");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) if (hcd == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) hcd->rsrc_start = dev->resource[0].start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) hcd->rsrc_len = resource_size(&dev->resource[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) hcd->regs = devm_ioremap_resource(&dev->dev, &dev->resource[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) if (IS_ERR(hcd->regs)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) retval = PTR_ERR(hcd->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) goto err_put;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) clk = devm_clk_get(&dev->dev, "usb-host");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) if (IS_ERR(clk)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) dev_err(&dev->dev, "cannot get usb-host clock\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) retval = PTR_ERR(clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) goto err_put;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) usb_clk = devm_clk_get(&dev->dev, "usb-bus-host");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) if (IS_ERR(usb_clk)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) dev_err(&dev->dev, "cannot get usb-bus-host clock\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) retval = PTR_ERR(usb_clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) goto err_put;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) s3c2410_start_hc(dev, hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) retval = usb_add_hcd(hcd, dev->resource[1].start, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) if (retval != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) goto err_ioremap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) device_wakeup_enable(hcd->self.controller);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) err_ioremap:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) s3c2410_stop_hc(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) err_put:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) usb_put_hcd(hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) return retval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) /*-------------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) #ifdef CONFIG_PM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) static int ohci_hcd_s3c2410_drv_suspend(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) struct usb_hcd *hcd = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) struct platform_device *pdev = to_platform_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) bool do_wakeup = device_may_wakeup(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) rc = ohci_suspend(hcd, do_wakeup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) s3c2410_stop_hc(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) static int ohci_hcd_s3c2410_drv_resume(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) struct usb_hcd *hcd = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) struct platform_device *pdev = to_platform_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) s3c2410_start_hc(pdev, hcd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) ohci_resume(hcd, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) #define ohci_hcd_s3c2410_drv_suspend NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) #define ohci_hcd_s3c2410_drv_resume NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) static const struct dev_pm_ops ohci_hcd_s3c2410_pm_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) .suspend = ohci_hcd_s3c2410_drv_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) .resume = ohci_hcd_s3c2410_drv_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) static const struct of_device_id ohci_hcd_s3c2410_dt_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) { .compatible = "samsung,s3c2410-ohci" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) { /* sentinel */ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) MODULE_DEVICE_TABLE(of, ohci_hcd_s3c2410_dt_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) static struct platform_driver ohci_hcd_s3c2410_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) .probe = ohci_hcd_s3c2410_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) .remove = ohci_hcd_s3c2410_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) .shutdown = usb_hcd_platform_shutdown,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) .name = "s3c2410-ohci",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) .pm = &ohci_hcd_s3c2410_pm_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) .of_match_table = ohci_hcd_s3c2410_dt_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) static int __init ohci_s3c2410_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) if (usb_disabled())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) pr_info("%s: " DRIVER_DESC "\n", hcd_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) ohci_init_driver(&ohci_s3c2410_hc_driver, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) * The Samsung HW has some unusual quirks, which require
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) * Sumsung-specific workarounds. We override certain hc_driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) * functions here to achieve that. We explicitly do not enhance
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) * ohci_driver_overrides to allow this more easily, since this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) * is an unusual case, and we don't want to encourage others to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) * override these functions by making it too easy.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) ohci_s3c2410_hc_driver.hub_status_data = ohci_s3c2410_hub_status_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) ohci_s3c2410_hc_driver.hub_control = ohci_s3c2410_hub_control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) return platform_driver_register(&ohci_hcd_s3c2410_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) module_init(ohci_s3c2410_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) static void __exit ohci_s3c2410_cleanup(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) platform_driver_unregister(&ohci_hcd_s3c2410_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) module_exit(ohci_s3c2410_cleanup);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) MODULE_DESCRIPTION(DRIVER_DESC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) MODULE_ALIAS("platform:s3c2410-ohci");