Commit graph

287446 commits

Author SHA1 Message Date
Russell King
9903405be5 ARM: sa11x0: remove old SoC private DMA driver
Now that all users are converted over to using the DMA engine API,
we can get rid of the old platform dependent DMA driver.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-25 23:55:09 +01:00
Russell King
277dc7ae14 Merge branch 'sa11x0-ir' into sa11x0 2012-03-25 23:54:57 +01:00
Russell King
374da9da22 Merge branch 'sa1111' into sa11x0
Conflicts:
	arch/arm/common/sa1111.c
	arch/arm/mach-sa1100/neponset.c

Fixed:
	arch/arm/mach-sa1100/assabet.c
for the neponset changes
2012-03-25 23:54:16 +01:00
Russell King
81e6ca3eb7 USB: sa1111: add hcd .reset method
Add the .reset method to the HCD, and update the .start method
accordingly for this change.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:14 +00:00
Russell King
846a70487e USB: sa1111: add OHCI shutdown methods
Add OHCI shutdown methods to cleanly shutdown the OHCI controller on
system shutdowns and reboots.  This avoids the controller continuing
to run should be soft-reboot the platform, potentially scribbling
over system memory.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:13 +00:00
Russell King
132db99ae2 USB: sa1111: reorganize ohci-sa1111.c
Combine usb_hcd_sa1111_probe() and ohci_hcd_sa1111_drv_probe(), doing
the same for the remove methods.

Move sa1111_start_hc and sa1111_stop_hc to be located next to these
the probe/release functions, as they're only called from them.

Get rid of the /*----*/ breaker lines.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:13 +00:00
Russell King
3f878dbcd6 USB: sa1111: get rid of nasty printk(KERN_DEBUG "%s: ...", __FILE__)
Use dev_dbg() instead, it's more friendly.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:13 +00:00
Russell King
9cb0f819eb USB: sa1111: sparse and checkpatch cleanups
Clean up the ohci-sa1111 driver formatting to be more compliant with
current standards, and add 'static' to various function definitions
to avoid sparse complaints about undeclared functions.  Remove the
unnecessary local declaration of 'usb_disabled', which can be found
instead in linux/usb.h.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:13 +00:00
Russell King
876c1f2785 ARM: sa11x0: don't static map sa1111
The sa1111 support will ioremap() the device; there is no need for
platforms to setup a static mapping for this.  Remove the static
mapping for this device from badge4, jornada720 and neponset.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:13 +00:00
Russell King
22eeaff367 ARM: sa1111: use dev_err() rather than printk()
Use dev_err() to report device specific errors rather than printk().

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:12 +00:00
Russell King
924e1d4910 ARM: sa1111: cleanup sub-device registration and unregistration
Move the releasing of resources out of the release function - this
allows a cleaner and more conventional arrangement of the registration
failure paths and a saner unregistration process for these devices.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:12 +00:00
Russell King
21d1c7702e ARM: sa1111: only setup DMA for DMA capable devices
It's pointless registering the PS/2 interfaces with the dmabounce code
when there's no DMA support for these in hardware, so only setup the
DMA masks for two subdevices which support DMA - the OHCI and SAC.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:12 +00:00
Russell King
09a2ba2fa0 ARM: sa1111: register sa1111 devices with dmabounce in bus notifier
Use the bus notifier to register sa1111 devices with dmabounce, rather
than after the device has been registered, potentially racing with
driver binding.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:12 +00:00
Russell King
2213536d78 ARM: sa1111: move USB interface register definitions to ohci-sa1111.c
Move the USB interface register definitions into the driver, rather
than keeping them in a common place.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:12 +00:00
Russell King
ea8c00ac18 ARM: sa1111: move PCMCIA interface register definitions to sa1111_generic.c
Move the PCMCIA interface register definitions into the driver, rather
than keeping them in a common place.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:11 +00:00
Russell King
4f8d9cae15 ARM: sa1111: move PS/2 interface register definitions to sa1111p2.c
Move the PS/2 interface register definitions into the driver, rather
than keeping them in a common location.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:11 +00:00
Russell King
6995f5b007 ARM: sa1111: delete unused physical GPIO register definitions
Get rid of the unused GPIO register definitions - we access GPIO
registers through the base + offset method, and having the phys
address definitions is unnecessary duplication.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:30:11 +00:00
Russell King
07be45f57e ARM: sa1111: provide a generic way to prevent devices from registering
Some platforms don't want certain devices to be registered, because,
eg, the interface is not wired.  Provide a way for platforms to
prevent various devices from being registered via a devid bitmask in
the platform data.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-24 11:29:52 +00:00
Russell King
d138dacb4b NET: sa11x0-ir: add DMA support for SIR transmit mode
As the DMA engine API allows DMA channels to be reconfigured on the
fly, we can now support switching the DMA channel configuration to
support SIR transmit DMA without needing to claim an additional
physical DMA channel - thereby using up half the DMA channels just
for one driver.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-07 11:46:19 +00:00
Russell King
bf95154ff6 NET: sa11x0-ir: convert sa11x0-ir driver to use DMA engine API
Convert the sa11x0 IrDA driver to use the sa11x0 DMA engine driver
rather than our own platform specific DMA API.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-07 11:46:17 +00:00
Russell King
bb8c95055a Merge branch 'sa11x0-dma' into sa11x0-ir 2012-03-07 11:46:12 +00:00
Russell King
7931d92f4f ARM: sa11x0: add SA-11x0 DMA device
Add sa11x0 DMA platform device and resources to the list of
generic platform devices for SA11x0 machines.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-07 11:32:21 +00:00
Russell King
6365bead25 DMA: sa11x0: add SA-11x0 DMA driver
Add support for the SA-11x0 DMA driver, which replaces the private
API version in arch/arm/mach-sa1100/dma.c.

