Commit Graph

474 Commits (ef6c680dc5a182a79b09567168d6713f46c85784)

Author SHA1 Message Date
Jassi Brar ef6c680dc5 spi/s3c64xx: Check before mem-region release
Add precautionary check before releasing memory region.

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-01-20 13:49:44 -07:00
Jassi Brar b0d5d6e553 spi/s3c64xx: Move src_clk to local driver data
The pointer to SPI rate source clock had better be the member of
driver local data structure rather than platform specific.
Also, remove definitions of variable 'sci' that are rendered
useless as a consequence.

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-01-20 13:49:44 -07:00
Jassi Brar ee64a37732 spi/s3c64xx: Differentiate ip and rate clock
The instance of SPI clock for controller and that used for generating
signals ought to be independently handled.

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-01-20 13:49:44 -07:00
Jassi Brar ad7de729c6 spi/s3c64xx: Rename s3c64xx_spi_cntrlr_info
Rename 'struct s3c64xx_spi_cntrlr_info' to lesser wordy
'struct s3c64xx_spi_info'

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-01-20 13:49:44 -07:00
Uwe Kleine-König e9a172f074 spi/mpc8xxx: don't check platform_get_irq's return value against zero
platform_get_irq returns -ENXIO on failure, so !irq was probably
always true.  Make irq a signed variable and compare irq <= 0.  Note
that a return value of zero is still handled as error even though this
could mean irq0.

This is a followup to 305b3228f9 that
changed the return value of platform_get_irq from 0 to -ENXIO on error.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-01-20 13:49:44 -07:00
Steven King 34b8c66173 spi: Add Freescale/Motorola Coldfire QSPI driver
Add support for the QSPI controller found some on Freescale/Motorola
Coldfire MCUs.

Full duplex, active high cs, spi modes 0-3 and word sizes 8-16 bits are
supported.  The hardware drives the MISO, MOSI and SCLK lines, but the chip
selects are managed via GPIO and must be configured by the board code.

The QSPI controller has an 80 byte buffer which allows us to transfer up to 16
words at a time.  For transfers longer than 16 words, we split the buffer in
half so we can update in one half while the controller is operating on the
other half.  Interrupt latencies then ultimately limits our sustained thru-put
to something less than half the maximum speed supported by the part.

Signed-off-by: Steven King <sfking@fdwdc.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-01-20 13:49:44 -07:00
Márton Németh 631e61b7ca spi: make Open Firmware device id constant
The match_table field of the struct of_device_id is constant
in <linux/of_platform.h> so it is worth to make the initialization
data constant.

The semantic match that finds this kind of pattern is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
disable decl_init,const_decl_init;
identifier I1, I2, x;
@@
	struct I1 {
	  ...
	  const struct I2 *x;
	  ...
	};
@s@
identifier r.I1, y;
identifier r.x, E;
@@
	struct I1 y = {
	  .x = E,
	};
@c@
identifier r.I2;
identifier s.E;
@@
	const struct I2 E[] = ... ;
@depends on !c@
identifier r.I2;
identifier s.E;
@@
+	const
	struct I2 E[] = ...;
// </smpl>

Signed-off-by: Márton Németh <nm127@freemail.hu>
Cc: Julia Lawall <julia@diku.dk>
Cc: cocci@diku.dk
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-01-20 13:49:44 -07:00
Robert P. J. Day 68ea2d82c3 spi: Fix reversed args to time_before() in Freescale stmp driver.
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-01-20 13:49:44 -07:00
Sandeep Paulraj 358934a60d spi: Add SPI master driver for DaVinci/DA8xx
This patch adds support for a SPI master driver for the
DaVinci series of SOCs

Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Signed-off-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Philby John <pjohn@in.mvista.com>
Signed-off-by: Sudhakar Rajashekhara <sudhakar.raj@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2010-01-20 13:49:34 -07:00
Linus Torvalds bf931a01a2 Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6
* 'next-spi' of git://git.secretlab.ca/git/linux-2.6:
  spi: spi_txx9.c: use resource_size()
  spi: spi_sh_sci.c: use resource_size()
  spi: spi_mpc8xxx.c: use resource_size()
  spi: spi_bfin5xx.c: use resource_size()
  spi: atmel_spi.c: use resource_size()
  spi: Add s3c64xx SPI Controller driver
  atmel_spi: fix dma addr calculation for len > BUFFER_SIZE
  spi_s3c24xx: add FIQ pseudo-DMA support
  spi: controller driver for Designware SPI core
  spidev: add proper section markers
  spidev: use DECLARE_BITMAP instead of declaring the array
