aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-06-24 18:13:27 +0000
committerJohn Crispin <blogic@openwrt.org>2014-06-24 18:13:27 +0000
commitf6f6b0e18c895a1c85337199ff746d674bf5f4bf (patch)
tree621dd323706aa8f327830cc64c6e4dcfc786cc88 /target/linux
parent477a08a4da08f5b4e83cfa92e318219b8871e442 (diff)
downloadupstream-f6f6b0e18c895a1c85337199ff746d674bf5f4bf.tar.gz
upstream-f6f6b0e18c895a1c85337199ff746d674bf5f4bf.tar.bz2
upstream-f6f6b0e18c895a1c85337199ff746d674bf5f4bf.zip
atheros[ar2315-spiflash]: pass I/O mem regions via resources
Pass I/O memory regions (flash read and MMR) via platform device resources array and use them inside spiflash driver. Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41320 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/atheros/patches-3.10/100-board.patch16
-rw-r--r--target/linux/atheros/patches-3.10/120-spiflash.patch19
2 files changed, 24 insertions, 11 deletions
diff --git a/target/linux/atheros/patches-3.10/100-board.patch b/target/linux/atheros/patches-3.10/100-board.patch
index eb927f768a..d7bd94a769 100644
--- a/target/linux/atheros/patches-3.10/100-board.patch
+++ b/target/linux/atheros/patches-3.10/100-board.patch
@@ -750,7 +750,7 @@
+#define AR2315_ENET0 0x10500000 /* ETHERNET MMR */
+#define AR2315_DSLBASE 0x11000000 /* RESET CONTROL MMR */
+#define AR2315_UART0 0x11100003 /* UART MMR */
-+#define AR2315_SPI 0x11300000 /* SPI FLASH MMR */
++#define AR2315_SPI_MMR 0x11300000 /* SPI FLASH MMR */
+#define AR2315_PCIEXT 0x80000000 /* pci external */
+
+/*
@@ -2521,16 +2521,16 @@
+
+static struct resource ar2315_spiflash_res[] = {
+ {
-+ .name = "flash_base",
++ .name = "spiflash_read",
+ .flags = IORESOURCE_MEM,
-+ .start = KSEG1ADDR(AR2315_SPI_READ),
-+ .end = KSEG1ADDR(AR2315_SPI_READ) + 0x1000000 - 1,
++ .start = AR2315_SPI_READ,
++ .end = AR2315_SPI_READ + 0x1000000 - 1,
+ },
+ {
-+ .name = "flash_regs",
++ .name = "spiflash_mmr",
+ .flags = IORESOURCE_MEM,
-+ .start = 0x11300000,
-+ .end = 0x11300012,
++ .start = AR2315_SPI_MMR,
++ .end = AR2315_SPI_MMR + 12 - 1,
+ },
+};
+
@@ -2553,7 +2553,7 @@
+ */
+static u8 __init *ar2315_flash_limit(void)
+{
-+ return (u8 *)ar2315_spiflash_res[0].end + 1;
++ return (u8 *)KSEG1ADDR(ar2315_spiflash_res[0].end + 1);
+}
+
+#ifdef CONFIG_LEDS_GPIO
diff --git a/target/linux/atheros/patches-3.10/120-spiflash.patch b/target/linux/atheros/patches-3.10/120-spiflash.patch
index 262af6094c..8630a3a2d1 100644
--- a/target/linux/atheros/patches-3.10/120-spiflash.patch
+++ b/target/linux/atheros/patches-3.10/120-spiflash.patch
@@ -23,7 +23,7 @@
--- /dev/null
+++ b/drivers/mtd/devices/ar2315.c
-@@ -0,0 +1,527 @@
+@@ -0,0 +1,540 @@
+
+/*
+ * MTD driver for the SPI Flash Memory support on Atheros AR2315
@@ -452,6 +452,7 @@
+{
+ struct spiflash_priv *priv;
+ struct mtd_info *mtd;
++ struct resource *res;
+ int index;
+ int result = 0;
+
@@ -461,7 +462,13 @@
+ priv->state = FL_READY;
+ mtd = &priv->mtd;
+
-+ priv->mmraddr = ioremap_nocache(SPI_FLASH_MMR, SPI_FLASH_MMR_SIZE);
++ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
++ if (!res) {
++ dev_err(&pdev->dev, "No MMR resource found\n");
++ goto error;
++ }
++
++ priv->mmraddr = ioremap_nocache(res->start, resource_size(res));
+ if (!priv->mmraddr) {
+ dev_warn(&pdev->dev, SPIFLASH "Failed to map flash device\n");
+ goto error;
@@ -473,7 +480,13 @@
+ goto error;
+ }
+
-+ priv->readaddr = ioremap_nocache(SPI_FLASH_READ,
++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
++ if (!res) {
++ dev_err(&pdev->dev, "No flash readmem resource found\n");
++ goto error;
++ }
++
++ priv->readaddr = ioremap_nocache(res->start,
+ flashconfig_tbl[index].byte_cnt);
+ if (!priv->readaddr) {
+ dev_warn(&pdev->dev, SPIFLASH "Failed to map flash device\n");