ar71xx: use backported SPI patches

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>

SVN-Revision: 35873
This commit is contained in:
Gabor Juhos 2013-03-04 09:40:44 +00:00
parent c28cdfab31
commit 0ad50b0bec
8 changed files with 119 additions and 69 deletions

View file

@ -1,19 +1,23 @@
From cbb3ade4765bc715b5c2eae4a7b6eaf3ff7ad958 Mon Sep 17 00:00:00 2001
From 486c150478777ef53cfef6f0d46840b9406b0612 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Wed, 11 Jan 2012 20:06:35 +0100
Subject: [PATCH 28/34] spi/ath79: add delay between SCK changes
Date: Thu, 27 Dec 2012 10:42:24 +0100
Subject: [PATCH] spi/ath79: add delay between SCK changes
commit 440114fdb13cbc53ea734bcc05b86bcf5b1e430c upstream.
The driver uses the "as fast as it can" approach
to drive the SCK signal. However this does not
work with certain low speed SPI chips (e.g. the
PCF2123 RTC chip). Add per-bit slowdowns in order
to be able to use the driver with such chips as
well.
PCF2123 RTC chip).
The patch adds per-bit slowdowns in order to be
able to use the driver with such chips as well.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/spi/spi-ath79.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 1 deletions(-)
1 file changed, 43 insertions(+), 1 deletion(-)
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c

View file

@ -0,0 +1,31 @@
From c7c943b1e3813ff5764ee6417a14530cb7cd6f57 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Thu, 27 Dec 2012 10:42:25 +0100
Subject: [PATCH] spi/ath79: add missing HIGH->LOW SCK transition
commit 72611db0eef21f4456d79ba302af4b34ea384f30 upstream.
The 'ath79_spi_txrx_mode0' function does not
set the SCK signal to LOW at the end of a word
transfer. This causes communications errors with
certain devices (e.g. the PCF2123 RTC chip).
The patch ensures that the SCK signal will be LOW.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/spi/spi-ath79.c | 2 ++
1 file changed, 2 insertions(+)
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -200,6 +200,8 @@ static u32 ath79_spi_txrx_mode0(struct s
ath79_spi_delay(sp, nsecs);
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out | AR71XX_SPI_IOC_CLK);
ath79_spi_delay(sp, nsecs);
+ if (bits == 1)
+ ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out);
word <<= 1;
}

View file

@ -1,7 +1,9 @@
From 06752f9b169493cd1323f8337c147ad2dd31025c Mon Sep 17 00:00:00 2001
From 622d87da7f99b29dde053881bf42c46de7572ce5 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 9 Jan 2012 15:03:28 +0100
Subject: [PATCH 30/34] spi/ath79: remove superfluous chip select code
Date: Thu, 27 Dec 2012 10:42:26 +0100
Subject: [PATCH] spi/ath79: remove superfluous chip select code
commit f1e8fc9898fd8ca78b7438d3c2e60028d3ae2a34 upstream.
The spi_bitbang driver calls the chipselect function
of the driver from spi_bitbang_setup in order to
@ -9,9 +11,10 @@ deselect the given SPI chip, so we don't have to
initialize the CS line here.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/spi/spi-ath79.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)
1 file changed, 6 deletions(-)
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c

View file

@ -1,14 +1,17 @@
From 6bd876a46b977643f27d2cc63f49e1bc84b78134 Mon Sep 17 00:00:00 2001
From f0b166c931c9971f2ae9614881565d23f58b3178 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 9 Jan 2012 15:04:21 +0100
Subject: [PATCH 31/34] spi/ath79: use gpio_request_one
Date: Thu, 27 Dec 2012 10:42:27 +0100
Subject: [PATCH] spi/ath79: use gpio_request_one
commit 95d79419feffb326a3d5cb50e2248129dec06bb0 upstream.
Use gpio_request_one() instead of multiple gpiolib calls.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/spi/spi-ath79.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
drivers/spi/spi-ath79.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c

View file

@ -1,7 +1,10 @@
From e63ceaa0c4f7be0498cd452981073d3ce8e7d1f5 Mon Sep 17 00:00:00 2001
From d731c08cf1d264fd6113b9a97790c5a3a86ea520 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Mon, 9 Jan 2012 15:00:46 +0100
Subject: [PATCH 32/34] spi/ath79: avoid multiple initialization of the SPI controller
Date: Thu, 27 Dec 2012 10:42:28 +0100
Subject: [PATCH] spi/ath79: avoid multiple initialization of the SPI
controller
commit c4a31f43005512b366e8bfc346e7f14c1a7a1ba7 upstream.
Currently we are initializing the SPI controller in
the chip select line function, and that function is
@ -14,9 +17,10 @@ and call those from probe/response in order to avoid
the mutliple initialization of the controller.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/spi/spi-ath79.c | 41 ++++++++++++++++++++++++-----------------
1 files changed, 24 insertions(+), 17 deletions(-)
1 file changed, 24 insertions(+), 17 deletions(-)
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c

View file

@ -0,0 +1,54 @@
From a32b0e7851320cba0144d20e87e5326ee81e1063 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Tue, 5 Feb 2013 20:57:55 +0100
Subject: [PATCH] spi/ath79: add shutdown handler
commit 7410e848583f9120dd5f9414629f01bb76b5ee5f upstream.
The SPI controller of the AR7xxx/AR9xxx SoCs
have a special mode which allows the SoC to
directly read data from SPI flash chips. In
this mode, the content of the SPI flash chip
can be accessed via a memory mapped region.
During early init time, the kernel expects
that the flash chip is accessible through
that memory region because it reads board
specific values (e.g. MAC address, WiFi
calibration data) from the flash on various
boards.
This is working if the kernel is loaded
directly by the bootloader because that
leaves the SPI controller in the special
mode. However it is not working in a kexec'd
kernel because the SPI driver does not restore
the special mode during shutdown.
The patch adds a shutdown handler to fix this
issue.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---
drivers/spi/spi-ath79.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -308,9 +308,15 @@ static int ath79_spi_remove(struct platf
return 0;
}
+static void ath79_spi_shutdown(struct platform_device *pdev)
+{
+ ath79_spi_remove(pdev);
+}
+
static struct platform_driver ath79_spi_driver = {
.probe = ath79_spi_probe,
.remove = ath79_spi_remove,
+ .shutdown = ath79_spi_shutdown,
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,

View file

@ -1,21 +0,0 @@
From bcb0fdebc08f828b54d0a2eb74a9d1378701a8e0 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Wed, 11 Jan 2012 20:33:41 +0100
Subject: [PATCH 29/34] spi/ath79: add missing HIGH->LOW SCK transition
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/spi/spi-ath79.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -200,6 +200,8 @@ static u32 ath79_spi_txrx_mode0(struct s
ath79_spi_delay(sp, nsecs);
ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out | AR71XX_SPI_IOC_CLK);
ath79_spi_delay(sp, nsecs);
+ if (bits == 1)
+ ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, out);
word <<= 1;
}

View file

@ -1,28 +0,0 @@
From dab305def68a9ea28c1c0ca2fc20bba645944914 Mon Sep 17 00:00:00 2001
From: Gabor Juhos <juhosg@openwrt.org>
Date: Wed, 11 Jan 2012 22:19:32 +0100
Subject: [PATCH 33/34] spi/ath79: add shutdown handler
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
drivers/spi/spi-ath79.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -308,9 +308,15 @@ static int ath79_spi_remove(struct platf
return 0;
}
+static void ath79_spi_shutdown(struct platform_device *pdev)
+{
+ ath79_spi_remove(pdev);
+}
+
static struct platform_driver ath79_spi_driver = {
.probe = ath79_spi_probe,
.remove = ath79_spi_remove,
+ .shutdown = ath79_spi_shutdown,
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,