summaryrefslogtreecommitdiffstats
path: root/drivers/spi
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/mvebu'Sascha Hauer2017-01-111-31/+56
|\
| * spi: mvebu: improve error reportingUwe Kleine-König2017-01-101-3/+11
| | | | | | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: mvebu: add LSB supportUwe Kleine-König2017-01-101-4/+24
| | | | | | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: mvebu: use wait_on_timeout instead of a loop with udelay.Uwe Kleine-König2017-01-101-7/+5
| | | | | | | | | | | | | | | | This looks nicer and reduces the time to transfer 40 MB at 50 MHz from 203 seconds to 87 seconds. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: mvebu: only read from bus when data is neededUwe Kleine-König2017-01-101-5/+5
| | | | | | | | | | | | | | | | This optimization reduced the time to transfer 40 MB at 50 MHz from 214 seconds to 203 seconds. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: mvebu: various non-critical improvements to armada_370_xp_spi_set_baudrateUwe Kleine-König2017-01-101-4/+3
| | | | | | | | | | | | | | | | | | - Initialize pdiv in declaration - fix format specifiers - simplify range check, pdiv can never be > 7 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: mvebu: make sure the value calculated for PSCL is also usedUwe Kleine-König2017-01-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | The function used a separate variable to hold the value calculated and only used it for range checking but then didn't use it. This fixes calculation for slow baud rate that require a divider > 15. Additionally fix the rounding. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: mvebu: fix register macros for Armada 370/XP clock dividerUwe Kleine-König2017-01-101-2/+2
| | | | | | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: mvebu: fix error handling for transfer problemsUwe Kleine-König2017-01-101-4/+4
| | | | | | | | | | | | | | | | | | When a message transfer fails no further messages are transferred, but the error value was not propagated to the caller. Fixes: 5db1a578d6ed ("spi: add Marvell MVEBU SoC SPI driver") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | spi: i.MX: reset controller on initSascha Hauer2017-01-101-0/+8
|/ | | | | | | | | | | | In rare cases the controller is does not work right after probe. When this happens the registers show that the TXFIFO contains words, but the transfer is never started. We observed that on some boards which boot from SPI NOR. The xload SPI code leaves the controller enabled, so the SPI controller is enabled during probe(). Disabling it before usage (and thus resetting it) helps. We haven't found out why exactly this happens. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: mvebu: fix baudrate selection for Armada 370/XPUwe Kleine-König2016-12-071-3/+5
| | | | | | | | | | | | | | | | | | There are two problems that made the driver choose the wrong baudrate calculation algorithm: a) The compatible used on 370/XP isn't marvell,armada-370-xp-spi but marvell,armada-370-spi or marvell,armada-xp-spi respectively. b) The probe function uses match = of_match_node(mvebu_spi_dt_ids, dev->device_node); to determine the right algorithm. As the devices are also compatible to marvell,orion-spi and this comes first in mvebu_spi_dt_ids[] it's always the older Orion algorithm that is used. This patch fixes both problems. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: mvebu: make more than one device on a bus workUwe Kleine-König2016-10-191-1/+1
| | | | | | | The mvebu socs support up to 8 chip selects. Make use of them. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX drivers: enable i.MX50 where already supportedAlexander Kurz2016-09-121-2/+2
| | | | | | | | The i.MX50 SOC includes one ESDHCv3, three ESDHCv2, one cspi and two ecspi instances which are supported by existing drivers. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM i.MX31: add SPI supportAlexander Kurz2016-08-032-4/+13
| | | | | | | | | | | | | | | | | The i.MX31 SPI interface was refered by freescale as spi_ver_0_4 in one of their older vendor extended linux releases. spi_ver_0_4 differs only in minor aspects to spi_ver_0_7 (i.MX35) which is already supported by barebox. Regarding barebox, the differences boil down to the location and length of the CHIP SELECT and BIT COUNT/BURST LENGTH elements of CONREG. The spi_ver_0_4 variant is limited to single word bursts with a maximum of 32 bits_per_word. Add support for the i.MX31 SPI interface to the barebox spi_ver_0_7 implementation. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: imx: Remove the use of property "fsl, spi-num-chipselects"Alexander Shiyan2016-06-271-12/+5
| | | | | | | | The "fsl,spi-num-chipselects" property will be marked obsolete soon. This patch updates the driver to be ready to such changes. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* MIPS: ath79: dts: sync spi stuff with linux v4.7-rc2Antony Pavlov2016-06-141-1/+1
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-05-091-1/+1
|\
| * whole tree: remove trailing whitespacesDu Huanpeng2016-04-211-1/+1
| | | | | | | | | | Signed-off-by: Du Huanpeng <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-1/+1
|/ | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-077-13/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: i.MX: optimize transfers for ECSPI v2.3Sascha Hauer2015-11-301-1/+72
| | | | | | | | | | | | | | Instead of writing one word to the txfifo and then wait until one is received in the rxfifo we can write while the txfifos are not full and read as long the rxfifos contain data. This makes transfers for the m25p80 driver around 7 times faster here. Unlike the last version this time we only optimize the common case with 8 bits per word and SPI_LSB_FIRST cleared. The other cases would require more bit shuffling of the data. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "spi: i.MX: optimize transfers for ECSPI v2.3"Sascha Hauer2015-10-051-72/+1
| | | | | | | This does not work on the Efika MX Smartbook which uses SPI to connect the MC13892. Needs some rework. This reverts commit 746a5530bee37c8d2ffc75609447641b3f3cb55b.
* spi: i.MX: optimize transfers for ECSPI v2.3Sascha Hauer2015-08-311-1/+72
| | | | | | | | | | Instead of writing one word to the txfifo and then wait until one is received in the rxfifo we can write until the txfifos are not full and read as long the rxfifos contain data. This makes transfers for the m25p80 driver around 7 times faster here. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: i.MX: create SoC specific transfer functionsSascha Hauer2015-08-311-14/+31
| | | | | | | There are SoC specific ways to optimize transfers. Make the way free to implement these by creating SoC specific transfer functions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: i.MX: use start mode control bitSascha Hauer2015-08-311-6/+2
| | | | | | | | The i.MX SPI controller in version 2.3 can immediately start a transfer when the txfifo is written to. In this mode we no longer have to trigger the transfer with the xch bit which makes the code a bit simpler. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2015-08-061-1/+1
|\
| * spi: only register enabled child nodesJan Luebbe2015-07-091-1/+1
| | | | | | | | | | Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | spi: i.MX: move register defines to include/Sascha Hauer2015-07-161-79/+1
|/ | | | | | | The register defines will be used by the SPI xload code, so move them to a place where the xload code can include them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Abolish cpu_read* and cpu_write* accessorsMasahiro Yamada2015-05-201-2/+2
| | | | | | | | | | | | | | Commit 2e6a88f2101d (add cpu native ordered io accessors) introduced these macros and then commit be57f20cdd7d (Fix big endian MMIO primitives) figured out they are equivalent to __raw_{read,write}*. They turned out unnecessary after all. Anyway, most source files use __raw_read* and __raw_write*. Let's replace a few remaining references and abolish them. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/of-device-id'Sascha Hauer2015-05-063-10/+10
|\
| * of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-303-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mvebu'Sascha Hauer2015-05-065-2/+247
|\ \
| * | spi: Add SPI GPIO bitbang driverSebastian Hesselbarth2015-04-273-0/+245
| | | | | | | | | | | | | | | | | | | | | This adds a driver for SPI master by GPIO pins. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | spi: ath79: move spidelay from spi-bitbang-txrxSebastian Hesselbarth2015-04-272-2/+2
| |/ | | | | | | | | | | | | | | | | Bitbang helpers for SPI require spidelay. This should be set by the user and not the helper itself. Move it to ath79_spi instead. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / spi: i.MX: Respect the value of 'cs_change'Andrey Smirnov2015-04-141-1/+19
|/ | | | | | | | Add the code to correctly handle 'cs_change' field in 'struct spi_transfer'(base on the similar code from altera_spi.c) Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: Call remove function only when availableSascha Hauer2015-03-171-1/+2
| | | | | | | | The bus implementations currently call the drivers remove hook unconditionally, but this hook is seldomly populated. Only call it when it's actually populated. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: move DMA alloc functions to dma.hLucas Stach2015-03-061-1/+0
| | | | | | | | | | This better separates the DMA from the MMU functionality. Also move all drivers that only depends on asm/mmu.h for the alloc functions over to the common header. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX: SPI: Respect SPI_LSB_FIRST flag in mode settingsAndrey Smirnov2015-01-161-4/+37
| | | | | | | | | | Add code to support SPI transfers that have data shifted out least significant bit first. This is useful in many cases, but specifically it is needed for drivers/firmware/altera_serial.c to work on i.MX platform. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: remove unnecessary mach/imx-regs.h includeSascha Hauer2015-01-051-1/+0
| | | | | | And replace the ones needed with the SoC specific header. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* spi: mxs-spi: Allow compilation on i.MX28 onlySascha Hauer2014-11-281-1/+1
| | | | | | | The driver does not compile on i.MX23, so remove the i.MX23 from the dependency list. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-163-2/+8
| | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: remove address of the Free Software FoundationAntony Pavlov2014-06-112-9/+0
| | | | | | | | | | | | | | | | | | The FSF address has changed; The FSF site says that address is Free Software Foundation 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA (see http://www.fsf.org/about/contact/) Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/omap'Sascha Hauer2014-06-042-2/+23
|\ | | | | | | | | | | Conflicts: arch/arm/configs/am335x_beaglebone_defconfig arch/arm/configs/am335x_defconfig
| * spi: omap: support swapping D0/D1Jan Luebbe2014-05-152-2/+23
| | | | | | | | | | | | | | The OMAP SPI core allows swapping MISO/MOSI and some boards are wired up that way, so add a property to swap the lines. Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
* | spi: i.MX: Move to coredevice_initcallSascha Hauer2014-05-191-1/+1
|/ | | | | | | SPI is often used by other devices, so make sure it's initialized early. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2014-05-052-4/+4
|\
| * SPI: i.MX: Remove redundant assignmentAlexander Shiyan2014-04-291-1/+1
| | | | | | | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * spi: altera_spi: fix altera_spi_setup() return error codesAntony Pavlov2014-04-231-3/+3
| | | | | | | | | | | | Reported-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mips'Sascha Hauer2014-05-054-0/+399
|\ \ | | | | | | | | | | | | Conflicts: arch/mips/boards/loongson-ls1b/serial.c
| * | spi: add controller driver for Atheros AR7XXX/AR9XXX SoCsAntony Pavlov2014-04-073-0/+304
| | | | | | | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>