]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Merge 3.14-rc3 into usb-next
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Feb 2014 17:27:12 +0000 (09:27 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Feb 2014 17:27:12 +0000 (09:27 -0800)
We want the fixes in this branch as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 files changed:
Documentation/devicetree/bindings/usb/usb-ehci.txt
Documentation/devicetree/bindings/usb/usb-ohci.txt [new file with mode: 0644]
Documentation/devicetree/bindings/usb/usb-uhci.txt [moved from Documentation/devicetree/bindings/usb/platform-uhci.txt with 76% similarity]
Documentation/devicetree/bindings/usb/usb-xhci.txt
Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt [deleted file]
Documentation/devicetree/bindings/usb/vt8500-ehci.txt [deleted file]
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/phy/Kconfig
drivers/usb/core/driver.c
drivers/usb/core/hub.c
drivers/usb/dwc2/core_intr.c
drivers/usb/dwc2/hcd_intr.c
drivers/usb/gadget/Kconfig
drivers/usb/host/Kconfig
drivers/usb/host/ehci-platform.c
drivers/usb/host/ohci-platform.c
drivers/usb/host/uhci-platform.c
drivers/usb/host/xhci-plat.c
drivers/usb/misc/Kconfig
drivers/usb/misc/usbled.c
drivers/usb/phy/phy-msm-usb.c

index fa18612f757b8edc6170cd1381dc5d2fc36cceab..ff151ec084c402c75ce0d634dbd9be622cba19bd 100644 (file)
@@ -1,19 +1,20 @@
 USB EHCI controllers
 
 Required properties:
-  - compatible : should be "usb-ehci".
+  - compatible : should be "generic-ehci".
   - reg : should contain at least address and length of the standard EHCI
     register set for the device. Optional platform-dependent registers
     (debug-port or other) can be also specified here, but only after
     definition of standard EHCI registers.
   - interrupts : one EHCI interrupt should be described here.
-If device registers are implemented in big endian mode, the device
-node should have "big-endian-regs" property.
-If controller implementation operates with big endian descriptors,
-"big-endian-desc" property should be specified.
-If both big endian registers and descriptors are used by the controller
-implementation, "big-endian" property can be specified instead of having
-both "big-endian-regs" and "big-endian-desc".
+
+Optional properties:
+ - big-endian-regs : boolean, set this for hcds with big-endian registers
+ - big-endian-desc : boolean, set this for hcds with big-endian descriptors
+ - big-endian : boolean, for hcds with big-endian-regs + big-endian-desc
+ - clocks : a list of phandle + clock specifier pairs
+ - phys : phandle + phy specifier pair
+ - phy-names : "usb"
 
 Example (Sequoia 440EPx):
     ehci@e0000300 {
@@ -23,3 +24,13 @@ Example (Sequoia 440EPx):
           reg = <0 e0000300 90 0 e0000390 70>;
           big-endian;
    };
+
+Example (Allwinner sun4i A10 SoC):
+   ehci0: usb@01c14000 {
+          compatible = "allwinner,sun4i-a10-ehci", "generic-ehci";
+          reg = <0x01c14000 0x100>;
+          interrupts = <39>;
+          clocks = <&ahb_gates 1>;
+          phys = <&usbphy 1>;
+          phy-names = "usb";
+   };
diff --git a/Documentation/devicetree/bindings/usb/usb-ohci.txt b/Documentation/devicetree/bindings/usb/usb-ohci.txt
new file mode 100644 (file)
index 0000000..45f67d9
--- /dev/null
@@ -0,0 +1,25 @@
+USB OHCI controllers
+
+Required properties:
+- compatible : "generic-ohci"
+- reg : ohci controller register range (address and length)
+- interrupts : ohci controller interrupt
+
+Optional properties:
+- big-endian-regs : boolean, set this for hcds with big-endian registers
+- big-endian-desc : boolean, set this for hcds with big-endian descriptors
+- big-endian : boolean, for hcds with big-endian-regs + big-endian-desc
+- clocks : a list of phandle + clock specifier pairs
+- phys : phandle + phy specifier pair
+- phy-names : "usb"
+
+Example:
+
+       ohci0: usb@01c14400 {
+               compatible = "allwinner,sun4i-a10-ohci", "generic-ohci";
+               reg = <0x01c14400 0x100>;
+               interrupts = <64>;
+               clocks = <&usb_clk 6>, <&ahb_gates 2>;
+               phys = <&usbphy 1>;
+               phy-names = "usb";
+       };
similarity index 76%
rename from Documentation/devicetree/bindings/usb/platform-uhci.txt
rename to Documentation/devicetree/bindings/usb/usb-uhci.txt
index a4fb0719d157195e18c7873ef9c03ec42ff98858..298133416c97ddfc01124e57cbd81dfb247f3b39 100644 (file)
@@ -2,14 +2,14 @@ Generic Platform UHCI Controller
 -----------------------------------------------------
 
 Required properties:
-- compatible : "platform-uhci"
+- compatible : "generic-uhci" (deprecated: "platform-uhci")
 - reg : Should contain 1 register ranges(address and length)
 - interrupts : UHCI controller interrupt
 
 Example:
 
        uhci@d8007b00 {
-               compatible = "platform-uhci";
+               compatible = "generic-uhci";
                reg = <0xd8007b00 0x200>;
                interrupts = <43>;
        };
index 5752df0e17a2e27790ef6ff7841f5d103fb5bc20..90f8f607d125b5c158012e7b24aa1ae58d564260 100644 (file)
@@ -1,14 +1,14 @@
 USB xHCI controllers
 
 Required properties:
-  - compatible: should be "xhci-platform".
+  - compatible: should be "generic-xhci" (deprecated: "xhci-platform").
   - reg: should contain address and length of the standard XHCI
     register set for the device.
   - interrupts: one XHCI interrupt should be described here.
 
 Example:
        usb@f0931000 {
-               compatible = "xhci-platform";
+               compatible = "generic-xhci";
                reg = <0xf0931000 0x8c8>;
                interrupts = <0x0 0x4e 0x0>;
        };
diff --git a/Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt b/Documentation/devicetree/bindings/usb/via,vt8500-ehci.txt
deleted file mode 100644 (file)
index 17b3ad1..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-VIA/Wondermedia VT8500 EHCI Controller
------------------------------------------------------
-
-Required properties:
-- compatible : "via,vt8500-ehci"
-- reg : Should contain 1 register ranges(address and length)
-- interrupts : ehci controller interrupt
-
-Example:
-
-       ehci@d8007900 {
-               compatible = "via,vt8500-ehci";
-               reg = <0xd8007900 0x200>;
-               interrupts = <43>;
-       };
diff --git a/Documentation/devicetree/bindings/usb/vt8500-ehci.txt b/Documentation/devicetree/bindings/usb/vt8500-ehci.txt
deleted file mode 100644 (file)
index 5fb8fd6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-VIA VT8500 and Wondermedia WM8xxx SoC USB controllers.
-
-Required properties:
- - compatible: Should be "via,vt8500-ehci" or "wm,prizm-ehci".
- - reg: Address range of the ehci registers. size should be 0x200
- - interrupts: Should contain the ehci interrupt.
-
-usb: ehci@D8007100 {
-       compatible = "wm,prizm-ehci", "usb-ehci";
-       reg = <0xD8007100 0x200>;
-       interrupts = <1>;
-};
index 3bfac3accd22fa6dc8a9be7a31cf9fd2814d2443..5a86198da3ab2600f863c80130b7611e7c0a4751 100644 (file)
@@ -2275,6 +2275,7 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) },
        { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_RISO_KAGAKU, USB_DEVICE_ID_RI_KA_WEBMAIL) },
        { }
 };
 