2009-12-17 15:59:05 -08:00
hartleys d53342bf96 spi: spi_txx9.c: use resource_size()
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 09:00:22 -07:00
hartleys 76b6fdd35a spi: spi_sh_sci.c: use resource_size()
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 09:00:10 -07:00
hartleys 82de76513e spi: spi_mpc8xxx.c: use resource_size()
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 09:00:02 -07:00
hartleys 74947b8982 spi: spi_bfin5xx.c: use resource_size()
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 08:59:50 -07:00
hartleys 905aa0ae91 spi: atmel_spi.c: use resource_size()
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 08:59:06 -07:00
Jassi Brar 230d42d422 spi: Add s3c64xx SPI Controller driver
Each SPI controller has exactly one CS line and as such doesn't
provide for multi-cs. We implement a workaround to support
multi-cs by _not_ configuring the mux'ed CS pin for each SPI
controller. The CS mechanism is assumed to be fully machine
specific - the driver doesn't even assume some GPIO pin is used
to control the CS.

The driver selects between DMA and POLLING mode depending upon
the xfer size - DMA mode for xfers bigger than FIFO size, POLLING
mode otherwise.

The driver has been designed to be capable of running SoCs since
s3c64xx and till date, for that reason some of the register fields
have been passed via, SoC specific, platform data.

Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 08:58:17 -07:00
Ben Nizette 6aed4ee9b4 atmel_spi: fix dma addr calculation for len > BUFFER_SIZE
If len > BUFFER_LEN and !xfer->rx_buf we end up calculating the tx buffer
address as

*tx_dma = xfer->tx_dma + xfer->len - BUFFER_SIZE;

which is constant; i.e.  we just send the last BUFFER_SIZE data over again
until we've reached the right number of bytes.

This patch gets around this by using the /requested/ length when
calculating addresses.

Note there's no way len != *plen when we calculate the rx buffer address
but conceptually we should be using *plen and I don't want someone to come
through later, see the calculations for rx and tx are different and "clean
up" back to what we had.

Signed-off-by: Ben Nizette <bn@niasdigital.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 08:57:07 -07:00
Ben Dooks bec0806cfe spi_s3c24xx: add FIQ pseudo-DMA support
Add pseudo-DMA by FIQ to the S3C24XX SPI driver.  This allows the driver
to get DMA-like performance where there are either no free DMA channels or
when doing transfers that required both TX and RX data paths.

Since this patch requires the addition of an assembly file to hold the FIQ
code, we rename the module (instead of adding a rename of the .c file to
this patch).  We expect most users are loading this via udev and thus
there should be no change to the userland configuration.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 08:57:01 -07:00
Feng Tang e24c745272 spi: controller driver for Designware SPI core
Driver for the Designware SPI core, it supports multipul interfaces like
PCI/APB etc.  User can use "dw_apb_ssi_db.pdf" from Synopsys as HW
datasheet.

[randy.dunlap@oracle.com: fix build]
[akpm@linux-foundation.org: build fix]
Signed-off-by: Feng Tang <feng.tang@intel.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 08:39:13 -07:00
Mike Frysinger db389b6143 spidev: add proper section markers
The driver already uses __devexit_p() in the structure, but looks like
actual __dev{init,exit} markings were forgotten.

The spidev_spi driver also needs renaming to include a "_driver" suffix to
avoid section mismatch warnings.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 08:39:12 -07:00
Thadeu Lima de Souza Cascardo 8ae1c92480 spidev: use DECLARE_BITMAP instead of declaring the array
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-17 08:39:12 -07:00
Alexey Dobriyan 471452104b const: constify remaining dev_pm_ops
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-15 08:53:25 -08:00
Linus Torvalds 478e4e9d7a Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6
* 'next-spi' of git://git.secretlab.ca/git/linux-2.6: (23 commits)
  spi: fix probe/remove section markings
  Add OMAP spi100k driver
  spi-imx: don't access struct device directly but use dev_get_platdata
  spi-imx: Add mx25 support
  spi-imx: use positive logic to distinguish cpu variants
  spi-imx: correct check for platform_get_irq failing
  ARM: NUC900: Add spi driver support for nuc900
  spi: SuperH MSIOF SPI Master driver V2
  spi: fix spidev compilation failure when VERBOSE is defined
  spi/au1550_spi: fix setupxfer not to override cfg with zeros
  spi/mpc8xxx: don't use __exit_p to wrap plat_mpc8xxx_spi_remove
  spi/i.MX: fix broken error handling for gpio_request
  spi/i.mx: drain MXC SPI transfer buffer when probing device
  MAINTAINERS: add SPI co-maintainer.
  spi/xilinx_spi: fix incorrect casting
  spi/mpc52xx-spi: minor cleanups
  xilinx_spi: add a platform driver using the xilinx_spi common module.
  xilinx_spi: add support for the DS570 IP.
  xilinx_spi: Switch to iomem functions and support little endian.
  xilinx_spi: Split into of driver and generic part.
  ...