We model this as a set of virtual DMA channels, one for each request
signal, and assign the virtual DMA channel to a physical DMA channel
when there is work to be done.  This allows DMA users to claim their
channels, and hold them while not in use, without affecting the
availability of the physical channels.

Another advantage over this approach, compared to the private version,
is that a channel can be reconfigured on the fly without having to
release and re-request it - which for the IrDA driver, allows us to
use DMA for SIR mode transmit without eating up three physical
channels.  As IrDA is half-duplex, we actually only need one physical
channel, and this architecture allows us to achieve that.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-03-07 11:32:21 +00:00
Russell King
3c500a3554 NET: sa11x0-ir: split si->dev for IrDA transmit and receive buffers
The sa11x0-ir device is not the device which is doing the DMA, the
DMA is being performed by a separate DMA engine.  Split the struct
device associated with each DMA channel from the main struct device,
but for the time being initialize it from the main struct device.

This is another preparatory step to converting this driver to use the
DMA engine API.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:57 +00:00
Russell King
04b7fc4dec NET: sa11x0-ir: fix size of SIR transmit buffer
The SIR transmit buffer was being allocated as 4000 bytes.  IrDA now
has constants for the buffer sizes, and defines the maximum wrapped
SIR packet to be 4269 bytes as indicated by IRDA_SIR_MAX_FRAME.  Use
this definition to allocate the transmit buffer instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:57 +00:00
Russell King
32273f5060 NET: sa11x0-ir: convert to use scatterlist DMA API
Convert the sa11x0 IrDA driver to use the scatterlist DMA API.  This
is a preparatory patch for converting the driver to use the DMA engine
API, which requires a struct scatterlist for every transfer.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:57 +00:00
Russell King
6a7f4911a4 NET: sa11x0-ir: get rid of si->hscr0
si->hscr0 is initialized to zero, and never changed.  Get rid of this
redundant variable.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:56 +00:00
Russell King
26f2bee1a3 NET: sa11x0-ir: move sa1100_irda_txdma_irq
Move the FIR DMA transmit completion function along-side the other FIR
protocol functions.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:56 +00:00
Russell King
a6b2ea66d6 NET: sa11x0-ir: move SIR and FIR interrupt support
Move the interrupt handlers to the SIR and FIR sections of the file.
This improves the localization of the protocol handlers.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:56 +00:00
Russell King
374f77390c NET: sa11x0-ir: indirect handling of SIR and FIR interrupts
Use the same method for doing this as we do for the tx_start functions.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:56 +00:00
Russell King
3d26db137a NET: sa11x0-ir: split SIR and FIR tx functions
Split the SIR and FIR transmit functions, as they behave differently.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:55 +00:00
Russell King
0e888ee315 NET: sa11x0-ir: factor out speed checks
Whenever we complete a transmit, we always check for a speed change.
This check was open coded in several places.  Provide a helper
function to do this instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:55 +00:00
Russell King
cbe1d24fb7 NET: sa11x0-ir: move sa1100_irda_{startup,shutdown,suspend,resume}
Places these functions in better locations in the file, near where
they are used.  This saves some tiresome paging up/down.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:54 +00:00
Russell King
ba84525bd9 NET: sa11x0-ir: fix leak of tx skb
Ensure that we unmap and free a pending transmit skb when the interface
is stopped.  We rearrange the code a little bit to give all places a
similar layout when freeing the skb in both the completion and interface
stop paths - this gives some consistency to the code.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:53 +00:00
Russell King
885767ca4c NET: sa11x0-ir: containerize DMA data
Both the transmit and receive DMA store identical data: the skb, dma
address, and the dma registers.  Move this data into its own data
structure.  The following replacements were used:

	rxskb -> dma_rx.skb
	rxbuf_dma -> dma_rx.dma
	rxdma -> dma_rx.regs

	txskb -> dma_tx.skb
	txbuf_dma -> dma_tx.dma
	txdma -> dma_tx.regs

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:53 +00:00
Russell King
e556fdbde3 NET: sa11x0-ir: obtain interrupt number from platform resources
Convert the sa11x0-ir driver to obtain its interrupt number from the
platform device resources, rather than via the asm/irq.h include.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:53 +00:00
Russell King
d32386086b NET: sa11x0-ir: set netdev's parent struct device
Add the missing SET_NETDEV_DEV() call to set the parent device
correctly for this network interface.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:52 +00:00
Russell King
22f0bf96de NET: sa11x0-ir: handle DMA mapping errors properly
Handle DMA mapping errors in the rx skb allocation and tx paths.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:52 +00:00
Russell King
15877e9c8a NET: sa11x0-ir: fix documentation bug
Spell the module parameter correctly in comments.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:37:52 +00:00
Russell King
e5c0fc4185 ARM: sa1111: change devid to be a bitmask
Change the sa1111 device id to be a bitmask.  This allows us to
specify the actual device, while allowing a single driver to bind
to both PS2 devices.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:52 +00:00
Russell King
3259701cc2 ARM: sa11x0: badge4: move board specific ohci initialization to badge4.c
Move the handling of the 5v supply into badge4.c, removing this board
specific detail from the sa1111 ohci driver.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:51 +00:00
Russell King
ae99ddbc97 ARM: sa1111: add platform enable/disable functions
Add platform hooks to be called when individual sa1111 devices are
enabled and disabled.  This will allow us to move some platform
specifics out of the individual drivers.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:50 +00:00
Russell King
6bd72f0562 ARM: sa1111: add shutdown hook to sa1111_driver structure
Add a shutdown hook to the sa1111_driver structure to allow drivers
to be notified of system reboots and shutdowns.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:50 +00:00
Russell King
36d3121302 ARM: sa1111: implement support for sparse IRQs
Implement the necessary allocation/freeing functionality to support
sparse IRQs with the SA-1111 device.  On non-sparse IRQ platforms,
this allows us to dynamically allocate from within the available IRQ
number space.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:50 +00:00
Russell King
f03ecaa0aa ARM: sa1111: finish "allow cascaded IRQs to be used by platforms"
Commit 19851c58e6 (sa1111: allow cascaded IRQs to be used by platforms)
moved the IRQ definitions to the .c file, and added an irq_base member
to the private data structure.