index 5a5248f2cc075b73ca68250866bddbc2b46f9bb1..b0027f7a46bb480a044b69d1b2a62f21cae603c1 100644 (file)
 #define USB_DEVICE_ID_PRIMAX_KEYBOARD  0x4e05
 
 
+#define USB_VENDOR_ID_RISO_KAGAKU      0x1294  /* Riso Kagaku Corp. */
+#define USB_DEVICE_ID_RI_KA_WEBMAIL    0x1320  /* Webmail Notifier */
+
 #endif
index afa2354f6600e72d904ea907ee92f775010ae8a9..4ef8755733c27b9c7f3891f91ee518b9e3bd1a3a 100644 (file)
@@ -5,7 +5,7 @@
 menu "PHY Subsystem"
 
 config GENERIC_PHY
-       tristate "PHY Core"
+       bool "PHY Core"
        help
          Generic PHY support.
 
index ab90a01568283c3c0d2a0a3df9b653bfba65a812..85e0450a2bc72c693e2ea82eff109835d957a71d 100644 (file)
@@ -312,9 +312,9 @@ static int usb_probe_interface(struct device *dev)
                return error;
        }
 
-       id = usb_match_id(intf, driver->id_table);
+       id = usb_match_dynamic_id(intf, driver);
        if (!id)
-               id = usb_match_dynamic_id(intf, driver);
+               id = usb_match_id(intf, driver->id_table);
        if (!id)
                return error;
 
index 64ea21971be23f770986b25cf05890553cf8d195..519f2c3594b222a478ea9ff2856deb4c17850ed4 100644 (file)
@@ -499,7 +499,8 @@ static void led_work (struct work_struct *work)
                changed++;
        }
        if (changed)
-               schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD);
+               queue_delayed_work(system_power_efficient_wq,
+                               &hub->leds, LED_CYCLE_PERIOD);
 }
 
 /* use a short timeout for hub/port status fetches */
@@ -1041,7 +1042,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
                if (type == HUB_INIT) {
                        delay = hub_power_on(hub, false);
                        PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2);
