Skip to contentSkip to conversation

SPI: MIPS: lantiq: add FALCON spi driver

PATCH In review John Crispin 3 participants 6 messages May 20, 2012 – May 30, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v5 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.

Cc spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org

---
This patch is part of a series moving the mips/lantiq target to OF and clkdev support. The patch, once Acked, should go upstream via Ralf's MIPS tree.

Changes in V5
* drop duplicate busnum assignment

Changes in V4
* drop busnum property

Changes in V3
* rephrase spi->SPI
* fix rate detection
* adds support for transfer_one & co
* adds of support

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 |  469 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 479 insertions(+), 0 deletions(-)
 create mode 100644 drivers/spi/spi-falcon.c
drivers/spi/Kconfig +9 -0
index 00c0240..62b2b5e 100644
@@ -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
index 9d75d21..b5cbab2 100644
@@ -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 +469 -0

469 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/
#1 lore raw
Quoted 48 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.

Cc spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org

---
This patch is part of a series moving the mips/lantiq target to OF and clkdev support. The patch, once Acked, should go upstream via Ralf's MIPS tree.

Changes in V5
* drop duplicate busnum assignment

Changes in V4
* drop busnum property

Changes in V3
* rephrase spi->SPI
* fix rate detection
* adds support for transfer_one & co
* adds of support

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 |  469 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 479 insertions(+), 0 deletions(-)
 create mode 100644 drivers/spi/spi-falcon.c
drivers/spi/Kconfig +0 -0
index 00c0240..62b2b5e 100644
@@ -144,6 +144,15 @@ config SPI_EP93XX
 	  This enables using the Cirrus EP93xx SPI controller in master

drivers/spi/Kconfig config SPI_EP93XX · line 154

Quoted 10 lines
drivers/spi/Kconfig +8 -0
 	  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.

What exactly does this mean? How does it not support any other type of SPI peripheral? SPI is a really simple protocol, so what is it about this hardware that prevents it being used with other SPI hardware?

I see a big state machine that appears to interpret the messages and pretend to be an SPI slave instead of telling linux about the real device. /me wonders if it should this instead be a block device driver?

drivers/spi/Kconfig config SPI_EP93XX

Quoted 9 lines
drivers/spi/Kconfig +9 -0
+static int falcon_sflash_prepare_xfer(struct spi_master *master)
+{
+	return 0;
+}
+
+static int falcon_sflash_unprepare_xfer(struct spi_master *master)
+{
+	return 0;
+}

Don't use empty hooks. Just leave them uninitialized. The core will do the right thing.

------------------------------------------------------------------------------
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/

#2 lore raw
Quoted 11 lines

What exactly does this mean? How does it not support any other type of SPI peripheral? SPI is a really simple protocol, so what is it about this hardware that prevents it being used with other SPI hardware?

I see a big state machine that appears to interpret the messages and pretend to be an SPI slave instead of telling linux about the real device. /me wonders if it should this instead be a block device driver?

Thomas will need to comment on this part

Quoted 12 lines

drivers/spi/spi-falcon.c line 368

Quoted 9 lines
drivers/spi/spi-falcon.c new file +9 -0
+static int falcon_sflash_prepare_xfer(struct spi_master *master)
+{
+	return 0;
+}
+
+static int falcon_sflash_unprepare_xfer(struct spi_master *master)
+{
+	return 0;
+}

Don't use empty hooks. Just leave them uninitialized. The core will do the right thing.

I was under the impression that the need for these 2 callbacks was removed in 3.5. As this patch flows via MIPS there would be a merge order problem making the kernel non bisectable

I am a bit confused. You keep ack'ing this driver and then commenting on it a few weeks later.... obsoleting the ACK ...

------------------------------------------------------------------------------
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/

#3 lore raw

Hello Grant, hello John,

John Crispin wrote on 2012-05-26:

Quoted 6 lines
Quoted 6 lines

What exactly does this mean? How does it not support any other type of SPI peripheral? SPI is a really simple protocol, so what is it about this hardware that prevents it being used with other SPI hardware?

