mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
Merge tag 'usb-for-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes: usb: patches for v4.3 merge window New support for Allwinne SoC on the MUSB driver has been added to the list of glue layers. MUSB also got support for building all DMA engines in one binary; this will be great for distros. DWC3 now has no trace of dev_dbg()/dev_vdbg() usage. We will rely solely on tracing to debug DWC3. There was also a fix for memory corruption with EP0 when maxpacket size transfers are > 512 bytes. Robert's EP capabilities flags is making EP selection a lot simpler. UDCs are now required to set these flags up when adding endpoints to the framework. Other than these, we have the usual set of miscelaneous cleanups and minor fixes. Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
@@ -5,4 +5,4 @@ Description:
|
||||
The attributes:
|
||||
|
||||
qlen - depth of loopback queue
|
||||
bulk_buflen - buffer length
|
||||
buflen - buffer length
|
||||
|
||||
@@ -9,4 +9,4 @@ Description:
|
||||
isoc_maxpacket - 0 - 1023 (fs), 0 - 1024 (hs/ss)
|
||||
isoc_mult - 0..2 (hs/ss only)
|
||||
isoc_maxburst - 0..15 (ss only)
|
||||
qlen - buffer length
|
||||
buflen - buffer length
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
Allwinner sun4i A10 musb DRC/OTG controller
|
||||
-------------------------------------------
|
||||
|
||||
Required properties:
|
||||
- compatible : "allwinner,sun4i-a10-musb", "allwinner,sun6i-a31-musb"
|
||||
or "allwinner,sun8i-a33-musb"
|
||||
- reg : mmio address range of the musb controller
|
||||
- clocks : clock specifier for the musb controller ahb gate clock
|
||||
- reset : reset specifier for the ahb reset (A31 and newer only)
|
||||
- interrupts : interrupt to which the musb controller is connected
|
||||
- interrupt-names : must be "mc"
|
||||
- phys : phy specifier for the otg phy
|
||||
- phy-names : must be "usb"
|
||||
- dr_mode : Dual-Role mode must be "host" or "otg"
|
||||
- extcon : extcon specifier for the otg phy
|
||||
|
||||
Example:
|
||||
|
||||
usb_otg: usb@01c13000 {
|
||||
compatible = "allwinner,sun4i-a10-musb";
|
||||
reg = <0x01c13000 0x0400>;
|
||||
clocks = <&ahb_gates 0>;
|
||||
interrupts = <38>;
|
||||
interrupt-names = "mc";
|
||||
phys = <&usbphy 0>;
|
||||
phy-names = "usb";
|
||||
extcon = <&usbphy 0>;
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -11,6 +11,19 @@ Optional properties:
|
||||
"peripheral" and "otg". In case this attribute isn't
|
||||
passed via DT, USB DRD controllers should default to
|
||||
OTG.
|
||||
- otg-rev: tells usb driver the release number of the OTG and EH supplement
|
||||
with which the device and its descriptors are compliant,
|
||||
in binary-coded decimal (i.e. 2.0 is 0200H). This
|
||||
property is used if any real OTG features(HNP/SRP/ADP)
|
||||
is enabled, if ADP is required, otg-rev should be
|
||||
0x0200 or above.
|
||||
- hnp-disable: tells OTG controllers we want to disable OTG HNP, normally HNP
|
||||
is the basic function of real OTG except you want it
|
||||
to be a srp-capable only B device.
|
||||
- srp-disable: tells OTG controllers we want to disable OTG SRP, SRP is
|
||||
optional for OTG device.
|
||||
- adp-disable: tells OTG controllers we want to disable OTG ADP, ADP is
|
||||
optional for OTG device.
|
||||
|
||||
This is an attribute to a USB controller such as:
|
||||
|
||||
@@ -21,4 +34,6 @@ dwc3@4a030000 {
|
||||
usb-phy = <&usb2_phy>, <&usb3,phy>;
|
||||
maximum-speed = "super-speed";
|
||||
dr_mode = "otg";
|
||||
otg-rev = <0x0200>;
|
||||
adp-disable;
|
||||
};
|
||||
|
||||
@@ -52,6 +52,10 @@ Required properties:
|
||||
Optional properties:
|
||||
- dr_mode: One of "host", "peripheral" or "otg". Defaults to "otg"
|
||||
|
||||
- switch-gpio: A phandle + gpio-specifier pair. Some boards are using Dual
|
||||
SPDT USB Switch, witch is cotrolled by GPIO to de/multiplex
|
||||
D+/D- USB lines between connectors.
|
||||
|
||||
- qcom,phy-init-sequence: PHY configuration sequence values. This is related to Device
|
||||
Mode Eye Diagram test. Start address at which these values will be
|
||||
written is ULPI_EXT_VENDOR_SPECIFIC. Value of -1 is reserved as
|
||||
|
||||
76
Documentation/devicetree/bindings/usb/qcom,usb-8x16-phy.txt
Normal file
76
Documentation/devicetree/bindings/usb/qcom,usb-8x16-phy.txt
Normal file
@@ -0,0 +1,76 @@
|
||||
Qualcomm's APQ8016/MSM8916 USB transceiver controller
|
||||
|
||||
- compatible:
|
||||
Usage: required
|
||||
Value type: <string>
|
||||
Definition: Should contain "qcom,usb-8x16-phy".
|
||||
|
||||
- reg:
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: USB PHY base address and length of the register map
|
||||
|
||||
- clocks:
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: See clock-bindings.txt section "consumers". List of
|
||||
two clock specifiers for interface and core controller
|
||||
clocks.
|
||||
|
||||
- clock-names:
|
||||
Usage: required
|
||||
Value type: <string>
|
||||
Definition: Must contain "iface" and "core" strings.
|
||||
|
||||
- vddcx-supply:
|
||||
Usage: required
|
||||
Value type: <phandle>
|
||||
Definition: phandle to the regulator VDCCX supply node.
|
||||
|
||||
- v1p8-supply:
|
||||
Usage: required
|
||||
Value type: <phandle>
|
||||
Definition: phandle to the regulator 1.8V supply node.
|
||||
|
||||
- v3p3-supply:
|
||||
Usage: required
|
||||
Value type: <phandle>
|
||||
Definition: phandle to the regulator 3.3V supply node.
|
||||
|
||||
- resets:
|
||||
Usage: required
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: See reset.txt section "consumers". PHY reset specifier.
|
||||
|
||||
- reset-names:
|
||||
Usage: required
|
||||
Value type: <string>
|
||||
Definition: Must contain "phy" string.
|
||||
|
||||
- switch-gpio:
|
||||
Usage: optional
|
||||
Value type: <prop-encoded-array>
|
||||
Definition: Some boards are using Dual SPDT USB Switch, witch is
|
||||
controlled by GPIO to de/multiplex D+/D- USB lines
|
||||
between connectors.
|
||||
|
||||
Example:
|
||||
usb_phy: phy@78d9000 {
|
||||
compatible = "qcom,usb-8x16-phy";
|
||||
reg = <0x78d9000 0x400>;
|
||||
|
||||
vddcx-supply = <&pm8916_s1_corner>;
|
||||
v1p8-supply = <&pm8916_l7>;
|
||||
v3p3-supply = <&pm8916_l13>;
|
||||
|
||||
clocks = <&gcc GCC_USB_HS_AHB_CLK>,
|
||||
<&gcc GCC_USB_HS_SYSTEM_CLK>;
|
||||
clock-names = "iface", "core";
|
||||
|
||||
resets = <&gcc GCC_USB2A_PHY_BCR>;
|
||||
reset-names = "phy";
|
||||
|
||||
// D+/D- lines: 1 - Routed to HUB, 0 - Device connector
|
||||
switch-gpio = <&pm8916_gpios 4 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
@@ -237,9 +237,7 @@ Testing the LOOPBACK function
|
||||
-----------------------------
|
||||
|
||||
device: run the gadget
|
||||
host: test-usb
|
||||
|
||||
http://www.linux-usb.org/usbtest/testusb.c
|
||||
host: test-usb (tools/usb/testusb.c)
|
||||
|
||||
8. MASS STORAGE function
|
||||
========================
|
||||
@@ -586,9 +584,8 @@ Testing the SOURCESINK function
|
||||
-------------------------------
|
||||
|
||||
device: run the gadget
|
||||
host: test-usb
|
||||
host: test-usb (tools/usb/testusb.c)
|
||||
|
||||
http://www.linux-usb.org/usbtest/testusb.c
|
||||
|
||||
16. UAC1 function
|
||||
=================
|
||||
|
||||
@@ -3153,36 +3153,46 @@ static const struct usb_gadget_ops nbu2ss_gadget_ops = {
|
||||
.ioctl = nbu2ss_gad_ioctl,
|
||||
};
|
||||
|
||||
static const char g_ep0_name[] = "ep0";
|
||||
static const char g_ep1_name[] = "ep1-bulk";
|
||||
static const char g_ep2_name[] = "ep2-bulk";
|
||||
static const char g_ep3_name[] = "ep3in-int";
|
||||
static const char g_ep4_name[] = "ep4-iso";
|
||||
static const char g_ep5_name[] = "ep5-iso";
|
||||
static const char g_ep6_name[] = "ep6-bulk";
|
||||
static const char g_ep7_name[] = "ep7-bulk";
|
||||
static const char g_ep8_name[] = "ep8in-int";
|
||||
static const char g_ep9_name[] = "ep9-iso";
|
||||
static const char g_epa_name[] = "epa-iso";
|
||||
static const char g_epb_name[] = "epb-bulk";
|
||||
static const char g_epc_name[] = "epc-nulk";
|
||||
static const char g_epd_name[] = "epdin-int";
|
||||
static const struct {
|
||||
const char *name;
|
||||
const struct usb_ep_caps caps;
|
||||
} ep_info[NUM_ENDPOINTS] = {
|
||||
#define EP_INFO(_name, _caps) \
|
||||
{ \
|
||||
.name = _name, \
|
||||
.caps = _caps, \
|
||||
}
|
||||
|
||||
static const char *gp_ep_name[NUM_ENDPOINTS] = {
|
||||
g_ep0_name,
|
||||
g_ep1_name,
|
||||
g_ep2_name,
|
||||
g_ep3_name,
|
||||
g_ep4_name,
|
||||
g_ep5_name,
|
||||
g_ep6_name,
|
||||
g_ep7_name,
|
||||
g_ep8_name,
|
||||
g_ep9_name,
|
||||
g_epa_name,
|
||||
g_epb_name,
|
||||
g_epc_name,
|
||||
g_epd_name,
|
||||
EP_INFO("ep0",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("ep1-bulk",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("ep2-bulk",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("ep3in-int",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)),
|
||||
EP_INFO("ep4-iso",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("ep5-iso",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("ep6-bulk",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("ep7-bulk",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("ep8in-int",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)),
|
||||
EP_INFO("ep9-iso",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("epa-iso",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("epb-bulk",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("epc-bulk",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)),
|
||||
EP_INFO("epdin-int",
|
||||
USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)),
|
||||
|
||||
#undef EP_INFO
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -3200,10 +3210,12 @@ static void __init nbu2ss_drv_ep_init(struct nbu2ss_udc *udc)
|
||||
ep->desc = NULL;
|
||||
|
||||
ep->ep.driver_data = NULL;
|
||||
ep->ep.name = gp_ep_name[i];
|
||||
ep->ep.name = ep_info[i].name;
|
||||
ep->ep.caps = ep_info[i].caps;
|
||||
ep->ep.ops = &nbu2ss_ep_ops;
|
||||
|
||||
ep->ep.maxpacket = (i == 0 ? EP0_PACKETSIZE : EP_PACKETSIZE);
|
||||
usb_ep_set_maxpacket_limit(&ep->ep,
|
||||
i == 0 ? EP0_PACKETSIZE : EP_PACKETSIZE);
|
||||
|
||||
list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
|
||||
INIT_LIST_HEAD(&ep->queue);
|
||||
|
||||
@@ -406,8 +406,11 @@ static inline u32 hw_test_and_write(struct ci_hdrc *ci, enum ci_hw_regs reg,
|
||||
static inline bool ci_otg_is_fsm_mode(struct ci_hdrc *ci)
|
||||
{
|
||||
#ifdef CONFIG_USB_OTG_FSM
|
||||
struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps;
|
||||
|
||||
return ci->is_otg && ci->roles[CI_ROLE_HOST] &&
|
||||
ci->roles[CI_ROLE_GADGET];
|
||||
ci->roles[CI_ROLE_GADGET] && (otg_caps->srp_support ||
|
||||
otg_caps->hnp_support || otg_caps->adp_support);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
@@ -560,6 +560,8 @@ static irqreturn_t ci_irq(int irq, void *data)
|
||||
static int ci_get_platdata(struct device *dev,
|
||||
struct ci_hdrc_platform_data *platdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (!platdata->phy_mode)
|
||||
platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
|
||||
|
||||
@@ -588,6 +590,19 @@ static int ci_get_platdata(struct device *dev,
|
||||
of_usb_host_tpl_support(dev->of_node);
|
||||
}
|
||||
|
||||
if (platdata->dr_mode == USB_DR_MODE_OTG) {
|
||||
/* We can support HNP and SRP of OTG 2.0 */
|
||||
platdata->ci_otg_caps.otg_rev = 0x0200;
|
||||
platdata->ci_otg_caps.hnp_support = true;
|
||||
platdata->ci_otg_caps.srp_support = true;
|
||||
|
||||
/* Update otg capabilities by DT properties */
|
||||
ret = of_usb_update_otg_caps(dev->of_node,
|
||||
&platdata->ci_otg_caps);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL)
|
||||
platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <linux/usb/phy.h>
|
||||
#include <linux/usb/otg.h>
|
||||
#include <linux/usb/otg-fsm.h>
|
||||
#include <linux/usb/chipidea.h>
|
||||
|
||||
#include "ci.h"
|
||||
#include "udc.h"
|
||||
|
||||
@@ -1624,6 +1624,20 @@ static int init_eps(struct ci_hdrc *ci)
|
||||
|
||||
hwep->ep.name = hwep->name;
|
||||
hwep->ep.ops = &usb_ep_ops;
|
||||
|
||||
if (i == 0) {
|
||||
hwep->ep.caps.type_control = true;
|
||||
} else {
|
||||
hwep->ep.caps.type_iso = true;
|
||||
hwep->ep.caps.type_bulk = true;
|
||||
hwep->ep.caps.type_int = true;
|
||||
}
|
||||
|
||||
if (j == TX)
|
||||
hwep->ep.caps.dir_in = true;
|
||||
else
|
||||
hwep->ep.caps.dir_out = true;
|
||||
|
||||
/*
|
||||
* for ep0: maxP defined in desc, for other
|
||||
* eps, maxP is set by epautoconfig() called
|
||||
@@ -1827,6 +1841,7 @@ static irqreturn_t udc_irq(struct ci_hdrc *ci)
|
||||
static int udc_start(struct ci_hdrc *ci)
|
||||
{
|
||||
struct device *dev = ci->dev;
|
||||
struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps;
|
||||
int retval = 0;
|
||||
|
||||
spin_lock_init(&ci->lock);
|
||||
@@ -1834,8 +1849,12 @@ static int udc_start(struct ci_hdrc *ci)
|
||||
ci->gadget.ops = &usb_gadget_ops;
|
||||
ci->gadget.speed = USB_SPEED_UNKNOWN;
|
||||
ci->gadget.max_speed = USB_SPEED_HIGH;
|
||||
ci->gadget.is_otg = ci->is_otg ? 1 : 0;
|
||||
ci->gadget.name = ci->platdata->name;
|
||||
ci->gadget.otg_caps = otg_caps;
|
||||
|
||||
if (ci->is_otg && (otg_caps->hnp_support || otg_caps->srp_support ||
|
||||
otg_caps->adp_support))
|
||||
ci->gadget.is_otg = 1;
|
||||
|
||||
INIT_LIST_HEAD(&ci->gadget.ep_list);
|
||||
|
||||
|
||||
@@ -154,6 +154,62 @@ bool of_usb_host_tpl_support(struct device_node *np)
|
||||
return false;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_usb_host_tpl_support);
|
||||
|
||||
/**
|
||||
* of_usb_update_otg_caps - to update usb otg capabilities according to
|
||||
* the passed properties in DT.
|
||||
* @np: Pointer to the given device_node
|
||||
* @otg_caps: Pointer to the target usb_otg_caps to be set
|
||||
*
|
||||
* The function updates the otg capabilities
|
||||
*/
|
||||
int of_usb_update_otg_caps(struct device_node *np,
|
||||
struct usb_otg_caps *otg_caps)
|
||||
{
|
||||
u32 otg_rev;
|
||||
|
||||
if (!otg_caps)
|
||||
return -EINVAL;
|
||||
|
||||
if (!of_property_read_u32(np, "otg-rev", &otg_rev)) {
|
||||
switch (otg_rev) {
|
||||
case 0x0100:
|
||||
case 0x0120:
|
||||
case 0x0130:
|
||||
case 0x0200:
|
||||
/* Choose the lesser one if it's already been set */
|
||||
if (otg_caps->otg_rev)
|
||||
otg_caps->otg_rev = min_t(u16, otg_rev,
|
||||
otg_caps->otg_rev);
|
||||
else
|
||||
otg_caps->otg_rev = otg_rev;
|
||||
break;
|
||||
default:
|
||||
pr_err("%s: unsupported otg-rev: 0x%x\n",
|
||||
np->full_name, otg_rev);
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* otg-rev is mandatory for otg properties, if not passed
|
||||
* we set it to be 0 and assume it's a legacy otg device.
|
||||
* Non-dt platform can set it afterwards.
|
||||
*/
|
||||
otg_caps->otg_rev = 0;
|
||||
}
|
||||
|
||||
if (of_find_property(np, "hnp-disable", NULL))
|
||||
otg_caps->hnp_support = false;
|
||||
if (of_find_property(np, "srp-disable", NULL))
|
||||
otg_caps->srp_support = false;
|
||||
if (of_find_property(np, "adp-disable", NULL) ||
|
||||
(otg_caps->otg_rev < 0x0200))
|
||||
otg_caps->adp_support = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(of_usb_update_otg_caps);
|
||||
|
||||
#endif
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
@@ -2880,7 +2880,7 @@ static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value)
|
||||
epctl = readl(hs->regs + epreg);
|
||||
|
||||
if (value) {
|
||||
epctl |= DXEPCTL_STALL + DXEPCTL_SNAK;
|
||||
epctl |= DXEPCTL_STALL | DXEPCTL_SNAK;
|
||||
if (epctl & DXEPCTL_EPENA)
|
||||
epctl |= DXEPCTL_EPDIS;
|
||||
} else {
|
||||
@@ -3289,6 +3289,19 @@ static void s3c_hsotg_initep(struct dwc2_hsotg *hsotg,
|
||||
usb_ep_set_maxpacket_limit(&hs_ep->ep, epnum ? 1024 : EP0_MPS_LIMIT);
|
||||
hs_ep->ep.ops = &s3c_hsotg_ep_ops;
|
||||
|
||||
if (epnum == 0) {
|
||||
hs_ep->ep.caps.type_control = true;
|
||||
} else {
|
||||
hs_ep->ep.caps.type_iso = true;
|
||||
hs_ep->ep.caps.type_bulk = true;
|
||||
hs_ep->ep.caps.type_int = true;
|
||||
}
|
||||
|
||||
if (dir_in)
|
||||
hs_ep->ep.caps.dir_in = true;
|
||||
else
|
||||
hs_ep->ep.caps.dir_out = true;
|
||||
|
||||
/*
|
||||
* if we're using dma, we need to set the next-endpoint pointer
|
||||
* to be something valid.
|
||||
|
||||
@@ -104,11 +104,4 @@ config USB_DWC3_QCOM
|
||||
Recent Qualcomm SoCs ship with one DesignWare Core USB3 IP inside,
|
||||
say 'Y' or 'M' if you have one such device.
|
||||
|
||||
comment "Debugging features"
|
||||
|
||||
config USB_DWC3_DEBUG
|
||||
bool "Enable Debugging Messages"
|
||||
help
|
||||
Say Y here to enable debugging messages on DWC3 Driver.
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# define_trace.h needs to know how to find our header
|
||||
CFLAGS_trace.o := -I$(src)
|
||||
|
||||
ccflags-$(CONFIG_USB_DWC3_DEBUG) := -DDEBUG
|
||||
|
||||
obj-$(CONFIG_USB_DWC3) += dwc3.o
|
||||
|
||||
dwc3-y := core.o debug.o trace.o
|
||||
|
||||
@@ -455,8 +455,6 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
|
||||
reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI;
|
||||
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
|
||||
} else {
|
||||
dev_warn(dwc->dev, "HSPHY Interface not defined\n");
|
||||
|
||||
/* Relying on default value. */
|
||||
if (!(reg & DWC3_GUSB2PHYCFG_ULPI_UTMI))
|
||||
break;
|
||||
|
||||
@@ -145,7 +145,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
|
||||
|
||||
exynos->susp_clk = devm_clk_get(dev, "usbdrd30_susp_clk");
|
||||
if (IS_ERR(exynos->susp_clk)) {
|
||||
dev_dbg(dev, "no suspend clk specified\n");
|
||||
dev_info(dev, "no suspend clk specified\n");
|
||||
exynos->susp_clk = NULL;
|
||||
}
|
||||
clk_prepare_enable(exynos->susp_clk);
|
||||
|
||||
@@ -115,7 +115,7 @@ static int kdwc3_probe(struct platform_device *pdev)
|
||||
|
||||
error = clk_prepare_enable(kdwc->clk);
|
||||
if (error < 0) {
|
||||
dev_dbg(kdwc->dev, "unable to enable usb clock, err %d\n",
|
||||
dev_err(kdwc->dev, "unable to enable usb clock, error %d\n",
|
||||
error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -128,8 +128,7 @@ struct dwc3_omap {
|
||||
|
||||
u32 dma_status:1;
|
||||
|
||||
struct extcon_specific_cable_nb extcon_vbus_dev;
|
||||
struct extcon_specific_cable_nb extcon_id_dev;
|
||||
struct extcon_dev *edev;
|
||||
struct notifier_block vbus_nb;
|
||||
struct notifier_block id_nb;
|
||||
|
||||
@@ -225,12 +224,10 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
|
||||
|
||||
switch (status) {
|
||||
case OMAP_DWC3_ID_GROUND:
|
||||
dev_dbg(omap->dev, "ID GND\n");
|
||||
|
||||
if (omap->vbus_reg) {
|
||||
ret = regulator_enable(omap->vbus_reg);
|
||||
if (ret) {
|
||||
dev_dbg(omap->dev, "regulator enable failed\n");
|
||||
dev_err(omap->dev, "regulator enable failed\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -245,8 +242,6 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
|
||||
break;
|
||||
|
||||
case OMAP_DWC3_VBUS_VALID:
|
||||
dev_dbg(omap->dev, "VBUS Connect\n");
|
||||
|
||||
val = dwc3_omap_read_utmi_ctrl(omap);
|
||||
val &= ~USBOTGSS_UTMI_OTG_CTRL_SESSEND;
|
||||
val |= USBOTGSS_UTMI_OTG_CTRL_IDDIG
|
||||
@@ -261,8 +256,6 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
|
||||
regulator_disable(omap->vbus_reg);
|
||||
|
||||
case OMAP_DWC3_VBUS_OFF:
|
||||
dev_dbg(omap->dev, "VBUS Disconnect\n");
|
||||
|
||||
val = dwc3_omap_read_utmi_ctrl(omap);
|
||||
val &= ~(USBOTGSS_UTMI_OTG_CTRL_SESSVALID
|
||||
| USBOTGSS_UTMI_OTG_CTRL_VBUSVALID
|
||||
@@ -273,7 +266,7 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_dbg(omap->dev, "invalid state\n");
|
||||
dev_WARN(omap->dev, "invalid state\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,37 +277,8 @@ static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap)
|
||||
|
||||
reg = dwc3_omap_read_irqmisc_status(omap);
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_DMADISABLECLR) {
|
||||
dev_dbg(omap->dev, "DMA Disable was Cleared\n");
|
||||
if (reg & USBOTGSS_IRQMISC_DMADISABLECLR)
|
||||
omap->dma_status = false;
|
||||
}
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_OEVT)
|
||||
dev_dbg(omap->dev, "OTG Event\n");
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_DRVVBUS_RISE)
|
||||
dev_dbg(omap->dev, "DRVVBUS Rise\n");
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_CHRGVBUS_RISE)
|
||||
dev_dbg(omap->dev, "CHRGVBUS Rise\n");
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_DISCHRGVBUS_RISE)
|
||||
dev_dbg(omap->dev, "DISCHRGVBUS Rise\n");
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_IDPULLUP_RISE)
|
||||
dev_dbg(omap->dev, "IDPULLUP Rise\n");
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_DRVVBUS_FALL)
|
||||
dev_dbg(omap->dev, "DRVVBUS Fall\n");
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_CHRGVBUS_FALL)
|
||||
dev_dbg(omap->dev, "CHRGVBUS Fall\n");
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_DISCHRGVBUS_FALL)
|
||||
dev_dbg(omap->dev, "DISCHRGVBUS Fall\n");
|
||||
|
||||
if (reg & USBOTGSS_IRQMISC_IDPULLUP_FALL)
|
||||
dev_dbg(omap->dev, "IDPULLUP Fall\n");
|
||||
|
||||
dwc3_omap_write_irqmisc_status(omap, reg);
|
||||
|
||||
@@ -434,7 +398,7 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap)
|
||||
reg &= ~USBOTGSS_UTMI_OTG_CTRL_SW_MODE;
|
||||
break;
|
||||
default:
|
||||
dev_dbg(omap->dev, "UNKNOWN utmi mode %d\n", utmi_mode);
|
||||
dev_WARN(omap->dev, "UNKNOWN utmi mode %d\n", utmi_mode);
|
||||
}
|
||||
|
||||
dwc3_omap_write_utmi_ctrl(omap, reg);
|
||||
@@ -454,23 +418,23 @@ static int dwc3_omap_extcon_register(struct dwc3_omap *omap)
|
||||
}
|
||||
|
||||
omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier;
|
||||
ret = extcon_register_interest(&omap->extcon_vbus_dev,
|
||||
edev->name, "USB",
|
||||
&omap->vbus_nb);
|
||||
ret = extcon_register_notifier(edev, EXTCON_USB,
|
||||
&omap->vbus_nb);
|
||||
if (ret < 0)
|
||||
dev_vdbg(omap->dev, "failed to register notifier for USB\n");
|
||||
|
||||
omap->id_nb.notifier_call = dwc3_omap_id_notifier;
|
||||
ret = extcon_register_interest(&omap->extcon_id_dev,
|
||||
edev->name, "USB-HOST",
|
||||
&omap->id_nb);
|
||||
ret = extcon_register_notifier(edev, EXTCON_USB_HOST,
|
||||
&omap->id_nb);
|
||||
if (ret < 0)
|
||||
dev_vdbg(omap->dev, "failed to register notifier for USB-HOST\n");
|
||||
|
||||
if (extcon_get_cable_state(edev, "USB") == true)
|
||||
if (extcon_get_cable_state_(edev, EXTCON_USB) == true)
|
||||
dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
|
||||
if (extcon_get_cable_state(edev, "USB-HOST") == true)
|
||||
if (extcon_get_cable_state_(edev, EXTCON_USB_HOST) == true)
|
||||
dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
|
||||
|
||||
omap->edev = edev;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -565,11 +529,8 @@ static int dwc3_omap_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
|
||||
err3:
|
||||
if (omap->extcon_vbus_dev.edev)
|
||||
extcon_unregister_interest(&omap->extcon_vbus_dev);
|
||||
if (omap->extcon_id_dev.edev)
|
||||
extcon_unregister_interest(&omap->extcon_id_dev);
|
||||
|
||||
extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
|
||||
extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
|
||||
err2:
|
||||
dwc3_omap_disable_irqs(omap);
|
||||
|
||||
@@ -586,10 +547,8 @@ static int dwc3_omap_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct dwc3_omap *omap = platform_get_drvdata(pdev);
|
||||
|
||||
if (omap->extcon_vbus_dev.edev)
|
||||
extcon_unregister_interest(&omap->extcon_vbus_dev);
|
||||
if (omap->extcon_id_dev.edev)
|
||||
extcon_unregister_interest(&omap->extcon_id_dev);
|
||||
extcon_unregister_notifier(omap->edev, EXTCON_USB, &omap->vbus_nb);
|
||||
extcon_unregister_notifier(omap->edev, EXTCON_USB_HOST, &omap->id_nb);
|
||||
dwc3_omap_disable_irqs(omap);
|
||||
of_platform_depopulate(omap->dev);
|
||||
pm_runtime_put_sync(&pdev->dev);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user