From 0ad50b0bec02ae964b722eb865d79e80439e066c Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 4 Mar 2013 09:40:44 +0000 Subject: [PATCH] ar71xx: use backported SPI patches Signed-off-by: Gabor Juhos SVN-Revision: 35873 --- ...ath79-add-delay-between-SCK-changes.patch} | 18 ++++--- ...-add-missing-HIGH-LOW-SCK-transition.patch | 31 +++++++++++ ...remove-superfluous-chip-select-code.patch} | 11 ++-- ... 004-spi-ath79-use-gpio_request_one.patch} | 13 +++-- ...ultiple-initialization-of-the-SPI-c.patch} | 12 +++-- .../006-spi-ath79-add-shutdown-handler.patch | 54 +++++++++++++++++++ ...-add-missing-HIGH-LOW-SCK-transition.patch | 21 -------- .../205-spi-ath79-add-shutdown-handler.patch | 28 ---------- 8 files changed, 119 insertions(+), 69 deletions(-) rename target/linux/ar71xx/patches-3.8/{200-spi-ath79-add-delay-between-SCK-changes.patch => 001-spi-ath79-add-delay-between-SCK-changes.patch} (86%) create mode 100644 target/linux/ar71xx/patches-3.8/002-spi-ath79-add-missing-HIGH-LOW-SCK-transition.patch rename target/linux/ar71xx/patches-3.8/{202-spi-ath79-remove-superfluous-chip-select-code.patch => 003-spi-ath79-remove-superfluous-chip-select-code.patch} (69%) rename target/linux/ar71xx/patches-3.8/{203-spi-ath79-use-gpio_request_one.patch => 004-spi-ath79-use-gpio_request_one.patch} (76%) rename target/linux/ar71xx/patches-3.8/{204-spi-ath79-avoid-multiple-initialization-of-the-SPI-c.patch => 005-spi-ath79-avoid-multiple-initialization-of-the-SPI-c.patch} (88%) create mode 100644 target/linux/ar71xx/patches-3.8/006-spi-ath79-add-shutdown-handler.patch delete mode 100644 target/linux/ar71xx/patches-3.8/201-spi-ath79-add-missing-HIGH-LOW-SCK-transition.patch delete mode 100644 target/linux/ar71xx/patches-3.8/205-spi-ath79-add-shutdown-handler.patch diff --git a/target/linux/ar71xx/patches-3.8/200-spi-ath79-add-delay-between-SCK-changes.patch b/target/linux/ar71xx/patches-3.8/001-spi-ath79-add-delay-between-SCK-changes.patch similarity index 86% rename from target/linux/ar71xx/patches-3.8/200-spi-ath79-add-delay-between-SCK-changes.patch rename to target/linux/ar71xx/patches-3.8/001-spi-ath79-add-delay-between-SCK-changes.patch index 7db744acf6..9a1062287c 100644 --- a/target/linux/ar71xx/patches-3.8/200-spi-ath79-add-delay-between-SCK-changes.patch +++ b/target/linux/ar71xx/patches-3.8/001-spi-ath79-add-delay-between-SCK-changes.patch @@ -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 -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 +Signed-off-by: Grant Likely --- 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 diff --git a/target/linux/ar71xx/patches-3.8/002-spi-ath79-add-missing-HIGH-LOW-SCK-transition.patch b/target/linux/ar71xx/patches-3.8/002-spi-ath79-add-missing-HIGH-LOW-SCK-transition.patch new file mode 100644 index 0000000000..393ffa5158 --- /dev/null +++ b/target/linux/ar71xx/patches-3.8/002-spi-ath79-add-missing-HIGH-LOW-SCK-transition.patch @@ -0,0 +1,31 @@ +From c7c943b1e3813ff5764ee6417a14530cb7cd6f57 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +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 +Signed-off-by: Grant Likely +--- + 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; + } diff --git a/target/linux/ar71xx/patches-3.8/202-spi-ath79-remove-superfluous-chip-select-code.patch b/target/linux/ar71xx/patches-3.8/003-spi-ath79-remove-superfluous-chip-select-code.patch similarity index 69% rename from target/linux/ar71xx/patches-3.8/202-spi-ath79-remove-superfluous-chip-select-code.patch rename to target/linux/ar71xx/patches-3.8/003-spi-ath79-remove-superfluous-chip-select-code.patch index eec3293d9e..58272bdbf5 100644 --- a/target/linux/ar71xx/patches-3.8/202-spi-ath79-remove-superfluous-chip-select-code.patch +++ b/target/linux/ar71xx/patches-3.8/003-spi-ath79-remove-superfluous-chip-select-code.patch @@ -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 -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 +Signed-off-by: Grant Likely --- 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 diff --git a/target/linux/ar71xx/patches-3.8/203-spi-ath79-use-gpio_request_one.patch b/target/linux/ar71xx/patches-3.8/004-spi-ath79-use-gpio_request_one.patch similarity index 76% rename from target/linux/ar71xx/patches-3.8/203-spi-ath79-use-gpio_request_one.patch rename to target/linux/ar71xx/patches-3.8/004-spi-ath79-use-gpio_request_one.patch index 12559bcae1..ee81ecd7fd 100644 --- a/target/linux/ar71xx/patches-3.8/203-spi-ath79-use-gpio_request_one.patch +++ b/target/linux/ar71xx/patches-3.8/004-spi-ath79-use-gpio_request_one.patch @@ -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 -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 +Signed-off-by: Grant Likely --- - 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 diff --git a/target/linux/ar71xx/patches-3.8/204-spi-ath79-avoid-multiple-initialization-of-the-SPI-c.patch b/target/linux/ar71xx/patches-3.8/005-spi-ath79-avoid-multiple-initialization-of-the-SPI-c.patch similarity index 88% rename from target/linux/ar71xx/patches-3.8/204-spi-ath79-avoid-multiple-initialization-of-the-SPI-c.patch rename to target/linux/ar71xx/patches-3.8/005-spi-ath79-avoid-multiple-initialization-of-the-SPI-c.patch index e69b9b3958..8ad1dc3a93 100644 --- a/target/linux/ar71xx/patches-3.8/204-spi-ath79-avoid-multiple-initialization-of-the-SPI-c.patch +++ b/target/linux/ar71xx/patches-3.8/005-spi-ath79-avoid-multiple-initialization-of-the-SPI-c.patch @@ -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 -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 +Signed-off-by: Grant Likely --- 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 diff --git a/target/linux/ar71xx/patches-3.8/006-spi-ath79-add-shutdown-handler.patch b/target/linux/ar71xx/patches-3.8/006-spi-ath79-add-shutdown-handler.patch new file mode 100644 index 0000000000..6f59884374 --- /dev/null +++ b/target/linux/ar71xx/patches-3.8/006-spi-ath79-add-shutdown-handler.patch @@ -0,0 +1,54 @@ +From a32b0e7851320cba0144d20e87e5326ee81e1063 Mon Sep 17 00:00:00 2001 +From: Gabor Juhos +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 +Signed-off-by: Grant Likely +--- + 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, diff --git a/target/linux/ar71xx/patches-3.8/201-spi-ath79-add-missing-HIGH-LOW-SCK-transition.patch b/target/linux/ar71xx/patches-3.8/201-spi-ath79-add-missing-HIGH-LOW-SCK-transition.patch deleted file mode 100644 index fd3d9689a2..0000000000 --- a/target/linux/ar71xx/patches-3.8/201-spi-ath79-add-missing-HIGH-LOW-SCK-transition.patch +++ /dev/null @@ -1,21 +0,0 @@ -From bcb0fdebc08f828b54d0a2eb74a9d1378701a8e0 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -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 ---- - 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; - } diff --git a/target/linux/ar71xx/patches-3.8/205-spi-ath79-add-shutdown-handler.patch b/target/linux/ar71xx/patches-3.8/205-spi-ath79-add-shutdown-handler.patch deleted file mode 100644 index fc54923bbe..0000000000 --- a/target/linux/ar71xx/patches-3.8/205-spi-ath79-add-shutdown-handler.patch +++ /dev/null @@ -1,28 +0,0 @@ -From dab305def68a9ea28c1c0ca2fc20bba645944914 Mon Sep 17 00:00:00 2001 -From: Gabor Juhos -Date: Wed, 11 Jan 2012 22:19:32 +0100 -Subject: [PATCH 33/34] spi/ath79: add shutdown handler - -Signed-off-by: Gabor Juhos ---- - 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, -- 2.30.2