aboutsummaryrefslogtreecommitdiffstats
path: root/package/boot/uboot-lantiq/patches/0004-sf-add-slim-probe-funtions-for-SPL.patch
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2014-04-12 21:21:14 +0000
committerJohn Crispin <john@openwrt.org>2014-04-12 21:21:14 +0000
commit1246dce0b31d3b950e04ab3a6fd466f289510c7c (patch)
tree5a8031c749e5208b4e979aad0f54ebb7841670b3 /package/boot/uboot-lantiq/patches/0004-sf-add-slim-probe-funtions-for-SPL.patch
parent22916814e3621dd807b0d89485ba3c60cfdf7c10 (diff)
downloadupstream-1246dce0b31d3b950e04ab3a6fd466f289510c7c.tar.gz
upstream-1246dce0b31d3b950e04ab3a6fd466f289510c7c.tar.bz2
upstream-1246dce0b31d3b950e04ab3a6fd466f289510c7c.zip
uboot-lantiq: update to v2013.10
Patches created from tree: git@github.com:danielschwierzeck/u-boot-lantiq.git v2013.10..u-boot-lantiq-v2013.10-openwrt4 Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> SVN-Revision: 40482
Diffstat (limited to 'package/boot/uboot-lantiq/patches/0004-sf-add-slim-probe-funtions-for-SPL.patch')
-rw-r--r--package/boot/uboot-lantiq/patches/0004-sf-add-slim-probe-funtions-for-SPL.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/package/boot/uboot-lantiq/patches/0004-sf-add-slim-probe-funtions-for-SPL.patch b/package/boot/uboot-lantiq/patches/0004-sf-add-slim-probe-funtions-for-SPL.patch
new file mode 100644
index 0000000000..d1768afec8
--- /dev/null
+++ b/package/boot/uboot-lantiq/patches/0004-sf-add-slim-probe-funtions-for-SPL.patch
@@ -0,0 +1,87 @@
+From da11da943487e2f724f25d409bcaa1f099637c0b Mon Sep 17 00:00:00 2001
+From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
+Date: Sun, 13 Oct 2013 14:56:45 +0200
+Subject: sf: add slim probe funtions for SPL
+
+Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
+
+diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
+index 2bba10c..380aa09 100644
+--- a/drivers/mtd/spi/sf_probe.c
++++ b/drivers/mtd/spi/sf_probe.c
+@@ -365,3 +365,58 @@ void spi_flash_free(struct spi_flash *flash)
+ spi_free_slave(flash->spi);
+ free(flash);
+ }
++
++#ifdef CONFIG_SPI_SPL_SIMPLE
++int spl_spi_flash_probe(struct spi_flash *flash)
++{
++ struct spi_slave *spi;
++ u8 idcode[5];
++ int ret;
++
++ /* Setup spi_slave */
++ spi = spi_setup_slave(CONFIG_SPL_SPI_BUS, CONFIG_SPL_SPI_CS,
++ CONFIG_SPL_SPI_MAX_HZ, CONFIG_SPL_SPI_MODE);
++ if (!spi) {
++ debug("SF: Failed to set up slave\n");
++ return -1;
++ }
++
++ /* Claim spi bus */
++ ret = spi_claim_bus(spi);
++ if (ret) {
++ debug("SF: Failed to claim SPI bus: %d\n", ret);
++ goto err_claim_bus;
++ }
++
++ /* Read the ID codes */
++ ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode));
++ if (ret) {
++ debug("SF: Failed to get idcodes\n");
++ goto err_read_id;
++ }
++
++ /* Validate params from spi_flash_params table */
++ flash->spi = spi;
++ ret = spi_flash_validate_params(flash, idcode);
++ if (ret)
++ goto err_read_id;
++
++ /* Release spi bus */
++ spi_release_bus(spi);
++
++ return 0;
++
++err_read_id:
++ spi_release_bus(spi);
++err_claim_bus:
++ spi_free_slave(spi);
++ flash->spi = NULL;
++
++ return ret;
++}
++
++void spl_spi_flash_free(struct spi_flash *flash)
++{
++ spi_free_slave(flash->spi);
++}
++#endif
+diff --git a/include/spi_flash.h b/include/spi_flash.h
+index 25ca8f1..411dd1b 100644
+--- a/include/spi_flash.h
++++ b/include/spi_flash.h
+@@ -69,6 +69,9 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
+ unsigned int max_hz, unsigned int spi_mode);
+ void spi_flash_free(struct spi_flash *flash);
+
++int spl_spi_flash_probe(struct spi_flash *flash);
++void spl_spi_flash_free(struct spi_flash *flash);
++
+ static inline int spi_flash_read(struct spi_flash *flash, u32 offset,
+ size_t len, void *buf)
+ {
+--
+1.8.3.2
+