9
0
Fork 0
Commit Graph

120 Commits

Author SHA1 Message Date
Hubert Feurstein 7ba9f45f6a imx_spi: fix bus-num setup
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-21 15:05:47 +01:00
Alexander Shiyan 6a256321b8 Use new device_platform_driver() macro for drivers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-13 09:23:28 +01:00
Michael Grzeschik 86024a9f70 SPI: Add i.MX 23/28 SPI driver support
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-11 20:58:34 +01:00
Jean-Christophe PLAGNIOL-VILLARD 8e92f54ad4 atmel_spi: fix spi cs gpio request loop
it's 0 to num_cs - 1

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2013-01-15 00:26:19 +08:00
Jean-Christophe PLAGNIOL-VILLARD 668dffaa0d spi: atmel: request cs pin via gpiolib
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-02 10:56:16 +01:00
Sascha Hauer 1a9e93cc81 drivers/base: fix corrupt device tree
dev_add_child is a very unsafe function. If called multiple times
it allows setting the same device to different parents thus corrupting
the siblings list. This happens regularly since:

| commit c2e568d19c
| Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| Date:   Sat Nov 3 16:11:05 2012 +0100
|
|    bus: add bus device
|
|    automatically add it as parent of any bus device if none already specified
|
|    we have now a nice output per bus

If for example a FATfs is mounted this nice output per bus often ends with:

>     `---- fat0
>     `---- 0
>          `---- 0x86f0000087020031-0x86f000410df27124: /dev/<NULL>
>          `---- sram00
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               unable to handle NULL pointer dereference at address 0x0000000c
> pc : [<87f08a20>]    lr : [<87f08a04>]
> sp : 86eff8c0  ip : 87f3fbde  fp : ffffffff
> r10: ffffffff  r9 : 00000000  r8 : 00000003
> r7 : 86f075b8  r6 : 00000002  r5 : ffffffec  r4 : 86f07544
> r3 : 00000000  r2 : 43f900b4  r1 : 00000020  r0 : 00000005
> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
> [<87f08a20>] (do_devinfo_subtree+0x90/0x130) from [<87f08a90>] (do_devinfo_subtree+0x100/0x130)
>
> [<87f3e070>] (unwind_backtrace+0x0/0x90) from [<87f28514>] (panic+0x28/0x3c)
> [<87f28514>] (panic+0x28/0x3c) from [<87f3e4b8>] (do_exception+0x10/0x14)
> [<87f3e4b8>] (do_exception+0x10/0x14) from [<87f3e544>] (do_data_abort+0x2c/0x38)
> [<87f3e544>] (do_data_abort+0x2c/0x38) from [<87f3e268>] (data_abort+0x48/0x60)

This patch fixes this by adding a device to its parents children list in
register_device so that dev_add_child is no longer needed. This function
is removed from the tree. Now callers of register_device have to clearly
set the parent *before* registering a device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Jan Lübbe <jlu@pengutronix.de>
2012-12-12 15:04:27 +01:00
Alexander Shiyan 4c20f9af97 Cleanup Kconfig files
This patch provides a global cleanup barebox Kconfig files. This includes
replacing spaces to tabs, formatting in accordance format, removing
extraneous lines and spaces. No functional changes.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-08 12:22:12 +01:00
Sascha Hauer 0bf6b41cfa Merge branch 'for-next/spi' 2012-11-16 14:02:49 +01:00
Jan Luebbe 630c4ecc5e omap3_spi: fix bus numbers according to omap3_add_spi[1-4]
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-12 09:38:06 +01:00
Jean-Christophe PLAGNIOL-VILLARD 45e9e0b1dc atmel_spi: add cs change support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-12 08:36:23 +01:00
Jean-Christophe PLAGNIOL-VILLARD bac41512cf atmel_spi: drop setup during transfer
this need to be handle at framework and driver level

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-12 08:36:23 +01:00
Jean-Christophe PLAGNIOL-VILLARD ccff91ae48 atmel_spi: fix cs support
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-12 08:36:23 +01:00
Jean-Christophe PLAGNIOL-VILLARD 1913518a46 atmel_spi: add sanity check in setup
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-12 08:36:23 +01:00
Jean-Christophe PLAGNIOL-VILLARD e55e5cd0fd atmel_spi: after setup the cs need to be disable
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-12 08:36:23 +01:00
Jean-Christophe PLAGNIOL-VILLARD b93dfd23c2 atmel_spi: split transfer to atmel_spi_do_xfer
This makes the code mre readable

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-12 08:35:18 +01:00
Jean-Christophe PLAGNIOL-VILLARD d43b73ba83 atmel_spi: use device id as bus num
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-12 08:35:15 +01:00
Jean-Christophe PLAGNIOL-VILLARD 968d444cdd spi: introduce spi_get_master
so we can request a master usefull for the spi command

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-12 08:32:16 +01:00
Jean-Christophe PLAGNIOL-VILLARD 19bd0bc9db spi: move the depends on SPI to if SPI and keep config alphanum ordered
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-30 10:24:12 +01:00
Sascha Hauer 94de405d8f Merge branch 'for-next/imx-clk' 2012-10-04 15:24:57 +02:00
Sascha Hauer d4edd480b2 ARM i.MX: Remove old clock support
The old clock support is now unused. Remove it. The former i.MX clko
command is superseeded by generic clock manipulation commands.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-04 15:19:57 +02:00
Sascha Hauer 2155161eca spi i.MX: Switch to clk support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-04 15:19:56 +02:00
Jean-Christophe PLAGNIOL-VILLARD 3c5327e660 switch all platform_bus device/driver registering to platform_driver/device_register
now register_driver and register_device are for bus only usage.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-04 15:19:12 +02:00
Sascha Hauer 0ed19adde8 Merge branch 'for-next/spi' 2012-10-03 21:13:05 +02:00
Sascha Hauer d1e65d2a7b Merge branch 'for-next/remove-fsf-address'
Conflicts:
	drivers/net/miidev.c
	include/miidev.h