-                       schedule_delayed_work(&hub->init_work,
+                       queue_delayed_work(system_power_efficient_wq,
+                                       &hub->init_work,
                                        msecs_to_jiffies(delay));
 
                        /* Suppress autosuspend until init is done */
@@ -1195,7 +1197,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
                /* Don't do a long sleep inside a workqueue routine */
                if (type == HUB_INIT2) {
                        PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func3);
-                       schedule_delayed_work(&hub->init_work,
+                       queue_delayed_work(system_power_efficient_wq,
+                                       &hub->init_work,
                                        msecs_to_jiffies(delay));
                        return;         /* Continues at init3: below */
                } else {
@@ -1209,7 +1212,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
        if (status < 0)
                dev_err(hub->intfdev, "activate --> %d\n", status);
        if (hub->has_indicators && blinkenlights)
-               schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD);
+               queue_delayed_work(system_power_efficient_wq,
+                               &hub->leds, LED_CYCLE_PERIOD);
 
        /* Scan all ports that need attention */
        kick_khubd(hub);
@@ -4311,7 +4315,8 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1)
                /* hub LEDs are probably harder to miss than syslog */
                if (hub->has_indicators) {
                        hub->indicator[port1-1] = INDICATOR_GREEN_BLINK;
-                       schedule_delayed_work (&hub->leds, 0);
+                       queue_delayed_work(system_power_efficient_wq,
+                                       &hub->leds, 0);
                }
        }
        kfree(qual);
@@ -4540,7 +4545,9 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
                                if (hub->has_indicators) {
                                        hub->indicator[port1-1] =
                                                INDICATOR_AMBER_BLINK;
-                                       schedule_delayed_work (&hub->leds, 0);
+                                       queue_delayed_work(
+                                               system_power_efficient_wq,
+                                               &hub->leds, 0);
                                }
                                status = -ENOTCONN;     /* Don't retry */
                                goto loop_disable;
index 8205799e6db32082cfd36aa9343464fa16283cf0..c93918b70d032e88654f8db40873e98b03112da7 100644 (file)
@@ -71,6 +71,26 @@ static const char *dwc2_op_state_str(struct dwc2_hsotg *hsotg)
        }
 }
 