2009-12-14 10:22:11 -08:00
Grant Likely 965346e3b9 spi: fix probe/remove section markings
Probe/remove functions need to be marked as __devinit and __devexit
(not __init an __exit) to prevent trying to run code that has been
discarded.  This patch fixes the spi_imx driver to mark probe and
remove correctly.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-13 01:03:12 -07:00
Cory Maccarrone 35c9049b27 Add OMAP spi100k driver
This change adds the OMAP SPI 100k driver created by
Fabrice Crohas <fcrohas@gmail.com>.  This SPI bus is found on
OMAP7xx-series smartphones, and for many, the touchscreen is
attached to this bus.

The lion's share of the work was done by Fabrice on this driver --
I am merely porting it from the Linwizard project on his behalf.

Signed-off-by: Cory Maccarrone <darkstar6262@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-13 01:02:11 -07:00
Uwe Kleine-König 980f3beeb6 spi-imx: don't access struct device directly but use dev_get_platdata
Also there is no casting needed to assign a void pointer.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-13 01:02:09 -07:00
Sascha Hauer 87f673e9ca spi-imx: Add mx25 support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-13 00:58:41 -07:00
Uwe Kleine-König f30d59c5d3 spi-imx: use positive logic to distinguish cpu variants
This is much safer when support for new variants is added.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-13 00:58:29 -07:00
Uwe Kleine-König 60f675a12c spi-imx: correct check for platform_get_irq failing
platform_get_irq returns -ENXIO if there is no entry.  So ensure
return value is greater than zero instead of non-zero.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-13 00:58:13 -07:00
Wan ZongShun 30eaed053c ARM: NUC900: Add spi driver support for nuc900
Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-13 00:58:00 -07:00
Magnus Damm 8051effcbc spi: SuperH MSIOF SPI Master driver V2
This patch is V2 of SPI Master support for the SuperH MSIOF.
Full duplex, spi mode 0-3, active high cs, 3-wire and lsb
first should all be supported, but the driver has so far
only been tested with "mmc_spi".

The MSIOF hardware comes with 32-bit FIFOs for receive and
transmit, and this driver simply breaks the SPI messages
into FIFO-sized chunks. The MSIOF hardware manages the pins
for clock, receive and transmit (sck/miso/mosi), but the chip
select pin is managed by software and must be configured as
a regular GPIO pin by the board code.

Performance wise there is still room for improvement, but
on a Ecovec board with the built-in sh7724 MSIOF0 this driver
gets Mini-sd read speeds of about half a megabyte per second.

Future work include better clock setup and merging of 8-bit
transfers into 32-bit words to reduce interrupt load and
improve throughput.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-13 00:48:27 -07:00
Linus Torvalds 09cea96caa Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (151 commits)
  powerpc: Fix usage of 64-bit instruction in 32-bit altivec code
  MAINTAINERS: Add PowerPC patterns
  powerpc/pseries: Track previous CPPR values to correctly EOI interrupts
  powerpc/pseries: Correct pseries/dlpar.c build break without CONFIG_SMP
  powerpc: Make "intspec" pointers in irq_host->xlate() const
  powerpc/8xx: DTLB Miss cleanup
  powerpc/8xx: Remove DIRTY pte handling in DTLB Error.
  powerpc/8xx: Start using dcbX instructions in various copy routines
  powerpc/8xx: Restore _PAGE_WRITETHRU
  powerpc/8xx: Add missing Guarded setting in DTLB Error.
  powerpc/8xx: Fixup DAR from buggy dcbX instructions.
  powerpc/8xx: Tag DAR with 0x00f0 to catch buggy instructions.
  powerpc/8xx: Update TLB asm so it behaves as linux mm expects.
  powerpc/8xx: Invalidate non present TLBs
  powerpc/pseries: Serialize cpu hotplug operations during deactivate Vs deallocate
  pseries/pseries: Add code to online/offline CPUs of a DLPAR node
  powerpc: stop_this_cpu: remove the cpu from the online map.
  powerpc/pseries: Add kernel based CPU DLPAR handling
  sysfs/cpu: Add probe/release files
  powerpc/pseries: Kernel DLPAR Infrastructure
  ...
