mirror of https://github.com/hak5/openwrt-owl.git
157 lines
4.3 KiB
Diff
157 lines
4.3 KiB
Diff
bcma: add arm support
|
|
|
|
|
|
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
---
|
|
drivers/bcma/Kconfig | 9 +++++
|
|
drivers/bcma/Makefile | 1 +
|
|
drivers/bcma/driver_arm.c | 61 ++++++++++++++++++++++++++++++++++
|
|
drivers/bcma/main.c | 7 ++++
|
|
include/linux/bcma/bcma.h | 2 ++
|
|
include/linux/bcma/bcma_driver_arm.h | 20 +++++++++++
|
|
6 files changed, 100 insertions(+)
|
|
create mode 100644 drivers/bcma/driver_arm.c
|
|
create mode 100644 include/linux/bcma/bcma_driver_arm.h
|
|
|
|
--- a/drivers/bcma/Kconfig
|
|
+++ b/drivers/bcma/Kconfig
|
|
@@ -54,6 +54,15 @@ config BCMA_DRIVER_MIPS
|
|
|
|
If unsure, say N
|
|
|
|
+config BCMA_DRIVER_ARM
|
|
+ bool "BCMA Broadcom ARM core driver"
|
|
+ depends on BCMA && ARM
|
|
+ help
|
|
+ Driver for the Broadcom MIPS core attached to Broadcom specific
|
|
+ Advanced Microcontroller Bus.
|
|
+
|
|
+ If unsure, say N
|
|
+
|
|
config BCMA_SFLASH
|
|
bool
|
|
depends on BCMA_DRIVER_MIPS
|
|
--- a/drivers/bcma/Makefile
|
|
+++ b/drivers/bcma/Makefile
|
|
@@ -5,6 +5,7 @@ bcma-$(CONFIG_BCMA_NFLASH) += driver_ch
|
|
bcma-y += driver_pci.o
|
|
bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o
|
|
bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o
|
|
+bcma-$(CONFIG_BCMA_DRIVER_ARM) += driver_arm.o
|
|
bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o
|
|
bcma-$(CONFIG_BCMA_DRIVER_GPIO) += driver_gpio.o
|
|
bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o
|
|
--- /dev/null
|
|
+++ b/drivers/bcma/driver_arm.c
|
|
@@ -0,0 +1,53 @@
|
|
+/*
|
|
+ * Broadcom specific AMBA
|
|
+ * Broadcom MIPS32 74K core driver
|
|
+ *
|
|
+ * Copyright 2009, Broadcom Corporation
|
|
+ * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
|
|
+ * Copyright 2010, Bernhard Loos <bernhardloos@googlemail.com>
|
|
+ * Copyright 2011, Hauke Mehrtens <hauke@hauke-m.de>
|
|
+ *
|
|
+ * Licensed under the GNU/GPL. See COPYING for details.
|
|
+ */
|
|
+
|
|
+#include "bcma_private.h"
|
|
+
|
|
+#include <linux/bcma/bcma.h>
|
|
+
|
|
+static void bcma_core_mips_set_irq_name(struct bcma_bus *bus, unsigned int irq,
|
|
+ u16 coreid, u8 unit)
|
|
+{
|
|
+ struct bcma_device *core;
|
|
+
|
|
+ core = bcma_find_core_unit(bus, coreid, unit);
|
|
+ if (!core) {
|
|
+ bcma_warn(bus,
|
|
+ "Can not find core (id: 0x%x, unit %i) for IRQ configuration.\n",
|
|
+ coreid, unit);
|
|
+ return;
|
|
+ }
|
|
+ core->irq = irq;
|
|
+}
|
|
+
|
|
+void bcma_core_arm_init(struct bcma_drv_arm *acore)
|
|
+{
|
|
+ struct bcma_bus *bus;
|
|
+ struct bcma_device *core;
|
|
+ bus = acore->core->bus;
|
|
+
|
|
+ if (acore->setup_done)
|
|
+ return;
|
|
+
|
|
+ bcma_core_mips_set_irq_name(bus, 111, BCMA_CORE_USB20, 0);
|
|
+
|
|
+ bcma_core_mips_set_irq_name(bus, 179, BCMA_CORE_MAC_GBIT, 0);
|
|
+ bcma_core_mips_set_irq_name(bus, 180, BCMA_CORE_MAC_GBIT, 1);
|
|
+ bcma_core_mips_set_irq_name(bus, 181, BCMA_CORE_MAC_GBIT, 2);
|
|
+ bcma_core_mips_set_irq_name(bus, 182, BCMA_CORE_MAC_GBIT, 3);
|
|
+
|
|
+ bcma_core_mips_set_irq_name(bus, 112, BCMA_CORE_USB30, 0);
|
|
+ bcma_debug(bus, "IRQ reconfiguration done\n");
|
|
+
|
|
+
|
|
+ acore->setup_done = true;
|
|
+}
|
|
--- a/drivers/bcma/main.c
|
|
+++ b/drivers/bcma/main.c
|
|
@@ -258,6 +258,13 @@ int bcma_bus_register(struct bcma_bus *b
|
|
bcma_core_mips_init(&bus->drv_mips);
|
|
}
|
|
|
|
+ /* Init ARM core */
|
|
+ core = bcma_find_core(bus, BCMA_CORE_ARMCA9);
|
|
+ if (core) {
|
|
+ bus->drv_arm.core = core;
|
|
+ bcma_core_arm_init(&bus->drv_arm);
|
|
+ }
|
|
+
|
|
/* Init PCIE core */
|
|
core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0);
|
|
if (core) {
|
|
--- a/include/linux/bcma/bcma.h
|
|
+++ b/include/linux/bcma/bcma.h
|
|
@@ -7,6 +7,7 @@
|
|
#include <linux/bcma/bcma_driver_chipcommon.h>
|
|
#include <linux/bcma/bcma_driver_pci.h>
|
|
#include <linux/bcma/bcma_driver_mips.h>
|
|
+#include <linux/bcma/bcma_driver_arm.h>
|
|
#include <linux/bcma/bcma_driver_gmac_cmn.h>
|
|
#include <linux/ssb/ssb.h> /* SPROM sharing */
|
|
|
|
@@ -334,6 +335,7 @@ struct bcma_bus {
|
|
struct bcma_drv_cc drv_cc;
|
|
struct bcma_drv_pci drv_pci[2];
|
|
struct bcma_drv_mips drv_mips;
|
|
+ struct bcma_drv_arm drv_arm;
|
|
struct bcma_drv_gmac_cmn drv_gmac_cmn;
|
|
|
|
/* We decided to share SPROM struct with SSB as long as we do not need
|
|
--- /dev/null
|
|
+++ b/include/linux/bcma/bcma_driver_arm.h
|
|
@@ -0,0 +1,20 @@
|
|
+#ifndef LINUX_BCMA_DRIVER_ARM_H_
|
|
+#define LINUX_BCMA_DRIVER_ARM_H_
|
|
+
|
|
+struct bcma_device;
|
|
+
|
|
+struct bcma_drv_arm {
|
|
+ struct bcma_device *core;
|
|
+ u8 setup_done:1;
|
|
+ u8 early_setup_done:1;
|
|
+};
|
|
+
|
|
+#ifdef CONFIG_BCMA_DRIVER_ARM
|
|
+extern void bcma_core_arm_init(struct bcma_drv_arm *acore);
|
|
+
|
|
+#else
|
|
+static inline void bcma_core_arm_init(struct bcma_drv_arm *acore) { }
|
|
+
|
|
+#endif
|
|
+
|
|
+#endif /* LINUX_BCMA_DRIVER_ARM_H_ */
|