The inerrupt demultiplexer uses irq_base, but the interrupt setup code
does not.  Also, although the commit adds a private data structure to
pass this data, it isn't even referenced, resulting in irq_base being
zero.

We also copied the IRQ numbers from the device info array into the actual
devices, resulting in wrong interrupt numbers passed to the sub-devices.

The net effect of this is that we always overwrite IRQs 0-54, even if
they are allocated elsewhere in the system.

Add the code necessary to setup the private irq_base, and use it in the
IRQ setup code.  Make the SA-1111 probe fail with -EINVAL if there is no
platform data provided.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:49 +00:00
Russell King
1ebcd7654e ARM: sa1111: add .owner initializer to sa1111 driver structures
Add a .owner initializer to the sa1111 driver structures to allow
allow the modules to be associated with their driver structures.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:49 +00:00
Russell King
4d5d11285c ARM: sa1111: add sa1111 core driver .owner initializer
Add an initializer for the struct device_driver .owner member.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:49 +00:00
Russell King
a22db0f382 ARM: sa1111: fix PWM state on suspend
We should not write to the SA1111 registers after setting the SLEEP
bit.  Moreover, the manual says that the PWM registers should be
disabled before we enter sleep.  So, move the clearing of these
registers earlier in the suspend sequence.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:48 +00:00
Russell King
29c140b623 ARM: sa1111: fix memory request/grant setup on PM events
We weren't re-enabling the memory request/grant signals on resume,
causing DMA devices on the sa1111 to fail.

Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:48 +00:00
Russell King
fbae0f8912 ARM: sa11x0: neponset: don't static map neponset registers
Now that we ioremap() the neponset register space, there's no need
to static map the neponset registers.  Get rid of this static mapping.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-02-09 15:34:18 +00:00