+/**
+ * dwc2_handle_usb_port_intr - handles OTG PRTINT interrupts.
+ * When the PRTINT interrupt fires, there are certain status bits in the Host
+ * Port that needs to get cleared.
+ *
+ * @hsotg: Programming view of DWC_otg controller
+ */
+static void dwc2_handle_usb_port_intr(struct dwc2_hsotg *hsotg)
+{
+       u32 hprt0 = readl(hsotg->regs + HPRT0);
+
+       if (hprt0 & HPRT0_ENACHG) {
+               hprt0 &= ~HPRT0_ENA;
+               writel(hprt0, hsotg->regs + HPRT0);
+       }
+
+       /* Clear interrupt */
+       writel(GINTSTS_PRTINT, hsotg->regs + GINTSTS);
+}
+
 /**
  * dwc2_handle_mode_mismatch_intr() - Logs a mode mismatch warning message
  *
@@ -479,9 +499,8 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev)
                if (dwc2_is_device_mode(hsotg)) {
                        dev_dbg(hsotg->dev,
                                " --Port interrupt received in Device mode--\n");
-                       gintsts = GINTSTS_PRTINT;
-                       writel(gintsts, hsotg->regs + GINTSTS);
-                       retval = 1;
+                       dwc2_handle_usb_port_intr(hsotg);
+                       retval = IRQ_HANDLED;
                }
        }
 
index 012f17ec1a37d3fa6b60f0a289e547e5cf054381..47b9eb5389b468d4710263bdd9a8d052cbba635c 100644 (file)
@@ -975,8 +975,8 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg,
                                  struct dwc2_qtd *qtd)
 {
        struct dwc2_hcd_urb *urb = qtd->urb;
-       int pipe_type = dwc2_hcd_get_pipe_type(&urb->pipe_info);
        enum dwc2_halt_status halt_status = DWC2_HC_XFER_COMPLETE;
+       int pipe_type;
        int urb_xfer_done;
 
        if (dbg_hc(chan))
@@ -984,6 +984,11 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg,
                         "--Host Channel %d Interrupt: Transfer Complete--\n",
                         chnum);
 
+       if (!urb)
+               goto handle_xfercomp_done;
+
+       pipe_type = dwc2_hcd_get_pipe_type(&urb->pipe_info);
+
        if (hsotg->core_params->dma_desc_enable > 0) {
                dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, halt_status);
                if (pipe_type == USB_ENDPOINT_XFER_ISOC)
@@ -1005,9 +1010,6 @@ static void dwc2_hc_xfercomp_intr(struct dwc2_hsotg *hsotg,
                }
        }
 
-       if (!urb)
-               goto handle_xfercomp_done;
-
        /* Update the QTD and URB states */
        switch (pipe_type) {
        case USB_ENDPOINT_XFER_CONTROL:
@@ -1105,7 +1107,7 @@ static void dwc2_hc_stall_intr(struct dwc2_hsotg *hsotg,
                               struct dwc2_qtd *qtd)
 {
        struct dwc2_hcd_urb *urb = qtd->urb;
-       int pipe_type = dwc2_hcd_get_pipe_type(&urb->pipe_info);
+       int pipe_type;
 
        dev_dbg(hsotg->dev, "--Host Channel %d Interrupt: STALL Received--\n",
                chnum);
@@ -1119,6 +1121,8 @@ static void dwc2_hc_stall_intr(struct dwc2_hsotg *hsotg,
        if (!urb)
                goto handle_stall_halt;
 
+       pipe_type = dwc2_hcd_get_pipe_type(&urb->pipe_info);
+
        if (pipe_type == USB_ENDPOINT_XFER_CONTROL)
                dwc2_host_complete(hsotg, qtd, -EPIPE);
 
index 8154165aa60142303a073c316ffcc8dde92e9d0a..42f017afd366ab33b0e365244076f3972bbe225c 100644 (file)
@@ -226,7 +226,7 @@ config USB_GR_UDC
 config USB_OMAP
        tristate "OMAP USB Device Controller"
        depends on ARCH_OMAP1
-       select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_H4_OTG
+       select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3
        help
           Many Texas Instruments OMAP processors have flexible full
           speed USB device controllers, with support for up to 30
index a9707da7da0bff969c68d6d5a0fa66f2816ef8b7..e22b82660831a00bb9b42803538e1816562c7a6f 100644 (file)
@@ -584,7 +584,6 @@ config FHCI_DEBUG
 config USB_U132_HCD
        tristate "Elan U132 Adapter Host Controller"
        depends on USB_FTDI_ELAN
-       default M
        help
          The U132 adapter is a USB to CardBus adapter specifically designed
          for PC cards that contain an OHCI host controller. Typical PC cards
index 01536cfd361da2bb5f275cd1812ae2eb2e9b9729..b3a0e11073aae8a3ed873305cd1737a1d2a45beb 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Copyright 2007 Steven Brown <sbrown@cortland.com>
  * Copyright 2010-2012 Hauke Mehrtens <hauke@hauke-m.de>
+ * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
  *
  * Derived from the ohci-ssb driver
  * Copyright 2007 Michael Buesch <m@bues.ch>
@@ -18,6 +19,7 @@
  *
  * Licensed under the GNU/GPL. See COPYING for details.
  */
+#include <linux/clk.h>
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
@@ -25,6 +27,7 @@
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/usb.h>
 #include <linux/usb/hcd.h>
 #include "ehci.h"
 
 #define DRIVER_DESC "EHCI generic platform driver"
+#define EHCI_MAX_CLKS 3
+#define hcd_to_ehci_priv(h) ((struct ehci_platform_priv *)hcd_to_ehci(h)->priv)
+
+struct ehci_platform_priv {
+       struct clk *clks[EHCI_MAX_CLKS];
+       struct phy *phy;
+};
 
 static const char hcd_name[] = "ehci-platform";
 
@@ -45,8 +55,6 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
 
        hcd->has_tt = pdata->has_tt;
        ehci->has_synopsys_hc_bug = pdata->has_synopsys_hc_bug;
-       ehci->big_endian_desc = pdata->big_endian_desc;
-       ehci->big_endian_mmio = pdata->big_endian_mmio;
 
        if (pdata->pre_setup) {
                retval = pdata->pre_setup(hcd);
@@ -64,38 +72,91 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
        return 0;
 }
 
+static int ehci_platform_power_on(struct platform_device *dev)
+{
+       struct usb_hcd *hcd = platform_get_drvdata(dev);
+       struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
+       int clk, ret;
+
+       for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++) {
+               ret = clk_prepare_enable(priv->clks[clk]);
+               if (ret)
+                       goto err_disable_clks;
+       }
+
+       if (priv->phy) {
+               ret = phy_init(priv->phy);
+               if (ret)
+                       goto err_disable_clks;
+
+               ret = phy_power_on(priv->phy);
+               if (ret)
+                       goto err_exit_phy;
+       }
+
+       return 0;
+
+err_exit_phy:
+       phy_exit(priv->phy);
+err_disable_clks:
+       while (--clk >= 0)
+               clk_disable_unprepare(priv->clks[clk]);
+
+       return ret;
+}
+
+static void ehci_platform_power_off(struct platform_device *dev)
+{
+       struct usb_hcd *hcd = platform_get_drvdata(dev);
+       struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
+       int clk;
+
+       if (priv->phy) {
+               phy_power_off(priv->phy);
+               phy_exit(priv->phy);
+       }
+
+       for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--)
+               if (priv->clks[clk])
+                       clk_disable_unprepare(priv->clks[clk]);
+}
+
 static struct hc_driver __read_mostly ehci_platform_hc_driver;
 
 static const struct ehci_driver_overrides platform_overrides __initconst = {
-       .reset =        ehci_platform_reset,
+       .reset =                ehci_platform_reset,
+       .extra_priv_size =      sizeof(struct ehci_platform_priv),
 };
 
-static struct usb_ehci_pdata ehci_platform_defaults;
+static struct usb_ehci_pdata ehci_platform_defaults = {
+       .power_on =             ehci_platform_power_on,
+       .power_suspend =        ehci_platform_power_off,
+       .power_off =            ehci_platform_power_off,
+};
 
 static int ehci_platform_probe(struct platform_device *dev)
 {
        struct usb_hcd *hcd;
        struct resource *res_mem;
-       struct usb_ehci_pdata *pdata;
-       int irq;
-       int err;
+       struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev);
+       struct ehci_platform_priv *priv;
+       struct ehci_hcd *ehci;
+       int err, irq, clk = 0;
 
        if (usb_disabled())
                return -ENODEV;
 
        /*
-        * use reasonable defaults so platforms don't have to provide these.
-        * with DT probing on ARM, none of these are set.
+        * Use reasonable defaults so platforms don't have to provide these
+        * with DT probing on ARM.
         */
-       if (!dev_get_platdata(&dev->dev))
-               dev->dev.platform_data = &ehci_platform_defaults;
+       if (!pdata)
+               pdata = &ehci_platform_defaults;
 
        err = dma_coerce_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
        if (err)
                return err;
 
-       pdata = dev_get_platdata(&dev->dev);
-
        irq = platform_get_irq(dev, 0);
        if (irq < 0) {
                dev_err(&dev->dev, "no irq provided");
@@ -107,17 +168,72 @@ static int ehci_platform_probe(struct platform_device *dev)
                return -ENXIO;
        }
 
+       hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev,
+                            dev_name(&dev->dev));
+       if (!hcd)
+               return -ENOMEM;
+
+       platform_set_drvdata(dev, hcd);
+       dev->dev.platform_data = pdata;
+       priv = hcd_to_ehci_priv(hcd);
+       ehci = hcd_to_ehci(hcd);
+
+       if (pdata == &ehci_platform_defaults && dev->dev.of_node) {
+               if (of_property_read_bool(dev->dev.of_node, "big-endian-regs"))
+                       ehci->big_endian_mmio = 1;
+
+               if (of_property_read_bool(dev->dev.of_node, "big-endian-desc"))
+                       ehci->big_endian_desc = 1;
+
+               if (of_property_read_bool(dev->dev.of_node, "big-endian"))
+                       ehci->big_endian_mmio = ehci->big_endian_desc = 1;
+
+               priv->phy = devm_phy_get(&dev->dev, "usb");
+               if (IS_ERR(priv->phy)) {
+                       err = PTR_ERR(priv->phy);
+                       if (err == -EPROBE_DEFER)
+                               goto err_put_hcd;
+                       priv->phy = NULL;
+               }
+
+               for (clk = 0; clk < EHCI_MAX_CLKS; clk++) {
+                       priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);
+                       if (IS_ERR(priv->clks[clk])) {
+                               err = PTR_ERR(priv->clks[clk]);
+                               if (err == -EPROBE_DEFER)
+                                       goto err_put_clks;
+                               priv->clks[clk] = NULL;
+                               break;
+                       }
+               }
+       }
+
+       if (pdata->big_endian_desc)
+               ehci->big_endian_desc = 1;
+       if (pdata->big_endian_mmio)
+               ehci->big_endian_mmio = 1;
+
+#ifndef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
+       if (ehci->big_endian_mmio) {
+               dev_err(&dev->dev,
+                       "Error: CONFIG_USB_EHCI_BIG_ENDIAN_MMIO not set\n");
+               err = -EINVAL;
+               goto err_put_clks;
+       }
+#endif
+#ifndef CONFIG_USB_EHCI_BIG_ENDIAN_DESC
+       if (ehci->big_endian_desc) {
+               dev_err(&dev->dev,
+                       "Error: CONFIG_USB_EHCI_BIG_ENDIAN_DESC not set\n");
+               err = -EINVAL;
+               goto err_put_clks;
+       }
+#endif
+
        if (pdata->power_on) {
                err = pdata->power_on(dev);
                if (err < 0)
-                       return err;
-       }
-
-       hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev,
-                            dev_name(&dev->dev));
-       if (!hcd) {
-               err = -ENOMEM;
-               goto err_power;
+                       goto err_put_clks;
        }
 
        hcd->rsrc_start = res_mem->start;
@@ -126,22 +242,28 @@ static int ehci_platform_probe(struct platform_device *dev)
        hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);
        if (IS_ERR(hcd->regs)) {
                err = PTR_ERR(hcd->regs);
-               goto err_put_hcd;
+               goto err_power;
        }
        err = usb_add_hcd(hcd, irq, IRQF_SHARED);
        if (err)
-               goto err_put_hcd;
+               goto err_power;
 
        device_wakeup_enable(hcd->self.controller);
        platform_set_drvdata(dev, hcd);
 
        return err;
 
-err_put_hcd:
-       usb_put_hcd(hcd);
 err_power:
        if (pdata->power_off)
                pdata->power_off(dev);
+err_put_clks:
+       while (--clk >= 0)
+               clk_put(priv->clks[clk]);
+err_put_hcd:
+       if (pdata == &ehci_platform_defaults)
+               dev->dev.platform_data = NULL;
+
+       usb_put_hcd(hcd);
 
        return err;
 }
@@ -150,13 +272,19 @@ static int ehci_platform_remove(struct platform_device *dev)
 {
        struct usb_hcd *hcd = platform_get_drvdata(dev);
        struct usb_ehci_pdata *pdata = dev_get_platdata(&dev->dev);
+       struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
+       int clk;
 
        usb_remove_hcd(hcd);
-       usb_put_hcd(hcd);
 
        if (pdata->power_off)
                pdata->power_off(dev);
 
+       for (clk = 0; clk < EHCI_MAX_CLKS && priv->clks[clk]; clk++)
+               clk_put(priv->clks[clk]);
+
+       usb_put_hcd(hcd);
+
        if (pdata == &ehci_platform_defaults)
                dev->dev.platform_data = NULL;
 
@@ -207,8 +335,10 @@ static int ehci_platform_resume(struct device *dev)
 static const struct of_device_id vt8500_ehci_ids[] = {
        { .compatible = "via,vt8500-ehci", },
        { .compatible = "wm,prizm-ehci", },
+       { .compatible = "generic-ehci", },
        {}
 };
+MODULE_DEVICE_TABLE(of, vt8500_ehci_ids);
 
 static const struct platform_device_id ehci_platform_table[] = {
        { "ehci-platform", 0 },
index 68f674cd095fa227cf06ade8eded93364184861b..b6002c951c5cbbede27756b449b9b66e4a97e1fc 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Copyright 2007 Michael Buesch <m@bues.ch>
  * Copyright 2011-2012 Hauke Mehrtens <hauke@hauke-m.de>
+ * Copyright 2014 Hans de Goede <hdegoede@redhat.com>
  *
  * Derived from the OCHI-SSB driver
  * Derived from the OHCI-PCI driver
  * Licensed under the GNU/GPL. See COPYING for details.
  */
 
+#include <linux/clk.h>
+#include <linux/dma-mapping.h>
 #include <linux/hrtimer.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/err.h>
+#include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/usb/ohci_pdriver.h>
 #include <linux/usb.h>
 #include "ohci.h"
 
 #define DRIVER_DESC "OHCI generic platform driver"
+#define OHCI_MAX_CLKS 3
+#define hcd_to_ohci_priv(h) ((struct ohci_platform_priv *)hcd_to_ohci(h)->priv)
+
+struct ohci_platform_priv {
+       struct clk *clks[OHCI_MAX_CLKS];
+       struct phy *phy;
+};
 
 static const char hcd_name[] = "ohci-platform";
 
@@ -36,10 +47,6 @@ static int ohci_platform_reset(struct usb_hcd *hcd)
        struct usb_ohci_pdata *pdata = dev_get_platdata(&pdev->dev);
        struct ohci_hcd *ohci = hcd_to_ohci(hcd);
 
-       if (pdata->big_endian_desc)
-               ohci->flags |= OHCI_QUIRK_BE_DESC;
-       if (pdata->big_endian_mmio)
-               ohci->flags |= OHCI_QUIRK_BE_MMIO;
        if (pdata->no_big_frame_no)
                ohci->flags |= OHCI_QUIRK_FRAME_NO;
        if (pdata->num_ports)
@@ -48,11 +55,67 @@ static int ohci_platform_reset(struct usb_hcd *hcd)
        return ohci_setup(hcd);
 }
 
+static int ohci_platform_power_on(struct platform_device *dev)
+{
+       struct usb_hcd *hcd = platform_get_drvdata(dev);
+       struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
+       int clk, ret;
+
+       for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++) {
+               ret = clk_prepare_enable(priv->clks[clk]);
+               if (ret)
+                       goto err_disable_clks;
+       }
+
+       if (priv->phy) {
+               ret = phy_init(priv->phy);
+               if (ret)
+                       goto err_disable_clks;
+
+               ret = phy_power_on(priv->phy);
+               if (ret)
+                       goto err_exit_phy;
+       }
+
+       return 0;
+
+err_exit_phy:
+       phy_exit(priv->phy);
+err_disable_clks:
+       while (--clk >= 0)
+               clk_disable_unprepare(priv->clks[clk]);
+
+       return ret;
+}
+
+static void ohci_platform_power_off(struct platform_device *dev)
+{
+       struct usb_hcd *hcd = platform_get_drvdata(dev);
+       struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
+       int clk;
+
+       if (priv->phy) {
+               phy_power_off(priv->phy);
+               phy_exit(priv->phy);
+       }
+
+       for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
+               if (priv->clks[clk])
+                       clk_disable_unprepare(priv->clks[clk]);
+}
+
 static struct hc_driver __read_mostly ohci_platform_hc_driver;
 
 static const struct ohci_driver_overrides platform_overrides __initconst = {
-       .product_desc = "Generic Platform OHCI controller",
-       .reset =        ohci_platform_reset,
+       .product_desc =         "Generic Platform OHCI controller",
+       .reset =                ohci_platform_reset,
+       .extra_priv_size =      sizeof(struct ohci_platform_priv),
+};
+
+static struct usb_ohci_pdata ohci_platform_defaults = {
+       .power_on =             ohci_platform_power_on,
+       .power_suspend =        ohci_platform_power_off,
+       .power_off =            ohci_platform_power_off,
 };
 
 static int ohci_platform_probe(struct platform_device *dev)
