SPI: MIPS: lantiq: add FALCON spi driver
PATCH v3 16/17 SPI: MIPS: lantiq: add FALCON spi driver
From: Thomas Langer <[email protected]>
The external bus unit (EBU) found on the FALCON SoC has spi emulation that is designed for serial flash access. This driver has only been tested with m25p80 type chips. The hardware has no support for other types of spi peripherals.
---
This patch was previously Acked in V2 by Grant
http://www.mail-archive.com/spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org/msg07874.html
Changes in V3
* rephrase spi->SPI
* fix rate detection
* adds support for transfer_one & co
* adds of support
* set Thomas as Author
Changes in V2
* remove several superflous calls to dev_dbg
* make use of module_platform_driver
* remove falcon_spi_cleanup as it was an empty function
* return real error codes instead of -1
* fixes operator spacing errors
* split arch and driver specific patches
* squash some lines to make use of the full 80 available chars
* Kconfig is now alphabetic again
* replace BUG() with WARN_ON()
drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-falcon.c | 474 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 484 insertions(+), 0 deletions(-) create mode 100644 drivers/spi/spi-falcon.c
drivers/spi/Kconfig +9 -0
@@ -144,6 +144,15 @@ config SPI_EP93XX This enables using the Cirrus EP93xx SPI controller in master mode. +config SPI_FALCON + tristate "Falcon SPI controller support" + depends on SOC_FALCON + help + The external bus unit (EBU) found on the FALC-ON SoC has SPI + emulation that is designed for serial flash access. This driver + has only been tested with m25p80 type chips. The hardware has no + support for other types of SPI peripherals. + config SPI_GPIO tristate "GPIO-based bitbanging SPI Master" depends on GENERIC_GPIO
drivers/spi/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_SPI_DW_MMIO) += spi-dw-mmio.o obj-$(CONFIG_SPI_DW_PCI) += spi-dw-midpci.o spi-dw-midpci-objs := spi-dw-pci.o spi-dw-mid.o obj-$(CONFIG_SPI_EP93XX) += spi-ep93xx.o +obj-$(CONFIG_SPI_FALCON) += spi-falcon.o obj-$(CONFIG_SPI_FSL_LIB) += spi-fsl-lib.o obj-$(CONFIG_SPI_FSL_ESPI) += spi-fsl-espi.o obj-$(CONFIG_SPI_FSL_SPI) += spi-fsl-spi.o
drivers/spi/spi-falcon.c new file +474 -0
474 lines not on this page · raw message
Signature · 9 lines
1.7.9.1 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Quoted 6 lines · John Crispin
From: Thomas Langer <[email protected]>
The external bus unit (EBU) found on the FALCON SoC has spi emulation that is designed for serial flash access. This driver has only been tested with m25p80 type chips. The hardware has no support for other types of spi peripherals.
Quoted 6 lines
Signed-off-by Thomas Langer <[email protected]>Signed-off-by John Crispin <[email protected]>Cc spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org---
This patch was previously Acked in V2 by Grant
http://www.mail-archive.com/spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org/msg07874.html
Which mostly stands except for (something I didn't notice before)....
Quoted 21 lines
drivers/spi/spi-falcon.c new file +21
-0+static int __devinit falcon_sflash_probe (struct platform_device *pdev) +{ +struct falcon_sflash *priv; +const __be32 *prop; +struct spi_master *master; +int ret, len; + +if (ltq_boot_select () !=BS_SPI ) { +dev_err (&pdev->dev,"invalid bootstrap options\n" ); +return -ENODEV ; + } + + master =spi_alloc_master (&pdev->dev,sizeof (*priv)); +if (!master) +return -ENOMEM ; + + priv =spi_master_get_devdata (master); + priv->master = master; + + master->mode_bits =SPI_MODE_3 ; + master->num_chipselect =1 ;
drivers/spi/spi-falcon.c line 436
Quoted 10 lines
drivers/spi/spi-falcon.c new file +10
-0+ master->bus_num =-1 ; + master->setup = falcon_sflash_setup; + master->prepare_transfer_hardware = falcon_sflash_prepare_xfer; + master->transfer_one_message = falcon_sflash_xfer_one; + master->unprepare_transfer_hardware = falcon_sflash_unprepare_xfer; + master->dev.of_node = pdev->dev.of_node; + + prop =of_get_property (pdev->dev.of_node,"busnum" , &len); +if (prop && (len ==sizeof (*prop))) + master->bus_num =be32_to_cpup (prop);
Drop this bit. spi bus numbers are dynamically assigned for DT usage. Using a property to override the bus number should not be done.
Userspace can determine the bus number for a given device from sysfs.
If you still **really** need a bus to have a specific number, then the correct way of handling it is to use a property in the /aliases node, and there is some infrastructure in drivers/of/base.c. Look for of_alias_get_id().
g.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/