aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-09-13 07:26:25 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-09-13 07:26:25 +0000
commit4fd67c3cd4bbc5e10736bbe1213d68c1490ba8f3 (patch)
tree71520d1e28e83bf40e0ac47254bb4f6266a4cacd /target
parent10cd35c0e73efee56fbcefa3a2d4ac6a2e8a9bc8 (diff)
downloadupstream-4fd67c3cd4bbc5e10736bbe1213d68c1490ba8f3.tar.gz
upstream-4fd67c3cd4bbc5e10736bbe1213d68c1490ba8f3.tar.bz2
upstream-4fd67c3cd4bbc5e10736bbe1213d68c1490ba8f3.zip
ar71xx: add device registration code for the AR934x NAND flash controller
SVN-Revision: 33387
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.c95
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.h27
-rw-r--r--target/linux/ar71xx/patches-3.3/602-MIPS-ath79-add-openwrt-stuff.patch16
-rw-r--r--target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch4
-rw-r--r--target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch2
-rw-r--r--target/linux/ar71xx/patches-3.3/612-ALL0315N-support.patch2
-rw-r--r--target/linux/ar71xx/patches-3.3/613-RB2011-support.patch2
7 files changed, 141 insertions, 7 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.c b/target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.c
new file mode 100644
index 0000000000..f330395fe2
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.c
@@ -0,0 +1,95 @@
+/*
+ * Atheros AR934X SoCs built-in NAND flash controller support
+ *
+ * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/dma-mapping.h>
+#include <linux/etherdevice.h>
+#include <linux/platform_device.h>
+#include <linux/platform/ar934x_nfc.h>
+
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/ar71xx_regs.h>
+
+#include "dev-nfc.h"
+
+static struct resource ath79_nfc_resources[2];
+static u64 ar934x_nfc_dmamask = DMA_BIT_MASK(32);
+static struct ar934x_nfc_platform_data ath79_nfc_data;
+
+static struct platform_device ath79_nfc_device = {
+ .name = AR934X_NFC_DRIVER_NAME,
+ .id = -1,
+ .resource = ath79_nfc_resources,
+ .num_resources = ARRAY_SIZE(ath79_nfc_resources),
+ .dev = {
+ .dma_mask = &ar934x_nfc_dmamask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
+ .platform_data = &ath79_nfc_data,
+ },
+};
+
+static void ar934x_nfc_hw_reset(bool active)
+{
+ if (active) {
+ ath79_device_reset_set(AR934X_RESET_NANDF);
+ udelay(100);
+
+ ath79_device_reset_set(AR934X_RESET_ETH_SWITCH_ANALOG);
+ udelay(250);
+ } else {
+ ath79_device_reset_clear(AR934X_RESET_ETH_SWITCH_ANALOG);
+ udelay(250);
+
+ ath79_device_reset_clear(AR934X_RESET_NANDF);
+ udelay(100);
+ }
+}
+
+static void ar934x_nfc_setup(void)
+{
+ ath79_nfc_resources[0].start = AR934X_NFC_BASE;
+ ath79_nfc_resources[0].end = AR934X_NFC_BASE + AR934X_NFC_SIZE - 1;
+ ath79_nfc_resources[0].flags = IORESOURCE_MEM;
+
+ ath79_nfc_resources[1].start = ATH79_MISC_IRQ(21);
+ ath79_nfc_resources[1].end = ATH79_MISC_IRQ(21);
+ ath79_nfc_resources[1].flags = IORESOURCE_IRQ;
+
+ ath79_nfc_data.hw_reset = ar934x_nfc_hw_reset;
+
+ platform_device_register(&ath79_nfc_device);
+}
+
+void __init ath79_nfc_set_select_chip(void (*f)(int chip_no))
+{
+ ath79_nfc_data.select_chip = f;
+}
+
+void __init ath79_nfc_set_scan_fixup(int (*f)(struct mtd_info *mtd))
+{
+ ath79_nfc_data.scan_fixup = f;
+}
+
+void __init ath79_nfc_set_parts(struct mtd_partition *parts, int nr_parts)
+{
+ ath79_nfc_data.parts = parts;
+ ath79_nfc_data.nr_parts = nr_parts;
+}
+
+void __init ath79_register_nfc(void)
+{
+ if (soc_is_ar934x())
+ ar934x_nfc_setup();
+ else
+ BUG();
+}
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.h b/target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.h
new file mode 100644
index 0000000000..1fc4b807b1
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ath79/dev-nfc.h
@@ -0,0 +1,27 @@
+/*
+ * Atheros AR934X SoCs built-in NAND Flash Controller support
+ *
+ * Copyright (C) 2011-2012 Gabor Juhos <juhosg@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#ifndef _ATH79_DEV_NFC_H
+#define _ATH79_DEV_NFC_H
+
+#ifdef CONFIG_ATH79_DEV_NFC
+void ath79_nfc_set_parts(struct mtd_partition *parts, int nr_parts);
+void ath79_nfc_set_select_chip(void (*f)(int chip_no));
+void ath79_nfc_set_scan_fixup(int (*f)(struct mtd_info *mtd));
+void ath79_register_nfc(void);
+#else
+static inline void ath79_nfc_set_parts(struct mtd_partition *parts,
+ int nr_parts) {}
+static inline void ath79_nfc_set_select_chip(void (*f)(int chip_no)) {}
+static inline void ath79_nfc_set_scan_fixup(int (*f)(struct mtd_info *mtd)) {}
+static inline void ath79_register_nfc(void) {}
+#endif
+
+#endif /* _ATH79_DEV_NFC_H */
diff --git a/target/linux/ar71xx/patches-3.3/602-MIPS-ath79-add-openwrt-stuff.patch b/target/linux/ar71xx/patches-3.3/602-MIPS-ath79-add-openwrt-stuff.patch
index 3c96819df4..e61496fcd4 100644
--- a/target/linux/ar71xx/patches-3.3/602-MIPS-ath79-add-openwrt-stuff.patch
+++ b/target/linux/ar71xx/patches-3.3/602-MIPS-ath79-add-openwrt-stuff.patch
@@ -21,7 +21,18 @@
config PCI_AR724X
def_bool n
-@@ -125,4 +139,13 @@ config ATH79_DEV_WMAC
+@@ -115,6 +129,10 @@ config ATH79_DEV_GPIO_BUTTONS
+ config ATH79_DEV_LEDS_GPIO
+ def_bool n
+
++config ATH79_DEV_NFC
++ depends on (SOC_AR934X)
++ def_bool n
++
+ config ATH79_DEV_SPI
+ def_bool n
+
+@@ -125,4 +143,13 @@ config ATH79_DEV_WMAC
depends on (SOC_AR913X || SOC_AR933X || SOC_AR934X || SOC_QCA955X)
def_bool n
@@ -37,7 +48,7 @@
endif
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
-@@ -17,13 +17,24 @@ obj-$(CONFIG_PCI) += pci.o
+@@ -17,13 +17,25 @@ obj-$(CONFIG_PCI) += pci.o
# Devices
#
obj-y += dev-common.o
@@ -47,6 +58,7 @@
obj-$(CONFIG_ATH79_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o
obj-$(CONFIG_ATH79_DEV_LEDS_GPIO) += dev-leds-gpio.o
+obj-$(CONFIG_ATH79_DEV_M25P80) += dev-m25p80.o
++obj-$(CONFIG_ATH79_DEV_NFC) += dev-nfc.o
obj-$(CONFIG_ATH79_DEV_SPI) += dev-spi.o
obj-$(CONFIG_ATH79_DEV_USB) += dev-usb.o
obj-$(CONFIG_ATH79_DEV_WMAC) += dev-wmac.o
diff --git a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch
index 59eeee0699..a5fed12f3c 100644
--- a/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch
+++ b/target/linux/ar71xx/patches-3.3/610-MIPS-ath79-openwrt-machines.patch
@@ -671,7 +671,7 @@
def_bool n
config ATH79_DEV_GPIO_BUTTONS
-@@ -156,4 +671,7 @@ config ATH79_PCI_ATH9K_FIXUP
+@@ -160,4 +675,7 @@ config ATH79_PCI_ATH9K_FIXUP
config ATH79_ROUTERBOOT
def_bool n
@@ -681,7 +681,7 @@
endif
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
-@@ -37,9 +37,62 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
+@@ -38,9 +38,62 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
#
# Machines
#
diff --git a/target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch b/target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch
index 319f1f5ce7..cd39f52969 100644
--- a/target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch
+++ b/target/linux/ar71xx/patches-3.3/611-TEW-712BR-support.patch
@@ -19,7 +19,7 @@
select SOC_AR71XX
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
-@@ -68,6 +68,7 @@ obj-$(CONFIG_ATH79_MACH_RB750) += mach-
+@@ -69,6 +69,7 @@ obj-$(CONFIG_ATH79_MACH_RB750) += mach-
obj-$(CONFIG_ATH79_MACH_RW2458N) += mach-rw2458n.o
obj-$(CONFIG_ATH79_MACH_TEW_632BRP) += mach-tew-632brp.o
obj-$(CONFIG_ATH79_MACH_TEW_673GRU) += mach-tew-673gru.o
diff --git a/target/linux/ar71xx/patches-3.3/612-ALL0315N-support.patch b/target/linux/ar71xx/patches-3.3/612-ALL0315N-support.patch
index fafb112400..7dedc04103 100644
--- a/target/linux/ar71xx/patches-3.3/612-ALL0315N-support.patch
+++ b/target/linux/ar71xx/patches-3.3/612-ALL0315N-support.patch
@@ -18,7 +18,7 @@
select SOC_AR724X
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
-@@ -40,6 +40,7 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
+@@ -41,6 +41,7 @@ obj-$(CONFIG_ATH79_ROUTERBOOT) += route
obj-$(CONFIG_ATH79_MACH_ALFA_AP96) += mach-alfa-ap96.o
obj-$(CONFIG_ATH79_MACH_ALFA_NX) += mach-alfa-nx.o
obj-$(CONFIG_ATH79_MACH_ALL0258N) += mach-all0258n.o
diff --git a/target/linux/ar71xx/patches-3.3/613-RB2011-support.patch b/target/linux/ar71xx/patches-3.3/613-RB2011-support.patch
index be2b144c74..656d5f8b59 100644
--- a/target/linux/ar71xx/patches-3.3/613-RB2011-support.patch
+++ b/target/linux/ar71xx/patches-3.3/613-RB2011-support.patch
@@ -24,7 +24,7 @@
ATH79_MACH_TEW_673GRU, /* TRENDnet TEW-673GRU */
--- a/arch/mips/ath79/Makefile
+++ b/arch/mips/ath79/Makefile
-@@ -66,6 +66,7 @@ obj-$(CONFIG_ATH79_MACH_PB44) += mach-p
+@@ -67,6 +67,7 @@ obj-$(CONFIG_ATH79_MACH_PB44) += mach-p
obj-$(CONFIG_ATH79_MACH_PB92) += mach-pb92.o
obj-$(CONFIG_ATH79_MACH_RB4XX) += mach-rb4xx.o
obj-$(CONFIG_ATH79_MACH_RB750) += mach-rb750.o