@@ -60,17 +123,24 @@ static int ohci_platform_probe(struct platform_device *dev)
        struct usb_hcd *hcd;
        struct resource *res_mem;
        struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
-       int irq;
-       int err = -ENOMEM;
-
-       if (!pdata) {
-               WARN_ON(1);
-               return -ENODEV;
-       }
+       struct ohci_platform_priv *priv;
+       struct ohci_hcd *ohci;
+       int err, irq, clk = 0;
 
        if (usb_disabled())
                return -ENODEV;
 
+       /*
+        * Use reasonable defaults so platforms don't have to provide these
+        * with DT probing on ARM.
+        */
+       if (!pdata)
+               pdata = &ohci_platform_defaults;
+
+       err = dma_coerce_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
+       if (err)
+               return err;
+
        irq = platform_get_irq(dev, 0);
        if (irq < 0) {
                dev_err(&dev->dev, "no irq provided");
@@ -83,17 +153,72 @@ static int ohci_platform_probe(struct platform_device *dev)
                return -ENXIO;
        }
 
+       hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev,
+                       dev_name(&dev->dev));
+       if (!hcd)
+               return -ENOMEM;
+
+       platform_set_drvdata(dev, hcd);
+       dev->dev.platform_data = pdata;
+       priv = hcd_to_ohci_priv(hcd);
+       ohci = hcd_to_ohci(hcd);
+
+       if (pdata == &ohci_platform_defaults && dev->dev.of_node) {
+               if (of_property_read_bool(dev->dev.of_node, "big-endian-regs"))
+                       ohci->flags |= OHCI_QUIRK_BE_MMIO;
+
+               if (of_property_read_bool(dev->dev.of_node, "big-endian-desc"))
+                       ohci->flags |= OHCI_QUIRK_BE_DESC;
+
+               if (of_property_read_bool(dev->dev.of_node, "big-endian"))
+                       ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC;
+
+               priv->phy = devm_phy_get(&dev->dev, "usb");
+               if (IS_ERR(priv->phy)) {
+                       err = PTR_ERR(priv->phy);
+                       if (err == -EPROBE_DEFER)
+                               goto err_put_hcd;
+                       priv->phy = NULL;
+               }
+
+               for (clk = 0; clk < OHCI_MAX_CLKS; clk++) {
+                       priv->clks[clk] = of_clk_get(dev->dev.of_node, clk);
+                       if (IS_ERR(priv->clks[clk])) {
+                               err = PTR_ERR(priv->clks[clk]);
+                               if (err == -EPROBE_DEFER)
+                                       goto err_put_clks;
+                               priv->clks[clk] = NULL;
+                               break;
+                       }
+               }
+       }
+
+       if (pdata->big_endian_desc)
+               ohci->flags |= OHCI_QUIRK_BE_DESC;
+       if (pdata->big_endian_mmio)
+               ohci->flags |= OHCI_QUIRK_BE_MMIO;
+
+#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_MMIO
+       if (ohci->flags & OHCI_QUIRK_BE_MMIO) {
+               dev_err(&dev->dev,
+                       "Error: CONFIG_USB_OHCI_BIG_ENDIAN_MMIO not set\n");
+               err = -EINVAL;
+               goto err_put_clks;
+       }
+#endif
+#ifndef CONFIG_USB_OHCI_BIG_ENDIAN_DESC
+       if (ohci->flags & OHCI_QUIRK_BE_DESC) {
+               dev_err(&dev->dev,
+                       "Error: CONFIG_USB_OHCI_BIG_ENDIAN_DESC not set\n");
+               err = -EINVAL;
+               goto err_put_clks;
+       }
+#endif
+
        if (pdata->power_on) {
                err = pdata->power_on(dev);
                if (err < 0)
-                       return err;
-       }
-
-       hcd = usb_create_hcd(&ohci_platform_hc_driver, &dev->dev,
-                       dev_name(&dev->dev));
-       if (!hcd) {
-               err = -ENOMEM;
-               goto err_power;
+                       goto err_put_clks;
        }
 
        hcd->rsrc_start = res_mem->start;
