Skip to content

Instantly share code, notes, and snippets.

@notro
Created October 2, 2013 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notro/6798734 to your computer and use it in GitHub Desktop.
Save notro/6798734 to your computer and use it in GitHub Desktop.
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index a37a50f..2e5e255 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -242,13 +242,13 @@ endif
machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
platdirs := $(patsubst %,arch/arm/plat-%/,$(plat-y))
-ifneq ($(CONFIG_ARCH_MULTIPLATFORM),y)
+#ifneq ($(CONFIG_ARCH_MULTIPLATFORM),y)
ifeq ($(KBUILD_SRC),)
KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(machdirs) $(platdirs))
else
KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs) $(platdirs))
endif
-endif
+#endif
export TEXT_OFFSET GZFLAGS MMUEXT
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
index 6e9deb7..5996a99 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
@@ -1,9 +1,26 @@
/dts-v1/;
+
+/memreserve/ 0x1c000000 0x04000000;
+
/include/ "bcm2835.dtsi"
/ {
compatible = "raspberrypi,model-b", "brcm,bcm2835";
- model = "Raspberry Pi Model B";
+ model = "v6 Raspberry Pi Model B";
+
+ chosen {
+ bootargs = "debug earlyprintk dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait";
+ };
memory {
reg = <0 0x10000000>;
@@ -36,6 +53,41 @@
};
};
+&spi {
+ status = "okay";
+
+ spidev@0{
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "spidev";
+ reg = <0>;
+ spi-max-frequency = <16000000>;
+ spi-cpha;
+ };
+
+ spidev@1{
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "spidev";
+ reg = <1>;
+ spi-max-frequency = <16000000>;
+ // Mode 0 (CPOL = 0, CPHA = 0)
+ };
+};
+
&i2c0 {
status = "okay";
clock-frequency = <100000>;
diff --git a/arch/arm/include/asm/fiq.h b/arch/arm/include/asm/fiq.h
index d493d0b..f1a131b 100644
--- a/arch/arm/include/asm/fiq.h
+++ b/arch/arm/include/asm/fiq.h
@@ -42,6 +42,7 @@ extern void disable_fiq(int fiq);
/* helpers defined in fiqasm.S: */
extern void __set_fiq_regs(unsigned long const *regs);
extern void __get_fiq_regs(unsigned long *regs);
+extern void __FIQ_Branch(unsigned long *regs);
static inline void set_fiq_regs(struct pt_regs const *regs)
{
diff --git a/arch/arm/kernel/fiqasm.S b/arch/arm/kernel/fiqasm.S
index 207f9d6..5233d54 100644
--- a/arch/arm/kernel/fiqasm.S
+++ b/arch/arm/kernel/fiqasm.S
@@ -47,3 +47,7 @@ ENTRY(__get_fiq_regs)
mov r0, r0 @ avoid hazard prior to ARMv4
mov pc, lr
ENDPROC(__get_fiq_regs)
+
+ENTRY(__FIQ_Branch)
+ mov pc, r8
+ENDPROC(__FIQ_Branch)
diff --git a/arch/arm/mach-bcm2835/Kconfig b/arch/arm/mach-bcm2835/Kconfig
index 560045c..a752c3a 100644
--- a/arch/arm/mach-bcm2835/Kconfig
+++ b/arch/arm/mach-bcm2835/Kconfig
@@ -10,6 +10,7 @@ config ARCH_BCM2835
select GENERIC_CLOCKEVENTS
select PINCTRL
select PINCTRL_BCM2835
+ select FIQ
help
This enables support for the Broadcom BCM2835 SoC. This SoC is
use in the Raspberry Pi, and Roku 2 devices.
diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c
index 40686d7..6623783 100644
--- a/arch/arm/mach-bcm2835/bcm2835.c
+++ b/arch/arm/mach-bcm2835/bcm2835.c
@@ -36,8 +36,79 @@
#define BCM2835_PERIPH_VIRT 0xf0000000
#define BCM2835_PERIPH_SIZE SZ_16M
+#include <linux/dma-mapping.h>
+
+
+//#include <mach/platform.h>
+#define BCM2708_PERI_BASE 0x20000000
+#define MPHI_BASE (BCM2708_PERI_BASE + 0x6000) /* Message -based Parallel Host Interface */
+#define USB_BASE (BCM2708_PERI_BASE + 0x980000) /* DTC_OTG USB controller */
+
+#define ARM_IRQ2_BASE 32
+#define INTERRUPT_HOSTPORT (ARM_IRQ2_BASE + 0)
+
+#define ARM_IRQ0_BASE 64
+#define INTERRUPT_USB (ARM_IRQ0_BASE + 11)
+
+// mach/irqs.h
+#define IRQ_ARMCTRL_START 0
+#define IRQ_USB (IRQ_ARMCTRL_START + INTERRUPT_USB)
+#define IRQ_HOSTPORT (IRQ_ARMCTRL_START + INTERRUPT_HOSTPORT)
+
+#define DMA_MASK_BITS_COMMON 32
+
static void __iomem *wdt_regs;
+
+static struct resource bcm2708_usb_resources[] = {
+ [0] = {
+ .start = USB_BASE,
+ .end = USB_BASE + SZ_128K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = MPHI_BASE,
+ .end = MPHI_BASE + SZ_4K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [2] = {
+ .start = IRQ_HOSTPORT,
+ .end = IRQ_HOSTPORT,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+//bool fiq_fix_enable = true;
+bool fiq_fix_enable = false;
+
+static struct resource bcm2708_usb_resources_no_fiq_fix[] = {
+ [0] = {
+ .start = USB_BASE,
+ .end = USB_BASE + SZ_128K - 1,
+ .flags = IORESOURCE_MEM,
+ },
+ [1] = {
+ .start = IRQ_USB,
+ .end = IRQ_USB,
+ .flags = IORESOURCE_IRQ,
+ },
+};
+
+
+static u64 usb_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
+
+static struct platform_device bcm2708_usb_device = {
+ .name = "bcm2708_usb",
+ .id = -1, /* only one bcm2708_usb */
+ .resource = bcm2708_usb_resources,
+ .num_resources = ARRAY_SIZE(bcm2708_usb_resources),
+ .dev = {
+ .dma_mask = &usb_dmamask,
+ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON),
+ },
+};
+
+
/*
* The machine restart method can be called from an atomic context so we won't
* be able to ioremap the regs then.
@@ -106,6 +177,18 @@ static void __init bcm2835_map_io(void)
iotable_init(&io_map, 1);
}
+int __init bcm_register_device(struct platform_device *pdev)
+{
+ int ret;
+
+ ret = platform_device_register(pdev);
+ if (ret)
+ pr_debug("Unable to register platform device '%s': %d\n",
+ pdev->name, ret);
+
+ return ret;
+}
+
static void __init bcm2835_init(void)
{
int ret;
@@ -122,6 +205,14 @@ static void __init bcm2835_init(void)
pr_err("of_platform_populate failed: %d\n", ret);
BUG();
}
+
+ if (!fiq_fix_enable)
+ {
+ bcm2708_usb_device.resource = bcm2708_usb_resources_no_fiq_fix;
+ bcm2708_usb_device.num_resources = ARRAY_SIZE(bcm2708_usb_resources_no_fiq_fix);
+ }
+ bcm_register_device(&bcm2708_usb_device);
+
}
static const char * const bcm2835_compat[] = {
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 70d7c5b..df8834b 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_USB_U132_HCD) += host/
obj-$(CONFIG_USB_R8A66597_HCD) += host/
obj-$(CONFIG_USB_HWA_HCD) += host/
obj-$(CONFIG_USB_ISP1760_HCD) += host/
+obj-$(CONFIG_USB_DWCOTG) += host/
obj-$(CONFIG_USB_IMX21_HCD) += host/
obj-$(CONFIG_USB_FSL_MPH_DR_OF) += host/
obj-$(CONFIG_USB_FUSBH200_HCD) += host/
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index b3f20d7..d702761 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -650,6 +650,19 @@ config USB_HWA_HCD
To compile this driver a module, choose M here: the module
will be called "hwa-hc".
+config USB_DWCOTG
+ tristate "Synopsis DWC host support"
+ depends on USB
+ help
+ The Synopsis DWC controller is a dual-role
+ host/peripheral/OTG ("On The Go") USB controllers.
+
+ Enable this option to support this IP in host controller mode.
+ If unsure, say N.
+
+ To compile this driver as a module, choose M here: the
+ modules built will be called dwc_otg and dwc_common_port.
+
config USB_IMX21_HCD
tristate "i.MX21 HCD support"
depends on ARM && ARCH_MXC
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 50b0041..ce63522 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -56,6 +56,7 @@ obj-$(CONFIG_USB_U132_HCD) += u132-hcd.o
obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
obj-$(CONFIG_USB_ISP1760_HCD) += isp1760.o
obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o
+obj-$(CONFIG_USB_DWCOTG) += dwc_otg/ dwc_common_port/
obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o
obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o
obj-$(CONFIG_USB_OCTEON2_COMMON) += octeon2-common.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment