Don't loop the interrupt service logic in the ISR. Currently it polls for
subsequent interrupts after servicing the first. This is not an error, but is
non-ideal for two reasons:
Firstly, there was a condition where the higher levels of interrupt control
could requeue the ISR while it was still acting. The first invocation would
then service the new interrupt and the second ISR invocation would be a NOP.
Secondly, there is no bound on the length of time the driver spends in ISR
context. ISRs ideally have a deterministic duration.
Fixed by just unlooping. Each ISR is now a oneshot. Interrupts that re-trigger
during servicing are handled by a subsequent incovation of the ISR.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Tested-by: Wendy Liang <wendy.liang@xilinx.com>
There is an unlikely early return path from the interrupt service that was
returning without releasing the global lock. If this return path is taken
the driver will crash as soon as any other activity tries to take the global
lock. Resolved by releasing the lock.
In ehci_xusbps_setup ehci_halt is called before ehci_init. This means that the
initial ehci_halt call is working on a not completely initialized ehci hcd
struct, which might cause undefined behavior. So make sure to call ehci_init
before calling ehci_halt.
This fixes also the following lockdep warning:
INFO: trying to register non-static key.
the code is fine but needs lockdep annotation.
turning off the locking correctness validator.
[<c001355c>] (unwind_backtrace+0x0/0xe0) from [<c005c6c0>] (__lock_acquire+0x1ac/0x19c0)
[<c005c6c0>] (__lock_acquire+0x1ac/0x19c0) from [<c005e394>] (lock_acquire+0x60/0x74)
[<c005e394>] (lock_acquire+0x60/0x74) from [<c034843c>] (_raw_spin_lock_irq+0x50/0x60)
[<c034843c>] (_raw_spin_lock_irq+0x50/0x60) from [<c02202e8>] (ehci_halt+0x14/0xd8)
[<c02202e8>] (ehci_halt+0x14/0xd8) from [<c022532c>] (ehci_xusbps_setup+0x58/0x41c)
[<c022532c>] (ehci_xusbps_setup+0x58/0x41c) from [<c020f828>] (usb_add_hcd+0x194/0x5c0)
[<c020f828>] (usb_add_hcd+0x194/0x5c0) from [<c0223e28>] (ehci_xusbps_drv_probe+0x158/0x1e0)
[<c0223e28>] (ehci_xusbps_drv_probe+0x158/0x1e0) from [<c01c84dc>] (platform_drv_probe+0x14/0x18)
...
Michal Simek [Tue, 4 Dec 2012 08:55:39 +0000 (09:55 +0100)]
mtd: xilinx_nandps: Remove __devinitconst from xnandps_commands
The array is used by a non-(dev)init function and thus must not
be declared __devinitconst.
Fixes a section mismatch warning.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: John Linn <john.linn@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
xilinx_axienet: Service completion interrupts ASAP
The packet completion interrupts for TX and RX should be serviced before
the packets are consumed. This ensures against the degenerate case when a
new completion interrupt is raised after the handler has exited but before
the interrupts are cleared. In this case its possible for the ISR to clear
an unhandled interrupt (leading to potential deadlock).
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Tested-by: Jason Wu <huanyu@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
The AXI-DMA rx-delay interrupt can sometimes be triggered when there are 0
outstanding packets received. This is due to the fact that the receive function
will greedily consume as many packets as possible on interrupt. So if two
packets (with a very particular timing) arrive in succession they will each
cause the rx-delay interrupt, but the first interrupt will consume both packets.
This means the second interrupt is a 0 packet receive.
This is mostly OK, except that the tail pointer register is updated
unconditionally on receive. Currently the tail pointer is always set to the
current bd-ring descriptor under the assumption that the hardware has moved onto
the next descriptor. What this means for length 0 recv is the current descriptor
that the hardware is potentially yet to use will be marked as the tail. This
causes the hardware to think its run out of descriptors deadlocking the whole rx
path.
Fixed by updating the tail pointer to the most recent successfully consumed
descriptor.
Reported-by: Wendy Liang <wendy.liang@xilinx.com> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Tested-by: Jason Wu <huanyu@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Mon, 3 Dec 2012 14:04:30 +0000 (15:04 +0100)]
usb: ehci-xilinx-usbps: Fix reboot issue in OTG mode via ehci_shutdown
This patch fix the problem with gadget modules
(CONFIG_USB_ZERO=m for example) because root_hub is not initialized
before OTG driver is notified about it. When it is notified
this code in "xilinx_usbps_otg.c" is causing the problem.
because wants to read root_hub structures.
if (otg->otg->host->root_hub) {
udev_otg = otg->otg->host->root_hub->children[otg_port-1];
}
Michal Simek [Thu, 22 Nov 2012 13:06:16 +0000 (14:06 +0100)]
usb: xusbps-dr-of: Fix probe function
There is no reason to call of_match_device inside OF
driver because probe function is called when
compatible strings are matched.
Also copying empty xusbps_pdata is quite weird
that's why I have removed it.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Mon, 26 Nov 2012 09:12:46 +0000 (10:12 +0100)]
usb: ehci-xilinx-usbps: Fix reboot issue in OTG mode
This patch fix the reboot issue when OTG mode is used
and reset is performed without using OTG-host mode.
The reason is not initializaed ehci->caps/regs which
are initialized in ehci_xusbps_setup but this function
is called when host mode is used.
But uninitialization depends on these values.
Michal Simek [Wed, 28 Nov 2012 08:29:45 +0000 (09:29 +0100)]
spi: spi-xilinx: Run run-time endian detection
Do not load endian value from platform data
and rather autodetect it.
The problem is with using this platform in PL on Zynq
when little endian arm IO function should be used but
there is no description in DTS which suggest this
and also platform_data doesn't contain this information.
Signed-off-by: Michal Simek <michal.simek@xilinx.com> CC: Srikanth Vemula <svemula@xilinx.com>
Soren Brinkmann [Thu, 29 Nov 2012 19:37:45 +0000 (11:37 -0800)]
gpio: xilinxps: Enable clock for non PM mode
Assuming the device clock would be enabled through RUNTIME_PM,
the clock was disabled in the driver's probe routine.
Obviously, this did break functionality in case the kernel is
compiled without CONFIG_PM_RUNTIME.
Soren Brinkmann [Thu, 29 Nov 2012 17:45:15 +0000 (09:45 -0800)]
gpio: xilinxps: Fix interrupts
This patch makes the GPIO interrupts work and they can be
used to resume from suspend.
Also we have to adjust the numbers of interrupts for zynq
because several subsystems - e.g. GPIO, PCIe
use virtual IRQs beyond 128, thus this number must be increased.
Let's allocate IRQs 128-256 for PCIe
and IRQs 256-512(ARCH_NR_GPIOS) for GPIOs.
Also chnage XGPIOPS_IRQBASE to reflect this.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Thu, 29 Nov 2012 16:12:38 +0000 (17:12 +0100)]
net: ethernet: emacps: Do no use emac power management
This is workaround for problem with busybox udhcp client
which is not able to obtain IP address when PM is on.
But on the other hand we need PM in menuconfig for
others driver that's why I am blocking PM code in the driver.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Fri, 30 Nov 2012 21:00:21 +0000 (22:00 +0100)]
zynq: pcie: AXI PCIE Fix section mismatch
Fix section mismatch because of section warnings.
Warning:
WARNING: arch/arm/mach-zynq/built-in.o(.text+0x2c5c):
Section mismatch in reference from the function xaxi_pcie_setup()
to the function .devinit.text:xaxi_pcie_set_bridge_resource()
The function xaxi_pcie_setup() references
the function __devinit xaxi_pcie_set_bridge_resource().
This is often because xaxi_pcie_setup lacks a __devinit
annotation or the annotation of xaxi_pcie_set_bridge_resource is wrong.
WARNING: arch/arm/mach-zynq/built-in.o(.text+0x2c68):
Section mismatch in reference from the function xaxi_pcie_setup()
to the function .devinit.text:xaxi_pcie_process_bridge_OF_ranges()
The function xaxi_pcie_setup() references
the function __devinit xaxi_pcie_process_bridge_OF_ranges().
This is often because xaxi_pcie_setup lacks a __devinit
annotation or the annotation of xaxi_pcie_process_bridge_OF_ranges is wrong.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
gpio: xilinx_gpiops: Fix gpio_request() return value
Commit bb1bff3c ("Xilinx: ARM: xgpiops: Adding PM support") added runtime power
management for the gpio driver. The gpio chip's request callback calls
pm_runtime_get() and passes the return value on, but pm_runtime_get() may either
return 0 or 1 on success, but the gpio request callback should only ever return
0 on success. This patch modifies the code to return 0 if the return value of
pm_runtime_get() is >= 0.
Soren Brinkmann [Thu, 29 Nov 2012 01:09:53 +0000 (17:09 -0800)]
arm: zynq: Remove mach/smc.h
The only user of mach/smc.h is the Zynq nandps driver. Required
content is moved from the header to the actual driver and the
redundant header is removed.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
Soren Brinkmann [Thu, 29 Nov 2012 01:09:52 +0000 (17:09 -0800)]
arm: zynq: Remove mach/nand.h
The only user of mach/nand.h is the Zynq nandps driver. Required
content is moved from the header to the actual driver and the
redundant header is removed.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
spi-xilinx is using the same structure name but
it is defined in include/linux/spi/xilinx_spi.h.
It is historical relic that it wasn't removed when
spi driver went to mainline.
Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: John Linn <john.linn@xilinx.com>
Soren Brinkmann [Tue, 27 Nov 2012 18:22:43 +0000 (10:22 -0800)]
mtd: xilinx_nandps: Rename driver to nandps
The acronym PSS is no longer used in favor of PS. The driver is
renamed accordingly. All ocurrences of PSS/pss are replaced by
PS/ps. The kernel configuration option is now named MTD_NAND_XILINX_PS.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
The existing driver reports wrong Rx/Tx error count (ifconfig).
The Rx/Tx error counters get incremented twice for most of.
the error cases. This patch fixes it.
Signed-off-by: Anirudha Sarangi <anirudh@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
Anirudha Sarangi [Tue, 27 Nov 2012 10:32:18 +0000 (16:02 +0530)]
net: xilinx_emacps: Fix driver issue under heavy Rx traffic
The existing driver misbehaves when subjected to heavy traffic
on the Rx path. Under heavy traffic (with a inter packet gap
in the range of 2-5 microseconds) the Rx path of the driver
becomes unresponsive. Under such heavy traffic load it is
natural for the driver to get overwhelmed on Rx path and drop
some packets (as per IEEE specs it is OK), but it should never
become completely unresponsive after the heavy Rx traffic is
taken off. The issue with the existing driver is, under heavy
Rx load, it starts getting lots of error interrupts (buffer not
available) and it does not process them properly. As a result,
at some point the driver consumes all BDs for Rx and does not
free any ensuring a complete lock up.
This patch fixes it by ensuring that even for error cases there
is a constant effort to free up any available BDs.
Signed-off-by: Anirudha Sarangi <anirudh@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
Soren Brinkmann [Mon, 19 Nov 2012 22:53:57 +0000 (14:53 -0800)]
spi: xilinx_qspips: Fix potential memory leaks
The spi_master struct was dynamically allocated but never freed.
Memory allocation used the type instead of *identifier to determine
the size of the area to allocate.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
Soren Brinkmann [Sat, 17 Nov 2012 02:17:39 +0000 (18:17 -0800)]
spi: xilinx_spips: Fix potential memory leaks
The spi_master struct was dynamically allocated but never freed.
Memory allocation used the type instead of *identifier to determine
the size of the area to allocate.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
Soren Brinkmann [Fri, 16 Nov 2012 00:15:32 +0000 (16:15 -0800)]
arm: zynq: Clean up OPP initialization
Instead of using a fixed set of frequncies for the OPP table, the
frequency operating points are added as following:
1. boot up CPU frequency (F_boot)
2. F_boot / 2
3. F_boot / 3
4. Minium frequency (200 MHz)
The actual frequencies may vary since the HW may not able to generate the exact
frequency.
If any of the frequencies from 2 - 4 fall below the minimum it is not available.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
Soren Brinkmann [Fri, 16 Nov 2012 00:15:31 +0000 (16:15 -0800)]
arm: zynq: Add boot up frequency OPP
We cannot know the CPU frequency the system boots up with at
compile time.
So, we uncoditionally add this frequency to the OPP table at
runtime.
Since this might result in duplicates in the frequency table,
other points are added only when it is not present in the OPP
list already.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
Srikanth Thokala [Wed, 14 Nov 2012 18:10:32 +0000 (23:40 +0530)]
DMA: Xilinx: Separation of DMA driver into three drivers
This patch separates the existing Xilinx DMA driver, which is
currently common driver for the three IPs AXI-DMA, AXI-VDMA, AXI-CDMA,
into three individual IP drivers. It also adds three test clients for
each DMA IP.
Signed-off-by: Srikanth Thokala <sthokal@xilinx.com> Acked-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek [Tue, 13 Nov 2012 13:14:44 +0000 (14:14 +0100)]
net: xilinx_emacps: Fix MII initialization
MII probing should be done in open function.
The problem was that phydev was connected in the xemacps_probe
function and disconnected in the xemacps_close function.
It means that if device is closed and open again phydev
is not connected because phydev connection is not setup.
It ends with NULL pointer exception because
phydev->attached_dev(in phy_detach()) is NULL.
Signed-off-by: Michal Simek <michal.simek@xilinx.com> Tested-by: John Linn <john.linn@xilinx.com> Tested-by: Soren Brinkmann <soren.brinkmann@xilinx.com>