SPI support for Sodaville
Subsystems (7)
The SPI core inside Sodaville is very much the same as in PXA25x. I Cc the ARM folks because patch 4 reorganizes some files so that they can be accessed from x86 so you see the whole picture. Yes, Sodaville is a x86 SoC :)
The SPI device is behind a PCI bus. The PCI probe code simply creates a platform device so we don't have much changes to the platform driver. I tried to avoid as much ifdefs as possible. There is no clock framework on x86 and the peripherals don't support changing their clocks or to enable/disable them. So I provided dummy function which keep the driver happy.
The patch series has been created with the -M option so file moves can be easily noticed. The whole series is also available at
git://git.linutronix.de/users/bigeasy/soda.git spi
Sebastian Andrzej Siewior (9):
spi/pxa2xx: don't use subys initcall for driver init spi/pxa2xx: add support for shared IRQ handler
spi/pxa2xx: Use define for SSSR_TFL_MASK instead of plain numbers arm/pxa2xx: reorgazine SSP and SPI header files
spi/pxa2xx: Add CE4100 support
spi/pxa2xx: Consider CE4100's FIFO depth
spi/pxa2xx: Add chipselect support for Sodaville
spi/pxa2xx: Modify RX-Tresh instead of busy-loop for the remaining RX bytes. spi/pxa2xx: pass of_node to spi device and set a parent device
Documentation/spi/pxa2xx | 4 +-
arch/arm/include/asm/pxa2xx_ssp.h | 15 ++
arch/arm/mach-pxa/cm-x255.c | 2 +-
arch/arm/mach-pxa/cm-x270.c | 2 +-
arch/arm/mach-pxa/corgi.c | 2 +-
arch/arm/mach-pxa/devices.c | 2 +-
arch/arm/mach-pxa/em-x270.c | 2 +-
arch/arm/mach-pxa/hx4700.c | 2 +-
arch/arm/mach-pxa/icontrol.c | 2 +-
arch/arm/mach-pxa/littleton.c | 2 +-
arch/arm/mach-pxa/lubbock.c | 2 +-
arch/arm/mach-pxa/pcm027.c | 2 +-
arch/arm/mach-pxa/poodle.c | 2 +-
arch/arm/mach-pxa/spitz.c | 3 +-
arch/arm/mach-pxa/stargate2.c | 2 +-
arch/arm/mach-pxa/tosa.c | 2 +-
arch/arm/mach-pxa/trizeps4.c | 1 -
arch/arm/mach-pxa/z2.c | 2 +-
arch/arm/mach-pxa/zeus.c | 2 +-
arch/arm/plat-pxa/ssp.c | 2 +-
arch/x86/include/asm/pxa2xx_spi_ce4100.h | 99 ++++++++++
arch/x86/include/asm/pxa2xx_ssp.h | 15 ++
drivers/spi/Kconfig | 15 +-
drivers/spi/Makefile | 1 +
drivers/spi/pxa2xx_spi.c | 185 +++++++++++++------
drivers/spi/pxa2xx_spi_pci.c | 201 ++++++++++++++++++++
.../plat/ssp.h => include/linux/pxa2xx_ssp.h | 16 +-
.../mach => include/linux/spi}/pxa2xx_spi.h | 16 ++-
sound/soc/pxa/pxa-ssp.c | 2 +-
29 files changed, 512 insertions(+), 93 deletions(-)
create mode 100644 arch/arm/include/asm/pxa2xx_ssp.h
create mode 100644 arch/x86/include/asm/pxa2xx_spi_ce4100.h
create mode 100644 arch/x86/include/asm/pxa2xx_ssp.h
create mode 100644 drivers/spi/pxa2xx_spi_pci.c
rename arch/arm/plat-pxa/include/plat/ssp.h => include/linux/pxa2xx_ssp.h (95%)
rename {arch/arm/mach-pxa/include/mach => include/linux/spi}/pxa2xx_spi.h (86%)Sebastian
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
It is a simple driver and there is no need to call its init function at the level of a subsystem.
--- drivers/spi/pxa2xx_spi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/spi/pxa2xx_spi.c +1 -1
@@ -1731,7 +1731,7 @@ static int __init pxa2xx_spi_init(void) {return platform_driver_probe (&driver, pxa2xx_spi_probe); } -subsys_initcall (pxa2xx_spi_init); +module_init (pxa2xx_spi_init); static void __exit pxa2xx_spi_exit(void) {
Signature · 1 line
1.7.3.2
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 6 lines · On Wed, 24 Nov 2010 12:13:19 +0100 Sebastian Andrzej Siewior…
It is a simple driver and there is no need to call its init function at the level of a subsystem.
Signed-off-by Sebastian Andrzej Siewior <[email protected]>Signed-off-by Dirk Brandewie <[email protected]>---
Please take a look at commit 5b61a749e8fd0a45a5e37c267d20a43ef0590d68 there are some situations where the spi driver needs to be loaded before the others, IIRC the change in the commit above was needed for the EZX phones, where the PMIC is on the spi bus and cpufreq operates on some regulator controlled by the PMIC; added Daniel Ribeiro on CC who maybe can give more details.
Regards,
Antonio
Quoted 20 lines
drivers/spi/pxa2xx_spi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/spi/pxa2xx_spi.c +1
-1@@ -1731,7 +1731,7 @@ static int __init pxa2xx_spi_init(void) {return platform_driver_probe (&driver, pxa2xx_spi_probe); } -subsys_initcall (pxa2xx_spi_init); +module_init (pxa2xx_spi_init); static void __exit pxa2xx_spi_exit(void) {Signature · 1 line
1.7.3.2
Signature · 15 lines
Antonio Ospite http://ao2.it PGP public key ID: 0x4553B001 A: Because it messes up the order in which people normally read text. See http://en.wikipedia.org/wiki/Posting_style Q: Why is top-posting such a bad thing? -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20101124/bdfe31b4/attachment.sig>
Haojian Zhuang
maintainerPATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
In reply to Sebastian Andrzej SiewiorQuoted 14 lines · Sebastian Andrzej Siewior
It is a simple driver and there is no need to call its init function at the level of a subsystem.
Signed-off-by Sebastian Andrzej Siewior <[email protected]>Signed-off-by Dirk Brandewie <[email protected]>---
?drivers/spi/pxa2xx_spi.c | ? ?2 +-
?1 files changed, 1 insertions(+), 1 deletions(-)drivers/spi/pxa2xx_spi.c +0
-0
drivers/spi/pxa2xx_spi.c static int __init pxa2xx_spi_init(void)
Quoted 9 lines
drivers/spi/pxa2xx_spi.c +1
-2@@ -1731,7 +1731,7 @@ static int __init pxa2xx_spi_init(void) ?{ ? ? ? ?return platform_driver_probe(&driver, pxa2xx_spi_probe); ?} -subsys_initcall (pxa2xx_spi_init); +module_init (pxa2xx_spi_init); ?static void __exit pxa2xx_spi_exit(void) ?{ --
Hi Sebastian,
Actually it's added for cpufreq usage. We can check the commit in below.
commit 5b61a749e8fd0a45a5e37c267d20a43ef0590d68
Author: Antonio Ospite <[email protected]> Date: Tue Sep 22 16:46:10 2009 -0700
pxa2xx_spi: register earlier
Register pxa2xx_spi earlier so it can be used with cpufreq
So I think that this modifcation may cause others brokne.
Thanks
Haojian
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 1 line · Haojian Zhuang
Hi Sebastian,
Hi Hoajian,
Quoted 7 lines
Actually it's added for cpufreq usage. We can check the commit in below.
pxa2xx_spi: register earlierRegister
pxa2xx_spiearlier so it can be used with cpufreqSo I think that this modifcation may cause others brokne.
I've been pointed out to this commit but I don't understand _why_. The part I don't get is "so it can be used with cpufreq". Is it refered to a driver or the subsystem as it?
Quoted 2 lines
Thanks
Haojian
Sebastian
Haojian Zhuang
maintainerPATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 10 lines · Sebastian Andrzej Siewior
Quoted 2 lines · Haojian Zhuang
Hi Sebastian,
Hi Hoajian,
Quoted 4 lines
Actually it's added for cpufreq usage. We can check the commit in below.
? ?pxa2xx_spi: register earlier
Quoted 8 lines
Quoted 3 lines
? ?Register
pxa2xx_spiearlier so it can be used with cpufreqSo I think that this modifcation may cause others brokne.
I've been pointed out to this commit but I don't understand _why_. The part I don't get is "so it can be used with cpufreq". Is it refered to a driver or the subsystem as it?
As we know, cpufreq is used to adjust frequency and voltage of CPU. We need some interface to access PMIC hardware, such as I2C, SPI, .... So I think that they need SPI to initialize first. Otherwise, they may meet failure on accessing PMIC hardware.
Thanks
Haojian
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
In reply to Sebastian Andrzej SiewiorQuoted 3 lines · Sebastian Andrzej Siewior
I've been pointed out to this commit but I don't understand _why_. The part I don't get is "so it can be used with cpufreq". Is it refered to a driver or the subsystem as it?
We need the regulators for the CPU rails to start before the cpufreq driver starts so cpufreq can talk to them, and since the regulators may be SPI attached this means we also need the SPI controller to start before cpufreq. cpufreq starts at vanilla init time.
There's an approach being looked at for handling this for devices but for deviceless stuff like cpufreq we've nothing.
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 6 lines · Mark Brown
Quoted 3 lines · Sebastian Andrzej Siewior
I've been pointed out to this commit but I don't understand _why_. The part I don't get is "so it can be used with cpufreq". Is it refered to a driver or the subsystem as it?
Quoted 7 lines
We need the regulators for the CPU rails to start before the cpufreq driver starts so cpufreq can talk to them, and since the regulators may be SPI attached this means we also need the SPI controller to start before cpufreq. ?cpufreq starts at vanilla init time.
There's an approach being looked at for handling this for devices but for deviceless stuff like cpufreq we've nothing.
It would be easy enough to defer cpufreq initialization based on some platform defined criteria. It's just an initcall. However, I don't know what the impact area is for subsystems that depend on cpufreq. Are there drivers that depend on cpufreq before initialized?
g.
Signature · 2 lines
Grant Likely, B.Sc., P.Eng. Secret Lab Technologies Ltd.
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 2 lines · Grant Likely
It would be easy enough to defer cpufreq initialization based on some platform defined criteria. It's just an initcall. However, I don't
Though it'd be much better to fix the thing where cpufreq doesn't have a device anyway.
Quoted 2 lines
know what the impact area is for subsystems that depend on cpufreq. Are there drivers that depend on cpufreq before initialized?
OMAP? It'd be fairly surprising if something were to have a strict dependency, though - more likely to be notifiers I'd expect. Usually cpufreq comes up fairly late.
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
In reply to Mark BrownQuoted 10 lines · Mark Brown
Quoted 3 lines · Sebastian Andrzej Siewior
I've been pointed out to this commit but I don't understand _why_. The part I don't get is "so it can be used with cpufreq". Is it refered to a driver or the subsystem as it?
We need the regulators for the CPU rails to start before the cpufreq driver starts so cpufreq can talk to them, and since the regulators may be SPI attached this means we also need the SPI controller to start before cpufreq. cpufreq starts at vanilla init time.
After digging through the code I think I've found it. pxa_cpu_init() registers a cpufreq client. cpufreq calls init and pxa then regulator_get() to get the regulator and I guess this is the problem. So I would suggest to defer pxa_cpu_init() via late_initcall().
The other way around will force you to hack the init code for various drivers to make it work.
Sebastian
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 12 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Mark Brown
Quoted 3 lines · Sebastian Andrzej Siewior
I've been pointed out to this commit but I don't understand _why_. The part I don't get is "so it can be used with cpufreq". Is it refered to a driver or the subsystem as it?
We need the regulators for the CPU rails to start before the cpufreq driver starts so cpufreq can talk to them, and since the regulators may be SPI attached this means we also need the SPI controller to start before cpufreq. cpufreq starts at vanilla init time.
Quoted 7 lines
After digging through the code I think I've found it.
pxa_cpu_init()registers a cpufreq client. cpufreq calls init and pxa thenregulator_get()to get the regulator and I guess this is the problem. So I would suggest to deferpxa_cpu_init()vialate_initcall().The other way around will force you to hack the init code for various drivers to make it work.
Why should the PXA code change when you haven't explained _why_ you want to change the SPI driver to conform to your idea?
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 18 lines · Russell King - ARM Linux
Quoted 17 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Mark Brown
Quoted 3 lines · Sebastian Andrzej Siewior
I've been pointed out to this commit but I don't understand _why_. The part I don't get is "so it can be used with cpufreq". Is it refered to a driver or the subsystem as it?
We need the regulators for the CPU rails to start before the cpufreq driver starts so cpufreq can talk to them, and since the regulators may be SPI attached this means we also need the SPI controller to start before cpufreq. ?cpufreq starts at vanilla init time.
After digging through the code I think I've found it.
pxa_cpu_init()registers a cpufreq client. cpufreq calls init and pxa thenregulator_get()to get the regulator and I guess this is the problem. So I would suggest to deferpxa_cpu_init()vialate_initcall().
Quoted 5 lines
Quoted 2 lines
The other way around will force you to hack the init code for various drivers to make it work.
Why should the PXA code change when you haven't explained _why_ you want to change the SPI driver to conform to your idea?
The idea is to get away from trying to resolve probe order issue by messing with the initcall level in spi and i2c bus drivers. It's fragile, and it doesn't work with drivers as modules. Instead, we're investigating making the dependencies explicit in the board support code. However, hacking other initcalls to enable what I want to do on the spi bus drivers isn't a solution, it is just moving the problem.
g.
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 26 lines · Grant Likely
Quoted 18 lines · Russell King - ARM Linux
Quoted 17 lines · Sebastian Andrzej Siewior
Quoted 10 lines · Mark Brown
Quoted 3 lines · Sebastian Andrzej Siewior
I've been pointed out to this commit but I don't understand _why_. The part I don't get is "so it can be used with cpufreq". Is it refered to a driver or the subsystem as it?
We need the regulators for the CPU rails to start before the cpufreq driver starts so cpufreq can talk to them, and since the regulators may be SPI attached this means we also need the SPI controller to start before cpufreq. ?cpufreq starts at vanilla init time.
After digging through the code I think I've found it.
pxa_cpu_init()registers a cpufreq client. cpufreq calls init and pxa thenregulator_get()to get the regulator and I guess this is the problem. So I would suggest to deferpxa_cpu_init()vialate_initcall().Quoted 5 lines
Quoted 2 lines
The other way around will force you to hack the init code for various drivers to make it work.
Why should the PXA code change when you haven't explained _why_ you want to change the SPI driver to conform to your idea?
Quoted 6 lines
The idea is to get away from trying to resolve probe order issue by messing with the initcall level in spi and i2c bus drivers. It's fragile, and it doesn't work with drivers as modules. Instead, we're investigating making the dependencies explicit in the board support code. However, hacking other initcalls to enable what I want to do on the spi bus drivers isn't a solution, it is just moving the problem.
I know that's what _you're_ doing, but that doesn't seem to be what Sebastian is doing. My question was targeted towards at Sebastian.
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
In reply to Russell King - ARM LinuxQuoted 2 lines · * Russell King - ARM Linux | 2010-11-25 23:54:15 [+0000]:
Why should the PXA code change when you haven't explained _why_ you want to change the SPI driver to conform to your idea?
The problem was, that the platform driver never got probed after I registered the PCI driver. For that reason I made the patch attached. It got lost while moving the tree forward and I did not notice it earlier. While at it, I changed the subsys_init to module_init because it looked wrong. At this time I was also thinking about using one module for the platform and PCI code but never got to it.
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 11 lines · Sebastian Andrzej Siewior
Quoted 2 lines · * Russell King - ARM Linux | 2010-11-25 23:54:15 [+0000]:
Why should the PXA code change when you haven't explained _why_ you want to change the SPI driver to conform to your idea?
The problem was, that the platform driver never got probed after I registered the PCI driver. For that reason I made the patch attached. It got lost while moving the tree forward and I did not notice it earlier. While at it, I changed the
subsys_inittomodule_initbecause it looked wrong. At this time I was also thinking about using one module for the platform and PCI code but never got to it.
This is one of the problems of the foo_driver_probe() idea - if the device is not present at the time the driver is registered, then the driver loses out completely.
This would seem to be exagerated as you're creating this platform device from a PCI device - who's to say that someone won't unbind the PCI device and re-bind it later, causing the platform device to be deleted and re-created?
As such, I think the patch you've shown in this email is more appropriate (getting rid of the platform_driver_probe()) than trying to sort out init-level dependencies. Really, the init-level dependencies in this case are not the problem - the use of platform_driver_probe() is.
PATCH 1/9 spi/pxa2xx: don't use subys initcall for driver init
Quoted 12 lines · Russell King - ARM Linux
Quoted 10 lines · Sebastian Andrzej Siewior
Quoted 2 lines · * Russell King - ARM Linux | 2010-11-25 23:54:15 [+0000]:
Why should the PXA code change when you haven't explained _why_ you want to change the SPI driver to conform to your idea?
The problem was, that the platform driver never got probed after I registered the PCI driver. For that reason I made the patch attached. It got lost while moving the tree forward and I did not notice it earlier. While at it, I changed the
subsys_inittomodule_initbecause it looked wrong. At this time I was also thinking about using one module for the platform and PCI code but never got to it.
Quoted 8 lines
This is one of the problems of the
foo_driver_probe()idea - if the device is not present at the time the driver is registered, then the driver loses out completely.This would seem to be exagerated as you're creating this platform device from a PCI device - who's to say that someone won't unbind the PCI device and re-bind it later, causing the platform device to be deleted and re-created?
Unbinding a PCI device should call ->remove of the pci driver and this in turn will remove the platform device which calls ->remove of the driver.
Quoted 4 lines
As such, I think the patch you've shown in this email is more appropriate (getting rid of the
platform_driver_probe()) than trying to sort out init-level dependencies. Really, the init-level dependencies in this case are not the problem - the use ofplatform_driver_probe()is.
Okay. So I leave as it.
Sebastian
PATCH 2/9 spi/pxa2xx: add support for shared IRQ handler
In reply to Sebastian Andrzej SiewiorThis is required in case the interrupt line is shared with other devices.
--- drivers/spi/pxa2xx_spi.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-)
drivers/spi/pxa2xx_spi.c +14 -1
@@ -742,6 +742,18 @@ static irqreturn_t ssp_int(int irq, void *dev_id) {struct driver_data *drv_data = dev_id;void __iomem *reg = drv_data->ioaddr; +u32 sccr1_reg =read_SSCR1 (reg); +u32 mask = drv_data->mask_sr; +u32 status; + + status =read_SSSR (reg); + +/* Ignore possible writes if we don't need to write */ +if (!(sccr1_reg &SSCR1_TIE )) + mask &= ~SSSR_TFS ; + +if (!(status & mask)) +return IRQ_NONE ;if (!drv_data->cur_msg) {
@@ -1512,7 +1524,8 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev) drv_data->mask_sr =SSSR_TINT |SSSR_RFS |SSSR_TFS |SSSR_ROR ; } - status =request_irq (ssp->irq, ssp_int,0 ,dev_name (dev), drv_data); + status =request_irq (ssp->irq, ssp_int,IRQF_SHARED ,dev_name (dev), + drv_data);if (status <0 ) {dev_err (&pdev->dev,"cannot get IRQ %d\n" , ssp->irq); goto out_error_master_alloc;
Signature · 1 line
1.7.3.2
PATCH 3/9 spi/pxa2xx: Use define for SSSR_TFL_MASK instead of plain numbers
In reply to Sebastian Andrzej Siewior--- arch/arm/plat-pxa/include/plat/ssp.h | 3 ++- drivers/spi/pxa2xx_spi.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-)
arch/arm/plat-pxa/include/plat/ssp.h +2 -1
@@ -82,7 +82,8 @@#define SSSR_TFS (1 << 5)/* Transmit FIFO Service Request */ #define SSSR_RFS (1 << 6)/* Receive FIFO Service Request */ #define SSSR_ROR (1 << 7)/* Receive FIFO Overrun */ - +#define SSSR_TFL_MASK (0xf << 8)/* Transmit FIFO Level mask */ +#define SSSR_RFL_MASK (0xf << 12)/* Receive FIFO Level mask */ /* extra bits in PXA255, PXA26x and PXA27x SSP ports */ #define SSCR0_TISSP (1 << 4)/* TI Sync Serial Protocol */
drivers/spi/pxa2xx_spi.c +4 -4
@@ -224,7 +224,7 @@ static int null_writer(struct driver_data *drv_data)void __iomem *reg = drv_data->ioaddr;u8 n_bytes = drv_data->n_bytes; -if (((read_SSSR (reg) &0x00000f00 ) ==0x00000f00 ) +if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) || (drv_data->tx == drv_data->tx_end))return 0 ;
@@ -252,7 +252,7 @@ static int u8_writer(struct driver_data *drv_data) {void __iomem *reg = drv_data->ioaddr; -if (((read_SSSR (reg) &0x00000f00 ) ==0x00000f00 ) +if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) || (drv_data->tx == drv_data->tx_end))return 0 ;
@@ -279,7 +279,7 @@ static int u16_writer(struct driver_data *drv_data) {void __iomem *reg = drv_data->ioaddr; -if (((read_SSSR (reg) &0x00000f00 ) ==0x00000f00 ) +if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) || (drv_data->tx == drv_data->tx_end))return 0 ;
@@ -306,7 +306,7 @@ static int u32_writer(struct driver_data *drv_data) {void __iomem *reg = drv_data->ioaddr; -if (((read_SSSR (reg) &0x00000f00 ) ==0x00000f00 ) +if (((read_SSSR (reg) &SSSR_TFL_MASK ) ==SSSR_TFL_MASK ) || (drv_data->tx == drv_data->tx_end))return 0 ;
Signature · 1 line
1.7.3.2
PATCH 4/9 arm/pxa2xx: reorgazine SSP and SPI header files
In reply to Sebastian Andrzej SiewiorThe PXA-SPI driver relies on some files / defines which are arm specific and are within the ARM tree. The CE4100 SoC which is x86 has also the SPI core.
This patch moves the ssp and spi files from arm/mach-pxa and plat-pxa to include/linux where the CE4100 can access them.
This move got verified by building the following defconfigs:
cm_x2xx_defconfig corgi_defconfig em_x270_defconfig ezx_defconfig imote2_defconfig pxa3xx_defconfig spitz_defconfig zeus_defconfig raumfeld_defconfig magician_defconfig
---
Documentation/spi/pxa2xx | 4 ++--
arch/arm/mach-pxa/cm-x255.c | 2 +-
arch/arm/mach-pxa/cm-x270.c | 2 +-
arch/arm/mach-pxa/corgi.c | 2 +-
arch/arm/mach-pxa/devices.c | 2 +-
arch/arm/mach-pxa/em-x270.c | 2 +-
arch/arm/mach-pxa/hx4700.c | 2 +-
arch/arm/mach-pxa/icontrol.c | 2 +-
arch/arm/mach-pxa/littleton.c | 2 +-
arch/arm/mach-pxa/lubbock.c | 2 +-
arch/arm/mach-pxa/pcm027.c | 2 +-
arch/arm/mach-pxa/poodle.c | 2 +-
arch/arm/mach-pxa/spitz.c | 3 +--
arch/arm/mach-pxa/stargate2.c | 2 +-
arch/arm/mach-pxa/tosa.c | 2 +-
arch/arm/mach-pxa/trizeps4.c | 1 -
arch/arm/mach-pxa/z2.c | 2 +-
arch/arm/mach-pxa/zeus.c | 2 +-
arch/arm/plat-pxa/ssp.c | 2 +-
drivers/spi/pxa2xx_spi.c | 4 +---
.../plat/ssp.h => include/linux/pxa2xx_ssp.h | 8 ++++----
.../mach => include/linux/spi}/pxa2xx_spi.h | 8 +++++---
sound/soc/pxa/pxa-ssp.c | 2 +-
23 files changed, 30 insertions(+), 32 deletions(-)
rename arch/arm/plat-pxa/include/plat/ssp.h => include/linux/pxa2xx_ssp.h (98%)
rename {arch/arm/mach-pxa/include/mach => include/linux/spi}/pxa2xx_spi.h (92%)Documentation/spi/pxa2xx +2 -2
@@ -19,7 +19,7 @@ Declaring PXA2xx Master Controllers ----------------------------------- Typically a SPI master is defined in the arch/.../mach-*/board-*.c as a "platform device". The master configuration is passed to the driver via a table -found in arch/arm/mach-pxa/include/mach/pxa2xx_spi.h: +found in include/linux/spi/pxa2xx_spi.h: struct pxa2xx_spi_master { enum pxa_ssp_type ssp_type;
@@ -94,7 +94,7 @@ using the "spi_board_info" structure found in "linux/spi/spi.h". See Each slave device attached to the PXA must provide slave specific configuration information via the structure "pxa2xx_spi_chip" found in -"arch/arm/mach-pxa/include/mach/pxa2xx_spi.h". The pxa2xx_spi master controller driver +"include/linux/spi/pxa2xx_spi.h". The pxa2xx_spi master controller driver will uses the configuration whenever the driver communicates with the slave device. All fields are optional.
arch/arm/mach-pxa/cm-x255.c +1 -1
@@ -17,13 +17,13 @@#include <linux/mtd/nand-gpio.h> #include <linux/spi/spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <asm/mach/arch.h> #include <asm/mach-types.h> #include <asm/mach/map.h> #include <mach/pxa25x.h> -#include <mach/pxa2xx_spi.h> #include "generic.h"
arch/arm/mach-pxa/cm-x270.c +1 -1
@@ -19,12 +19,12 @@#include <video/mbxfb.h> #include <linux/spi/spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/spi/libertas_spi.h> #include <mach/pxa27x.h> #include <mach/ohci.h> #include <mach/mmc.h> -#include <mach/pxa2xx_spi.h> #include "generic.h"
arch/arm/mach-pxa/corgi.c +1 -1
@@ -28,6 +28,7 @@#include <linux/spi/spi.h> #include <linux/spi/ads7846.h> #include <linux/spi/corgi_lcd.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/mtd/sharpsl.h> #include <linux/input/matrix_keypad.h> #include <video/w100fb.h>
@@ -48,7 +49,6 @@#include <mach/irda.h> #include <mach/mmc.h> #include <mach/udc.h> -#include <mach/pxa2xx_spi.h> #include <mach/corgi.h> #include <mach/sharpsl_pm.h>
arch/arm/mach-pxa/devices.c +1 -1
@@ -3,6 +3,7 @@#include <linux/init.h> #include <linux/platform_device.h> #include <linux/dma-mapping.h> +#include <linux/spi/pxa2xx_spi.h> #include <asm/pmu.h> #include <mach/udc.h>
@@ -12,7 +13,6 @@#include <mach/irda.h> #include <mach/ohci.h> #include <plat/pxa27x_keypad.h> -#include <mach/pxa2xx_spi.h> #include <mach/camera.h> #include <mach/audio.h> #include <mach/hardware.h>
arch/arm/mach-pxa/em-x270.c +1 -1
@@ -26,6 +26,7 @@#include <linux/spi/spi.h> #include <linux/spi/tdo24m.h> #include <linux/spi/libertas_spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/power_supply.h> #include <linux/apm-emulation.h> #include <linux/i2c.h>
@@ -46,7 +47,6 @@#include <plat/pxa27x_keypad.h> #include <plat/i2c.h> #include <mach/camera.h> -#include <mach/pxa2xx_spi.h> #include "generic.h" #include "devices.h"
arch/arm/mach-pxa/hx4700.c +1 -1
@@ -33,6 +33,7 @@#include <linux/regulator/max1586.h> #include <linux/spi/ads7846.h> #include <linux/spi/spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/usb/gpio_vbus.h> #include <mach/hardware.h>
@@ -43,7 +44,6 @@#include <mach/hx4700.h> #include <plat/i2c.h> #include <mach/irda.h> -#include <mach/pxa2xx_spi.h> #include <video/platform_lcd.h> #include <video/w100fb.h>
arch/arm/mach-pxa/icontrol.c +1 -1
@@ -24,7 +24,7 @@#include <mach/mxm8x10.h> #include <linux/spi/spi.h> -#include <mach/pxa2xx_spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/can/platform/mcp251x.h> #include "generic.h"
arch/arm/mach-pxa/littleton.c +1 -1
@@ -22,6 +22,7 @@#include <linux/clk.h> #include <linux/gpio.h> #include <linux/spi/spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/smc91x.h> #include <linux/i2c.h> #include <linux/leds.h>
@@ -42,7 +43,6 @@#include <mach/pxa300.h> #include <mach/pxafb.h> #include <mach/mmc.h> -#include <mach/pxa2xx_spi.h> #include <plat/pxa27x_keypad.h> #include <mach/littleton.h> #include <plat/i2c.h>
arch/arm/mach-pxa/lubbock.c +1 -1
@@ -25,7 +25,7 @@#include <linux/spi/spi.h> #include <linux/spi/ads7846.h> -#include <mach/pxa2xx_spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <asm/setup.h> #include <asm/memory.h>
arch/arm/mach-pxa/pcm027.c +1 -1
@@ -25,12 +25,12 @@#include <linux/mtd/physmap.h> #include <linux/spi/spi.h> #include <linux/spi/max7301.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/leds.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <mach/pxa27x.h> -#include <mach/pxa2xx_spi.h> #include <mach/pcm027.h> #include "generic.h"
arch/arm/mach-pxa/poodle.c +1 -1
@@ -25,6 +25,7 @@#include <linux/i2c.h> #include <linux/spi/spi.h> #include <linux/spi/ads7846.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/mtd/sharpsl.h> #include <mach/hardware.h>
@@ -43,7 +44,6 @@#include <mach/irda.h> #include <mach/poodle.h> #include <mach/pxafb.h> -#include <mach/pxa2xx_spi.h> #include <plat/i2c.h> #include <asm/hardware/scoop.h>
arch/arm/mach-pxa/spitz.c +1 -2
@@ -23,7 +23,7 @@#include <linux/spi/spi.h> #include <linux/spi/ads7846.h> #include <linux/spi/corgi_lcd.h> -#include <linux/mtd/physmap.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/mtd/sharpsl.h> #include <linux/input/matrix_keypad.h> #include <linux/regulator/machine.h>
@@ -41,7 +41,6 @@#include <mach/mmc.h> #include <mach/ohci.h> #include <mach/pxafb.h> -#include <mach/pxa2xx_spi.h> #include <mach/spitz.h> #include <mach/sharpsl_pm.h>
arch/arm/mach-pxa/stargate2.c +1 -1
@@ -46,10 +46,10 @@#include <plat/i2c.h> #include <mach/mmc.h> #include <mach/udc.h> -#include <mach/pxa2xx_spi.h> #include <mach/pxa27x-udc.h> #include <linux/spi/spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/mfd/da903x.h> #include <linux/sht15.h>
arch/arm/mach-pxa/tosa.c +1 -1
@@ -32,6 +32,7 @@#include <linux/gpio.h> #include <linux/pda_power.h> #include <linux/spi/spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/input/matrix_keypad.h> #include <asm/setup.h>
@@ -44,7 +45,6 @@#include <mach/mmc.h> #include <mach/udc.h> #include <mach/tosa_bt.h> -#include <mach/pxa2xx_spi.h> #include <mach/audio.h> #include <asm/mach/arch.h>
arch/arm/mach-pxa/trizeps4.c +0 -1
@@ -40,7 +40,6 @@#include <asm/mach/flash.h> #include <mach/pxa27x.h> -#include <mach/pxa2xx_spi.h> #include <mach/trizeps4.h> #include <mach/audio.h> #include <mach/pxafb.h>
arch/arm/mach-pxa/z2.c +1 -1
@@ -20,6 +20,7 @@#include <linux/z2_battery.h> #include <linux/dma-mapping.h> #include <linux/spi/spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/spi/libertas_spi.h> #include <linux/spi/lms283gf05.h> #include <linux/power_supply.h>
@@ -38,7 +39,6 @@#include <mach/pxafb.h> #include <mach/mmc.h> #include <plat/pxa27x_keypad.h> -#include <mach/pxa2xx_spi.h> #include <plat/i2c.h>
arch/arm/mach-pxa/zeus.c +1 -1
@@ -20,6 +20,7 @@#include <linux/dm9000.h> #include <linux/mmc/host.h> #include <linux/spi/spi.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/mtd/physmap.h>
@@ -41,7 +42,6 @@#include <mach/pxa27x-udc.h> #include <mach/udc.h> #include <mach/pxafb.h> -#include <mach/pxa2xx_spi.h> #include <mach/mfp-pxa27x.h> #include <mach/pm.h> #include <mach/audio.h>
arch/arm/plat-pxa/ssp.c +1 -1
@@ -28,11 +28,11 @@#include <linux/clk.h> #include <linux/err.h> #include <linux/platform_device.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/io.h> #include <asm/irq.h> #include <mach/hardware.h> -#include <plat/ssp.h> static DEFINE_MUTEX (ssp_lock);static LIST_HEAD (ssp_list);
drivers/spi/pxa2xx_spi.c +1 -3
@@ -23,6 +23,7 @@#include <linux/errno.h> #include <linux/interrupt.h> #include <linux/platform_device.h> +#include <linux/spi/pxa2xx_spi.h> #include <linux/dma-mapping.h> #include <linux/spi/spi.h> #include <linux/workqueue.h>
@@ -35,9 +36,6 @@#include <asm/irq.h> #include <asm/delay.h> -#include <mach/dma.h> -#include <plat/ssp.h> -#include <mach/pxa2xx_spi.h> MODULE_AUTHOR ("Stephen Street" );MODULE_DESCRIPTION ("PXA2xx SSP SPI Controller" );
include/linux/pxa2xx_ssp.h renamed from arch/arm/plat-pxa/include/plat/ssp.h +4 -4
@@ -1,5 +1,5 @@/* -* ssp.h +* pxa2xx_ssp.h * * Copyright (C) 2003 Russell King, All Rights Reserved. *
@@ -16,8 +16,8 @@* PXA3xx SSP1, SSP2, SSP3, SSP4 */ -#ifndef __ASM_ARCH_SSP_H -#define __ASM_ARCH_SSP_H +#ifndef __LINUX_SSP_H +#define __LINUX_SSP_H#include <linux/list.h> #include <linux/io.h>
@@ -184,4 +184,4 @@ static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg)struct ssp_device *pxa_ssp_request (int port,const char *label);void pxa_ssp_free (struct ssp_device *); -#endif /* __ASM_ARCH_SSP_H */ +#endif
include/linux/spi/pxa2xx_spi.h renamed from arch/arm/mach-pxa/include/mach/pxa2xx_spi.h +5 -3
@@ -15,9 +15,11 @@* along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef __linux_pxa2xx_spi_h +#define __linux_pxa2xx_spi_h -#ifndef PXA2XX_SPI_H_ -#define PXA2XX_SPI_H_ +#include <linux/pxa2xx_ssp.h> +#include <mach/dma.h> #define PXA2XX_CS_ASSERT (0x01)#define PXA2XX_CS_DEASSERT (0x02)
@@ -44,4 +46,4 @@ struct pxa2xx_spi_chip {extern void pxa2xx_set_spi_info (unsigned id,struct pxa2xx_spi_master *info); -#endif /*PXA2XX_SPI_H_*/ +#endif
sound/soc/pxa/pxa-ssp.c +1 -1
@@ -20,6 +20,7 @@#include <linux/platform_device.h> #include <linux/clk.h> #include <linux/io.h> +#include <linux/pxa2xx_ssp.h> #include <asm/irq.h>
@@ -33,7 +34,6 @@#include <mach/hardware.h> #include <mach/dma.h> #include <mach/audio.h> -#include <plat/ssp.h> #include "../../arm/pxa2xx-pcm.h" #include "pxa-ssp.h"
Signature · 1 line
1.7.3.2
Haojian Zhuang
maintainerPATCH 4/9 arm/pxa2xx: reorgazine SSP and SPI header files
include/linux/pxa2xx_ssp.h
Quoted 419 lines · Sebastian Andrzej Siewior
The PXA-SPI driver relies on some files / defines which are arm specific and are within the ARM tree. The CE4100 SoC which is x86 has also the SPI core.
This patch moves the ssp and spi files from arm/mach-pxa and plat-pxa toinclude/linuxwhere the CE4100 can access them.This move got verified by building the following defconfigs:
?cm_x2xx_defconfigcorgi_defconfigem_x270_defconfigezx_defconfig?imote2_defconfigpxa3xx_defconfigspitz_defconfigzeus_defconfig?raumfeld_defconfigmagician_defconfigSigned-off-by Sebastian Andrzej Siewior <[email protected]>Signed-off-by Dirk Brandewie <[email protected]>---
?Documentation/spi/pxa2xx ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?4 ++-- ?arch/arm/mach-pxa/cm-x255.c ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?arch/arm/mach-pxa/cm-x270.c ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?arch/arm/mach-pxa/corgi.c ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?arch/arm/mach-pxa/devices.c ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?arch/arm/mach-pxa/em-x270.c ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?arch/arm/mach-pxa/hx4700.c ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +- ?arch/arm/mach-pxa/icontrol.c ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +- ?arch/arm/mach-pxa/littleton.c ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?arch/arm/mach-pxa/lubbock.c ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?arch/arm/mach-pxa/pcm027.c ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +- ?arch/arm/mach-pxa/poodle.c ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +- ?arch/arm/mach-pxa/spitz.c ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?3 +-- ?arch/arm/mach-pxa/stargate2.c ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?arch/arm/mach-pxa/tosa.c ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +- ?arch/arm/mach-pxa/trizeps4.c ? ? ? ? ? ? ? ? ? ? ? | ? ?1 - ?arch/arm/mach-pxa/z2.c ? ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +- ?arch/arm/mach-pxa/zeus.c ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +- ?arch/arm/plat-pxa/ssp.c ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +- ?drivers/spi/pxa2xx_spi.c ? ? ? ? ? ? ? ? ? ? ? ? ? | ? ?4 +--- ?.../plat/ssp.h => include/linux/pxa2xx_ssp.h ? ? ? | ? ?8 ++++---- ?.../mach => include/linux/spi}/pxa2xx_spi.h ? ? ? ?| ? ?8 +++++--- ?sound/soc/pxa/pxa-ssp.c ? ? ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +-?23 files changed, 30 insertions(+), 32 deletions(-)
?renamearch/arm/plat-pxa/include/plat/ssp.h=>include/linux/pxa2xx_ssp.h(98%) ?rename {arch/arm/mach-pxa/include/mach=>include/linux/spi}/pxa2xx_spi.h(92%)Documentation/spi/pxa2xx +0
-0@@ -19,7 +19,7 @@ Declaring PXA2xx Master Controllers?-----------------------------------
?Typically a SPI master is defined in thearch/.../mach-*/board-*.cas a ?"platform device". ?The master configuration is passed to the driver via a tableDocumentation/spi/pxa2xx +1
-1-found in arch/arm/mach-pxa/include/mach/pxa2xx_spi.h: +found in include/linux/spi/pxa2xx_spi.h:?struct
pxa2xx_spi_master{
? ? ? ?enumpxa_ssp_typessp_type;Documentation/spi/pxa2xx +0
-0@@ -94,7 +94,7 @@ using the "spi_board_info" structure found in "linux/spi/spi.h". See?Each slave device attached to the PXA must provide slave specific configuration ?information via the structure "
pxa2xx_spi_chip" found in -"arch/arm/mach-pxa/include/mach/pxa2xx_spi.h". ?Thepxa2xx_spimaster controller driver +"include/linux/spi/pxa2xx_spi.h". ?Thepxa2xx_spimaster controller driver ?will uses the configuration whenever the driver communicates with the slave ?device. All fields are optional.arch/arm/mach-pxa/cm-x255.c +0
-0@@ -17,13 +17,13 @@?#include <
linux/mtd/nand-gpio.h>?#include <
linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>?#include <
asm/mach/arch.h>
?#include <asm/mach-types.h>
?#include <asm/mach/map.h>?#include <
mach/pxa25x.h>
-#include <mach/pxa2xx_spi.h>?#include "
generic.h"arch/arm/mach-pxa/cm-x270.c +0
-0@@ -19,12 +19,12 @@?#include <
video/mbxfb.h>?#include <
linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/spi/libertas_spi.h>?#include <
mach/pxa27x.h>
?#include <mach/ohci.h>
?#include <mach/mmc.h>
-#include <mach/pxa2xx_spi.h>?#include "
generic.h"arch/arm/mach-pxa/corgi.c +0
-0@@ -28,6 +28,7 @@?#include <
linux/spi/spi.h>
?#include <linux/spi/ads7846.h>
?#include <linux/spi/corgi_lcd.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/mtd/sharpsl.h>
?#include <linux/input/matrix_keypad.h>
?#include <video/w100fb.h>arch/arm/mach-pxa/corgi.c +0
-0@@ -48,7 +49,6 @@?#include <
mach/irda.h>
?#include <mach/mmc.h>
?#include <mach/udc.h>
-#include <mach/pxa2xx_spi.h>
?#include <mach/corgi.h>
?#include <mach/sharpsl_pm.h>arch/arm/mach-pxa/devices.c +0
-0@@ -3,6 +3,7 @@?#include <
linux/init.h>
?#include <linux/platform_device.h>
?#include <linux/dma-mapping.h>
+#include <linux/spi/pxa2xx_spi.h>?#include <
asm/pmu.h>
?#include <mach/udc.h>arch/arm/mach-pxa/devices.c +0
-0@@ -12,7 +13,6 @@?#include <
mach/irda.h>
?#include <mach/ohci.h>
?#include <plat/pxa27x_keypad.h>
-#include <mach/pxa2xx_spi.h>
?#include <mach/camera.h>
?#include <mach/audio.h>
?#include <mach/hardware.h>arch/arm/mach-pxa/em-x270.c +0
-0@@ -26,6 +26,7 @@?#include <
linux/spi/spi.h>
?#include <linux/spi/tdo24m.h>
?#include <linux/spi/libertas_spi.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/power_supply.h>
?#include <linux/apm-emulation.h>
?#include <linux/i2c.h>arch/arm/mach-pxa/em-x270.c +0
-0@@ -46,7 +47,6 @@?#include <
plat/pxa27x_keypad.h>
?#include <plat/i2c.h>
?#include <mach/camera.h>
-#include <mach/pxa2xx_spi.h>?#include "
generic.h"
?#include "devices.h"arch/arm/mach-pxa/hx4700.c +0
-0@@ -33,6 +33,7 @@?#include <
linux/regulator/max1586.h>
?#include <linux/spi/ads7846.h>
?#include <linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/usb/gpio_vbus.h>?#include <
mach/hardware.h>arch/arm/mach-pxa/hx4700.c +0
-0@@ -43,7 +44,6 @@?#include <
mach/hx4700.h>
?#include <plat/i2c.h>
?#include <mach/irda.h>
-#include <mach/pxa2xx_spi.h>?#include <
video/platform_lcd.h>
?#include <video/w100fb.h>arch/arm/mach-pxa/icontrol.c +0
-0@@ -24,7 +24,7 @@?#include <
mach/mxm8x10.h>?#include <
linux/spi/spi.h>arch/arm/mach-pxa/icontrol.c +1
-1-#include <mach/pxa2xx_spi.h> +#include <linux/spi/pxa2xx_spi.h> ?#include <
linux/can/platform/mcp251x.h>?#include "
generic.h"arch/arm/mach-pxa/littleton.c +0
-0@@ -22,6 +22,7 @@?#include <
linux/clk.h>
?#include <linux/gpio.h>
?#include <linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/smc91x.h>
?#include <linux/i2c.h>
?#include <linux/leds.h>arch/arm/mach-pxa/littleton.c +0
-0@@ -42,7 +43,6 @@?#include <
mach/pxa300.h>
?#include <mach/pxafb.h>
?#include <mach/mmc.h>
-#include <mach/pxa2xx_spi.h>
?#include <plat/pxa27x_keypad.h>
?#include <mach/littleton.h>
?#include <plat/i2c.h>arch/arm/mach-pxa/lubbock.c +0
-0@@ -25,7 +25,7 @@?#include <
linux/spi/spi.h>
?#include <linux/spi/ads7846.h>arch/arm/mach-pxa/lubbock.c +1
-1-#include <mach/pxa2xx_spi.h> +#include <linux/spi/pxa2xx_spi.h> ?#include <
asm/setup.h>
?#include <asm/memory.h>arch/arm/mach-pxa/pcm027.c +0
-0@@ -25,12 +25,12 @@?#include <
linux/mtd/physmap.h>
?#include <linux/spi/spi.h>
?#include <linux/spi/max7301.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/leds.h>?#include <
asm/mach-types.h>
?#include <asm/mach/arch.h>
?#include <mach/pxa27x.h>
-#include <mach/pxa2xx_spi.h>
?#include <mach/pcm027.h>
?#include "generic.h"arch/arm/mach-pxa/poodle.c +0
-0@@ -25,6 +25,7 @@?#include <
linux/i2c.h>
?#include <linux/spi/spi.h>
?#include <linux/spi/ads7846.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/mtd/sharpsl.h>?#include <
mach/hardware.h>arch/arm/mach-pxa/poodle.c +0
-0@@ -43,7 +44,6 @@?#include <
mach/irda.h>
?#include <mach/poodle.h>
?#include <mach/pxafb.h>
-#include <mach/pxa2xx_spi.h>
?#include <plat/i2c.h>?#include <
asm/hardware/scoop.h>arch/arm/mach-pxa/spitz.c +0
-0@@ -23,7 +23,7 @@?#include <
linux/spi/spi.h>
?#include <linux/spi/ads7846.h>
?#include <linux/spi/corgi_lcd.h>arch/arm/mach-pxa/spitz.c +1
-1-#include <linux/mtd/physmap.h> +#include <linux/spi/pxa2xx_spi.h> ?#include <
linux/mtd/sharpsl.h>
?#include <linux/input/matrix_keypad.h>
?#include <linux/regulator/machine.h>arch/arm/mach-pxa/spitz.c +0
-0@@ -41,7 +41,6 @@?#include <
mach/mmc.h>
?#include <mach/ohci.h>
?#include <mach/pxafb.h>
-#include <mach/pxa2xx_spi.h>
?#include <mach/spitz.h>
?#include <mach/sharpsl_pm.h>arch/arm/mach-pxa/stargate2.c +0
-0@@ -46,10 +46,10 @@?#include <
plat/i2c.h>
?#include <mach/mmc.h>
?#include <mach/udc.h>
-#include <mach/pxa2xx_spi.h>
?#include <mach/pxa27x-udc.h>?#include <
linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/mfd/da903x.h>
?#include <linux/sht15.h>arch/arm/mach-pxa/tosa.c +0
-0@@ -32,6 +32,7 @@?#include <
linux/gpio.h>
?#include <linux/pda_power.h>
?#include <linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/input/matrix_keypad.h>?#include <
asm/setup.h>arch/arm/mach-pxa/tosa.c +0
-0@@ -44,7 +45,6 @@?#include <
mach/mmc.h>
?#include <mach/udc.h>
?#include <mach/tosa_bt.h>
-#include <mach/pxa2xx_spi.h>
?#include <mach/audio.h>?#include <
asm/mach/arch.h>arch/arm/mach-pxa/trizeps4.c +0
-0@@ -40,7 +40,6 @@?#include <
asm/mach/flash.h>?#include <
mach/pxa27x.h>
-#include <mach/pxa2xx_spi.h>
?#include <mach/trizeps4.h>
?#include <mach/audio.h>
?#include <mach/pxafb.h>arch/arm/mach-pxa/z2.c +0
-0@@ -20,6 +20,7 @@?#include <
linux/z2_battery.h>
?#include <linux/dma-mapping.h>
?#include <linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/spi/libertas_spi.h>
?#include <linux/spi/lms283gf05.h>
?#include <linux/power_supply.h>arch/arm/mach-pxa/z2.c +0
-0@@ -38,7 +39,6 @@?#include <
mach/pxafb.h>
?#include <mach/mmc.h>
?#include <plat/pxa27x_keypad.h>
-#include <mach/pxa2xx_spi.h>?#include <
plat/i2c.h>arch/arm/mach-pxa/zeus.c +0
-0@@ -20,6 +20,7 @@?#include <
linux/dm9000.h>
?#include <linux/mmc/host.h>
?#include <linux/spi/spi.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/mtd/mtd.h>
?#include <linux/mtd/partitions.h>
?#include <linux/mtd/physmap.h>arch/arm/mach-pxa/zeus.c +0
-0@@ -41,7 +42,6 @@?#include <
mach/pxa27x-udc.h>
?#include <mach/udc.h>
?#include <mach/pxafb.h>
-#include <mach/pxa2xx_spi.h>
?#include <mach/mfp-pxa27x.h>
?#include <mach/pm.h>
?#include <mach/audio.h>arch/arm/plat-pxa/ssp.c +0
-0@@ -28,11 +28,11 @@?#include <
linux/clk.h>
?#include <linux/err.h>
?#include <linux/platform_device.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/io.h>?#include <
asm/irq.h>
?#include <mach/hardware.h>
-#include <plat/ssp.h>?static
DEFINE_MUTEX(ssp_lock);
?staticLIST_HEAD(ssp_list);drivers/spi/pxa2xx_spi.c +0
-0@@ -23,6 +23,7 @@?#include <
linux/errno.h>
?#include <linux/interrupt.h>
?#include <linux/platform_device.h>
+#include <linux/spi/pxa2xx_spi.h>
?#include <linux/dma-mapping.h>
?#include <linux/spi/spi.h>
?#include <linux/workqueue.h>drivers/spi/pxa2xx_spi.c +0
-0@@ -35,9 +36,6 @@?#include <
asm/irq.h>
?#include <asm/delay.h>drivers/spi/pxa2xx_spi.c +0
-3-#include <mach/dma.h> -#include <plat/ssp.h> -#include <mach/pxa2xx_spi.h> ?MODULE_AUTHOR("Stephen Street");
?MODULE_DESCRIPTION("PXA2xx SSP SPI Controller");include/linux/pxa2xx_ssp.h renamed from arch/arm/plat-pxa/include/plat/ssp.h +0
-0
Is there any reason to rename ssp.h?
Quoted 80 lines
include/linux/pxa2xx_ssp.h renamed from arch/arm/plat-pxa/include/plat/ssp.h +0
-0@@ -1,5 +1,5 @@?/*
- * ?ssp.h
+ * ?pxa2xx_ssp.h
?*
?* ?Copyright (C) 2003 Russell King, All Rights Reserved. ?*include/linux/pxa2xx_ssp.h renamed from arch/arm/plat-pxa/include/plat/ssp.h +0
-0@@ -16,8 +16,8 @@?* ? ? ? PXA3xx ? ? SSP1, SSP2, SSP3, SSP4
?*/include/linux/pxa2xx_ssp.h renamed from arch/arm/plat-pxa/include/plat/ssp.h +2
-2-#ifndef __ASM_ARCH_SSP_H -#define __ASM_ARCH_SSP_H +#ifndef __LINUX_SSP_H +#define __LINUX_SSP_H?#include <
linux/list.h>
?#include <linux/io.h>include/linux/pxa2xx_ssp.h renamed from arch/arm/plat-pxa/include/plat/ssp.h +1
-1@@ -184,4 +184,4 @@ static inline u32 pxa_ssp_read_reg(struct ssp_device *dev, u32 reg) ?struct ssp_device *pxa_ssp_request(int port, const char *label); ?void pxa_ssp_free(struct ssp_device *); -#endif /* __ASM_ARCH_SSP_H */ +#endif include/linux/spi/pxa2xx_spi.h renamed from arch/arm/mach-pxa/include/mach/pxa2xx_spi.h +0
-0@@ -15,9 +15,11 @@?* along with this program; if not, write to the Free Software ?* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ?*/
include/linux/spi/pxa2xx_spi.h renamed from arch/arm/mach-pxa/include/mach/pxa2xx_spi.h +4
-2+#ifndef __linux_pxa2xx_spi_h +#define __linux_pxa2xx_spi_h -#ifndef PXA2XX_SPI_H_ -#define PXA2XX_SPI_H_ +#include <linux/pxa2xx_ssp.h> +#include <mach/dma.h> ?#define
PXA2XX_CS_ASSERT(0x01)
?#definePXA2XX_CS_DEASSERT(0x02)include/linux/spi/pxa2xx_spi.h renamed from arch/arm/mach-pxa/include/mach/pxa2xx_spi.h +1
-1@@ -44,4 +46,4 @@ struct pxa2xx_spi_chip { ?extern void pxa2xx_set_spi_info(unsigned id, struct pxa2xx_spi_master *info); -#endif /*PXA2XX_SPI_H_*/ +#endif sound/soc/pxa/pxa-ssp.c +0
-0@@ -20,6 +20,7 @@?#include <
linux/platform_device.h>
?#include <linux/clk.h>
?#include <linux/io.h>
+#include <linux/pxa2xx_ssp.h>?#include <
asm/irq.h>sound/soc/pxa/pxa-ssp.c +0
-0@@ -33,7 +34,6 @@?#include <
mach/hardware.h>
?#include <mach/dma.h>
?#include <mach/audio.h>
-#include <plat/ssp.h>?#include "
../../arm/pxa2xx-pcm.h"
?#include "pxa-ssp.h"
--
1.7.3.2_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 4/9 arm/pxa2xx: reorgazine SSP and SPI header files
Quoted 2 lines · Haojian Zhuang
On Wed, Nov 24, 2010 at 7:13 PM, Sebastian Andrzej Siewior <[email protected]> wrote:
<snip>
Quoted 8 lines
include/linux/pxa2xx_ssp.h
Quoted 7 lines
include/linux/pxa2xx_ssp.h renamed from arch/arm/plat-pxa/include/plat/ssp.h +0
-0Is there any reason to rename
ssp.h?
Yup. It ends up in a global include/linux folder so just ssp may get confused with something else. I didn't move it into the spi folder because it isn't really spi and it is also used by the sound driver.
Sebastian
PATCH 5/9 spi/pxa2xx: Add CE4100 support
In reply to Sebastian Andrzej SiewiorSodaville's SPI controller is very much the same as in PXA25x. The difference:
- The RX/TX FIFO is only 4 words deep instead of 16
- No DMA support
- The SPI controller offers a CS functionality
--- arch/x86/include/asm/pxa2xx_spi_ce4100.h | 99 +++++++++++++++ drivers/spi/Kconfig | 15 ++- drivers/spi/Makefile | 1 + drivers/spi/pxa2xx_spi.c | 1 - drivers/spi/pxa2xx_spi_pci.c | 201 ++++++++++++++++++++++++++++++ include/linux/spi/pxa2xx_spi.h | 10 ++- 6 files changed, 320 insertions(+), 7 deletions(-) create mode 100644 arch/x86/include/asm/pxa2xx_spi_ce4100.h create mode 100644 drivers/spi/pxa2xx_spi_pci.c
arch/x86/include/asm/pxa2xx_spi_ce4100.h new file +99 -0
@@ -0,0 +1,99 @@ +#ifndef __asm_pxa2xx_spi_ce4100_h +#define __asm_pxa2xx_spi_ce4100_h + +/* +* The CE4100 does not provide DMA support. This bits are here to let the driver +* compile and will never be used. Maybe we get DMA support at a later point in +* time. +*/ + +#define DCSR (n) (n) +#define DSADR (n) (n) +#define DTADR (n) (n) +#define DCMD (n) (n) +#define DRCMR (n) (n) + +#define DCSR_RUN (1 << 31)/* Run Bit */ +#define DCSR_NODESC (1 << 30)/* No-Descriptor Fetch */ +#define DCSR_STOPIRQEN (1 << 29)/* Stop Interrupt Enable */ +#define DCSR_REQPEND (1 << 8)/* Request Pending (read-only) */ +#define DCSR_STOPSTATE (1 << 3)/* Stop State (read-only) */ +#define DCSR_ENDINTR (1 << 2)/* End Interrupt */ +#define DCSR_STARTINTR (1 << 1)/* Start Interrupt */ +#define DCSR_BUSERR (1 << 0)/* Bus Error Interrupt */ + +#define DCSR_EORIRQEN (1 << 28)/* End of Receive Interrupt Enable */ +#define DCSR_EORJMPEN (1 << 27)/* Jump to next descriptor on EOR */ +#define DCSR_EORSTOPEN (1 << 26)/* STOP on an EOR */ +#define DCSR_SETCMPST (1 << 25)/* Set Descriptor Compare Status */ +#define DCSR_CLRCMPST (1 << 24)/* Clear Descriptor Compare Status */ +#define DCSR_CMPST (1 << 10)/* The Descriptor Compare Status */ +#define DCSR_EORINTR (1 << 9)/* The end of Receive */ + +#define DRCMR_MAPVLD (1 << 7)/* Map Valid */ +#define DRCMR_CHLNUM 0x1f/* mask for Channel Number */ + +#define DDADR_DESCADDR 0xfffffff0/* Address of next descriptor */ +#define DDADR_STOP (1 << 0)/* Stop */ + +#define DCMD_INCSRCADDR (1 << 31)/* Source Address Increment Setting. */ +#define DCMD_INCTRGADDR (1 << 30)/* Target Address Increment Setting. */ +#define DCMD_FLOWSRC (1 << 29)/* Flow Control by the source. */ +#define DCMD_FLOWTRG (1 << 28)/* Flow Control by the target. */ +#define DCMD_STARTIRQEN (1 << 22)/* Start Interrupt Enable */ +#define DCMD_ENDIRQEN (1 << 21)/* End Interrupt Enable */ +#define DCMD_ENDIAN (1 << 18)/* Device Endian-ness. */ +#define DCMD_BURST8 (1 << 16)/* 8 byte burst */ +#define DCMD_BURST16 (2 << 16)/* 16 byte burst */ +#define DCMD_BURST32 (3 << 16)/* 32 byte burst */ +#define DCMD_WIDTH1 (1 << 14)/* 1 byte width */ +#define DCMD_WIDTH2 (2 << 14)/* 2 byte width (HalfWord) */ +#define DCMD_WIDTH4 (3 << 14)/* 4 byte width (Word) */ +#define DCMD_LENGTH 0x01fff/* length mask (max = 8K - 1) */ + +/* +* Descriptor structure for PXA's DMA engine +* Note: this structure must always be aligned to a 16-byte boundary. +*/ + +typedef enum { +DMA_PRIO_HIGH =0 , +DMA_PRIO_MEDIUM =1 , +DMA_PRIO_LOW =2 +}pxa_dma_prio ; + +/* +* DMA registration +*/ + +static inline int pxa_request_dma (char *name, +pxa_dma_prio prio, +void (*irq_handler)(int ,void *), +void *data) +{ +return -ENODEV ; +} + +static inline void pxa_free_dma (int dma_ch) +{ +} + +/* +* The CE4100 does not have the clk framework implemented and SPI clock can +* not be switched on/off or the divider changed. +*/ +static inline void clk_disable (struct clk *clk) +{ +} + +static inline int clk_enable (struct clk *clk) +{ +return 0 ; +} + +static inline unsigned long clk_get_rate (struct clk *clk) +{ +return 3686400 ; +} + +#endif
drivers/spi/Kconfig +10 -5
@@ -267,12 +267,17 @@ config SPI_PPC4xx config SPI_PXA2XX tristate "PXA2xx SSP SPI master" - depends on ARCH_PXA && EXPERIMENTAL - select PXA_SSP + depends on (ARCH_PXA || X86_32) && EXPERIMENTAL + select PXA_SSP if ARCH_PXA + select SPI_PXA2XX_PCI if !ARCH_PXA help - This enables using a PXA2xx SSP port as a SPI master controller. - The driver can be configured to use any SSP port and additional - documentation can be found a Documentation/spi/pxa2xx. + This enables using a PXA2xx or Sodaville SSP port as a SPI master + controller. The driver can be configured to use any SSP port and + additional documentation can be found a Documentation/spi/pxa2xx. + +config SPI_PXA2XX_PCI + bool + depends on SPI_PXA2XX && PCI config SPI_S3C24XX tristate "Samsung S3C24XX series SPI"
drivers/spi/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_SPI_GPIO) += spi_gpio.o obj-$(CONFIG_SPI_IMX) += spi_imx.o obj-$(CONFIG_SPI_LM70_LLP) += spi_lm70llp.o obj-$(CONFIG_SPI_PXA2XX) += pxa2xx_spi.o +obj-$(CONFIG_SPI_PXA2XX_PCI) += pxa2xx_spi_pci.o obj-$(CONFIG_SPI_OMAP_UWIRE) += omap_uwire.o obj-$(CONFIG_SPI_OMAP24XX) += omap2_mcspi.o obj-$(CONFIG_SPI_OMAP_100K) += omap_spi_100k.o
drivers/spi/pxa2xx_spi.c +0 -1
@@ -28,7 +28,6 @@#include <linux/spi/spi.h> #include <linux/workqueue.h> #include <linux/delay.h> -#include <linux/clk.h> #include <linux/gpio.h> #include <linux/slab.h>
drivers/spi/pxa2xx_spi_pci.c new file +201 -0
201 lines not on this page · raw message
include/linux/spi/pxa2xx_spi.h +9 -1
@@ -19,7 +19,6 @@#define __linux_pxa2xx_spi_h#include <linux/pxa2xx_ssp.h> -#include <mach/dma.h> #define PXA2XX_CS_ASSERT (0x01)#define PXA2XX_CS_DEASSERT (0x02)
@@ -44,6 +43,15 @@ struct pxa2xx_spi_chip { void (*cs_control)(u32 command); }; +#ifdef CONFIG_ARCH_PXA + +#include <linux/clk.h> +#include <mach/dma.h> +extern void pxa2xx_set_spi_info (unsigned id,struct pxa2xx_spi_master *info); +#else +#include <asm/pxa2xx_spi_ce4100.h> + +#endif #endif
Signature · 1 line
1.7.3.2
PATCH 6/9 spi/pxa2xx: Consider CE4100's FIFO depth
In reply to Sebastian Andrzej SiewiorFor PXA the default threshold is FIFO_DEPTH / 2. Adjust this value for CE4100.
--- arch/arm/include/asm/pxa2xx_ssp.h | 15 +++++++++++++++ arch/x86/include/asm/pxa2xx_ssp.h | 15 +++++++++++++++ drivers/spi/pxa2xx_spi.c | 2 -- include/linux/pxa2xx_ssp.h | 7 +------ 4 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 arch/arm/include/asm/pxa2xx_ssp.h create mode 100644 arch/x86/include/asm/pxa2xx_ssp.h
arch/arm/include/asm/pxa2xx_ssp.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef ASM_PXA2XX_SSP_H +#define ASM_PXA2XX_SSP_H + +#define RX_THRESH_DFLT 8 +#define TX_THRESH_DFLT 8 + +#define SSSR_TFL_MASK (0xf << 8)/* Transmit FIFO Level mask */ +#define SSSR_RFL_MASK (0xf << 12)/* Receive FIFO Level mask */ + +#define SSCR1_TFT (0x000003c0)/* Transmit FIFO Threshold (mask) */ +#define SSCR1_TxTresh (x) (((x) - 1) << 6)/* level [1..16] */ +#define SSCR1_RFT (0x00003c00)/* Receive FIFO Threshold (mask) */ +#define SSCR1_RxTresh (x) (((x) - 1) << 10)/* level [1..16] */ + +#endif
arch/x86/include/asm/pxa2xx_ssp.h new file +15 -0
@@ -0,0 +1,15 @@ +#ifndef ASM_PXA2XX_SSP_H +#define ASM_PXA2XX_SSP_H + +#define RX_THRESH_DFLT 2 +#define TX_THRESH_DFLT 2 + +#define SSSR_TFL_MASK (0x3 << 8)/* Transmit FIFO Level mask */ +#define SSSR_RFL_MASK (0x3 << 12)/* Receive FIFO Level mask */ + +#define SSCR1_TFT (0x000000c0)/* Transmit FIFO Threshold (mask) */ +#define SSCR1_TxTresh (x) (((x) - 1) << 6)/* level [1..4] */ +#define SSCR1_RFT (0x00000c00)/* Receive FIFO Threshold (mask) */ +#define SSCR1_RxTresh (x) (((x) - 1) << 10)/* level [1..4] */ + +#endif
drivers/spi/pxa2xx_spi.c +0 -2
@@ -43,8 +43,6 @@ MODULE_ALIAS("platform:pxa2xx-spi");#define MAX_BUSES 3 -#define RX_THRESH_DFLT 8 -#define TX_THRESH_DFLT 8#define TIMOUT_DFLT 1000#define DMA_INT_MASK (DCSR_ENDINTR | DCSR_STARTINTR | DCSR_BUSERR)
include/linux/pxa2xx_ssp.h +1 -6
@@ -21,6 +21,7 @@#include <linux/list.h> #include <linux/io.h> +#include <asm/pxa2xx_ssp.h> /* * SSP Serial Port Registers
@@ -71,10 +72,6 @@#define SSCR1_SPO (1 << 3)/* Motorola SPI SSPSCLK polarity setting */ #define SSCR1_SPH (1 << 4)/* Motorola SPI SSPSCLK phase setting */ #define SSCR1_MWDS (1 << 5)/* Microwire Transmit Data Size */ -#define SSCR1_TFT (0x000003c0)/* Transmit FIFO Threshold (mask) */ -#define SSCR1_TxTresh (x) (((x) - 1) << 6)/* level [1..16] */ -#define SSCR1_RFT (0x00003c00)/* Receive FIFO Threshold (mask) */ -#define SSCR1_RxTresh (x) (((x) - 1) << 10)/* level [1..16] */ #define SSSR_TNF (1 << 2)/* Transmit FIFO Not Full */ #define SSSR_RNE (1 << 3)/* Receive FIFO Not Empty */
@@ -82,8 +79,6 @@#define SSSR_TFS (1 << 5)/* Transmit FIFO Service Request */ #define SSSR_RFS (1 << 6)/* Receive FIFO Service Request */ #define SSSR_ROR (1 << 7)/* Receive FIFO Overrun */ -#define SSSR_TFL_MASK (0xf << 8)/* Transmit FIFO Level mask */ -#define SSSR_RFL_MASK (0xf << 12)/* Receive FIFO Level mask */ /* extra bits in PXA255, PXA26x and PXA27x SSP ports */ #define SSCR0_TISSP (1 << 4)/* TI Sync Serial Protocol */
Signature · 1 line
1.7.3.2
PATCH 7/9 spi/pxa2xx: Add chipselect support for Sodaville
In reply to Sebastian Andrzej SiewiorThe SPI core on Sodaville supports chip selects. Its configuration moved into the SSSR register at bit 0 and 1. Thus Sodaville can be hooked up with up to 4 devices.
This patch ensures that the bits which are otherwiese reserved are only touched on Sodaville and not on any other PXAs. Also it makes sure that the status register does not lose the CS information while clearing the ROR bit.
--- drivers/spi/pxa2xx_spi.c | 93 ++++++++++++++++++++++++++++++++------------ include/linux/pxa2xx_ssp.h | 2 + 2 files changed, 70 insertions(+), 25 deletions(-)
drivers/spi/pxa2xx_spi.c +68 -25
@@ -163,7 +163,10 @@ struct chip_data {u8 enable_dma;u8 bits_per_word;u32 speed_hz; -int gpio_cs; +union { +int gpio_cs; +unsigned int frm; + };int gpio_cs_inverted;int (*write)(struct driver_data *drv_data);int (*read)(struct driver_data *drv_data);
@@ -176,6 +179,11 @@ static void cs_assert(struct driver_data *drv_data) {struct chip_data *chip = drv_data->cur_chip; +if (drv_data->ssp_type == Sodaville_SSP) { +write_SSSR (drv_data->cur_chip->frm, drv_data->ioaddr); +return ; + } +if (chip->cs_control) { chip->cs_control (PXA2XX_CS_ASSERT );return ;
@@ -189,6 +197,9 @@ static void cs_deassert(struct driver_data *drv_data) {struct chip_data *chip = drv_data->cur_chip; +if (drv_data->ssp_type == Sodaville_SSP) +return ; +if (chip->cs_control) { chip->cs_control (PXA2XX_CS_DEASSERT );return ;
@@ -198,6 +209,25 @@ static void cs_deassert(struct driver_data *drv_data)gpio_set_value (chip->gpio_cs, !chip->gpio_cs_inverted); } +static void write_SSSR_CS (struct driver_data *drv_data,u32 val) +{ +void __iomem *reg = drv_data->ioaddr; + +if (drv_data->ssp_type == Sodaville_SSP) + val |=read_SSSR (reg) &SSSR_ALT_FRM_MASK ; + +write_SSSR (val, reg); +} + +static int pxa25x_ssp_comp (struct driver_data *drv_data) +{ +if (drv_data->ssp_type == PXA25x_SSP) +return 1 ; +if (drv_data->ssp_type == Sodaville_SSP) +return 1 ; +return 0 ; +} +static int flush (struct driver_data *drv_data) {unsigned long limit = loops_per_jiffy <<1 ;
@@ -209,7 +239,7 @@ static int flush(struct driver_data *drv_data)read_SSDR (reg); } }while ((read_SSSR (reg) &SSSR_BSY ) && --limit); -write_SSSR (SSSR_ROR , reg); +write_SSSR_CS (drv_data,SSSR_ROR );return limit; }
@@ -502,9 +532,9 @@ static void dma_error_stop(struct driver_data *drv_data, const char *msg)/* Stop and reset */ DCSR (drv_data->rx_channel) =RESET_DMA_CHANNEL ;DCSR (drv_data->tx_channel) =RESET_DMA_CHANNEL ; -write_SSSR (drv_data->clear_sr, reg); +write_SSSR_CS (drv_data, drv_data->clear_sr);write_SSCR1 (read_SSCR1 (reg) & ~drv_data->dma_cr1, reg); -if (drv_data->ssp_type != PXA25x_SSP) +if (!pxa25x_ssp_comp (drv_data))write_SSTO (0 , reg);flush (drv_data);write_SSCR0 (read_SSCR0 (reg) & ~SSCR0_SSE , reg);
@@ -524,7 +554,7 @@ static void dma_transfer_complete(struct driver_data *drv_data)/* Clear and disable interrupts on SSP and DMA channels*/ write_SSCR1 (read_SSCR1 (reg) & ~drv_data->dma_cr1, reg); -write_SSSR (drv_data->clear_sr, reg); +write_SSSR_CS (drv_data, drv_data->clear_sr);DCSR (drv_data->tx_channel) =RESET_DMA_CHANNEL ;DCSR (drv_data->rx_channel) =RESET_DMA_CHANNEL ;
@@ -617,7 +647,7 @@ static irqreturn_t dma_transfer(struct driver_data *drv_data)/* Clear and disable timeout interrupt, do the rest in * dma_transfer_complete */ -if (drv_data->ssp_type != PXA25x_SSP) +if (!pxa25x_ssp_comp (drv_data))write_SSTO (0 , reg);/* finish this transfer, start the next */
@@ -635,9 +665,9 @@ static void int_error_stop(struct driver_data *drv_data, const char* msg)void __iomem *reg = drv_data->ioaddr;/* Stop and reset SSP */ -write_SSSR (drv_data->clear_sr, reg); +write_SSSR_CS (drv_data, drv_data->clear_sr);write_SSCR1 (read_SSCR1 (reg) & ~drv_data->int_cr1, reg); -if (drv_data->ssp_type != PXA25x_SSP) +if (!pxa25x_ssp_comp (drv_data))write_SSTO (0 , reg);flush (drv_data);write_SSCR0 (read_SSCR0 (reg) & ~SSCR0_SSE , reg);
@@ -653,9 +683,9 @@ static void int_transfer_complete(struct driver_data *drv_data)void __iomem *reg = drv_data->ioaddr;/* Stop SSP */ -write_SSSR (drv_data->clear_sr, reg); +write_SSSR_CS (drv_data, drv_data->clear_sr);write_SSCR1 (read_SSCR1 (reg) & ~drv_data->int_cr1, reg); -if (drv_data->ssp_type != PXA25x_SSP) +if (!pxa25x_ssp_comp (drv_data))write_SSTO (0 , reg);/* Update total byte transfered return count actual bytes read */
@@ -711,7 +741,7 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data)if (drv_data->tx == drv_data->tx_end) {write_SSCR1 (read_SSCR1 (reg) & ~SSCR1_TIE , reg);/* PXA25x_SSP has no timeout, read trailing bytes */ -if (drv_data->ssp_type == PXA25x_SSP) { +if (pxa25x_ssp_comp (drv_data)) {if (!wait_ssp_rx_stall (reg)) { int_error_stop(drv_data, "interrupt_transfer: "
@@ -754,9 +784,9 @@ static irqreturn_t ssp_int(int irq, void *dev_id)write_SSCR0 (read_SSCR0 (reg) & ~SSCR0_SSE , reg);write_SSCR1 (read_SSCR1 (reg) & ~drv_data->int_cr1, reg); -if (drv_data->ssp_type != PXA25x_SSP) +if (!pxa25x_ssp_comp (drv_data))write_SSTO (0 , reg); -write_SSSR (drv_data->clear_sr, reg); +write_SSSR_CS (drv_data, drv_data->clear_sr);dev_err (&drv_data->pdev->dev,"bad message state " "in interrupt handler\n" );
@@ -869,7 +899,7 @@ static unsigned int ssp_get_clk_div(struct ssp_device *ssp, int rate) {unsigned long ssp_clk =clk_get_rate (ssp->clk); -if (ssp->type == PXA25x_SSP) +if (ssp->type == PXA25x_SSP || ssp->type == Sodaville_SSP)return ((ssp_clk / (2 * rate) -1 ) &0xff ) <<8 ;else return ((ssp_clk / rate -1 ) &0xfff ) <<8 ;
@@ -1095,7 +1125,7 @@ static void pump_transfers(unsigned long data)/* Clear status */ cr1 = chip->cr1 | chip->threshold | drv_data->int_cr1; -write_SSSR (drv_data->clear_sr, reg); +write_SSSR_CS (drv_data, drv_data->clear_sr); }/* see if we need to reload the config registers */
@@ -1105,7 +1135,7 @@ static void pump_transfers(unsigned long data)/* stop the SSP, and update the other bits */ write_SSCR0 (cr0 & ~SSCR0_SSE , reg); -if (drv_data->ssp_type != PXA25x_SSP) +if (!pxa25x_ssp_comp (drv_data))write_SSTO (chip->timeout, reg);/* first set CR1 without interrupt and service enables */ write_SSCR1 (cr1 &SSCR1_CHANGE_MASK , reg);
@@ -1113,7 +1143,7 @@ static void pump_transfers(unsigned long data)write_SSCR0 (cr0, reg); }else { -if (drv_data->ssp_type != PXA25x_SSP) +if (!pxa25x_ssp_comp (drv_data))write_SSTO (chip->timeout, reg); }
@@ -1240,14 +1270,13 @@ static int setup(struct spi_device *spi)uint tx_thres =TX_THRESH_DFLT ;uint rx_thres =RX_THRESH_DFLT ; -if (drv_data->ssp_type != PXA25x_SSP +if (!pxa25x_ssp_comp (drv_data) && (spi->bits_per_word <4 || spi->bits_per_word >32 )) {dev_err (&spi->dev,"failed setup: ssp_type=%d, bits/wrd=%d " "b/w not 4-32 for type non-PXA25x_SSP\n" , drv_data->ssp_type, spi->bits_per_word);return -EINVAL ; - } -else if (drv_data->ssp_type == PXA25x_SSP + }else if (pxa25x_ssp_comp (drv_data) && (spi->bits_per_word <4 || spi->bits_per_word >16 )) { dev_err(&spi->dev, "failed setup: ssp_type=%d, bits/wrd=%d "
@@ -1266,7 +1295,17 @@ static int setup(struct spi_device *spi)return -ENOMEM ; } - chip->gpio_cs =-1 ; +if (drv_data->ssp_type == Sodaville_SSP) { +if (spi->chip_select >4 ) { +dev_err (&spi->dev,"failed setup: " +"cs number must not be > 4.\n" ); +kfree (chip); +return -EINVAL ; + } + + chip->frm = spi->chip_select; + }else + chip->gpio_cs =-1 ; chip->enable_dma =0 ; chip->timeout =TIMOUT_DFLT ; chip->dma_burst_size = drv_data->master_info->enable_dma ?
@@ -1322,7 +1361,7 @@ static int setup(struct spi_device *spi) | (((spi->mode & SPI_CPOL) != 0) ? SSCR1_SPO : 0);/* NOTE: PXA25x_SSP _could_ use external clocking ... */ -if (drv_data->ssp_type != PXA25x_SSP) +if (!pxa25x_ssp_comp (drv_data)) dev_dbg(&spi->dev, "%ld Hz actual, %s\n", clk_get_rate(ssp->clk) / (1 + ((chip->cr0 & SSCR0_SCR(0xfff)) >> 8)),
@@ -1357,17 +1396,21 @@ static int setup(struct spi_device *spi)spi_set_ctldata (spi, chip); +if (drv_data->ssp_type == Sodaville_SSP) +return 0 ; +return setup_cs (spi, chip, chip_info); }static void cleanup (struct spi_device *spi) {struct chip_data *chip =spi_get_ctldata (spi); +struct driver_data *drv_data =spi_master_get_devdata (spi->master);if (!chip)return ; -if (gpio_is_valid (chip->gpio_cs)) +if (drv_data->ssp_type != Sodaville_SSP &&gpio_is_valid (chip->gpio_cs))gpio_free (chip->gpio_cs);kfree (chip);
@@ -1507,7 +1550,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev) drv_data->ioaddr = ssp->mmio_base; drv_data->ssdr_physical = ssp->phys_base +SSDR ; -if (ssp->type == PXA25x_SSP) { +if (pxa25x_ssp_comp (drv_data)) { drv_data->int_cr1 =SSCR1_TIE |SSCR1_RIE ; drv_data->dma_cr1 =0 ; drv_data->clear_sr =SSSR_ROR ;
@@ -1569,7 +1612,7 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev) | SSCR0_Motorola |SSCR0_DataSize (8 ), drv_data->ioaddr); -if (drv_data->ssp_type != PXA25x_SSP) +if (!pxa25x_ssp_comp (drv_data))write_SSTO (0 , drv_data->ioaddr);write_SSPSP (0 , drv_data->ioaddr);
include/linux/pxa2xx_ssp.h +2 -0
@@ -73,6 +73,7 @@#define SSCR1_SPH (1 << 4)/* Motorola SPI SSPSCLK phase setting */ #define SSCR1_MWDS (1 << 5)/* Microwire Transmit Data Size */ +#define SSSR_ALT_FRM_MASK 3/* Masks the SFRM signal number */ #define SSSR_TNF (1 << 2)/* Transmit FIFO Not Full */ #define SSSR_RNE (1 << 3)/* Receive FIFO Not Empty */ #define SSSR_BSY (1 << 4)/* SSP Busy */
@@ -135,6 +136,7 @@ enum pxa_ssp_type { PXA25x_NSSP,/* pxa 255, 26x (including ASSP) */ PXA27x_SSP,PXA168_SSP , + Sodaville_SSP, }; struct ssp_device {
Signature · 1 line
1.7.3.2
PATCH 8/9 spi/pxa2xx: Modify RX-Tresh instead of busy-loop for the remaining RX bytes.
In reply to Sebastian Andrzej SiewiorAfter all TX bytes are sent, the driver spins while the SPI core is busy and then it spins for a "short" period of time until RX bytes are available.
On Sodavile the busy flag disappears pretty quick and after that it takes approx ~130ms (sometimes less but not much) until there are bytes available in the RX FIFO.
This patch removes the busy loop and modifies the RX threshould so we get woken up once the remainings bytes arrived.
--- drivers/spi/pxa2xx_spi.c | 56 ++++++++++++++++++++++++++++++++-------------- 1 files changed, 39 insertions(+), 17 deletions(-)
drivers/spi/pxa2xx_spi.c +39 -17
@@ -660,13 +660,25 @@ static irqreturn_t dma_transfer(struct driver_data *drv_data)return IRQ_NONE ; } +static void reset_sccr1 (struct driver_data *drv_data) +{ +void __iomem *reg = drv_data->ioaddr; +struct chip_data *chip = drv_data->cur_chip; +u32 sccr1_reg; + + sccr1_reg =read_SSCR1 (reg) & ~drv_data->int_cr1; + sccr1_reg &= ~SSCR1_RFT ; + sccr1_reg |= chip->threshold; +write_SSCR1 (sccr1_reg, reg); +} +static void int_error_stop (struct driver_data *drv_data,const char * msg) {void __iomem *reg = drv_data->ioaddr;/* Stop and reset SSP */ write_SSSR_CS (drv_data, drv_data->clear_sr); -write_SSCR1 (read_SSCR1 (reg) & ~drv_data->int_cr1, reg); +reset_sccr1 (drv_data);if (!pxa25x_ssp_comp (drv_data))write_SSTO (0 , reg);flush (drv_data);
@@ -684,7 +696,7 @@ static void int_transfer_complete(struct driver_data *drv_data)/* Stop SSP */ write_SSSR_CS (drv_data, drv_data->clear_sr); -write_SSCR1 (read_SSCR1 (reg) & ~drv_data->int_cr1, reg); +reset_sccr1 (drv_data);if (!pxa25x_ssp_comp (drv_data))write_SSTO (0 , reg);
@@ -739,24 +751,34 @@ static irqreturn_t interrupt_transfer(struct driver_data *drv_data) }if (drv_data->tx == drv_data->tx_end) { -write_SSCR1 (read_SSCR1 (reg) & ~SSCR1_TIE , reg); -/* PXA25x_SSP has no timeout, read trailing bytes */ +u32 bytes_left; +u32 sccr1_reg; + + sccr1_reg =read_SSCR1 (reg); + sccr1_reg &= ~SSCR1_TIE ; + +/* +* PXA25x_SSP has no timeout, set up rx threshould for the +* remaing RX bytes. +*/ if (pxa25x_ssp_comp (drv_data)) { -if (!wait_ssp_rx_stall (reg)) - { -int_error_stop (drv_data,"interrupt_transfer: " -"rx stall failed" ); -return IRQ_HANDLED ; - } -if (!drv_data->read (drv_data)) - { -int_error_stop (drv_data, -"interrupt_transfer: " -"trailing byte read failed" ); -return IRQ_HANDLED ; + + sccr1_reg &= ~SSCR1_RFT ; + + bytes_left = drv_data->rx_end - drv_data->rx; +switch (drv_data->n_bytes) { +case 4 : + bytes_left >>=1 ; +case 2 : + bytes_left >>=1 ; } -int_transfer_complete (drv_data); + +if (bytes_left >RX_THRESH_DFLT ) + bytes_left =RX_THRESH_DFLT ; + + sccr1_reg |=SSCR1_RxTresh (bytes_left); } +write_SSCR1 (sccr1_reg, reg); }/* We did something */
Signature · 1 line
1.7.3.2
PATCH 9/9 spi/pxa2xx: pass of_node to spi device and set a parent device
In reply to Sebastian Andrzej Siewiorthe of_node will auto-publish devices which are added to the device tree.
--- drivers/spi/pxa2xx_spi.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/spi/pxa2xx_spi.c +4 -0
@@ -1556,6 +1556,10 @@ static int __init pxa2xx_spi_probe(struct platform_device *pdev) drv_data->pdev = pdev; drv_data->ssp = ssp; + master->dev.parent = &pdev->dev; +#ifdef CONFIG_OF + master->dev.of_node = pdev->dev.of_node; +#endif /* the spi->mode bits understood by this driver: */ master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH ;
Signature · 1 line
1.7.3.2