This flag is set before sending the zlp. So use present tense instead
of the past tense.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Enable phy driver to report vbus session. This allows us to remove
D+ pullup when vbus is not present.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Gregory Herrero <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
The warning is probably good but it has false positives in both dma and non-dma
cases. So its not very helpful in either.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
According to programming guide, zero length packet should be
programmed on its own and should not be counted in DIEPTSIZ.PktCnt
with other packets.
For ep0, this is the zlp for DATA IN stage (if required) and not for
the STATUS stage.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Gregory Herrero <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Manage ep0 state in software to add handling of status OUT stage.
Just toggling hsotg->setup in s3c_hsotg_handle_outdone leaves it in
wrong state in 2-stage control transfers.
Moreover, ensure that for setup-packet s3c_hsotg_handle_outdone is
called either from SetupDone or OutDone but not both. Dwc2 ip v3.00a
generates both SetupDone and OutDone on setup packets.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
When matching tx fifo to endpoint, consider all fifos instead of
hard limiting to 8
Moreover, print error in case no fifo could be found.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
< 15 check doesn't show debug information for endpoint 15.
It is possible to have less than 15 endpoints so use limit
provided by hardware configuration.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
As fifo size can vary between SOCs, add possibility to configure
them from device tree. Fifo sizes used by the legacy driver will
be used If they are not provided by the device tree.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Gregory Herrero <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Reviewed-by: Robert Baldyga <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Current code does not check endpoint 15 interrupt. Use number
of endpoint configured in hardware instead of the hardcoded value.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
GHWCFG1 provides hardware configuration of each endpoint. Use
it to configure the endpoints instead of assuming all even
endpoint are OUT and all odd endpoints are IN.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
* Add an of specific function to parse device node properties.
* Enable dma usage only if device tree property 'g_use_dma' is present.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Gregory Herrero <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
HBstLen is GAHBCFG[4:1]. Use GAHBCFG_HBSTLEN_SHIFT to write burst-
length at correct position.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Gregory Herrero <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
In the error path, s3c_hsotg_phy_disable should be called after a
call to s3c_hsotg_phy_enable is made.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
When using DMA, data of the previous setup packet can be read back
from cache because ep0 and ctrl buffers are embedded in struct s3c_hsotg.
Allocate buffers instead of embedding them.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Reviewed-by: Robert Baldyga <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Only process DOEPINT.XferCompl on data packet as DOEPINTn.SetUp can
occur with or without DOEPINT.XferCompl. When DOEPINT.SetUp occurs
with DOEPINT.XferCompl, only DOEPINT.SetUp needs to be handled.
Moreover, ignore DOEPINT.XferCompl when it occurs with
DOEPINT.StupPktRcvd as driver needs to wait for DOEPINT.SetUp to
continue.
Tested-by: Robert Baldyga <[email protected]>
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Mian Yousaf Kaukab <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Felipe writes:
usb: fixes for v3.19-rc5
Just three fixes this time. An oops fix in ep_write() from gadgetfs,
another oops for the Atmel UDC when unloading a gadget driver and
the fix for PHY deferred probing.
Signed-off-by: Felipe Balbi <[email protected]>
Conflicts:
drivers/usb/phy/phy.c
UDC core has already done it before .udc_stop and after .udc_start.
Signed-off-by: Peter Chen <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
UDC core has already done it before .udc_stop and after .udc_start.
Signed-off-by: Peter Chen <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Instead of using variable length array, use a static length equal to
the size of the ffs->ev.types array. This gets rid of a sparse warning:
drivers/usb/gadget/function/f_fs.c:401:44: warning:
Variable length array is used.
and makes it more explicit that the array has a very tight upper size
limit. Also add some more documentation about the ev.types array and
how its size is limited and affects the rest of the code.
Reported-by: Dan Carpenter <[email protected]>
Reported-by: Rohith Seelaboyina <[email protected]>
Signed-off-by: Michal Nazarewicz <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Add support for vbus detection and power supply. This code is more or
less stolen from phy-gpio-vbus-usb.c, and aims at providing a detection
mechanism for VBus (ie. usb cable plug) based on a GPIO line, and a
power supply activation which draws current from the VBus.
[ [email protected] : fix build break ]
Signed-off-by: Robert Jarzmik <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Change internal gpio handling from integer gpios into gpio
descriptors. This change only addresses the internal API and
device-tree/ACPI, while the legacy platform data remains integer space
based.
This change is only build compile tested, and very prone to error. I
leave this comment for now in the commit message so that this patch gets
some testing as I'm pretty sure it's buggy.
Signed-off-by: Robert Jarzmik <[email protected]>
Acked-by: Linus Walleij <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Cache INT_ENB register value in order to avoid uncached iomem access, and
thus improve access time to INT_ENB value.
Acked-by: Alexandre Belloni <[email protected]>
Signed-off-by: Boris Brezillon <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Avoid interpreting useless status flags when we're not waiting for such
events by masking the status variable with the interrupt enabled register
value.
Acked-by: Alexandre Belloni <[email protected]>
Reported-by: Patrice VILCHEZ <[email protected]>
Signed-off-by: Boris Brezillon <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
at91sam9g45 and at91sam9x5 SoCs have an hardware bug forcing us to
generate a pulse on the BIAS signal on "USB end of reset” and
“USB end of resume" events.
Acked-by: Alexandre Belloni <[email protected]>
Reported-by: Patrice VILCHEZ <[email protected]>
Signed-off-by: Boris Brezillon <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
at91sam9rl SoC has an erratum forcing us to toggle the BIAS on USB
suspend/resume events.
This specific handling is only activated when CONFIG_ARCH_AT91SAM9RL is
set and this option is only set when building a non-DT kernel, which is
problematic since non-DT support for at91sam9rl SoC has been removed.
Rework the toggle_bias implementation to attach it to the "at91sam9rl-udc"
compatible string.
Add new compatible strings to avoid executing at91sam9rl erratum handling
on other SoCs.
Acked-by: Alexandre Belloni <[email protected]>
Signed-off-by: Boris Brezillon <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Removes some functions that are not used anywhere:
fsl_otg_tick_timer() view_ulpi()
This was partially found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
For some user cases, like plug out and replug in usb device during
the system suspend, the speed negotiation will be error due to host
doesn't know the device's disconnection, and it still hopes the
high speed device, but the device backs to "powered" state which
its high speed termination is not enabled, the usb core calls
the PHY's disconnect notifier with "full speed", it will NOT
take effect at all.
If the usb core calls disconnect notifer, the port change must happen,
so it is safe to disable high speed disconenct detector, since
connect notifier will be called soon if the device is still connected
on the port, and we will enable high speed disconnect detector at that
time.
Acked-by: Li Jun <[email protected]>
Signed-off-by: Peter Chen <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
When we shut down the PHY, we need to power down all PHY's functions
as well as disable wakeup, it is the opposite operation we do at .init.
Signed-off-by: Peter Chen <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
This patch fixes in simpler way the bug described in [1] and [2]. It
looks like DWC2 is the only UDC driver that doesn't force usb requests
to complete in ep_disable() function. This causes described problem,
because we have no guarantee that all requests will be completed before
unbind of usb function.
To fix this problem we force all requests of disabled endpoint to complete.
Also currently running request is not handled. This allowed to simplify
code of kill_all_requests() function, because 'force' parameter is always
set to true, so we don't need it anymore.
In s3c_hsotg_rx_data() we change function used to print message when active
request is NULL from dev_warn() to dev_dbg(), because such situation is
harmless for driver and now it can take place during normal endpoint
disabling.
[1] https://lkml.org/lkml/2014/12/9/283
[2] https://lkml.org/lkml/2014/12/12/360
Acked-by: Paul Zimmerman <[email protected]>
Signed-off-by: Robert Baldyga <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Some debug messages were not build due to unconditional #if 0.
These messages are very useful for debugging and the user can enable
them on demand via dynamic debug.
If they are not enabled the performance is not affected.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
ASSERT_OUT_NAKING was only called by out_flush and was hidden behind a
ifdef.
This patch moves the inline function into out_flush and remove the
ifdef. The user can decide to print the debug message or not via dynamic
printk
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
After fix superspeed dma_done was applied we can simplify the code by
removing the duplicated dma_done and letting the function check if there
are more completed dma transactions.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
The function is very simple, does not declare any variable and it is
called in the irq path.
The counterpart for net228x is already declared as inline.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Function resume_dma is not used, remove it.
The reason the compiler did not catch this dead code is the inline
modifier.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Once the defect 7374 is patched, there is no reason the keep reading the
idx scratch register.
Cache the content of the scratch idx register on device flag.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Do not duplicate the code for the else branch of the condition.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
We can use the same function for both families of chips and also remove
the ep_stop_dma() function.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
irqs_superspeed calls ep_stall instead of set/clear_halt, due to a
workaround for SS seqnum. Create a function with the workaround and
call set/clear_halt instead.
This way we can compare the code of super/normal speed and it is easier
to follow the code.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Field is_halt is never used by any function.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
ep_stdrsp was only called by handle_stat0_irqs_superspeed and with
always the same flags.
Remove the function and replace the call by the code inside the
function, since it is very simple once the dead code is removed.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
restart_dma is not used before it is declaration. Therefore we can
remove this definition.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
Remove dma_started field from net2280_ep structure, since it is not used
by any function.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
use_dma parameter was designed to enable the dma on the chip. It was
enabled by default.
It comes from the time when the dma was not reliable. Now it has been
working ok in production.
This patch removes this parameter.
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>