2009-12-12 14:27:24 -08:00
Linus Torvalds 4ef58d4e2a Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (42 commits)
  tree-wide: fix misspelling of "definition" in comments
  reiserfs: fix misspelling of "journaled"
  doc: Fix a typo in slub.txt.
  inotify: remove superfluous return code check
  hdlc: spelling fix in find_pvc() comment
  doc: fix regulator docs cut-and-pasteism
  mtd: Fix comment in Kconfig
  doc: Fix IRQ chip docs
  tree-wide: fix assorted typos all over the place
  drivers/ata/libata-sff.c: comment spelling fixes
  fix typos/grammos in Documentation/edac.txt
  sysctl: add missing comments
  fs/debugfs/inode.c: fix comment typos
  sgivwfb: Make use of ARRAY_SIZE.
  sky2: fix sky2_link_down copy/paste comment error
  tree-wide: fix typos "couter" -> "counter"
  tree-wide: fix typos "offest" -> "offset"
  fix kerneldoc for set_irq_msi()
  spidev: fix double "of of" in comment
  comment typo fix: sybsystem -> subsystem
  ...
2009-12-09 19:43:33 -08:00
Linus Torvalds 18821b0408 Merge branch 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'bkl-drivers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  agp: Remove the BKL from agp_open
  inifiband: Remove BKL from ipath_open()
  mips: Remove BKL from tb0219
  drivers: Remove BKL from scx200_gpio
  drivers: Remove BKL from pc8736x_gpio
  parisc: Remove BKL from eisa_eeprom
  rtc: Remove BKL from efirtc
  input: Remove BKL from hp_sdc_rtc
  hw_random: Remove BKL from core
  macintosh: Remove BKL from ans-lcd
  nvram: Drop the bkl from non-generic nvram_llseek()
  nvram: Drop the bkl from nvram_llseek()
  mem_class: Drop the bkl from memory_open()
  spi: Remove BKL from spidev_open
  drivers: Remove BKL from cs5535_gpio
  drivers: Remove BKL from misc_open
2009-12-09 08:07:38 -08:00
Benjamin Herrenschmidt bcd6acd51f Merge commit 'origin/master' into next
Conflicts:
	include/linux/kvm.h
2009-12-09 17:14:38 +11:00
Benjamin Herrenschmidt 8c82da5e24 Merge commit 'gcl/next' into next 2009-12-09 17:10:22 +11:00
Florian Fainelli 41df70d9ac spi: fix spidev compilation failure when VERBOSE is defined
When VERBOSE is defined in the spidev module, the compilation
will throw an error on 'spi' not being defined:

CC [M]  drivers/spi/spidev.o
drivers/spi/spidev.c: In function 'spidev_message':
drivers/spi/spidev.c:266: error: 'spi' undeclared (first use in this function)
drivers/spi/spidev.c:266: error: (Each undeclared identifier is reported only once
drivers/spi/spidev.c:266: error: for each function it appears in.)

instead of using spi-> we should actually use spidev->spi.
This patch fixes the build failure.

Signed-off-by: Florian Fainelli <ffainelli@freebox.fr>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:17 -07:00
Jan Nikitenko 04ba24b34a spi/au1550_spi: fix setupxfer not to override cfg with zeros
fix setupxfer() not to override generic configuration of speed_hz
and bits_per_word with zeros

Signed-off-by: Jan Nikitenko <jan.nikitenko@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:16 -07:00
Uwe Kleine-König b3a0894516 spi/mpc8xxx: don't use __exit_p to wrap plat_mpc8xxx_spi_remove
The function plat_mpc8xxx_spi_remove is defined using __devexit, so don't
use __exit_p but __devexit_p to wrap it.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:16 -07:00
John Ogness bbd050af0e spi/i.MX: fix broken error handling for gpio_request
i.MX35-provided chipselects are represented using negative numbers. If
gpio_request() fails and the previous chipselect was a negative number,
the while loop is endless (i is never decremented).

