Skip to content

Instantly share code, notes, and snippets.

@notro
Created August 13, 2015 22:43
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/445656c7c0321a6f2c7c to your computer and use it in GitHub Desktop.
Save notro/445656c7c0321a6f2c7c to your computer and use it in GitHub Desktop.
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5105175..9bc668a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -328,6 +328,8 @@ config ARCH_BCM2708
select GENERIC_CLOCKEVENTS
select ARM_ERRATA_411920
select MACH_BCM2708
+ select MULTI_IRQ_HANDLER
+ select SPARSE_IRQ
select VC4
select FIQ
help
diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi
index cfed625..b375365 100644
--- a/arch/arm/boot/dts/bcm2708_common.dtsi
+++ b/arch/arm/boot/dts/bcm2708_common.dtsi
@@ -67,7 +67,7 @@
};
intc: interrupt-controller {
- compatible = "brcm,bcm2708-armctrl-ic";
+ compatible = "brcm,bcm2835-armctrl-ic";
reg = <0x7e00b200 0x200>;
interrupt-controller;
#interrupt-cells = <2>;
diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile
index 5120994..3da1a1b 100644
--- a/arch/arm/mach-bcm2708/Makefile
+++ b/arch/arm/mach-bcm2708/Makefile
@@ -2,5 +2,4 @@
# Makefile for the linux kernel.
#
-obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o
-obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o
+obj-$(CONFIG_MACH_BCM2708) += bcm2708.o
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 937c2d3..49fd469 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -32,6 +32,7 @@
#include <linux/clockchips.h>
#include <linux/cnt32_to_63.h>
#include <linux/io.h>
+#include <linux/irqchip.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/spi/spi.h>
@@ -43,6 +44,7 @@
#include <linux/clkdev.h>
#include <asm/system_info.h>
#include <mach/hardware.h>
+#include <mach/irqs.h>
#include <asm/irq.h>
#include <linux/leds.h>
#include <asm/mach-types.h>
@@ -101,7 +103,7 @@ static void __init bcm2708_init_led(void);
void __init bcm2708_init_irq(void)
{
- armctrl_init(__io_address(ARMCTRL_IC_BASE), 0, 0, 0);
+ irqchip_init();
}
static struct map_desc bcm2708_io_desc[] __initdata = {
diff --git a/arch/arm/mach-bcm2708/include/mach/irqs.h b/arch/arm/mach-bcm2708/include/mach/irqs.h
index 45152ed..2da5953 100644
--- a/arch/arm/mach-bcm2708/include/mach/irqs.h
+++ b/arch/arm/mach-bcm2708/include/mach/irqs.h
@@ -194,6 +194,6 @@
#define SPARE_ALLOC_IRQS 64
#define BCM2708_ALLOC_IRQS (HARD_IRQS+FIQ_IRQS+GPIO_IRQS+SPARE_ALLOC_IRQS)
#define FREE_IRQS 128
-#define NR_IRQS (BCM2708_ALLOC_IRQS+FREE_IRQS)
+//#define NR_IRQS (BCM2708_ALLOC_IRQS+FREE_IRQS)
#endif /* _BCM2708_IRQS_H_ */
diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c
index 8b8762d..06faf51 100644
--- a/drivers/i2c/busses/i2c-bcm2708.c
+++ b/drivers/i2c/busses/i2c-bcm2708.c
@@ -104,24 +104,6 @@ struct bcm2708_i2c {
*/
static void bcm2708_i2c_init_pinmode(int id)
{
-#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3))
-#define SET_GPIO_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3))
-
- int pin;
- u32 *gpio = ioremap(GPIO_BASE, SZ_16K);
-
- BUG_ON(id != 0 && id != 1);
- /* BSC0 is on GPIO 0 & 1, BSC1 is on GPIO 2 & 3 */
- for (pin = id*2+0; pin <= id*2+1; pin++) {
- printk("bcm2708_i2c_init_pinmode(%d,%d)\n", id, pin);
- INP_GPIO(pin); /* set mode to GPIO input first */
- SET_GPIO_ALT(pin, 0); /* set mode to ALT 0 */
- }
-
- iounmap(gpio);
-
-#undef INP_GPIO
-#undef SET_GPIO_ALT
}
static inline u32 bcm2708_rd(struct bcm2708_i2c *bi, unsigned reg)
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index b8d4e96..a6580d8 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -1,6 +1,6 @@
obj-$(CONFIG_IRQCHIP) += irqchip.o
-obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o
+obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708) += irq-bcm2835.o
obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o
obj-$(CONFIG_ARCH_HIP04) += irq-hip04.o
obj-$(CONFIG_ARCH_MMP) += irq-mmp.o
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 9ad73f3..eab78a5 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1,3 +1,4 @@
+#define DEBUG
/*
* linux/drivers/mmc/core/core.c
*
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index 1a22a82..ccc6078 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -63,7 +63,7 @@ static inline void mmc_delay(unsigned int ms)
cond_resched();
mdelay(ms);
} else {
- msleep(ms);
+ mdelay(ms);
}
}
diff --git a/drivers/spi/spi-bcm2708.c b/drivers/spi/spi-bcm2708.c
index 781c747..7f6c43a 100644
--- a/drivers/spi/spi-bcm2708.c
+++ b/drivers/spi/spi-bcm2708.c
@@ -104,22 +104,6 @@ struct bcm2708_spi_state {
*/
static void bcm2708_init_pinmode(void)
{
-#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3))
-#define SET_GPIO_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3))
-
- int pin;
- u32 *gpio = ioremap(GPIO_BASE, SZ_16K);
-
- /* SPI is on GPIO 7..11 */
- for (pin = 7; pin <= 11; pin++) {
- INP_GPIO(pin); /* set mode to GPIO input first */
- SET_GPIO_ALT(pin, 0); /* set mode to ALT 0 */
- }
-
- iounmap(gpio);
-
-#undef INP_GPIO
-#undef SET_GPIO_ALT
}
static inline u32 bcm2708_rd(struct bcm2708_spi *bs, unsigned reg)
diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
index 5c83309..3680c88 100644
--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
@@ -444,12 +444,11 @@ static void hcd_init_fiq(void *cookie)
else
DWC_WARN("MPHI periph has NOT been enabled");
#endif
+
// Enable FIQ interrupt from USB peripheral
-#ifdef CONFIG_ARCH_BCM2835
+ printk("%s: platform_get_irq=%d\n", __func__, platform_get_irq(otg_dev->os_dep.platformdev, 1));
enable_fiq(platform_get_irq(otg_dev->os_dep.platformdev, 1));
-#else
- enable_fiq(INTERRUPT_VC_USB);
-#endif
+
local_fiq_enable();
}
diff --git a/kernel/power/poweroff.c b/kernel/power/poweroff.c
index 7ef6866..3e4e47e 100644
--- a/kernel/power/poweroff.c
+++ b/kernel/power/poweroff.c
@@ -39,6 +39,7 @@ static struct sysrq_key_op sysrq_poweroff_op = {
static int __init pm_sysrq_init(void)
{
+ if (0)
register_sysrq_key('o', &sysrq_poweroff_op);
return 0;
}
diff --git a/sound/soc/bcm/bcm2708-i2s.c b/sound/soc/bcm/bcm2708-i2s.c
index 5e93cd6..17cc59e 100644
--- a/sound/soc/bcm/bcm2708-i2s.c
+++ b/sound/soc/bcm/bcm2708-i2s.c
@@ -322,20 +322,6 @@ static int bcm2708_i2s_set_dai_bclk_ratio(struct snd_soc_dai *dai,
static int bcm2708_i2s_set_function(unsigned offset, int function)
{
- #define GPIOFSEL(x) (0x00+(x)*4)
- void __iomem *gpio = __io_address(GPIO_BASE);
- unsigned alt = function <= 3 ? function + 4: function == 4 ? 3 : 2;
- unsigned gpiodir;
- unsigned gpio_bank = offset / 10;
- unsigned gpio_field_offset = (offset - 10 * gpio_bank) * 3;
-
- if (offset >= BCM2708_NR_GPIOS)
- return -EINVAL;
-
- gpiodir = readl(gpio + GPIOFSEL(gpio_bank));
- gpiodir &= ~(7 << gpio_field_offset);
- gpiodir |= alt << gpio_field_offset;
- writel(gpiodir, gpio + GPIOFSEL(gpio_bank));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment