summaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-04-07 20:53:34 +0000
committerjuhosg <juhosg@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-04-07 20:53:34 +0000
commitce9abcca4ab5bce6302f80cf4c2de48d24db9b47 (patch)
tree4c10b5fe575b0c687e4a3c4bde27a4bf7dbbb4b1 /target/linux/ar71xx
parent005ecd42682b8b6231f61f1ef29c2d1dbdff174b (diff)
ar71xx: add support for the built-in WMAC of the AR934x
Signed-off-by: Jaiganesh Narayanan <jnarayanan@atheros.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26521 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig3
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/Makefile1
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar934x-wmac.c64
-rw-r--r--target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar934x-wmac.h18
-rw-r--r--target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h3
5 files changed, 89 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
index 79f308b13..051df4cb7 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Kconfig
@@ -309,6 +309,9 @@ config AR71XX_DEV_AP94_PCI
config AR71XX_DEV_AR913X_WMAC
def_bool n
+config AR71XX_DEV_AR934X_WMAC
+ def_bool n
+
config AR71XX_DEV_DSA
def_bool n
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
index b0747b439..988e521a1 100644
--- a/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_AR71XX_DEV_AP91_PCI) += dev-ap91-pci.o
obj-$(CONFIG_AR71XX_DEV_AP94_PCI) += dev-ap94-pci.o
obj-$(CONFIG_AR71XX_DEV_AR913X_WMAC) += dev-ar913x-wmac.o
+obj-$(CONFIG_AR71XX_DEV_AR934X_WMAC) += dev-ar934x-wmac.o
obj-$(CONFIG_AR71XX_DEV_DSA) += dev-dsa.o
obj-$(CONFIG_AR71XX_DEV_GPIO_BUTTONS) += dev-gpio-buttons.o
obj-$(CONFIG_AR71XX_DEV_LEDS_GPIO) += dev-leds-gpio.o
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar934x-wmac.c b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar934x-wmac.c
new file mode 100644
index 000000000..e7d550f4a
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar934x-wmac.c
@@ -0,0 +1,64 @@
+/*
+ * Atheros AR934x SoC built-in WMAC device support
+ *
+ * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
+ *
+ * Parts of this file are based on Atheros 2.6.31 BSP
+ *
+ * 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/init.h>
+#include <linux/delay.h>
+#include <linux/etherdevice.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+
+#include <asm/mach-ar71xx/ar71xx.h>
+
+#include "dev-ar934x-wmac.h"
+
+static struct ath9k_platform_data ar934x_wmac_data = {
+ .led_pin = -1,
+};
+
+static u8 ar934x_wmac_mac[6];
+
+static struct resource ar934x_wmac_resources[] = {
+ {
+ .start = AR934X_WMAC_BASE,
+ .end = AR934X_WMAC_BASE + AR934X_WMAC_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ }, {
+ .start = AR71XX_CPU_IRQ_IP2,
+ .end = AR71XX_CPU_IRQ_IP2,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+static struct platform_device ar934x_wmac_device = {
+ .name = "ath9k",
+ .id = -1,
+ .resource = ar934x_wmac_resources,
+ .num_resources = ARRAY_SIZE(ar934x_wmac_resources),
+ .dev = {
+ .platform_data = &ar934x_wmac_data,
+ },
+};
+
+void __init ar934x_add_device_wmac(u8 *cal_data, u8 *mac_addr)
+{
+ if (cal_data)
+ memcpy(ar934x_wmac_data.eeprom_data, cal_data,
+ sizeof(ar934x_wmac_data.eeprom_data));
+
+ if (mac_addr) {
+ memcpy(ar934x_wmac_mac, mac_addr, sizeof(ar934x_wmac_mac));
+ ar934x_wmac_data.macaddr = ar934x_wmac_mac;
+ }
+
+ platform_device_register(&ar934x_wmac_device);
+}
diff --git a/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar934x-wmac.h b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar934x-wmac.h
new file mode 100644
index 000000000..36230006a
--- /dev/null
+++ b/target/linux/ar71xx/files/arch/mips/ar71xx/dev-ar934x-wmac.h
@@ -0,0 +1,18 @@
+/*
+ * Atheros AR934x SoC built-in WMAC device support
+ *
+ * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
+ *
+ * Parts of this file are based on Atheros linux 2.6.31 BSP
+ *
+ * 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 _AR71XX_DEV_AR934X_WMAC_H
+#define _AR71XX_DEV_AR934X_WMAC_H
+
+void ar934x_add_device_wmac(u8 *cal_data, u8 *mac_addr) __init;
+
+#endif /* _AR71XX_DEV_AR934X_WMAC_H */
diff --git a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h
index e671f58ed..2a540a83e 100644
--- a/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h
+++ b/target/linux/ar71xx/files/arch/mips/include/asm/mach-ar71xx/ar71xx.h
@@ -70,6 +70,9 @@
#define AR91XX_WMAC_BASE (AR71XX_APB_BASE + 0x000C0000)
#define AR91XX_WMAC_SIZE 0x30000
+#define AR934X_WMAC_BASE (AR71XX_APB_BASE + 0x00100000)
+#define AR934X_WMAC_SIZE 0x1ffff
+
#define AR71XX_MEM_SIZE_MIN 0x0200000
#define AR71XX_MEM_SIZE_MAX 0x10000000