Quoted 7 lines
Quoted 5 lines

I see a big state machine that appears to interpret the messages and pretend to be an SPI slave instead of telling linux about the real device. /me wonders if it should this instead be a block device driver?

Thomas will need to comment on this part

The hardware is an "EBU" (External Bus Unit) for different type of memories and flashes (NOR, NAND and serial).
One of the features of this EBU is the "execute in place" for serial flashes. This shows that there is some logic in the hardware for automatic reading, all other actions must be done using a specific cmd register.

Even if there are some restrictions from the hardware state machine, the goal was to use the standard driver for serial flash devices (m25p80). Otherwise, with a dedicated block device driver, we would have to duplicate much of this code and had to maintain an own list of supported flash chips.

I hope this reason is good enough for getting this driver accepted.

Best Regards,
Thomas

------------------------------------------------------------------------------
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/

#5 lore raw
In reply to John Crispin
Quoted 27 lines · John Crispin
Quoted 11 lines

What exactly does this mean? How does it not support any other type of SPI peripheral? SPI is a really simple protocol, so what is it about this hardware that prevents it being used with other SPI hardware?

I see a big state machine that appears to interpret the messages and pretend to be an SPI slave instead of telling linux about the real device. /me wonders if it should this instead be a block device driver?

Thomas will need to comment on this part

Quoted 12 lines

drivers/spi/spi-falcon.c line 368

Quoted 9 lines
drivers/spi/spi-falcon.c new file +9 -0
+static int falcon_sflash_prepare_xfer(struct spi_master *master)
+{
+	return 0;
+}
+
+static int falcon_sflash_unprepare_xfer(struct spi_master *master)
+{
+	return 0;
+}

Don't use empty hooks. Just leave them uninitialized. The core will do the right thing.

Quoted 6 lines

I was under the impression that the need for these 2 callbacks was removed in 3.5. As this patch flows via MIPS there would be a merge order problem making the kernel non bisectable

I am a bit confused. You keep ack'ing this driver and then commenting on it a few weeks later.... obsoleting the ACK ...

Hahah. I receive a *lot* of email. I can't remember what I reviewed yesterday, let alone last week. If I ack something, then add my ack when you repost. Otherwise I don't have any clues as to what I've said in the past.

Also, I reserve the right to review all new versions of patches; that doesn't invalidate the ack, but Ralf can decide whether to pick it up and ask for follow-up changes, or to ask for another respin.

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/

#4 lore raw
In reply to Langer Thomas (LQDE CPE AE SW)
Quoted 22 lines · Langer Thomas (LQDE CPE AE SW)

Hello Grant, hello John,

John Crispin wrote on 2012-05-26:

Quoted 6 lines
Quoted 6 lines

What exactly does this mean? How does it not support any other type of SPI peripheral? SPI is a really simple protocol, so what is it about this hardware that prevents it being used with other SPI hardware?

Quoted 7 lines
Quoted 5 lines

I see a big state machine that appears to interpret the messages and pretend to be an SPI slave instead of telling linux about the real device. /me wonders if it should this instead be a block device driver?

Thomas will need to comment on this part

The hardware is an "EBU" (External Bus Unit) for different type of memories and flashes (NOR, NAND and serial).
One of the features of this EBU is the "execute in place" for serial flashes. This shows that there is some logic in the hardware for automatic reading, all other actions must be done using a specific cmd register.

Quoted 6 lines

Even if there are some restrictions from the hardware state machine, the goal was to use the standard driver for serial flash devices (m25p80). Otherwise, with a dedicated block device driver, we would have to duplicate much of this code and had to maintain an own list of supported flash chips.

I hope this reason is good enough for getting this driver accepted.

To be clear, I'm not going to nack the driver over this issue; but it bothers me that I cannot understand what it is doing and I do wonder if there is a better approach.

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/

_______________________________________________
spi-devel-general mailing list spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/spi-devel-general