@@ -102,11 +227,11 @@ static int ohci_platform_probe(struct platform_device *dev)
        hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);
        if (IS_ERR(hcd->regs)) {
                err = PTR_ERR(hcd->regs);
-               goto err_put_hcd;
+               goto err_power;
        }
        err = usb_add_hcd(hcd, irq, IRQF_SHARED);
        if (err)
-               goto err_put_hcd;
+               goto err_power;
 
        device_wakeup_enable(hcd->self.controller);
 
@@ -114,11 +239,17 @@ static int ohci_platform_probe(struct platform_device *dev)
 
        return err;
 
-err_put_hcd:
-       usb_put_hcd(hcd);
 err_power:
        if (pdata->power_off)
                pdata->power_off(dev);
+err_put_clks:
+       while (--clk >= 0)
+               clk_put(priv->clks[clk]);
+err_put_hcd:
+       if (pdata == &ohci_platform_defaults)
+               dev->dev.platform_data = NULL;
+
+       usb_put_hcd(hcd);
 
        return err;
 }
@@ -127,13 +258,22 @@ static int ohci_platform_remove(struct platform_device *dev)
 {
        struct usb_hcd *hcd = platform_get_drvdata(dev);
        struct usb_ohci_pdata *pdata = dev_get_platdata(&dev->dev);
+       struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
+       int clk;
 
        usb_remove_hcd(hcd);
-       usb_put_hcd(hcd);
 
        if (pdata->power_off)
                pdata->power_off(dev);
 
+       for (clk = 0; clk < OHCI_MAX_CLKS && priv->clks[clk]; clk++)
+               clk_put(priv->clks[clk]);
+
+       usb_put_hcd(hcd);
+
+       if (pdata == &ohci_platform_defaults)
+               dev->dev.platform_data = NULL;
+
        return 0;
 }
 
@@ -180,6 +320,12 @@ static int ohci_platform_resume(struct device *dev)
 #define ohci_platform_resume   NULL
 #endif /* CONFIG_PM */
 
