You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'usb-for-v3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next
Felipe writes: usb: patches for v3.20 merge window Here's the big pull request for Gadgets and PHYs. It's a total of 217 non-merge commits with pretty much everything being touched. The most important bits are a ton of new documentation for almost all usb gadget functions, a new isp1760 UDC driver, several improvements to the old net2280 UDC driver, and some minor tracepoint improvements to dwc3. Other than that, a big list of minor cleanups, smaller bugfixes and new features all over the place. Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
@@ -0,0 +1,265 @@
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: UVC function directory
|
||||
|
||||
streaming_maxburst - 0..15 (ss only)
|
||||
streaming_maxpacket - 1..1023 (fs), 1..3072 (hs/ss)
|
||||
streaming_interval - 1..16
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Control descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/class
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Class descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/class/ss
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Super speed control class descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/class/fs
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Full speed control class descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Terminal descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Output terminal descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/output/default
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Default output terminal descriptors
|
||||
|
||||
All attributes read only:
|
||||
iTerminal - index of string descriptor
|
||||
bSourceID - id of the terminal to which this terminal
|
||||
is connected
|
||||
bAssocTerminal - id of the input terminal to which this output
|
||||
terminal is associated
|
||||
wTerminalType - terminal type
|
||||
bTerminalID - a non-zero id of this terminal
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Camera terminal descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/terminal/camera/default
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Default camera terminal descriptors
|
||||
|
||||
All attributes read only:
|
||||
bmControls - bitmap specifying which controls are
|
||||
supported for the video stream
|
||||
wOcularFocalLength - the value of Locular
|
||||
wObjectiveFocalLengthMax- the value of Lmin
|
||||
wObjectiveFocalLengthMin- the value of Lmax
|
||||
iTerminal - index of string descriptor
|
||||
bAssocTerminal - id of the output terminal to which
|
||||
this terminal is connected
|
||||
wTerminalType - terminal type
|
||||
bTerminalID - a non-zero id of this terminal
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/processing
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Processing unit descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/processing/default
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Default processing unit descriptors
|
||||
|
||||
All attributes read only:
|
||||
iProcessing - index of string descriptor
|
||||
bmControls - bitmap specifying which controls are
|
||||
supported for the video stream
|
||||
wMaxMultiplier - maximum digital magnification x100
|
||||
bSourceID - id of the terminal to which this unit is
|
||||
connected
|
||||
bUnitID - a non-zero id of this unit
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/header
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Control header descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/header/name
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Specific control header descriptors
|
||||
|
||||
dwClockFrequency
|
||||
bcdUVC
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Streaming descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Streaming class descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/ss
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Super speed streaming class descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/hs
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: High speed streaming class descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class/fs
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Full speed streaming class descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Color matching descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/color_matching/default
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Default color matching descriptors
|
||||
|
||||
All attributes read only:
|
||||
bMatrixCoefficients - matrix used to compute luma and
|
||||
chroma values from the color primaries
|
||||
bTransferCharacteristics- optoelectronic transfer
|
||||
characteristic of the source picutre,
|
||||
also called the gamma function
|
||||
bColorPrimaries - color primaries and the reference
|
||||
white
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: MJPEG format descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Specific MJPEG format descriptors
|
||||
|
||||
All attributes read only,
|
||||
except bmaControls and bDefaultFrameIndex:
|
||||
bmaControls - this format's data for bmaControls in
|
||||
the streaming header
|
||||
bmInterfaceFlags - specifies interlace information,
|
||||
read-only
|
||||
bAspectRatioY - the X dimension of the picture aspect
|
||||
ratio, read-only
|
||||
bAspectRatioX - the Y dimension of the picture aspect
|
||||
ratio, read-only
|
||||
bmFlags - characteristics of this format,
|
||||
read-only
|
||||
bDefaultFrameIndex - optimum frame index for this stream
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/mjpeg/name/name
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Specific MJPEG frame descriptors
|
||||
|
||||
dwFrameInterval - indicates how frame interval can be
|
||||
programmed; a number of values
|
||||
separated by newline can be specified
|
||||
dwDefaultFrameInterval - the frame interval the device would
|
||||
like to use as default
|
||||
dwMaxVideoFrameBufferSize- the maximum number of bytes the
|
||||
compressor will produce for a video
|
||||
frame or still image
|
||||
dwMaxBitRate - the maximum bit rate at the shortest
|
||||
frame interval in bps
|
||||
dwMinBitRate - the minimum bit rate at the longest
|
||||
frame interval in bps
|
||||
wHeight - height of decoded bitmap frame in px
|
||||
wWidth - width of decoded bitmam frame in px
|
||||
bmCapabilities - still image support, fixed frame-rate
|
||||
support
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Uncompressed format descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Specific uncompressed format descriptors
|
||||
|
||||
bmaControls - this format's data for bmaControls in
|
||||
the streaming header
|
||||
bmInterfaceFlags - specifies interlace information,
|
||||
read-only
|
||||
bAspectRatioY - the X dimension of the picture aspect
|
||||
ratio, read-only
|
||||
bAspectRatioX - the Y dimension of the picture aspect
|
||||
ratio, read-only
|
||||
bDefaultFrameIndex - optimum frame index for this stream
|
||||
bBitsPerPixel - number of bits per pixel used to
|
||||
specify color in the decoded video
|
||||
frame
|
||||
guidFormat - globally unique id used to identify
|
||||
stream-encoding format
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/uncompressed/name/name
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Specific uncompressed frame descriptors
|
||||
|
||||
dwFrameInterval - indicates how frame interval can be
|
||||
programmed; a number of values
|
||||
separated by newline can be specified
|
||||
dwDefaultFrameInterval - the frame interval the device would
|
||||
like to use as default
|
||||
dwMaxVideoFrameBufferSize- the maximum number of bytes the
|
||||
compressor will produce for a video
|
||||
frame or still image
|
||||
dwMaxBitRate - the maximum bit rate at the shortest
|
||||
frame interval in bps
|
||||
dwMinBitRate - the minimum bit rate at the longest
|
||||
frame interval in bps
|
||||
wHeight - height of decoded bitmap frame in px
|
||||
wWidth - width of decoded bitmam frame in px
|
||||
bmCapabilities - still image support, fixed frame-rate
|
||||
support
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Streaming header descriptors
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header/name
|
||||
Date: Dec 2014
|
||||
KernelVersion: 3.20
|
||||
Description: Specific streaming header descriptors
|
||||
|
||||
All attributes read only:
|
||||
bTriggerUsage - how the host software will respond to
|
||||
a hardware trigger interrupt event
|
||||
bTriggerSupport - flag specifying if hardware
|
||||
triggering is supported
|
||||
bStillCaptureMethod - method of still image caputre
|
||||
supported
|
||||
bTerminalLink - id of the output terminal to which
|
||||
the video endpoint of this interface
|
||||
is connected
|
||||
bmInfo - capabilities of this video streaming
|
||||
interface
|
||||
@@ -51,7 +51,10 @@ usb1: gadget@fffa4000 {
|
||||
Atmel High-Speed USB device controller
|
||||
|
||||
Required properties:
|
||||
- compatible: Should be "atmel,at91sam9rl-udc"
|
||||
- compatible: Should be one of the following
|
||||
"at91sam9rl-udc"
|
||||
"at91sam9g45-udc"
|
||||
"sama5d3-udc"
|
||||
- reg: Address and length of the register set for the device
|
||||
- interrupts: Should contain usba interrupt
|
||||
- ep childnode: To specify the number of endpoints and their properties.
|
||||
|
||||
@@ -20,6 +20,10 @@ Optional properties:
|
||||
Refer to phy/phy-bindings.txt for generic phy consumer properties
|
||||
- dr_mode: shall be one of "host", "peripheral" and "otg"
|
||||
Refer to usb/generic.txt
|
||||
- g-use-dma: enable dma usage in gadget driver.
|
||||
- g-rx-fifo-size: size of rx fifo size in gadget mode.
|
||||
- g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode.
|
||||
- g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode.
|
||||
|
||||
Example:
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ Optional properties:
|
||||
function should be enabled
|
||||
- phys: phandle + phy specifier pair
|
||||
- phy-names: must be "usb"
|
||||
- dmas: Must contain a list of references to DMA specifiers.
|
||||
- dma-names : Must contain a list of DMA names, "tx" or "rx".
|
||||
|
||||
Example:
|
||||
usbhs: usb@e6590000 {
|
||||
|
||||
@@ -13,10 +13,15 @@ Optional properties:
|
||||
- clock-frequency: the clock frequency (in Hz) that the PHY clock must
|
||||
be configured to.
|
||||
|
||||
- vcc-supply: phandle to the regulator that provides RESET to the PHY.
|
||||
- vcc-supply: phandle to the regulator that provides power to the PHY.
|
||||
|
||||
- reset-gpios: Should specify the GPIO for reset.
|
||||
|
||||
- vbus-detect-gpio: should specify the GPIO detecting a VBus insertion
|
||||
(see Documentation/devicetree/bindings/gpio/gpio.txt)
|
||||
- vbus-regulator : should specifiy the regulator supplying current drawn from
|
||||
the VBus line (see Documentation/devicetree/bindings/regulator/regulator.txt).
|
||||
|
||||
Example:
|
||||
|
||||
hsusb1_phy {
|
||||
@@ -26,8 +31,11 @@ Example:
|
||||
clock-names = "main_clk";
|
||||
vcc-supply = <&hsusb1_vcc_regulator>;
|
||||
reset-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
|
||||
vbus-detect-gpio = <&gpio2 13 GPIO_ACTIVE_HIGH>;
|
||||
vbus-regulator = <&vbus_regulator>;
|
||||
};
|
||||
|
||||
hsusb1_phy is a NOP USB PHY device that gets its clock from an oscillator
|
||||
and expects that clock to be configured to 19.2MHz by the NOP PHY driver.
|
||||
hsusb1_vcc_regulator provides power to the PHY and GPIO 7 controls RESET.
|
||||
GPIO 13 detects VBus insertion, and accordingly notifies the vbus-regulator.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -236,8 +236,12 @@ I: If#= 0 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=serial
|
||||
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
|
||||
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
|
||||
|
||||
You must explicitly load the usbserial driver with parameters to
|
||||
configure it to recognize the gadget serial device, like this:
|
||||
You must load the usbserial driver and explicitly set its parameters
|
||||
to configure it to recognize the gadget serial device, like this:
|
||||
|
||||
echo 0x0525 0xA4A6 >/sys/bus/usb-serial/drivers/generic/new_id
|
||||
|
||||
The legacy way is to use module parameters:
|
||||
|
||||
modprobe usbserial vendor=0x0525 product=0xA4A6
|
||||
|
||||
|
||||
+1
-1
@@ -3033,7 +3033,7 @@ S: Maintained
|
||||
F: drivers/platform/x86/dell-wmi.c
|
||||
|
||||
DESIGNWARE USB2 DRD IP DRIVER
|
||||
M: Paul Zimmerman <paulz@synopsys.com>
|
||||
M: John Youn <johnyoun@synopsys.com>
|
||||
L: linux-usb@vger.kernel.org
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
|
||||
S: Maintained
|
||||
|
||||
@@ -1608,7 +1608,7 @@ static int std_req_get_status(struct nbu2ss_udc *udc)
|
||||
switch (recipient) {
|
||||
case USB_RECIP_DEVICE:
|
||||
if (udc->ctrl.wIndex == 0x0000) {
|
||||
if (udc->self_powered)
|
||||
if (udc->gadget.is_selfpowered)
|
||||
status_data |= (1 << USB_DEVICE_SELF_POWERED);
|
||||
|
||||
if (udc->remote_wakeup)
|
||||
@@ -3117,7 +3117,7 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget)
|
||||
static int nbu2ss_gad_set_selfpowered(struct usb_gadget *pgadget,
|
||||
int is_selfpowered)
|
||||
{
|
||||
struct nbu2ss_udc *udc;
|
||||
struct nbu2ss_udc *udc;
|
||||
unsigned long flags;
|
||||
|
||||
/* INFO("=== %s()\n", __func__); */
|
||||
@@ -3130,7 +3130,7 @@ static int nbu2ss_gad_set_selfpowered(struct usb_gadget *pgadget,
|
||||
udc = container_of(pgadget, struct nbu2ss_udc, gadget);
|
||||
|
||||
spin_lock_irqsave(&udc->lock, flags);
|
||||
udc->self_powered = (is_selfpowered != 0);
|
||||
pgadget->is_selfpowered = (is_selfpowered != 0);
|
||||
spin_unlock_irqrestore(&udc->lock, flags);
|
||||
|
||||
return 0;
|
||||
@@ -3308,7 +3308,7 @@ static int __init nbu2ss_drv_contest_init(
|
||||
spin_lock_init(&udc->lock);
|
||||
udc->dev = &pdev->dev;
|
||||
|
||||
udc->self_powered = 1;
|
||||
udc->gadget.is_selfpowered = 1;
|
||||
udc->devstate = USB_STATE_NOTATTACHED;
|
||||
udc->pdev = pdev;
|
||||
udc->mA = 0;
|
||||
|
||||
@@ -624,7 +624,6 @@ struct nbu2ss_udc {
|
||||
unsigned linux_suspended:1;
|
||||
unsigned linux_resume:1;
|
||||
unsigned usb_suspended:1;
|
||||
unsigned self_powered:1;
|
||||
unsigned remote_wakeup:1;
|
||||
unsigned udc_enabled:1;
|
||||
|
||||
|
||||
@@ -104,6 +104,8 @@ source "drivers/usb/dwc2/Kconfig"
|
||||
|
||||
source "drivers/usb/chipidea/Kconfig"
|
||||
|
||||
source "drivers/usb/isp1760/Kconfig"
|
||||
|
||||
comment "USB port drivers"
|
||||
|
||||
if USB
|
||||
|
||||
@@ -8,6 +8,7 @@ obj-$(CONFIG_USB) += core/
|
||||
|
||||
obj-$(CONFIG_USB_DWC3) += dwc3/
|
||||
obj-$(CONFIG_USB_DWC2) += dwc2/
|
||||
obj-$(CONFIG_USB_ISP1760) += isp1760/
|
||||
|
||||
obj-$(CONFIG_USB_MON) += mon/
|
||||
|
||||
@@ -23,7 +24,6 @@ obj-$(CONFIG_USB_ISP1362_HCD) += host/
|
||||
obj-$(CONFIG_USB_U132_HCD) += host/
|
||||
obj-$(CONFIG_USB_R8A66597_HCD) += host/
|
||||
obj-$(CONFIG_USB_HWA_HCD) += host/
|
||||
obj-$(CONFIG_USB_ISP1760_HCD) += host/
|
||||
obj-$(CONFIG_USB_IMX21_HCD) += host/
|
||||
obj-$(CONFIG_USB_FSL_MPH_DR_OF) += host/
|
||||
obj-$(CONFIG_USB_FUSBH200_HCD) += host/
|
||||
|
||||
@@ -819,8 +819,8 @@ __acquires(hwep->lock)
|
||||
}
|
||||
|
||||
if ((setup->bRequestType & USB_RECIP_MASK) == USB_RECIP_DEVICE) {
|
||||
/* Assume that device is bus powered for now. */
|
||||
*(u16 *)req->buf = ci->remote_wakeup << 1;
|
||||
*(u16 *)req->buf = (ci->remote_wakeup << 1) |
|
||||
ci->gadget.is_selfpowered;
|
||||
} else if ((setup->bRequestType & USB_RECIP_MASK) \
|
||||
== USB_RECIP_ENDPOINT) {
|
||||
dir = (le16_to_cpu(setup->wIndex) & USB_ENDPOINT_DIR_MASK) ?
|
||||
@@ -1520,6 +1520,19 @@ static int ci_udc_vbus_draw(struct usb_gadget *_gadget, unsigned ma)
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
|
||||
static int ci_udc_selfpowered(struct usb_gadget *_gadget, int is_on)
|
||||
{
|
||||
struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget);
|
||||
struct ci_hw_ep *hwep = ci->ep0in;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(hwep->lock, flags);
|
||||
_gadget->is_selfpowered = (is_on != 0);
|
||||
spin_unlock_irqrestore(hwep->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Change Data+ pullup status
|
||||
* this func is used by usb_gadget_connect/disconnet
|
||||
*/
|
||||
@@ -1549,6 +1562,7 @@ static int ci_udc_stop(struct usb_gadget *gadget);
|
||||
static const struct usb_gadget_ops usb_gadget_ops = {
|
||||
.vbus_session = ci_udc_vbus_session,
|
||||
.wakeup = ci_udc_wakeup,
|
||||
.set_selfpowered = ci_udc_selfpowered,
|
||||
.pullup = ci_udc_pullup,
|
||||
.vbus_draw = ci_udc_vbus_draw,
|
||||
.udc_start = ci_udc_start,
|
||||
|
||||
@@ -23,7 +23,7 @@ choice
|
||||
|
||||
config USB_DWC2_HOST
|
||||
bool "Host only mode"
|
||||
depends on USB
|
||||
depends on USB=y || (USB_DWC2=m && USB)
|
||||
help
|
||||
The Designware USB2.0 high-speed host controller
|
||||
integrated into many SoCs. Select this option if you want the
|
||||
@@ -42,7 +42,7 @@ config USB_DWC2_PERIPHERAL
|
||||
|
||||
config USB_DWC2_DUAL_ROLE
|
||||
bool "Dual Role mode"
|
||||
depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || USB_GADGET=USB_DWC2)
|
||||
depends on (USB=y && USB_GADGET=y) || (USB_DWC2=m && USB && USB_GADGET)
|
||||
help
|
||||
Select this option if you want the driver to work in a dual-role
|
||||
mode. In this mode both host and gadget features are enabled, and
|
||||
|
||||
@@ -462,7 +462,7 @@ int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int irq)
|
||||
dwc2_enable_common_interrupts(hsotg);
|
||||
|
||||
/*
|
||||
* Do device or host intialization based on mode during PCD and
|
||||
* Do device or host initialization based on mode during PCD and
|
||||
* HCD initialization
|
||||
*/
|
||||
if (dwc2_is_host_mode(hsotg)) {
|
||||
|
||||
+46
-14
@@ -108,7 +108,7 @@ struct s3c_hsotg_req;
|
||||
* @halted: Set if the endpoint has been halted.
|
||||
* @periodic: Set if this is a periodic ep, such as Interrupt
|
||||
* @isochronous: Set if this is a isochronous ep
|
||||
* @sent_zlp: Set if we've sent a zero-length packet.
|
||||
* @send_zlp: Set if we need to send a zero-length packet.
|
||||
* @total_data: The total number of data bytes done.
|
||||
* @fifo_size: The size of the FIFO (for periodic IN endpoints)
|
||||
* @fifo_load: The amount of data loaded into the FIFO (periodic IN)
|
||||
@@ -149,7 +149,7 @@ struct s3c_hsotg_ep {
|
||||
unsigned int halted:1;
|
||||
unsigned int periodic:1;
|
||||
unsigned int isochronous:1;
|
||||
unsigned int sent_zlp:1;
|
||||
unsigned int send_zlp:1;
|
||||
|
||||
char name[10];
|
||||
};
|
||||
@@ -158,14 +158,12 @@ struct s3c_hsotg_ep {
|
||||
* struct s3c_hsotg_req - data transfer request
|
||||
* @req: The USB gadget request
|
||||
* @queue: The list of requests for the endpoint this is queued for.
|
||||
* @in_progress: Has already had size/packets written to core
|
||||
* @mapped: DMA buffer for this request has been mapped via dma_map_single().
|
||||
* @saved_req_buf: variable to save req.buf when bounce buffers are used.
|
||||
*/
|
||||
struct s3c_hsotg_req {
|
||||
struct usb_request req;
|
||||
struct list_head queue;
|
||||
unsigned char in_progress;
|
||||
unsigned char mapped;
|
||||
void *saved_req_buf;
|
||||
};
|
||||
|
||||
#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
|
||||
@@ -193,6 +191,22 @@ enum dwc2_lx_state {
|
||||
DWC2_L3, /* Off state */
|
||||
};
|
||||
|
||||
/*
|
||||
* Gadget periodic tx fifo sizes as used by legacy driver
|
||||
* EP0 is not included
|
||||
*/
|
||||
#define DWC2_G_P_LEGACY_TX_FIFO_SIZE {256, 256, 256, 256, 768, 768, 768, \
|
||||
768, 0, 0, 0, 0, 0, 0, 0}
|
||||
|
||||
/* Gadget ep0 states */
|
||||
enum dwc2_ep0_state {
|
||||
DWC2_EP0_SETUP,
|
||||
DWC2_EP0_DATA_IN,
|
||||
DWC2_EP0_DATA_OUT,
|
||||
DWC2_EP0_STATUS_IN,
|
||||
DWC2_EP0_STATUS_OUT,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct dwc2_core_params - Parameters for configuring the core
|
||||
*
|
||||
@@ -381,7 +395,7 @@ struct dwc2_core_params {
|
||||
* @power_optimized Are power optimizations enabled?
|
||||
* @num_dev_ep Number of device endpoints available
|
||||
* @num_dev_perio_in_ep Number of device periodic IN endpoints
|
||||
* avaialable
|
||||
* available
|
||||
* @dev_token_q_depth Device Mode IN Token Sequence Learning Queue
|
||||
* Depth
|
||||
* 0 to 30
|
||||
@@ -434,6 +448,9 @@ struct dwc2_hw_params {
|
||||
u32 snpsid;
|
||||
};
|
||||
|
||||
/* Size of control and EP0 buffers */
|
||||
#define DWC2_CTRL_BUFF_SIZE 8
|
||||
|
||||
/**
|
||||
* struct dwc2_hsotg - Holds the state of the driver, including the non-periodic
|
||||
* and periodic schedules
|
||||
@@ -552,14 +569,20 @@ struct dwc2_hw_params {
|
||||
* @num_of_eps: Number of available EPs (excluding EP0)
|
||||
* @debug_root: Root directrory for debugfs.
|
||||
* @debug_file: Main status file for debugfs.
|
||||
* @debug_testmode: Testmode status file for debugfs.
|
||||
* @debug_fifo: FIFO status file for debugfs.
|
||||
* @ep0_reply: Request used for ep0 reply.
|
||||
* @ep0_buff: Buffer for EP0 reply data, if needed.
|
||||
* @ctrl_buff: Buffer for EP0 control requests.
|
||||
* @ctrl_req: Request for EP0 control packets.
|
||||
* @setup: NAK management for EP0 SETUP
|
||||
* @ep0_state: EP0 control transfers state
|
||||
* @test_mode: USB test mode requested by the host
|
||||
* @last_rst: Time of last reset
|
||||
* @eps: The endpoints being supplied to the gadget framework
|
||||
* @g_using_dma: Indicate if dma usage is enabled
|
||||
* @g_rx_fifo_sz: Contains rx fifo size value
|
||||
* @g_np_g_tx_fifo_sz: Contains Non-Periodic tx fifo size value
|
||||
* @g_tx_fifo_sz: Contains tx fifo size value per endpoints
|
||||
*/
|
||||
struct dwc2_hsotg {
|
||||
struct device *dev;
|
||||
@@ -591,6 +614,7 @@ struct dwc2_hsotg {
|
||||
|
||||
struct dentry *debug_root;
|
||||
struct dentry *debug_file;
|
||||
struct dentry *debug_testmode;
|
||||
struct dentry *debug_fifo;
|
||||
|
||||
/* DWC OTG HW Release versions */
|
||||
@@ -684,15 +708,21 @@ struct dwc2_hsotg {
|
||||
|
||||
struct usb_request *ep0_reply;
|
||||
struct usb_request *ctrl_req;
|
||||
u8 ep0_buff[8];
|
||||
u8 ctrl_buff[8];
|
||||
void *ep0_buff;
|
||||
void *ctrl_buff;
|
||||
enum dwc2_ep0_state ep0_state;
|
||||
u8 test_mode;
|
||||
|
||||
struct usb_gadget gadget;
|
||||
unsigned int enabled:1;
|
||||
unsigned int connected:1;
|
||||
unsigned int setup:1;
|
||||
unsigned long last_rst;
|
||||
struct s3c_hsotg_ep *eps;
|
||||
struct s3c_hsotg_ep *eps_in[MAX_EPS_CHANNELS];
|
||||
struct s3c_hsotg_ep *eps_out[MAX_EPS_CHANNELS];
|
||||
u32 g_using_dma;
|
||||
u32 g_rx_fifo_sz;
|
||||
u32 g_np_g_tx_fifo_sz;
|
||||
u32 g_tx_fifo_sz[MAX_EPS_CHANNELS];
|
||||
#endif /* CONFIG_USB_DWC2_PERIPHERAL || CONFIG_USB_DWC2_DUAL_ROLE */
|
||||
};
|
||||
|
||||
@@ -969,7 +999,8 @@ extern int s3c_hsotg_remove(struct dwc2_hsotg *hsotg);
|
||||
extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2);
|
||||
extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2);
|
||||
extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq);
|
||||
extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2);
|
||||
extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2,
|
||||
bool reset);
|
||||
extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg);
|
||||
extern void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2);
|
||||
#else
|
||||
@@ -981,7 +1012,8 @@ static inline int s3c_hsotg_resume(struct dwc2_hsotg *dwc2)
|
||||
{ return 0; }
|
||||
static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
|
||||
{ return 0; }
|
||||
static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2) {}
|
||||
static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2,
|
||||
bool reset) {}
|
||||
static inline void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) {}
|
||||
static inline void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2) {}
|
||||
#endif
|
||||
|
||||
+834
-363
File diff suppressed because it is too large
Load Diff
+16
-80
@@ -316,10 +316,12 @@ void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg)
|
||||
*/
|
||||
static void dwc2_hcd_rem_wakeup(struct dwc2_hsotg *hsotg)
|
||||
{
|
||||
if (hsotg->lx_state == DWC2_L2)
|
||||
if (hsotg->lx_state == DWC2_L2) {
|
||||
hsotg->flags.b.port_suspend_change = 1;
|
||||
else
|
||||
usb_hcd_resume_root_hub(hsotg->priv);
|
||||
} else {
|
||||
hsotg->flags.b.port_l1_change = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1371,7 +1373,7 @@ static void dwc2_conn_id_status_change(struct work_struct *work)
|
||||
hsotg->op_state = OTG_STATE_B_PERIPHERAL;
|
||||
dwc2_core_init(hsotg, false, -1);
|
||||
dwc2_enable_global_interrupts(hsotg);
|
||||
s3c_hsotg_core_init_disconnected(hsotg);
|
||||
s3c_hsotg_core_init_disconnected(hsotg, false);
|
||||
s3c_hsotg_core_connect(hsotg);
|
||||
} else {
|
||||
/* A-Device connector (Host Mode) */
|
||||
@@ -1473,30 +1475,6 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, u16 windex)
|
||||
}
|
||||
}
|
||||
|
||||
static void dwc2_port_resume(struct dwc2_hsotg *hsotg)
|
||||
{
|
||||
u32 hprt0;
|
||||
|
||||
/* After clear the Stop PHY clock bit, we should wait for a moment
|
||||
* for PLL work stable with clock output.
|
||||
*/
|
||||
writel(0, hsotg->regs + PCGCTL);
|
||||
usleep_range(2000, 4000);
|
||||
|
||||
hprt0 = dwc2_read_hprt0(hsotg);
|
||||
hprt0 |= HPRT0_RES;
|
||||
writel(hprt0, hsotg->regs + HPRT0);
|
||||
hprt0 &= ~HPRT0_SUSP;
|
||||
/* according to USB2.0 Spec 7.1.7.7, the host must send the resume
|
||||
* signal for at least 20ms
|
||||
*/
|
||||
usleep_range(20000, 25000);
|
||||
|
||||
hprt0 &= ~HPRT0_RES;
|
||||
writel(hprt0, hsotg->regs + HPRT0);
|
||||
hsotg->lx_state = DWC2_L0;
|
||||
}
|
||||
|
||||
/* Handles hub class-specific requests */
|
||||
static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
|
||||
u16 wvalue, u16 windex, char *buf, u16 wlength)
|
||||
@@ -1542,7 +1520,17 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
|
||||
case USB_PORT_FEAT_SUSPEND:
|
||||
dev_dbg(hsotg->dev,
|
||||
"ClearPortFeature USB_PORT_FEAT_SUSPEND\n");
|
||||
dwc2_port_resume(hsotg);
|
||||
writel(0, hsotg->regs + PCGCTL);
|
||||
usleep_range(20000, 40000);
|
||||
|
||||
hprt0 = dwc2_read_hprt0(hsotg);
|
||||
hprt0 |= HPRT0_RES;
|
||||
writel(hprt0, hsotg->regs + HPRT0);
|
||||
hprt0 &= ~HPRT0_SUSP;
|
||||
usleep_range(100000, 150000);
|
||||
|
||||
hprt0 &= ~HPRT0_RES;
|
||||
writel(hprt0, hsotg->regs + HPRT0);
|
||||
break;
|
||||
|
||||
case USB_PORT_FEAT_POWER:
|
||||
@@ -2317,55 +2305,6 @@ static void _dwc2_hcd_stop(struct usb_hcd *hcd)
|
||||
usleep_range(1000, 3000);
|
||||
}
|
||||
|
||||
static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
|
||||
{
|
||||
struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
|
||||
u32 hprt0;
|
||||
|
||||
if (!((hsotg->op_state == OTG_STATE_B_HOST) ||
|
||||
(hsotg->op_state == OTG_STATE_A_HOST)))
|
||||
return 0;
|
||||
|
||||
/* TODO: We get into suspend from 'on' state, maybe we need to do
|
||||
* something if we get here from DWC2_L1(LPM sleep) state one day.
|
||||
*/
|
||||
if (hsotg->lx_state != DWC2_L0)
|
||||
return 0;
|
||||
|
||||
hprt0 = dwc2_read_hprt0(hsotg);
|
||||
if (hprt0 & HPRT0_CONNSTS) {
|
||||
dwc2_port_suspend(hsotg, 1);
|
||||
} else {
|
||||
u32 pcgctl = readl(hsotg->regs + PCGCTL);
|
||||
|
||||
pcgctl |= PCGCTL_STOPPCLK;
|
||||
writel(pcgctl, hsotg->regs + PCGCTL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _dwc2_hcd_resume(struct usb_hcd *hcd)
|
||||
{
|
||||
struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
|
||||
u32 hprt0;
|
||||
|
||||
if (!((hsotg->op_state == OTG_STATE_B_HOST) ||
|
||||
(hsotg->op_state == OTG_STATE_A_HOST)))
|
||||
return 0;
|
||||
|
||||
if (hsotg->lx_state != DWC2_L2)
|
||||
return 0;
|
||||
|
||||
hprt0 = dwc2_read_hprt0(hsotg);
|
||||
if ((hprt0 & HPRT0_CONNSTS) && (hprt0 & HPRT0_SUSP))
|
||||
dwc2_port_resume(hsotg);
|
||||
else
|
||||
writel(0, hsotg->regs + PCGCTL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Returns the current frame number */
|
||||
static int _dwc2_hcd_get_frame_number(struct usb_hcd *hcd)
|
||||
{
|
||||
@@ -2736,9 +2675,6 @@ static struct hc_driver dwc2_hc_driver = {
|
||||
.hub_status_data = _dwc2_hcd_hub_status_data,
|
||||
.hub_control = _dwc2_hcd_hub_control,
|
||||
.clear_tt_buffer_complete = _dwc2_hcd_clear_tt_buffer_complete,
|
||||
|
||||
.bus_suspend = _dwc2_hcd_suspend,
|
||||
.bus_resume = _dwc2_hcd_resume,
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -294,6 +294,7 @@
|
||||
#define GHWCFG4_NUM_IN_EPS_MASK (0xf << 26)
|
||||
#define GHWCFG4_NUM_IN_EPS_SHIFT 26
|
||||
#define GHWCFG4_DED_FIFO_EN (1 << 25)
|
||||
#define GHWCFG4_DED_FIFO_SHIFT 25
|
||||
#define GHWCFG4_SESSION_END_FILT_EN (1 << 24)
|
||||
#define GHWCFG4_B_VALID_FILT_EN (1 << 23)
|
||||
#define GHWCFG4_A_VALID_FILT_EN (1 << 22)
|
||||
@@ -541,6 +542,7 @@
|
||||
|
||||
#define DIEPINT(_a) HSOTG_REG(0x908 + ((_a) * 0x20))
|
||||
#define DOEPINT(_a) HSOTG_REG(0xB08 + ((_a) * 0x20))
|
||||
#define DXEPINT_SETUP_RCVD (1 << 15)
|
||||
#define DXEPINT_INEPNAKEFF (1 << 6)
|
||||
#define DXEPINT_BACK2BACKSETUP (1 << 6)
|
||||
#define DXEPINT_INTKNEPMIS (1 << 5)
|
||||
|
||||
@@ -155,6 +155,8 @@ static int dwc2_driver_probe(struct platform_device *dev)
|
||||
struct dwc2_core_params defparams;
|
||||
struct dwc2_hsotg *hsotg;
|
||||
struct resource *res;
|
||||
struct phy *phy;
|
||||
struct usb_phy *uphy;
|
||||
int retval;
|
||||
int irq;
|
||||
|
||||
@@ -212,6 +214,24 @@ static int dwc2_driver_probe(struct platform_device *dev)
|
||||
|
||||
hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node);
|
||||
|
||||
/*
|
||||
* Attempt to find a generic PHY, then look for an old style
|
||||
* USB PHY
|
||||
*/
|
||||
phy = devm_phy_get(&dev->dev, "usb2-phy");
|
||||
if (IS_ERR(phy)) {
|
||||
hsotg->phy = NULL;
|
||||
uphy = devm_usb_get_phy(&dev->dev, USB_PHY_TYPE_USB2);
|
||||
if (IS_ERR(uphy))
|
||||
hsotg->uphy = NULL;
|
||||
else
|
||||
hsotg->uphy = uphy;
|
||||
} else {
|
||||
hsotg->phy = phy;
|
||||
phy_power_on(hsotg->phy);
|
||||
phy_init(hsotg->phy);
|
||||
}
|
||||
|
||||
spin_lock_init(&hsotg->lock);
|
||||
mutex_init(&hsotg->init_mutex);
|
||||
retval = dwc2_gadget_init(hsotg, irq);
|
||||
@@ -231,8 +251,15 @@ static int __maybe_unused dwc2_suspend(struct device *dev)
|
||||
struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev);
|
||||
int ret = 0;
|
||||
|
||||
if (dwc2_is_device_mode(dwc2))
|
||||
if (dwc2_is_device_mode(dwc2)) {
|
||||
ret = s3c_hsotg_suspend(dwc2);
|
||||
} else {
|
||||
if (dwc2->lx_state == DWC2_L0)
|
||||
return 0;
|
||||
phy_exit(dwc2->phy);
|
||||
phy_power_off(dwc2->phy);
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -241,8 +268,13 @@ static int __maybe_unused dwc2_resume(struct device *dev)
|
||||
struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev);
|
||||
int ret = 0;
|
||||
|
||||
if (dwc2_is_device_mode(dwc2))
|
||||
if (dwc2_is_device_mode(dwc2)) {
|
||||
ret = s3c_hsotg_resume(dwc2);
|
||||
} else {
|
||||
phy_power_on(dwc2->phy);
|
||||
phy_init(dwc2->phy);
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user