Also, the error loop would never call gpio_free on chipselect[0].

And finally, the error message was missing an endline.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:16 -07:00
Daniel Mack ce1807b2e5 spi/i.mx: drain MXC SPI transfer buffer when probing device
On the MX31litekit, the bootloader seems to communicate with the MC13783
PMIC chip before booting Linux. However, it does not flush all the
buffers properly after that, which makes the imx-spi driver read
bogus data when probing the MC13783.

Fix that by draining the SPI receive buffer on startup.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:16 -07:00
Grant Likely 920712af49 spi/xilinx_spi: fix incorrect casting
This patch fixes the error exposed by the following build warning:

drivers/spi/xilinx_spi.c: In function 'xilinx_spi_init':
drivers/spi/xilinx_spi.c:411: warning: cast from pointer to integer
of different size

Fixed by change %x to %p in the format string.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:15 -07:00
Wolfram Sang 937041e216 spi/mpc52xx-spi: minor cleanups
- drop own, obsolete include-file
- drop IRQF_SAMPLE_RANDOM (deprecated feature)
- drop 'if' above kfree()
- typos, braces & whitespaces

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Luotao Fu <l.fu@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:15 -07:00
Richard Röjfors 771669349e xilinx_spi: add a platform driver using the xilinx_spi common module.
This patch adds in a platform device driver using the xilinx_spi common module.

Tested-by: John Linn <John.Linn@xilinx.com>
Signed-off-by: Richard Röjfors <richard.rojfors@mocean-labs.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:14 -07:00
Richard Röjfors c9da2e1255 xilinx_spi: add support for the DS570 IP.
This patch adds in support for the DS570 IP.

It's register compatible with the DS464, but adds support for 8/16/32 SPI.

The 8/16/32 support is added by attaching callbacks reading/writing the
proper amount of data. To indicate to the driver which amount of bits
to use a new field is introduced in the platform data struct.

Acked-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: John Linn <John.Linn@xilinx.com>
Signed-off-by: Richard Röjfors <richard.rojfors@mocean-labs.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:14 -07:00
Richard Röjfors 86fc593599 xilinx_spi: Switch to iomem functions and support little endian.
This patch changes the out_(be)(8|16|32) and in_(be)(8|16|32) calls to 32 bits ioread/iowrite.

The read and write function are attached to the internal struct as callbacks, callback
is selected depending on endianess.

This will also build on platforms not supporting the in/out calls for instance x86.

Acked-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: John Linn <John.Linn@xilinx.com>
Signed-off-by: Richard Röjfors <richard.rojfors@mocean-labs.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:14 -07:00
Richard Röjfors d5af91a1fa xilinx_spi: Split into of driver and generic part.
This patch splits the xilinx_spi driver into a generic part and a
OF driver part.

The reason for this is to later add in a platform driver as well.

Tested-by: John Linn <John.Linn@xilinx.com>
Signed-off-by: Richard Röjfors <richard.rojfors@mocean-labs.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:14 -07:00
Luotao Fu b8d4e2ce60 mpc52xx_spi: add gpio chipselect
This one enables the mpc52xx_spi driver for usage of user defined gpio lines
as chipselect. This way we can control some more spi devices than only one

V2 Changes:
* preinitialize the gpio as output in probe function and call gpio_set_value in
  the chip select function instead of calling direction_output every time.
* initialize the gpio line with output high, since we don't support CS_HIGH
  in the driver currently any way. change gpio value setting to default active
  low in chip select call.
* free the gpio array while error or removing.

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:13 -07:00
Luotao Fu d65aea99bd mpc52xx_spi: add missing mode_bits definition
V2 changes:
* remove CS_HIGH mode

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:13 -07:00
Luotao Fu 4a495b1c43 mpc52xx_spi: fix clearing status register
Before reading status register to check MODF failure, we have to clear it
first since the MODF flag will be set after initializing the spi master,
if the hardware comes up with a low SS. The processor datasheet reads:
Mode Fault flag -- bit sets if SS input goes low while SPI is configured as a
master. Flag is cleared automatically by an SPI status register read (with MODF
set) followed by a SPI control register 1 write.
Hence simply rereading the register is not sufficient to clear the flag. We
redo the write also to make sure to clear the flag.

V2 Changes:
* change variable type from int to u8

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2009-12-08 18:48:13 -07:00