+static const struct of_device_id ohci_platform_ids[] = {
+       { .compatible = "generic-ohci", },
+       { }
+};
+MODULE_DEVICE_TABLE(of, ohci_platform_ids);
+
 static const struct platform_device_id ohci_platform_table[] = {
        { "ohci-platform", 0 },
        { }
@@ -200,6 +346,7 @@ static struct platform_driver ohci_platform_driver = {
                .owner  = THIS_MODULE,
                .name   = "ohci-platform",
                .pm     = &ohci_platform_pm_ops,
+               .of_match_table = ohci_platform_ids,
        }
 };
 
index 44e6c9da88922431f3551d4e563e2fec525ffed1..01833ab2b5c397ced4d86b83b7c3c3d476e8d286 100644 (file)
@@ -148,6 +148,7 @@ static void uhci_hcd_platform_shutdown(struct platform_device *op)
 }
 
 static const struct of_device_id platform_uhci_ids[] = {
+       { .compatible = "generic-uhci", },
        { .compatible = "platform-uhci", },
        {}
 };
index 8abda5c73ca1e846aaff80a2e6096dff73d04853..8affef910782ed6f406b7d362e38ac0c0c9341df 100644 (file)
@@ -226,6 +226,7 @@ static const struct dev_pm_ops xhci_plat_pm_ops = {
 
 #ifdef CONFIG_OF
 static const struct of_device_id usb_xhci_of_match[] = {
+       { .compatible = "generic-xhci" },
        { .compatible = "xhci-platform" },
        { },
 };
index ba5f70f92888774c5ef900d44c6f8ad941e6b4e9..1bca274dc3b5273029799908f9499b5b4e61091b 100644 (file)
@@ -128,7 +128,6 @@ config USB_IDMOUSE
 
 config USB_FTDI_ELAN
        tristate "Elan PCMCIA CardBus Adapter USB Client"
-       default M
        help
          ELAN's Uxxx series of adapters are USB to PCMCIA CardBus adapters.
          Currently only the U132 adapter is available.
index 78eb4ff33269ae875d75400e250ea855107f25ba..bdef0d6eb91d059b5b47325902ee29298a426221 100644 (file)
 enum led_type {
        DELCOM_VISUAL_SIGNAL_INDICATOR,
        DREAM_CHEEKY_WEBMAIL_NOTIFIER,
+       RISO_KAGAKU_LED
 };
 
+/* the Webmail LED made by RISO KAGAKU CORP. decodes a color index
+   internally, we want to keep the red+green+blue sysfs api, so we decode
+   from 1-bit RGB to the riso kagaku color index according to this table... */
+
+static unsigned const char riso_kagaku_tbl[] = {
+/* R+2G+4B -> riso kagaku color index */
+       [0] = 0, /* black   */
+       [1] = 2, /* red     */
+       [2] = 1, /* green   */
+       [3] = 5, /* yellow  */
+       [4] = 3, /* blue    */
+       [5] = 6, /* magenta */
+       [6] = 4, /* cyan    */
+       [7] = 7  /* white   */
+};
+
+#define RISO_KAGAKU_IX(r,g,b) riso_kagaku_tbl[((r)?1:0)+((g)?2:0)+((b)?4:0)]
+
 /* table of devices that work with this driver */
 static const struct usb_device_id id_table[] = {
        { USB_DEVICE(0x0fc5, 0x1223),
@@ -32,6 +51,8 @@ static const struct usb_device_id id_table[] = {
                        .driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER },
        { USB_DEVICE(0x1d34, 0x000a),
                        .driver_info = DREAM_CHEEKY_WEBMAIL_NOTIFIER },
+       { USB_DEVICE(0x1294, 0x1320),
+                       .driver_info = RISO_KAGAKU_LED },
        { },
 };
 MODULE_DEVICE_TABLE(usb, id_table);
@@ -48,6 +69,7 @@ static void change_color(struct usb_led *led)
 {
        int retval = 0;
        unsigned char *buffer;
+       int actlength;
 
        buffer = kmalloc(8, GFP_KERNEL);
        if (!buffer) {
@@ -104,6 +126,18 @@ static void change_color(struct usb_led *led)
                                        2000);
                break;
 
+       case RISO_KAGAKU_LED:
+               buffer[0] = RISO_KAGAKU_IX(led->red, led->green, led->blue);
+               buffer[1] = 0;
+               buffer[2] = 0;
+               buffer[3] = 0;
+               buffer[4] = 0;
+
+               retval = usb_interrupt_msg(led->udev,
+                       usb_sndctrlpipe(led->udev, 2),
+                       buffer, 5, &actlength, 1000 /*ms timeout*/);
+               break;
+
        default:
                dev_err(&led->udev->dev, "unknown device type %d\n", led->type);
        }
index 8546c8dccd51b003fc9aba3038184cd2d0eedbea..64c9d14ea77dce12306c1ff3e93a3bf7c651c90c 100644 (file)
@@ -1429,7 +1429,8 @@ static int __init msm_otg_probe(struct platform_device *pdev)
        motg->phy.otg = kzalloc(sizeof(struct usb_otg), GFP_KERNEL);
        if (!motg->phy.otg) {
                dev_err(&pdev->dev, "unable to allocate msm_otg\n");
-               return -ENOMEM;
+               ret = -ENOMEM;
+               goto free_motg;
        }
 
        motg->pdata = dev_get_platdata(&pdev->dev);