2012-10-03 21:12:48 +02:00
Jan Luebbe 0f77ca3c49 spi: switch from printf back to debug
Commit 5888a3b5c9 accidentally changed
this to printf.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-27 07:17:52 +02:00
Jean-Christophe PLAGNIOL-VILLARD 72b0a6503f driver: register bus
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-23 21:15:13 +02:00
Sascha Hauer 86dcc1754e spi imx: dt support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-23 21:15:12 +02:00
Sascha Hauer 77322aa896 Treewide: remove address of the Free Software Foundation
The FSF address has changed in the past. Instead of updating it
each time the address changes, just drop it completely treewide.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-17 10:57:41 +02:00
Sascha Hauer 5888a3b5c9 spi: add oftree support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-14 13:35:47 +02:00
Sascha Hauer 617bfbcbeb SPI: Put SPI devices on their own bus
This patch adds a SPI bus on which the SPI devices and drivers register.
This makes it cleaner as SPI devices won't accidently end up probed by
a platform_device driver.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-09-14 11:47:24 +02:00
Jan Luebbe e95b2673ef drivers/spi: add driver for the Multichannel SPI controller found in TI SoCs
Also create devices for OMAP3.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-09-06 19:35:03 +02:00
Eric Bénard ae22e4f2f9 i.MX35: add cspi1 support
tested with a m25p128 flash both in nand boot & spi boot.

Signed-off-by: Eric Bénard <eric@eukrea.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-08-29 09:00:22 +02:00
Sascha Hauer 5f78112920 SPI i.MX: Add support for i.MX6
The i.MX5 does not have a valid function to get the spi clock. This
patch introduces a function for i.MX6, and moves the bogus spi clock
speed to the speed-imx5*.c. Not nice, but preserves the current status
quo for i.MX5

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-07-31 19:59:50 +02:00
Alexander Shiyan 385c54648b i.MX SPI: Setup SPI chipselect to inactive state while initializing device
To avoid unnecessary preset initial state chipselect lines for SPI, set it to
inactive state when adding devices to the system.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-16 19:20:33 +02:00
Jan Luebbe 7b5817e58d drivers/spi/spi.c: use DEVICE_ID_DYNAMIC when allocating a struct device_d
This causes allocation of a free id and avoids conflicts if multiple
identical SPI devices are attached.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-05-14 19:47:13 +02:00
Sascha Hauer e0f4fb2c98 Merge branch 'master' into next
Conflicts:
	drivers/ata/disk_drive.c

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-29 20:45:23 +01:00
Michael Grzeschik 5da11da840 atmel_spi: add mesg->actual_length, so devices can use it for read/write
Without this i.e. the m25p driver is not working properly.

Its used to calculate the return value of the read/write function of
some devices. If the value is missing, barebox would always
miscalculate the next transfer sizes.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-25 12:41:18 +01:00
Franck Jullien 146bea9b9b spi/altera_spi: Add cs_change support
The Linux kernel says (spi.h) :

* All SPI transfers start with the relevant chipselect active.  Normally
* it stays selected until after the last transfer in a message.  Drivers
* can affect the chipselect signal using cs_change.
*
* (i) If the transfer isn't the last one in the message, this flag is
* used to make the chipselect briefly go inactive in the middle of the
* message.  Toggling chipselect in this way may be needed to terminate
* a chip command, letting a single spi_message perform all of group of
* chip transactions together.
*
* (ii) When the transfer is the last one in the message, the chip may
* stay selected until the next transfer.  On multi-device SPI busses
* with nothing blocking messages going to other devices, this is just
* a performance hint; starting a message to another device deselects
* this one.  But in other cases, this can be used to ensure correctness.
* Some devices need protocol transactions to be built from a series of
* spi_message submissions, where the content of one message is
* determined by the results of previous messages and where the whole
* transaction
* ends when the chipselect goes intactive.

In other words, cs_change changes the default chipselect *behavior*.

Support of cs_change is necessary to implement the mci spi driver.

This patch also fix few things:

Passing the bus number to the brand new master device.
Disable chipselect during master->setup.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-25 12:38:34 +01:00
Paul Fertser 686bd976a6 spi: enfore default bits_per_word value
Documentation says it should default to 8 when not specified
explicitly by the device data.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-29 12:27:32 +02:00
Paul Fertser 67f2dcc0d7 spi: let master a chance to setup device before registering it
Call setup() before registering the device because registering leads
to a probe routine of the slave device and that requires an
initialised master.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-29 12:27:32 +02:00
Sascha Hauer 3ee7877a48 introduce io.h
To allow for some generic io accessors introduce io.h and use
this instead of asm/io.h throughout the tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-22 19:03:05 +02:00
Paul Fertser 8c1f388d88 imx25: imx_spi: support CSPI v0.7 as found on i.MX25
Based on the Linux driver. Tested with m25p80 with CS in GPIO mode.

Clock setting support is ad-hoc as the corresponding mach is not using
the generic clock infrastructure.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-21 09:43:44 +02:00
Hubert Feurstein bea738f7ba spi: add atmel-spi driver
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-14 10:40:17 +02:00
Paul Fertser 19284441cc imx_spi: rework transfer according to the API, fix compatibility with spi_write_then_read()
This code was tested barely with m25p80 driver, reading jedec id and some data
from the chip worked fine.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-09-12 12:19:40 +02:00
Franck Jullien d7bb45559c nios2: Add Altera SPI master driver
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-24 18:44:25 +02:00
Sascha Hauer c574a0d1f1 spi: make the spi devices children of the parent bus
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-17 09:36:35 +02:00
Marc Kleine-Budde 9eaaf1b1ca ARM: add support for the i.MX53
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-29 12:10:38 +02:00
Sascha Hauer 294894c975 spi i.MX: convert to struct resource
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-19 00:12:52 +08:00
Franck Jullien 07b2cff207 spi: unregister dev if master->setup fails
If the device setup executed by the spi master fails,
unregister the created device.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-06 10:25:39 +02:00
Franck Jullien 4c35079c1c spi: add bits_per_word to proxy structure
During the creation of a new spi device, we need to
have the possiblility to give the bits_per_word value
to master->setup.

As a matter of fact, spi master could check the spi
device bits_per_word and compare this value against its
capabilities.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-06 10:25:39 +02:00
Hubert Feurstein c0b9629867 spi: add more spi transfer functions
This commit adds the following spi transfer functions:
  - spi_write
  - spi_read
  - spi_write_then_read
  - spi_w8r8

The code has been ported from the linux kernel.

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-21 13:56:49 +02:00
Hubert Feurstein 76f46b5619 spi: add platform_data pointer to spi_board_info
In the spi layer this pointer will be assigned to the
platform_data pointer of the new spi device, thus it can
be accessed in the drivers 'probe' handler.

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-21 13:56:49 +02:00
Juergen Beisert f9a11ecfef Make DIV_ROUND_UP macro globally available
Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-12-14 15:15:06 +01:00
Sascha Hauer 2ebb440e1d Move mfd drivers to drivers/mfd
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-11 13:22:13 +02:00
Sascha Hauer 8f14d065e1 spi i.MX: Add i.MX51 support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-11 13:22:13 +02:00
Sascha Hauer a104d0eaa3 spi i.MX: redirect functions to version specific functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-11 13:22:13 +02:00
Sascha Hauer 3e2efa148e spi i.MX: add spi version namespace to register defines
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-11 13:22:12 +02:00
Marc Kleine-Budde 7ee5aa3329 spi: dev->id is an int, not a string, fix debug output
Also convert __FUNCTION__ -> __func__

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
2009-11-24 10:01:07 +01:00
Jean-Christophe PLAGNIOL-VILLARD f6a579da9c [ARM] Move include/asm-arm/arch-* to arch/arm/*/include/mach
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2009-10-22 14:21:25 +02:00
Sascha Hauer a03a8de461 mc13783: fix spi mode, remove now unneeded double read
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-02 15:34:55 +02:00
Sascha Hauer 5931e20907 imx spi: Use gpio as chip selects
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-10-02 15:34:25 +02:00
Sascha Hauer 56139274fd spi: remove bogus setup of proxy device
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-07-21 16:41:46 +02:00
Sascha Hauer b7a9f4e6ce mc13783 cdev
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-07-21 16:41:45 +02:00
Sascha Hauer a2b7cd183b introduce cdev
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-07-21 16:41:44 +02:00
Sascha Hauer 1ecc871b3a imx_spi: make locally used function static
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2009-05-13 15:59:29 +02:00
Sascha Hauer 41f4253b6c mc13783: Add lseek
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-12-09 11:24:47 +01:00
Sascha Hauer 6497c22742 mc13783 pmic: add open/close functions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2008-09-02 16:23:54 +02:00
Menon, Nishanth b9655280e2 This is Kconfig cleanup patch (not all configurations will use CFI, SPI, RAMFS and DEVFS).
* Enable CFI and SPI drivers menuconfig option to be able to disable them in menuconfig.
* Introduce capability to disable ramfs and devfs.
2008-05-12 15:59:48 +02:00
Sascha Hauer a14a5c02f0 first (partly) running spi support 2008-03-14 12:59:55 +01:00
Sascha Hauer 906eea397a beginning of SPI support 2008-03-11 22:13:06 +01:00