From 277700ac32a7a1de2ae9011441d9989593aea950 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Mon, 8 Jun 2015 12:15:27 +0200 Subject: [PATCH] projects/RPi*/patches/linux: update RPi support patches Signed-off-by: Stephan Raue --- projects/RPi/linux/linux.arm.conf | 14 +- .../patches/linux/linux-01-RPi_support.patch | 22604 ++++++++++++++-- projects/RPi2/linux/linux.arm.conf | 14 +- .../patches/linux/linux-01-RPi_support.patch | 22604 ++++++++++++++-- 4 files changed, 40810 insertions(+), 4426 deletions(-) diff --git a/projects/RPi/linux/linux.arm.conf b/projects/RPi/linux/linux.arm.conf index 7b09cfd5e1..c71e7b2fe4 100644 --- a/projects/RPi/linux/linux.arm.conf +++ b/projects/RPi/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.0.4 Kernel Configuration +# Linux/arm 4.0.5 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -313,7 +313,6 @@ CONFIG_ARCH_BCM2708=y CONFIG_MACH_BCM2708=y CONFIG_BCM2708_DT=y CONFIG_BCM2708_GPIO=y -CONFIG_BCM2708_VCMEM=y # CONFIG_BCM2708_NOL2CACHE is not set CONFIG_BCM2708_SPIDEV=y @@ -1372,6 +1371,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_IPMI_HANDLER is not set CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_BCM2835=y CONFIG_HW_RANDOM_BCM2708=m # CONFIG_R3964 is not set # CONFIG_RAW_DRIVER is not set @@ -1379,6 +1379,7 @@ CONFIG_HW_RANDOM_BCM2708=m CONFIG_BRCM_CHAR_DRIVERS=y CONFIG_BCM_VC_CMA=y # CONFIG_BCM_VC_SM is not set +CONFIG_BCM2708_VCMEM=y # CONFIG_XILLYBUS is not set # @@ -1739,7 +1740,7 @@ CONFIG_THERMAL_BCM2835=y # Texas Instruments thermal drivers # CONFIG_WATCHDOG=y -# CONFIG_WATCHDOG_CORE is not set +CONFIG_WATCHDOG_CORE=y # CONFIG_WATCHDOG_NOWAYOUT is not set # @@ -1753,6 +1754,7 @@ CONFIG_WATCHDOG=y # CONFIG_DW_WATCHDOG is not set # CONFIG_MAX63XX_WATCHDOG is not set CONFIG_BCM2708_WDT=m +CONFIG_BCM2835_WDT=m # CONFIG_MEN_A21_WDT is not set # @@ -3012,7 +3014,10 @@ CONFIG_COMMON_CLK=y # CONFIG_SH_TIMER_TMU is not set # CONFIG_EM_TIMER_STI is not set # CONFIG_CLKSRC_VERSATILE is not set -# CONFIG_MAILBOX is not set +CONFIG_MAILBOX=y +CONFIG_BCM2708_MBOX=y +# CONFIG_PL320_MBOX is not set +# CONFIG_ALTERA_MBOX is not set # CONFIG_IOMMU_SUPPORT is not set # @@ -3027,6 +3032,7 @@ CONFIG_COMMON_CLK=y # # SOC (System On Chip) specific Drivers # +CONFIG_BCM2708_POWER=y # CONFIG_SOC_TI is not set # CONFIG_PM_DEVFREQ is not set CONFIG_EXTCON=m diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch index 6cf4846602..c1f57bb01c 100644 --- a/projects/RPi/patches/linux/linux-01-RPi_support.patch +++ b/projects/RPi/patches/linux/linux-01-RPi_support.patch @@ -1,7 +1,7 @@ -From a041b743ae97433e56b58a8f4c81f7c15af9e644 Mon Sep 17 00:00:00 2001 +From 0e7aaf92061593060fc62957aeec745534add9a4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 001/154] Main bcm2708 linux port +Subject: [PATCH 001/216] Main bcm2708 linux port Signed-off-by: popcornmix --- @@ -147,10 +147,10 @@ index eb7bb51..27c0f92 100644 machine-$(CONFIG_ARCH_CLPS711X) += clps711x machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c -index fdfa3a7..f5ffaacb 100644 +index 2bf1a16..2915516 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c -@@ -166,6 +166,16 @@ void arch_cpu_idle_dead(void) +@@ -172,6 +172,16 @@ void arch_cpu_idle_dead(void) } #endif @@ -4559,7 +4559,7 @@ index 0000000..5e43e85 +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:bcm-mbox"); diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig -index 9b4f29e..0c5d4ac 100644 +index 9b4f29e5..0c5d4ac 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -358,7 +358,7 @@ config CPU_PJ4B @@ -4636,10 +4636,10 @@ index 0c8cbe5..c3b84a2 100644 mmc_pm_flag_t pm_caps; /* supported pm features */ -From cf0e6b17a6c03de2d0f88fc6a9d1691ba7057669 Mon Sep 17 00:00:00 2001 +From 6763b931593e5ce8e1b5e45de482527d61390f56 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 7 May 2013 14:32:27 +0100 -Subject: [PATCH 002/154] Add 2709 platform for Raspberry Pi 2 +Subject: [PATCH 002/216] Add 2709 platform for Raspberry Pi 2 --- arch/arm/Kconfig | 21 + @@ -4651,7 +4651,7 @@ Subject: [PATCH 002/154] Add 2709 platform for Raspberry Pi 2 arch/arm/mach-bcm2709/armctrl.c | 361 +++++++ arch/arm/mach-bcm2709/armctrl.h | 27 + arch/arm/mach-bcm2709/bcm2708_gpio.c | 426 ++++++++ - arch/arm/mach-bcm2709/bcm2709.c | 1257 ++++++++++++++++++++++ + arch/arm/mach-bcm2709/bcm2709.c | 1263 ++++++++++++++++++++++ arch/arm/mach-bcm2709/bcm2709.h | 49 + arch/arm/mach-bcm2709/clock.c | 61 ++ arch/arm/mach-bcm2709/clock.h | 24 + @@ -4686,7 +4686,7 @@ Subject: [PATCH 002/154] Add 2709 platform for Raspberry Pi 2 arch/arm/mm/proc-v7.S | 1 + arch/arm/tools/mach-types | 1 + drivers/clocksource/arm_arch_timer.c | 36 + - 44 files changed, 6061 insertions(+) + 44 files changed, 6067 insertions(+) create mode 100644 arch/arm/mach-bcm2709/Kconfig create mode 100644 arch/arm/mach-bcm2709/Makefile create mode 100644 arch/arm/mach-bcm2709/Makefile.boot @@ -5707,10 +5707,10 @@ index 0000000..c1e9254 +MODULE_LICENSE("GPL"); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c new file mode 100644 -index 0000000..da11ad1 +index 0000000..f8679bb --- /dev/null +++ b/arch/arm/mach-bcm2709/bcm2709.c -@@ -0,0 +1,1257 @@ +@@ -0,0 +1,1263 @@ +/* + * linux/arch/arm/mach-bcm2709/bcm2709.c + * @@ -6731,7 +6731,7 @@ index 0000000..da11ad1 + /* + * Make irqs happen for the system timer + */ -+ setup_irq(IRQ_TIMER3, &bcm2708_timer_irq); ++ setup_irq(IRQ_TIMER3, &bcm2709_timer_irq); + + sched_clock_register(bcm2709_read_sched_clock, 32, STC_FREQ_HZ); + @@ -6745,7 +6745,7 @@ index 0000000..da11ad1 + timer0_clockevent.cpumask = cpumask_of(0); + clockevents_register_device(&timer0_clockevent); + -+ register_current_timer_delay(&bcm2708_delay_timer); ++ register_current_timer_delay(&bcm2709_delay_timer); +} + +#else @@ -6825,6 +6825,7 @@ index 0000000..da11ad1 +} + + ++#ifdef CONFIG_SMP +#include + +#include @@ -6927,6 +6928,7 @@ index 0000000..da11ad1 + .smp_secondary_init = bcm2709_secondary_init, + .smp_boot_secondary = bcm2709_boot_secondary, +}; ++#endif + +static const char * const bcm2709_compat[] = { + "brcm,bcm2709", @@ -6936,7 +6938,9 @@ index 0000000..da11ad1 + +MACHINE_START(BCM2709, "BCM2709") + /* Maintainer: Broadcom Europe Ltd. */ ++#ifdef CONFIG_SMP + .smp = smp_ops(bcm2709_smp_ops), ++#endif + .map_io = bcm2709_map_io, + .init_irq = bcm2709_init_irq, + .init_time = bcm2709_timer_init, @@ -6949,7 +6953,9 @@ index 0000000..da11ad1 + +MACHINE_START(BCM2708, "BCM2709") + /* Maintainer: Broadcom Europe Ltd. */ ++#ifdef CONFIG_SMP + .smp = smp_ops(bcm2709_smp_ops), ++#endif + .map_io = bcm2709_map_io, + .init_irq = bcm2709_init_irq, + .init_time = bcm2709_timer_init, @@ -11086,10 +11092,10 @@ index a3025e7..4a2a601 100644 + return 0; +} -From 0c400d193883398993f26d6250a091c51b1377b9 Mon Sep 17 00:00:00 2001 +From ade70caa2a108d3a2257a32ce6873758ae968f97 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Oct 2014 18:50:05 +0100 -Subject: [PATCH 003/154] Add bcm2708_gpio driver +Subject: [PATCH 003/216] Add bcm2708_gpio driver Signed-off-by: popcornmix @@ -11693,10 +11699,10 @@ index 0000000..fb69624 + +#endif -From 775b3e09b76f068631e566e53fd8951108bd386a Mon Sep 17 00:00:00 2001 +From 2ca472651d3e308f62709f5e2536eaba99944b11 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 004/154] Add dwc_otg driver +Subject: [PATCH 004/216] Add dwc_otg driver Signed-off-by: popcornmix @@ -12109,6 +12115,8 @@ This edge case can be hit if the port is disabled while the FIQ is in the middle of a transaction. Make the effects less severe. Also get rid of the useless return value. + +squash: dwc_otg: Allow to build without SMP --- arch/arm/Kconfig | 1 + arch/arm/include/asm/irqflags.h | 16 +- @@ -46428,7 +46436,7 @@ index 0000000..6a8be63 +#endif diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c new file mode 100644 -index 0000000..276ad0c7 +index 0000000..7e0c726 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c @@ -0,0 +1,1346 @@ @@ -46512,7 +46520,7 @@ index 0000000..276ad0c7 + * fiq_fsm_spin_lock() - ARMv6+ bare bones spinlock + * Must be called with local interrupts and FIQ disabled. + */ -+#ifdef CONFIG_ARCH_BCM2709 ++#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) +inline void fiq_fsm_spin_lock(fiq_lock_t *lock) +{ + unsigned long tmp; @@ -46545,7 +46553,7 @@ index 0000000..276ad0c7 +/** + * fiq_fsm_spin_unlock() - ARMv6+ bare bones spinunlock + */ -+#ifdef CONFIG_ARCH_BCM2709 ++#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) +inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) +{ + smp_mb(); @@ -72935,10 +72943,10 @@ index 0000000..cdc9963 +test_main(); +0; -From c3a4819b87e839196b80d548bd1c092a9c86b6e0 Mon Sep 17 00:00:00 2001 +From 0876a9278a3227e3f8924b6e04c1af6c18d4e1e7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:54:32 +0100 -Subject: [PATCH 005/154] bcm2708 watchdog driver +Subject: [PATCH 005/216] bcm2708 watchdog driver Signed-off-by: popcornmix --- @@ -73366,10 +73374,10 @@ index 0000000..8a27d68 +MODULE_ALIAS_MISCDEV(TEMP_MINOR); +MODULE_LICENSE("GPL"); -From 0f320c21ab29d3d5b3a9ec8c13bdd50160ccd7c4 Mon Sep 17 00:00:00 2001 +From e32648d3db67d9954ee0a8bc13ab3f81345c50af Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:55:09 +0100 -Subject: [PATCH 006/154] bcm2708 framebuffer driver +Subject: [PATCH 006/216] bcm2708 framebuffer driver Signed-off-by: popcornmix @@ -76814,10 +76822,10 @@ index 3c14e43..7626beb6a 100644 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From 040ebd148dd7f1adbc7fe1172ff85712c503ddea Mon Sep 17 00:00:00 2001 +From 31a44367b5b2a156b2a45d34a1e6b65c55fe8c96 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 007/154] dmaengine: Add support for BCM2708 +Subject: [PATCH 007/216] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -76934,7 +76942,7 @@ index a4aac4c..d03e7b5 100644 /* return channel no or -ve error */ extern int bcm_dma_chan_alloc(unsigned preferred_feature_set, diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index da11ad1..fe467e2 100644 +index f8679bb..c4bd0a4 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -269,6 +269,11 @@ static struct platform_device bcm2708_dmaman_device = { @@ -77982,10 +77990,10 @@ index 0000000..6150b8f +MODULE_AUTHOR("Gellert Weisz "); +MODULE_LICENSE("GPL v2"); -From 086397f74b4a70f1d343083150526ce37bb51b1d Mon Sep 17 00:00:00 2001 +From 7ec18e818133424bf20d58993fa6822dd241e096 Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 008/154] MMC: added alternative MMC driver +Subject: [PATCH 008/216] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -78138,7 +78146,7 @@ index 6a7cfe0..9d41de9 100644 obj-$(CONFIG_MMC_OMAP) += omap.o diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c new file mode 100644 -index 0000000..28b00d3 +index 0000000..eef0d351 --- /dev/null +++ b/drivers/mmc/host/bcm2835-mmc.c @@ -0,0 +1,1506 @@ @@ -79532,8 +79540,8 @@ index 0000000..28b00d3 + +#ifndef FORCE_PIO + if (node) { -+ host->dma_chan_tx = of_dma_request_slave_channel(node, "tx"); -+ host->dma_chan_rx = of_dma_request_slave_channel(node, "rx"); ++ host->dma_chan_tx = dma_request_slave_channel(dev, "tx"); ++ host->dma_chan_rx = dma_request_slave_channel(dev, "rx"); + } else { + dma_cap_mask_t mask; + @@ -79649,10 +79657,10 @@ index 0000000..28b00d3 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 594665ed12b19a7e2b9729948854266eb323c126 Mon Sep 17 00:00:00 2001 +From 97f9d94720b108ba3e793621d4a500cc593fc775 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 009/154] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 009/216] cma: Add vc_cma driver to enable use of CMA Signed-off-by: popcornmix @@ -80977,10 +80985,10 @@ index 0000000..5325832 + +#endif /* VC_CMA_H */ -From fccbda977ca17339b97bbf5edd574b8e70fa4837 Mon Sep 17 00:00:00 2001 +From 6bafd180b5b7672ebbaea3878e78511d309007a0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 010/154] bcm2708: alsa sound driver +Subject: [PATCH 010/216] bcm2708: alsa sound driver Signed-off-by: popcornmix @@ -83648,10 +83656,10 @@ index 0000000..af3e6eb + +#endif // _VC_AUDIO_DEFS_H_ -From 97dda9a97ddf5f6203d61024c9ed196cc6547f71 Mon Sep 17 00:00:00 2001 +From ddf7318165c6faf5bc73597105a2eed9fece4225 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 011/154] bcm2708 vchiq driver +Subject: [PATCH 011/216] bcm2708 vchiq driver Signed-off-by: popcornmix @@ -83711,6 +83719,14 @@ vchiq: Include SIGSTOP and SIGCONT in list of signals not-masked by vchiq to all vchiq_arm: Complete support for SYNCHRONOUS mode vchiq: Remove inline from suspend/resume + +vchiq: Allocation does not need to be atomic + +vchiq: Fix wrong condition check + +The log level is checked from within the log call. Remove the check in the call. + +Signed-off-by: Pranith Kumar --- drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + @@ -85401,7 +85417,7 @@ index 0000000..7ea5c64 +#endif /* VCHIQ_2835_H */ diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c new file mode 100644 -index 0000000..7e7b09f +index 0000000..8ec88bb --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -0,0 +1,562 @@ @@ -85506,7 +85522,7 @@ index 0000000..7e7b09f + frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); + + g_slot_mem = dma_alloc_coherent(NULL, g_slot_mem_size + frag_mem_size, -+ &g_slot_phys, GFP_ATOMIC); ++ &g_slot_phys, GFP_KERNEL); + + if (!g_slot_mem) { + vchiq_log_error(vchiq_arm_log_level, @@ -85729,7 +85745,7 @@ index 0000000..7e7b09f +void +vchiq_dump_platform_use_state(VCHIQ_STATE_T *state) +{ -+ vchiq_log_info((vchiq_arm_log_level>=VCHIQ_LOG_INFO),"Suspend timer not in use"); ++ vchiq_log_info(vchiq_arm_log_level, "Suspend timer not in use"); +} +void +vchiq_platform_handle_timeout(VCHIQ_STATE_T *state) @@ -96773,10 +96789,10 @@ index 0000000..b6bfa21 + return vchiq_build_time; +} -From f4a8d547b219dcc32e45b4d1be94bd6f29b5c9d7 Mon Sep 17 00:00:00 2001 +From 859a7d70416a46048ab89165367891de2104ef6f Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 012/154] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 012/216] vcsm: VideoCore shared memory service for BCM2835 Add experimental support for the VideoCore shared memory service. This allows user processes to allocate memory from VideoCore's @@ -101118,10 +101134,10 @@ index 0000000..da1c523 +MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); +MODULE_LICENSE("GPL v2"); -From 773c64424de0413c0123f47b57ddf2d25af01cb7 Mon Sep 17 00:00:00 2001 +From 103cb0411fad640ec86640f3fda90a3da782aa68 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:51:55 +0100 -Subject: [PATCH 013/154] Add hwrng (hardware random number generator) driver +Subject: [PATCH 013/216] Add hwrng (hardware random number generator) driver --- drivers/char/hw_random/Kconfig | 11 ++++ @@ -101288,10 +101304,10 @@ index 0000000..340f004 +MODULE_DESCRIPTION("BCM2708 H/W Random Number Generator (RNG) driver"); +MODULE_LICENSE("GPL and additional rights"); -From 904a182ff0dfdbd150aa6ef19159ac9ba96066f5 Mon Sep 17 00:00:00 2001 +From 4e3072cbb7ce07057d091188fc1a3897e3169007 Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 014/154] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 014/216] lirc: added support for RaspberryPi GPIO lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others See: https://github.com/raspberrypi/linux/issues/525 @@ -102038,10 +102054,10 @@ index 0000000..8aa452d +module_param(debug, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Enable debugging messages"); -From 32d6e3231f6e018338992a265ba7b6f2179c4554 Mon Sep 17 00:00:00 2001 +From 123948742379f19e1c2764020d8c523d445550bf Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 015/154] Add cpufreq driver +Subject: [PATCH 015/216] Add cpufreq driver --- arch/arm/Kconfig | 1 + @@ -102325,10 +102341,10 @@ index 0000000..447ca09 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From d926a40edc92b086e4423d592e496449dfa5a9aa Mon Sep 17 00:00:00 2001 +From f563316302e117df98e91a8e1366dae653094f04 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 016/154] Added hwmon/thermal driver for reporting core +Subject: [PATCH 016/216] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian --- @@ -102850,10 +102866,10 @@ index 0000000..85fceb5 + +module_platform_driver(bcm2835_thermal_driver); -From 0d075f7303d4dfb9a68542c82da34adba9ad7b0d Mon Sep 17 00:00:00 2001 +From bb1c2fec8850e0e017e3b80f51df5dc850627555 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 4 Nov 2013 18:56:10 +0000 -Subject: [PATCH 017/154] Add Chris Boot's i2c and spi drivers. +Subject: [PATCH 017/216] Add Chris Boot's i2c and spi drivers. i2c-bcm2708: fixed baudrate @@ -104223,10 +104239,10 @@ index 0000000..b04a57d +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From b04b9accf510953206911fbd5aec5125d4b90cbc Mon Sep 17 00:00:00 2001 +From 530db15891390005623b20a03dda6ef6871607bc Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 018/154] bcm2835: add v4l2 camera device +Subject: [PATCH 018/216] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -111553,10 +111569,10 @@ index 0000000..9d1d11e + +#endif /* MMAL_VCHIQ_H */ -From c0d39b50f52eac29ab791e7e5cb71c4bf2625c28 Mon Sep 17 00:00:00 2001 +From 47303896a0462c49e8bf3e5ef31e744d891a30a4 Mon Sep 17 00:00:00 2001 From: notro Date: Sun, 6 Jul 2014 12:07:25 +0200 -Subject: [PATCH 019/154] spi-bcm2708: Prepare for Common Clock Framework +Subject: [PATCH 019/216] spi-bcm2708: Prepare for Common Clock Framework migration As part of migrating to use the Common Clock Framework, replace clk_enable() @@ -111601,10 +111617,10 @@ index b04a57d..349d21f 100644 free_irq(bs->irq, master); iounmap(bs->base); -From 191bc5b30c4d70ee25628836493b39fc58d3066d Mon Sep 17 00:00:00 2001 +From d8d78e0bb5731d6fb3f1f813dc795e98be064870 Mon Sep 17 00:00:00 2001 From: notro Date: Sun, 6 Jul 2014 12:09:30 +0200 -Subject: [PATCH 020/154] BCM2708: Migrate to the Common Clock Framework +Subject: [PATCH 020/216] BCM2708: Migrate to the Common Clock Framework As part of moving towards using Device Tree, the Common Clock Framework has to be used instead of the BCM2708 clock implementation. @@ -111874,10 +111890,10 @@ index 5f9d725..0000000 - unsigned long rate; -}; -From 671554aed0097da7a7aaadcb570ce9233daf1212 Mon Sep 17 00:00:00 2001 +From 5f8aad35cdb010ca9fc0c58cca2a5a11fce879ec Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 021/154] BCM2708: Add core Device Tree support +Subject: [PATCH 021/216] BCM2708: Add core Device Tree support Add the bare minimum needed to boot BCM2708 from a Device Tree. @@ -111907,7 +111923,7 @@ BCM2708_DT: Correct length of the peripheral space create mode 100644 arch/arm/boot/dts/bcm2709.dtsi diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index a1c776b..c86833d 100644 +index 992ea0b..25fbf52 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1,5 +1,17 @@ @@ -112508,10 +112524,10 @@ index 080e260..496cbcd 100644 module_param(boardrev, uint, 0644); -From dbecd2f191760388beaa8bc7d50b297f6b6ba9ac Mon Sep 17 00:00:00 2001 +From 55bd100cb5e042a279b944a4ff3c0f00c51ed64c Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 022/154] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 022/216] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -112604,10 +112620,10 @@ index fb795c3..fa72af0 100644 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -From a064f31e6bd2bc3c89c6f0f891c94c8d3ed79a99 Mon Sep 17 00:00:00 2001 +From ee44a85f3a6b76509c3de7ee16164e8d32eecc24 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 025/154] Speed up console framebuffer imageblit function +Subject: [PATCH 025/216] Speed up console framebuffer imageblit function Especially on platforms with a slower CPU but a relatively high framebuffer fill bandwidth, like current ARM devices, the existing @@ -112816,10 +112832,10 @@ index a2bb276..436494f 100644 start_index, pitch_index); } else -From 3fc041479669d18c335458796d9b7e81e5ee3696 Mon Sep 17 00:00:00 2001 +From 12b6956e3ba31498771d282025fc4a44b6648559 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 026/154] Allow mac address to be set in smsc95xx +Subject: [PATCH 026/216] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -112910,10 +112926,10 @@ index 26423ad..e29a323 100644 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { -From b74131aa0aa5883c5bb3074b0b08760b30612c72 Mon Sep 17 00:00:00 2001 +From 03ecfd1c727358b884730a06b05d072ef28ebffd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 027/154] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 027/216] enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module) 1-wire: Add support for configuring pin for w1-gpio kernel module @@ -113185,10 +113201,10 @@ index 2820924..fd0550f 100644 } } -From 511d5ff03dd5fb71d537fe5e712d128e2442030c Mon Sep 17 00:00:00 2001 +From 4624b823abd044524b26cb4d7111564f141e540f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 029/154] config: Enable CONFIG_MEMCG, but leave it disabled +Subject: [PATCH 029/216] config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. --- @@ -113243,10 +113259,10 @@ index b34ef4a..c2aa348 100644 /** -From dbb28fde0c6e74d7c5385ca1d5ba7dcaf77d903a Mon Sep 17 00:00:00 2001 +From 14913d5804e6cc14027404667dbacd69267fd032 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:33:38 +0100 -Subject: [PATCH 030/154] ASoC: Add support for BCM2708 +Subject: [PATCH 030/216] ASoC: Add support for BCM2708 This driver adds support for digital audio (I2S) for the BCM2708 SoC that is used by the @@ -114389,10 +114405,10 @@ index 0000000..6fdcbc1 + +#endif -From c0c4345041ac79f762c5a5ea91328bf323e201a8 Mon Sep 17 00:00:00 2001 +From 95f9b87c32e716eb0276c9d6d1228db5a9e38a0e Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 031/154] ASoC: Add support for PCM5102A codec +Subject: [PATCH 031/216] ASoC: Add support for PCM5102A codec Some definitions to support the PCM5102A codec by Texas Instruments. @@ -114517,10 +114533,10 @@ index 0000000..126f1e9 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 4102a7dbd70a7e71a1ab3d138d2b1effea0bcc21 Mon Sep 17 00:00:00 2001 +From b8442f0526d6de697deec639e36023a92a2d178a Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:04:54 +0100 -Subject: [PATCH 032/154] BCM2708: Add I2S support to board file +Subject: [PATCH 032/216] BCM2708: Add I2S support to board file Adds the required initializations for I2S to the board file of mach-bcm2708. @@ -114575,10 +114591,10 @@ index 5873f8b..7f4ebf4 100644 struct amba_device *d = amba_devs[i]; amba_device_register(d, &iomem_resource); -From 1054e906f33b25b716db57ae6c649a4009a16102 Mon Sep 17 00:00:00 2001 +From 40cf34f896f3ac88ad775464619175b5167ddacb Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 033/154] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 033/216] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -114727,10 +114743,10 @@ index 0000000..4b70b45 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From 1685814fc1a8b98fe0cbfb4eb88515d8642e8d05 Mon Sep 17 00:00:00 2001 +From c2ef063e2adb0e41654dc580ae959a86cde6f6f5 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 034/154] BCM2708: Add HifiBerry DAC to board file +Subject: [PATCH 034/216] BCM2708: Add HifiBerry DAC to board file This adds the initalization of the HifiBerry DAC to the mach-bcm2708 board file. @@ -114778,10 +114794,10 @@ index 7f4ebf4..94ce8fc 100644 struct amba_device *d = amba_devs[i]; amba_device_register(d, &iomem_resource); -From 5ec50b24ac72688ccf7f0fa46f3a1ed90beec8df Mon Sep 17 00:00:00 2001 +From 1de129c2113a6fb145e654260b683e6c7e30bb51 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 6 Dec 2013 20:50:28 +0100 -Subject: [PATCH 035/154] ASoC: BCM2708: Add support for RPi-DAC +Subject: [PATCH 035/216] ASoC: BCM2708: Add support for RPi-DAC This adds a machine driver for the RPi-DAC. @@ -115076,10 +115092,10 @@ index 0000000..b4eaa44 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 76bd7ab96dfa110f8996f50939e0a7fee9033b12 Mon Sep 17 00:00:00 2001 +From 11dea4325311685b8d38b791b519e74a561476ca Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 036/154] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 036/216] ASoC: wm8804: Implement MCLK configuration options, add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs for most sample rates. At 192kHz only 128xfs is supported. The existing driver selects 128xfs automatically for some lower samples rates. By using an @@ -115119,10 +115135,10 @@ index b2b0e68..ba2a0f8 100644 #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ -From aa032227a1ece45842be1d2ff3f8385e585eb1d5 Mon Sep 17 00:00:00 2001 +From 84aed3cc8e8d60407b60cd132fe7a673024fb1a4 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 037/154] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 037/216] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -115325,10 +115341,10 @@ index 0000000..446ecdd +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From 407d23d8a45300407b9f83a8a119b9e70836676b Mon Sep 17 00:00:00 2001 +From 4d5dd3c3d6019cf233add726cbe3aac6e543c540 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:26:08 +0100 -Subject: [PATCH 038/154] BCM2708: Added support for HiFiBerry Digi board Board +Subject: [PATCH 038/216] BCM2708: Added support for HiFiBerry Digi board Board initalization by I2C Signed-off-by: Daniel Matuschek @@ -115375,10 +115391,10 @@ index fb955755..0ad5343 100644 bcm_register_device_dt(&snd_rpi_dac_device); bcm_register_device_dt(&snd_pcm1794a_codec_device); -From fcd76211074648ab8dbec0960443cc5e43936786 Mon Sep 17 00:00:00 2001 +From 963fd96f5747dd0c693a87cbb23bc1239d3bda72 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 039/154] ASoC: wm8804: Set idle_bias_off to false Idle bias +Subject: [PATCH 039/216] ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup Signed-off-by: Daniel Matuschek @@ -115400,10 +115416,10 @@ index ba2a0f8..91974f9 100644 .controls = wm8804_snd_controls, .num_controls = ARRAY_SIZE(wm8804_snd_controls), -From 2624db940287a364ccab772c498a0c098a5fadba Mon Sep 17 00:00:00 2001 +From f5995e9c2cc2d801d5b05e3f4be0bdafb184943a Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 040/154] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 040/216] Add IQaudIO Sound Card support for Raspberry Pi --- arch/arm/mach-bcm2708/bcm2708.c | 22 ++++++++ @@ -115600,10 +115616,10 @@ index 0000000..8d0e2ae +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From 809f7a7f459b05073bbb47de741894d302abb8ce Mon Sep 17 00:00:00 2001 +From 5d1809ba161ed01404974ad13403d23a008bd181 Mon Sep 17 00:00:00 2001 From: Howard Mitchell Date: Mon, 2 Mar 2015 17:28:02 +0000 -Subject: [PATCH 041/154] Set a limit of 0dB on Digital Volume Control +Subject: [PATCH 041/216] Set a limit of 0dB on Digital Volume Control The main volume control in the PCM512x DAC has a range up to +24dB. This is dangerously loud and can potentially cause massive @@ -115633,10 +115649,10 @@ index 8d0e2ae..aff7377 100644 return 0; } -From 918b734bf69d761efb0f66be2d19093b0156b408 Mon Sep 17 00:00:00 2001 +From 8dbd2bddafe5d604e9f03a702d5ae50c0dd791e6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 042/154] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 042/216] vmstat: Workaround for issue where dirty page count goes negative See: @@ -115663,10 +115679,10 @@ index 82e7db7..f87d16d 100644 static inline void __inc_zone_page_state(struct page *page, -From 6c9eeae1a0d49e5209b3040ba0b3ebc8f22ec96d Mon Sep 17 00:00:00 2001 +From 15bf30debd62320326c6a474f69eabbf3b43029e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 18:55:53 +0100 -Subject: [PATCH 043/154] BCM2708: armctrl: Add IRQ Device Tree support +Subject: [PATCH 043/216] BCM2708: armctrl: Add IRQ Device Tree support Add Device Tree IRQ support for BCM2708. Usage is the same as for irq-bcm2835. @@ -115808,10 +115824,10 @@ index 96fa9b9..74bacb3 100644 return 0; } -From d41a10ba93b35b80f449a8ca942a8e7e21046651 Mon Sep 17 00:00:00 2001 +From e85c6248222486f0aca8f09ea4bf7ad463b15487 Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 044/154] BCM2708: use pinctrl-bcm2835 +Subject: [PATCH 044/216] BCM2708: use pinctrl-bcm2835 Use pinctrl-bcm2835 instead of the pinctrl-bcm2708 and bcm2708_gpio combination. @@ -115864,10 +115880,10 @@ index 9aa8a3f..9d1149e 100644 .can_sleep = false, }; -From 16b8124e21e7dcd729a59ed38824e1b915fe8ea9 Mon Sep 17 00:00:00 2001 +From d00f2dcc5c02b51e10e6516e12570db41509ffe5 Mon Sep 17 00:00:00 2001 From: notro Date: Sun, 27 Jul 2014 20:12:58 +0200 -Subject: [PATCH 045/154] spi: bcm2708: add device tree support +Subject: [PATCH 045/216] spi: bcm2708: add device tree support Add DT support to driver and add to .dtsi file. Setup pins and spidev in .dts file. @@ -115992,10 +116008,10 @@ index 349d21f..041b5e2 100644 .probe = bcm2708_spi_probe, .remove = bcm2708_spi_remove, -From c04316c256e9e516650611dd4a9c980db0eae29c Mon Sep 17 00:00:00 2001 +From 13cf0c2ef8f80ef3e128343e2d07cd3d31eb9860 Mon Sep 17 00:00:00 2001 From: notro Date: Tue, 29 Jul 2014 11:04:49 +0200 -Subject: [PATCH 046/154] i2c: bcm2708: add device tree support +Subject: [PATCH 046/216] i2c: bcm2708: add device tree support Add DT support to driver and add to .dtsi file. Setup pins in .dts file. @@ -116138,10 +116154,10 @@ index 7d385a3..526129b 100644 .probe = bcm2708_i2c_probe, .remove = bcm2708_i2c_remove, -From 7708377b701a832e1e5ceb7b1ffdf07d144935e3 Mon Sep 17 00:00:00 2001 +From b36757e9c2eb66112c0cebce20ac608f1f94cbe4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 047/154] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 047/216] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -116177,10 +116193,10 @@ index bfbe1be..a738b25 100644 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From 9d7ac0e308c904869352d6a7961217d99c4e1313 Mon Sep 17 00:00:00 2001 +From 72f91c3f7d8b2944ccadbe7d3d57128c1fc08a8b Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 24 Jul 2014 21:24:03 +0100 -Subject: [PATCH 048/154] usb: core: make overcurrent messages more prominent +Subject: [PATCH 048/216] usb: core: make overcurrent messages more prominent Hub overcurrent messages are more serious than "debug". Increase loglevel. --- @@ -116188,7 +116204,7 @@ Hub overcurrent messages are more serious than "debug". Increase loglevel. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index d7c3d5a..6ca08fa 100644 +index 3b71516..8324c14 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -4922,7 +4922,7 @@ static void port_event(struct usb_hub *hub, int port1) @@ -116201,10 +116217,10 @@ index d7c3d5a..6ca08fa 100644 USB_PORT_FEAT_C_OVER_CURRENT); msleep(100); /* Cool down */ -From d2a00394bb184cc1933e5676bea8df542270361a Mon Sep 17 00:00:00 2001 +From cf880d700f626df4e4910b8dedea887720bf6018 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 7 Aug 2014 02:03:50 +0100 -Subject: [PATCH 049/154] Revert "ARM: dma: Use dma_pfn_offset for dma address +Subject: [PATCH 049/216] Revert "ARM: dma: Use dma_pfn_offset for dma address translation" This reverts commit 6ce0d20016925d031f1e24d64302e4c976d7cec6. @@ -116213,7 +116229,7 @@ This reverts commit 6ce0d20016925d031f1e24d64302e4c976d7cec6. 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h -index b52101d..f5572d9 100644 +index b52101d3..f5572d9 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -58,37 +58,21 @@ static inline int dma_set_mask(struct device *dev, u64 mask) @@ -116256,10 +116272,10 @@ index b52101d..f5572d9 100644 } -From 2b376efb3a813405d83208fd8e2edc63af06fc2d Mon Sep 17 00:00:00 2001 +From 3492b141fbae950fd9614cb643257658e5d89329 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 050/154] Added support for HiFiBerry DAC+ +Subject: [PATCH 050/216] Added support for HiFiBerry DAC+ The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses a different codec chip (PCM5122), therefore a new driver is necessary. @@ -116470,10 +116486,10 @@ index 0000000..c63387b +MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); +MODULE_LICENSE("GPL v2"); -From a7e71af10914924d8399d3fbc47159add5cbc3bf Mon Sep 17 00:00:00 2001 +From 3663a863bd1a077dfe48177181118e464a1d6f08 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 051/154] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 051/216] Added driver for HiFiBerry Amp amplifier add-on board The driver contains a low-level hardware driver for the TAS5713 and the drivers for the Raspberry Pi I2S subsystem. @@ -117303,10 +117319,10 @@ index 0000000..8f019e0 + +#endif /* _TAS5713_H */ -From 903043678721b196027ed1b8e0e1003b13a2f635 Mon Sep 17 00:00:00 2001 +From 5cd70cb7da74d3817f6037213f1a79ff31254d89 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Apr 2015 19:14:18 +0100 -Subject: [PATCH 052/154] bcm2708: Allow option card devices to be configured +Subject: [PATCH 052/216] bcm2708: Allow option card devices to be configured via DT If the kernel is built with Device Tree support, and if a DT blob @@ -117331,10 +117347,10 @@ index 03fa1cb..c816526 100644 static struct platform_driver bcm2835_i2s_driver = { .probe = bcm2835_i2s_probe, -From 1af7b4b7930de1c4d478bf2bd2c1805b3cb239bc Mon Sep 17 00:00:00 2001 +From b2ee40fa3d362faf4071abda9f1e273b6e80ec78 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 18:45:39 +0100 -Subject: [PATCH 053/154] Adding Device Tree support for some RPi audio cards +Subject: [PATCH 053/216] Adding Device Tree support for some RPi audio cards --- arch/arm/boot/dts/hifiberry-dac-overlay.dts | 34 +++++++++++++++++++++ @@ -117765,10 +117781,10 @@ index 126f1e9..7c6598e 100644 }; -From fa54f49c2322b1e80b7156c75b5eac370ccbc144 Mon Sep 17 00:00:00 2001 +From ea3aad745389e9631e71c1b175e37d6874ee980b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 054/154] fdt: Add support for the CONFIG_CMDLINE_EXTEND option +Subject: [PATCH 054/216] fdt: Add support for the CONFIG_CMDLINE_EXTEND option --- drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- @@ -117823,10 +117839,10 @@ index 3a896c9..0320a6f 100644 pr_debug("Command line is: %s\n", (char*)data); -From 66958bd53eb066f3472cf7f8ace313dbca4137b5 Mon Sep 17 00:00:00 2001 +From a9a57c353bdccbc5cd60d995c53d6146addf78fc Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 16 Dec 2014 10:23:48 +0000 -Subject: [PATCH 055/154] DT: Add overrides to enable i2c0, i2c1, spi and i2s +Subject: [PATCH 055/216] DT: Add overrides to enable i2c0, i2c1, spi and i2s --- arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 10 ++++++++++ @@ -117870,10 +117886,10 @@ index d8c6d15..167b22b 100644 + }; +}; -From c4afc4f5951ab82593f87be4245e70b364ee623e Mon Sep 17 00:00:00 2001 +From 4bdc71b8c2f9444a8ec6fe833cb92ba4fd4130f7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 18 Dec 2014 16:48:32 +0000 -Subject: [PATCH 056/154] lirc-rpi: Add device tree support, and a suitable +Subject: [PATCH 056/216] lirc-rpi: Add device tree support, and a suitable overlay The overlay supports DT parameters that match the old module @@ -118167,10 +118183,10 @@ index 8aa452d..24563ec 100644 if (result < 0) goto exit_rpi; -From d93c40a747bc024aec7d9fcddb35e6c20e71ee79 Mon Sep 17 00:00:00 2001 +From fb3c953810dfcbba431ad3c70eb5751d014db152 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 6 Jan 2015 12:06:55 +0000 -Subject: [PATCH 057/154] Fix the activity LED in DT mode +Subject: [PATCH 057/216] Fix the activity LED in DT mode Add a "leds" node to the base DTBs, and a subnode for the activity LED. You can change the LED function like this: @@ -118302,10 +118318,10 @@ index 0a916a4..d879316 100644 clocks { -From f12459c4b2fb1b9fe43ca17b18e796a1038aa5f5 Mon Sep 17 00:00:00 2001 +From 1c9f91aafc02bd624edc56899972cb13f48f921d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 15 Jan 2015 10:39:06 +0000 -Subject: [PATCH 058/154] Adding w1-gpio device tree overlays +Subject: [PATCH 058/216] Adding w1-gpio device tree overlays N.B. Requires firmware supporting multi-target overrides @@ -118415,10 +118431,10 @@ index 0000000..b3e97c2 + }; +}; -From f24e351f438ea544a9ab6ec86c3c2152f4490559 Mon Sep 17 00:00:00 2001 +From 740e2da8a9fa6f84e95707ee0a10b4a4cfeaed4a Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Fri, 23 Jan 2015 16:41:17 +0100 -Subject: [PATCH 059/154] TAS5713: return error if initialisation fails +Subject: [PATCH 059/216] TAS5713: return error if initialisation fails Existing TAS5713 driver logs errors during initialisation, but does not return an error code. Therefore even if initialisation fails, the driver will still be @@ -118485,10 +118501,10 @@ index a24c1da..9b27138 100644 return 0; } -From c70c2040d0a4e4e0c14e7d0d348479d8e9819028 Mon Sep 17 00:00:00 2001 +From 9615583a44fc9449d77a247d0207b35eab1db982 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 23 Jan 2015 14:48:55 +0000 -Subject: [PATCH 060/154] scripts/dtc: Update to upstream version with overlay +Subject: [PATCH 060/216] scripts/dtc: Update to upstream version with overlay patches --- @@ -123701,17 +123717,17 @@ index 54d4e904..d644002 100644 -#define DTC_VERSION "DTC 1.4.0-dirty" +#define DTC_VERSION "DTC 1.4.1-g36c70742" -From 0b07678de56962ea6065e426ac90cf04d32bb5e4 Mon Sep 17 00:00:00 2001 +From 453099dc662c02d1308039ab2dabb176e052eabf Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 23 Jan 2015 15:18:03 +0000 -Subject: [PATCH 061/154] BCM2708_DT: Build the overlays as well +Subject: [PATCH 061/216] BCM2708_DT: Build the overlays as well --- arch/arm/boot/dts/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index c86833d..0784306 100644 +index 25fbf52..63d902c 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -12,6 +12,15 @@ ifeq ($(CONFIG_BCM2709_DT),y) @@ -123731,10 +123747,10 @@ index c86833d..0784306 100644 alphascale-asm9260-devkit.dtb # Keep at91 dtb files sorted alphabetically for each SoC -From 04543b4caada4daf9b9e0423014320a000ae71ea Mon Sep 17 00:00:00 2001 +From b39dde193e6242ec53938122e553e3af4cd528ed Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Sun, 25 Jan 2015 19:41:06 +0100 -Subject: [PATCH 062/154] Add device tree overlay for HiFiBerry Amp/Amp+ +Subject: [PATCH 062/216] Add device tree overlay for HiFiBerry Amp/Amp+ This patch add the missing device tree file for the HiFiBerry Amp and Amp+ boards. --- @@ -123744,7 +123760,7 @@ This patch add the missing device tree file for the HiFiBerry Amp and Amp+ board create mode 100644 arch/arm/boot/dts/hifiberry-amp-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 0784306..8e48eb3 100644 +index 63d902c..63d89df 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -15,6 +15,7 @@ endif @@ -123801,10 +123817,10 @@ index 0000000..2c81448 + }; +}; -From 231e60fed4d703d27ae821a85739cb4f296c1706 Mon Sep 17 00:00:00 2001 +From da11da093a2c65a9faa481e0688b0f242476ee78 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 26 Jan 2015 09:18:24 +0000 -Subject: [PATCH 063/154] Add pps-gpio DT overlay +Subject: [PATCH 063/216] Add pps-gpio DT overlay Parameters: gpiopin= // Default 18 @@ -123815,7 +123831,7 @@ Parameters: create mode 100644 arch/arm/boot/dts/pps-gpio-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 8e48eb3..f542d0b 100644 +index 63d89df..18637de 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -19,6 +19,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb @@ -123867,10 +123883,10 @@ index 0000000..40bf0e1 + }; +}; -From fc55e032ddb72eae5a11c32240a383592a0dc00a Mon Sep 17 00:00:00 2001 +From 4cddfa6e3758e34eaeeb8457e0f012965436bc1c Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Wed, 29 Oct 2014 23:30:30 -0700 -Subject: [PATCH 064/154] Added support to reserve/enable a GPIO pin to be used +Subject: [PATCH 064/216] Added support to reserve/enable a GPIO pin to be used from pps-gpio module (LinuxPPS). Enable PPS modules in default config for RPi. @@ -123943,7 +123959,7 @@ index 66bc839..cc3e56c 100644 +module_param(pps_gpio_pin, int, 0644); +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index fe467e2..f141103 100644 +index c4bd0a4..914c970 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -37,6 +37,7 @@ @@ -123999,17 +124015,17 @@ index fe467e2..f141103 100644 #if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) w1_gpio_pdata.pin = w1_gpio_pin; w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup; -@@ -1261,3 +1286,5 @@ module_param(disk_led_active_low, uint, 0644); +@@ -1267,3 +1292,5 @@ module_param(disk_led_active_low, uint, 0644); module_param(reboot_part, uint, 0644); module_param(w1_gpio_pin, uint, 0644); module_param(w1_gpio_pullup, uint, 0644); +module_param(pps_gpio_pin, int, 0644); +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); -From b85ff8bd837ac1e0cc8bbd17a9eb9ec3d909d8ae Mon Sep 17 00:00:00 2001 +From 2ff35a0e682880dbae67c842805ea848285b373f Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 3 Sep 2014 14:44:22 +0100 -Subject: [PATCH 065/154] I2C: Only register the I2C device for the current +Subject: [PATCH 065/216] I2C: Only register the I2C device for the current board revision --- @@ -124054,7 +124070,7 @@ index cc3e56c..c8aea5b 100644 +module_param(vc_i2c_override, bool, 0644); +MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral."); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index f141103..396c1e7 100644 +index 914c970..259d552 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -97,6 +97,7 @@ static unsigned reboot_part = 0; @@ -124083,17 +124099,17 @@ index f141103..396c1e7 100644 bcm_register_device(&bcm2835_hwmon_device); bcm_register_device(&bcm2835_thermal_device); -@@ -1288,3 +1296,5 @@ module_param(w1_gpio_pin, uint, 0644); +@@ -1294,3 +1302,5 @@ module_param(w1_gpio_pin, uint, 0644); module_param(w1_gpio_pullup, uint, 0644); module_param(pps_gpio_pin, int, 0644); MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); +module_param(vc_i2c_override, bool, 0644); +MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral."); -From 67b07b343f34129919acae4c56eb3114ffed92f4 Mon Sep 17 00:00:00 2001 +From 32bee38e1fca47be55a48205e850c16901127982 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 28 Jan 2015 16:22:04 +0000 -Subject: [PATCH 066/154] BCM2708_DT: Add pcf8523-rtc overlay +Subject: [PATCH 066/216] BCM2708_DT: Add pcf8523-rtc overlay --- arch/arm/boot/dts/Makefile | 1 + @@ -124102,7 +124118,7 @@ Subject: [PATCH 066/154] BCM2708_DT: Add pcf8523-rtc overlay create mode 100644 arch/arm/boot/dts/pcf8523-rtc-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index f542d0b..efd1c04 100644 +index 18637de..c909f7b 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -19,6 +19,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb @@ -124142,10 +124158,10 @@ index 0000000..0071f62 + }; +}; -From 8b09a2b295e9e9ad120a87f3f2722d41edaecfec Mon Sep 17 00:00:00 2001 +From 7358633426ec4c3897c26cb1575a0ab7309e4f73 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Sat, 31 Jan 2015 16:07:56 +0100 -Subject: [PATCH 067/154] Add a parameter to turn off SPDIF output if no audio +Subject: [PATCH 067/216] Add a parameter to turn off SPDIF output if no audio is playing This patch adds the paramater auto_shutdown_output to the kernel module. @@ -124217,10 +124233,10 @@ index 74a8c73..a245995 100644 static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { -From d1b18954b288e865312efad2cd25c0dc4724b2a0 Mon Sep 17 00:00:00 2001 +From fdcfdf08df6289445d33e8acaf68faa5f5b4923b Mon Sep 17 00:00:00 2001 From: Joerg Hohensohn Date: Sun, 1 Feb 2015 22:08:03 +0100 -Subject: [PATCH 068/154] bugfix for 32kHz sample rate, was missing +Subject: [PATCH 068/216] bugfix for 32kHz sample rate, was missing --- sound/soc/bcm/hifiberry_digi.c | 1 + @@ -124239,10 +124255,10 @@ index a245995..a294a1b 100644 case 48000: case 88200: -From 79e41e4a631f1f62a6593a49b37adbf61cb0c69b Mon Sep 17 00:00:00 2001 +From 601bc9883a6bf209e736d2b1cc5991176ed1abf3 Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 069/154] Update ds1307 driver for device-tree support +Subject: [PATCH 069/216] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -124269,10 +124285,10 @@ index 4ffabb3..c6789a7 100644 .driver = { .name = "rtc-ds1307", -From c29e2b5781f6e54152dfdbc07a205e7b17ce16b9 Mon Sep 17 00:00:00 2001 +From c6e4ebd2dec4446f061cab8fa0a860e0fe7fd30a Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:26:03 -0700 -Subject: [PATCH 070/154] Add device-tree overlay for ds1307 +Subject: [PATCH 070/216] Add device-tree overlay for ds1307 Signed-off-by: Ryan Coe --- @@ -124282,7 +124298,7 @@ Signed-off-by: Ryan Coe create mode 100644 arch/arm/boot/dts/ds1307-rtc-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index efd1c04..d45424c 100644 +index c909f7b..7755a84 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -12,6 +12,7 @@ ifeq ($(CONFIG_BCM2709_DT),y) @@ -124322,10 +124338,10 @@ index 0000000..7d27044 + }; +}; -From 21a00874bde5439caf8dae1f60fbe4794f1b2ee2 Mon Sep 17 00:00:00 2001 +From 7abd2997600af8ee74045e490c6db3a41f716636 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 071/154] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 071/216] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -124652,15 +124668,15 @@ index 0000000..2ca2b98 +MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); +MODULE_LICENSE("GPL"); -From ec616ff69fa39ef7b7b232a27a339e6ec0b0b50e Mon Sep 17 00:00:00 2001 +From be825a324f0b4e90f3fc396b0ed17442c5cb771d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 20 Jun 2014 17:19:27 +0100 -Subject: [PATCH 072/154] bcm2709: Simplify and strip down IRQ handler +Subject: [PATCH 072/216] bcm2709: Simplify and strip down IRQ handler --- arch/arm/include/asm/entry-macro-multi.S | 2 + - arch/arm/mach-bcm2709/include/mach/entry-macro.S | 169 +++++++++++------------ - 2 files changed, 85 insertions(+), 86 deletions(-) + arch/arm/mach-bcm2709/include/mach/entry-macro.S | 173 +++++++++++------------ + 2 files changed, 87 insertions(+), 88 deletions(-) diff --git a/arch/arm/include/asm/entry-macro-multi.S b/arch/arm/include/asm/entry-macro-multi.S index 469a2b3..9c0a7eb 100644 @@ -124682,7 +124698,7 @@ index 469a2b3..9c0a7eb 100644 .macro arch_irq_handler, symbol_name .align 5 diff --git a/arch/arm/mach-bcm2709/include/mach/entry-macro.S b/arch/arm/mach-bcm2709/include/mach/entry-macro.S -index d08591b..101d9f1 100644 +index d08591b..08d184c 100644 --- a/arch/arm/mach-bcm2709/include/mach/entry-macro.S +++ b/arch/arm/mach-bcm2709/include/mach/entry-macro.S @@ -22,102 +22,99 @@ @@ -124713,6 +124729,10 @@ index d08591b..101d9f1 100644 + ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source + add \irqstat, \irqstat, \base, lsl #2 + ldr \tmp, [\irqstat] ++#ifdef CONFIG_SMP ++ /* test for mailbox0 (IPI) interrupt */ ++ tst \tmp, #0x10 ++ beq 1030f - /* get core's local interrupt controller */ - ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source @@ -124723,22 +124743,6 @@ index d08591b..101d9f1 100644 - /* ignore mailbox interrupts */ - bics \tmp, #0xf0 - beq 1005f -+ /* test for mailbox0 (IPI) interrupt */ -+ tst \tmp, #0x10 -+ beq 1030f - -- @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1)) -- @ N.B. CLZ is an ARM5 instruction. -- mov \irqnr, #(ARM_IRQ_LOCAL_BASE + 31) -- sub \irqstat, \tmp, #1 -- eor \irqstat, \irqstat, \tmp -- clz \tmp, \irqstat -- sub \irqnr, \tmp -- b 1020f --1005: -- /* get core number */ -- mrc p15, 0, \tmp, c0, c0, 5 -- ubfx \tmp, \tmp, #0, #2 + /* get core's mailbox interrupt control */ + ldr \irqstat, = __io_address(ARM_LOCAL_MAILBOX0_CLR0) @ mbox_clr + add \irqstat, \irqstat, \base, lsl #4 @@ -124752,25 +124756,24 @@ index d08591b..101d9f1 100644 + mov r1, sp + adr lr, BSYM(1b) + b do_IPI - -- cmp \tmp, #1 -- beq 1020f -- cmp \tmp, #2 -- beq 1020f -- cmp \tmp, #3 -- beq 1020f ++#endif +1030: + /* check gpu interrupt */ + tst \tmp, #0x100 + beq 1040f -- /* get masked status */ -- ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)] -- mov \irqnr, #(ARM_IRQ0_BASE + 31) -- and \tmp, \irqstat, #0x300 @ save bits 8 and 9 -- /* clear bits 8 and 9, and test */ -- bics \irqstat, \irqstat, #0x300 -- bne 1010f +- @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1)) +- @ N.B. CLZ is an ARM5 instruction. +- mov \irqnr, #(ARM_IRQ_LOCAL_BASE + 31) +- sub \irqstat, \tmp, #1 +- eor \irqstat, \irqstat, \tmp +- clz \tmp, \irqstat +- sub \irqnr, \tmp +- b 1020f +-1005: +- /* get core number */ +- mrc p15, 0, \tmp, c0, c0, 5 +- ubfx \tmp, \tmp, #0, #2 + ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE) + /* get masked status */ + ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)] @@ -124780,6 +124783,21 @@ index d08591b..101d9f1 100644 + bics \irqstat, \irqstat, #0x300 + bne 1010f +- cmp \tmp, #1 +- beq 1020f +- cmp \tmp, #2 +- beq 1020f +- cmp \tmp, #3 +- beq 1020f +- +- /* get masked status */ +- ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)] +- mov \irqnr, #(ARM_IRQ0_BASE + 31) +- and \tmp, \irqstat, #0x300 @ save bits 8 and 9 +- /* clear bits 8 and 9, and test */ +- bics \irqstat, \irqstat, #0x300 +- bne 1010f +- - tst \tmp, #0x100 - ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)] - movne \irqnr, #(ARM_IRQ1_BASE + 31) @@ -124872,10 +124890,10 @@ index d08591b..101d9f1 100644 +1: get_irqnr_and_base r0, r2, r6, lr + .endm -From 5bb524a3e375d3d4220a88184293d82667e8b57e Mon Sep 17 00:00:00 2001 +From 219ae1b83de018ba2a3e3d909c0cbfce14579c14 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Tue, 3 Feb 2015 07:15:19 +0100 -Subject: [PATCH 073/154] HiFiBerry Amp: fix device-tree problems +Subject: [PATCH 073/216] HiFiBerry Amp: fix device-tree problems Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. --- @@ -124929,10 +124947,10 @@ index 1e87ee06..5903915 100644 .probe = snd_rpi_hifiberry_amp_probe, .remove = snd_rpi_hifiberry_amp_remove, -From 913d3a3c763a571ca99f9ea81c0ef0c663bac578 Mon Sep 17 00:00:00 2001 +From 81042a79740e7b0c61fcbfa97e76c3d97c40b630 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 3 Feb 2015 11:41:38 +0000 -Subject: [PATCH 074/154] BCM270x_DT: Add i2c0_baudrate and i2c1_baudrate +Subject: [PATCH 074/216] BCM270x_DT: Add i2c0_baudrate and i2c1_baudrate parameters --- @@ -124981,10 +124999,10 @@ index 46f4908..75c222f 100644 act_led_gpio = <&act_led>,"gpios:4"; act_led_activelow = <&act_led>,"gpios:8"; -From 9ca7fc789a28057c51d699266c2e6b57db7861cc Mon Sep 17 00:00:00 2001 +From 4ff8b4c54db8215c8daa7a1d70c623b642143f16 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 4 Feb 2015 10:02:24 +0000 -Subject: [PATCH 075/154] pinctrl-bcm2835: bcm2835_gpio_direction_output must +Subject: [PATCH 075/216] pinctrl-bcm2835: bcm2835_gpio_direction_output must set the value --- @@ -125012,10 +125030,10 @@ index 9d1149e..d9c727b 100644 static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) -From 7ea41787ab061ab5957c4e6e4cc1351816ee9bb1 Mon Sep 17 00:00:00 2001 +From 1184251f953b0cd578ee44fa36d67f7f9091e6a5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 4 Feb 2015 12:59:36 +0000 -Subject: [PATCH 076/154] w1-gpio: Sort out the pullup/parasitic power tangle +Subject: [PATCH 076/216] w1-gpio: Sort out the pullup/parasitic power tangle --- arch/arm/boot/dts/w1-gpio-overlay.dts | 4 +++- @@ -125188,10 +125206,10 @@ index d58594a..feae942 100644 unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; -From 0ef85a9dc0dc08fe3e69b02e4f87ee8a38b01723 Mon Sep 17 00:00:00 2001 +From a0d0e3ba49f5daa0ece5234cdf688fb490ee15a7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 5 Feb 2015 16:01:44 +0000 -Subject: [PATCH 077/154] i2c_bcm2708: Fix clock reference counting +Subject: [PATCH 077/216] i2c_bcm2708: Fix clock reference counting --- drivers/i2c/busses/i2c-bcm2708.c | 12 ++++++++++-- @@ -125239,10 +125257,10 @@ index 526129b..fda59ba 100644 kfree(bi); -From 6c1a859165c378643f946f6c89eaf246655f5f8f Mon Sep 17 00:00:00 2001 +From dffb6179317e46f3f2d60c62b6b4c6c1008990ef Mon Sep 17 00:00:00 2001 From: Byron Bradley Date: Fri, 6 Feb 2015 14:19:41 +0000 -Subject: [PATCH 078/154] Add device-tree overlay for pcf2127 +Subject: [PATCH 078/216] Add device-tree overlay for pcf2127 Signed-off-by: Byron Bradley --- @@ -125252,7 +125270,7 @@ Signed-off-by: Byron Bradley create mode 100644 arch/arm/boot/dts/pcf2127-rtc-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index d45424c..ca55980 100644 +index 7755a84..6cb743a 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -20,6 +20,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb @@ -125292,10 +125310,10 @@ index 0000000..01fc81d + }; +}; -From 604eef02f110e3e44c54bf61fb9fbbe2e130eec9 Mon Sep 17 00:00:00 2001 +From 6547e99ab9f5be7bc839f36becfc18e6dd879d0d Mon Sep 17 00:00:00 2001 From: android Date: Mon, 25 Aug 2014 13:18:21 +0100 -Subject: [PATCH 079/154] BCM2708_VCIO : Add automatic creation of device node +Subject: [PATCH 079/216] BCM2708_VCIO : Add automatic creation of device node --- arch/arm/mach-bcm2708/vcio.c | 12 +++++++++++- @@ -125377,10 +125395,10 @@ index 5e43e85..700bff4 100644 } -From e42746b1c99904a99a28cd326d5616087ea4f87a Mon Sep 17 00:00:00 2001 +From 05b37dedc10f2da009b868c101623c742eda1c3f Mon Sep 17 00:00:00 2001 From: jeanleflambeur Date: Sun, 1 Feb 2015 12:35:38 +0100 -Subject: [PATCH 080/154] Fix grabbing lock from atomic context in i2c driver +Subject: [PATCH 080/216] Fix grabbing lock from atomic context in i2c driver 2 main changes: - check for timeouts in the bcm2708_bsc_setup function as indicated by this comment: @@ -125599,10 +125617,10 @@ index fda59ba..81e9374 100644 dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", pdev->id, (unsigned long)regs->start, irq, baudrate); -From 1d773d31a54a7e2b7771986035e1a2d8d0e610e6 Mon Sep 17 00:00:00 2001 +From 2e3d8378c9031150eda4fd030b14d6c4ea762786 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 12 Feb 2015 11:17:53 +0000 -Subject: [PATCH 081/154] Fix LED "input" trigger implementation for 3.19 +Subject: [PATCH 081/216] Fix LED "input" trigger implementation for 3.19 --- drivers/leds/leds-gpio.c | 10 +++++++++- @@ -125689,10 +125707,10 @@ index f70f84f..f3fcaa1 100644 /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ -From 1054dcb8e6e64ebea0195b960b5cd154f0209b44 Mon Sep 17 00:00:00 2001 +From 9bdca5da4acd1e4893a10183c0202b2b1293b9cd Mon Sep 17 00:00:00 2001 From: Rainer Herbers Date: Sun, 15 Feb 2015 13:44:14 +0100 -Subject: [PATCH 082/154] Create bmp085_i2c-sensor-overlay.dts and update +Subject: [PATCH 082/216] Create bmp085_i2c-sensor-overlay.dts and update Makefile --- @@ -125702,7 +125720,7 @@ Subject: [PATCH 082/154] Create bmp085_i2c-sensor-overlay.dts and update create mode 100644 arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index ca55980..6839ece 100644 +index 6cb743a..7946143 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -12,6 +12,7 @@ ifeq ($(CONFIG_BCM2709_DT),y) @@ -125743,10 +125761,10 @@ index 0000000..b830bf2 + }; +}; -From 6f6691ec5aeefa93782d70690f69bf9ffdd1b644 Mon Sep 17 00:00:00 2001 +From 92765161f74e60edf1eb2c752f2cd3ea9d531d14 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 083/154] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 083/216] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -125892,10 +125910,10 @@ index d9c727b..ae68710 100644 }, }; -From f84f3792f87b50bfff0e15e1a78c39386bbf5b5d Mon Sep 17 00:00:00 2001 +From d1f5e57c873c1acf3be524693888af970a08f4fb Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 084/154] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 084/216] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -125922,10 +125940,10 @@ index ae68710..87b7a4a 100644 pc->irq_data[i].irqgroup = i; -From 97ee5645351880dce63ec9a15477b278ca21d0d8 Mon Sep 17 00:00:00 2001 +From a10a9f8313c8fff626c82bf63608f3f00188c5db Mon Sep 17 00:00:00 2001 From: Dave Martin Date: Fri, 27 Feb 2015 15:51:37 +0000 -Subject: [PATCH 085/154] serial/amba-pl011: Activate TX IRQ passively +Subject: [PATCH 085/216] serial/amba-pl011: Activate TX IRQ passively The current PL011 driver transmits a dummy character when the UART is opened, to assert the TX IRQ for the first time @@ -126269,10 +126287,10 @@ index 16ca535..c243729 100644 /* Ensure interrupts from this UART are masked and cleared */ -From 103c9b4d22e0e0ef5cecd80284b379253192f14b Mon Sep 17 00:00:00 2001 +From 75d9fae636d84117aa46cf0c2dcc556d02d67aca Mon Sep 17 00:00:00 2001 From: Dave Martin Date: Wed, 1 Apr 2015 14:08:31 +0100 -Subject: [PATCH 086/154] serial/amba-pl011: Refactor and simplify TX FIFO +Subject: [PATCH 086/216] serial/amba-pl011: Refactor and simplify TX FIFO handling Commit 734745c serial/amba-pl011: Activate TX IRQ passively @@ -126513,10 +126531,10 @@ index c243729..e32f4d7 100644 /* Ensure interrupts from this UART are masked and cleared */ -From 04fa1b67ccabb1b4f0a1270cbbbcb915d7b088bb Mon Sep 17 00:00:00 2001 +From 29cd864c0ec9d9d593e569ee5d4fcb463d36cb35 Mon Sep 17 00:00:00 2001 From: Jon Burgess Date: Tue, 17 Feb 2015 13:22:17 +0000 -Subject: [PATCH 087/154] Create generic i2c-rtc overlay for supporting ds1307, +Subject: [PATCH 087/216] Create generic i2c-rtc overlay for supporting ds1307, ds3231, pcf2127 and pcf8523. Signed-off-by: Jon Burgess @@ -126527,7 +126545,7 @@ Signed-off-by: Jon Burgess create mode 100644 arch/arm/boot/dts/i2c-rtc-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 6839ece..bc13a9a 100644 +index 7946143..6753fcb 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -14,6 +14,7 @@ endif @@ -126588,10 +126606,10 @@ index 0000000..5d5abb1 + }; +}; -From c667acb84fa9818d76bdd1f4260887f93f656735 Mon Sep 17 00:00:00 2001 +From 600d5e0e89ecc723b7ffb29209b058d0275502e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Feb 2015 21:24:05 +0100 -Subject: [PATCH 088/154] dts: overlay: add support for rpi-display +Subject: [PATCH 088/216] dts: overlay: add support for rpi-display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -126606,7 +126624,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/rpi-display-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index bc13a9a..3b2da65 100644 +index 6753fcb..de47748 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -25,6 +25,7 @@ dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb @@ -126705,10 +126723,10 @@ index 0000000..0578810 + }; +}; -From 85f41ebf84581d2e545c75be7022319bcc30539d Mon Sep 17 00:00:00 2001 +From 525949ace298ff41d93fc2025ac768654e745642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Feb 2015 21:36:27 +0100 -Subject: [PATCH 089/154] dts: overlay: add support for HY28A display +Subject: [PATCH 089/216] dts: overlay: add support for HY28A display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -126724,7 +126742,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/hy28a-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 3b2da65..1e1be41 100644 +index de47748..8d7e535 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -19,6 +19,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb @@ -126829,10 +126847,10 @@ index 0000000..3cd3083 + }; +}; -From 3319258136b59fb0316583e4c8e8ab7663ae1676 Mon Sep 17 00:00:00 2001 +From 131c6ba7b078b8536755c8cae2e31c09053b5804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Feb 2015 21:38:00 +0100 -Subject: [PATCH 090/154] dts: overlay: add support for HY28B display +Subject: [PATCH 090/216] dts: overlay: add support for HY28B display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -126848,7 +126866,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/hy28b-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 1e1be41..7321acb 100644 +index 8d7e535..ec26431b1 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -20,6 +20,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb @@ -127008,10 +127026,10 @@ index 0000000..f774c4a + }; +}; -From 712e74ab3536054a09a73f67dd9f7cc8aa92a79f Mon Sep 17 00:00:00 2001 +From 33ce6c6c093580873f0f54b8633f44479d31786b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Feb 2015 21:38:47 +0100 -Subject: [PATCH 091/154] dts: overlay: add support for PiScreen display +Subject: [PATCH 091/216] dts: overlay: add support for PiScreen display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127026,7 +127044,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/piscreen-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 7321acb..68ee5dd 100644 +index ec26431b1..107448d 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -26,6 +26,7 @@ dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb @@ -127138,10 +127156,10 @@ index 0000000..8cd6a95 + }; +}; -From 7d5e61de5fa320467e13bee90a2291362ba0520e Mon Sep 17 00:00:00 2001 +From 5ef8657c77133ceed5a8ddf80fed6d3002ac9dca Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 092/154] enc28j60: Add device tree compatible string and an +Subject: [PATCH 092/216] enc28j60: Add device tree compatible string and an overlay --- @@ -127152,7 +127170,7 @@ Subject: [PATCH 092/154] enc28j60: Add device tree compatible string and an create mode 100755 arch/arm/boot/dts/enc28j60-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 68ee5dd..a91c55d 100644 +index 107448d..81afe85 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -14,6 +14,7 @@ endif @@ -127225,10 +127243,10 @@ index b1b5f66..c6b6e1a 100644 .probe = enc28j60_probe, .remove = enc28j60_remove, -From 1f2eb975fb1c953feee4d76c5f7c90db92599530 Mon Sep 17 00:00:00 2001 +From 04e8bf899200ef72d464ce9ee362d4377fbd7d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 27 Feb 2015 18:17:25 +0100 -Subject: [PATCH 093/154] dts: overlay: add support for Adafruit PiTFT +Subject: [PATCH 093/216] dts: overlay: add support for Adafruit PiTFT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127243,7 +127261,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/pitft28-resistive-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index a91c55d..707d373 100644 +index 81afe85..07c6eeb 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -28,6 +28,7 @@ dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb @@ -127376,10 +127394,10 @@ index 0000000..d506eae + }; +}; -From db632c485213fe893ecde8ca944cdaaf13ccc655 Mon Sep 17 00:00:00 2001 +From 917597bfd056d8d37b02a21e7ea4e56023a3e630 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Mon, 2 Mar 2015 09:37:02 +0000 -Subject: [PATCH 094/154] enable compiling spi-bcm2835 and add overlay to allow +Subject: [PATCH 094/216] enable compiling spi-bcm2835 and add overlay to allow us to load the driver --- @@ -127389,7 +127407,7 @@ Subject: [PATCH 094/154] enable compiling spi-bcm2835 and add overlay to allow create mode 100644 arch/arm/boot/dts/spi-bcm2835-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 707d373..3988c44 100644 +index 07c6eeb..e83179f 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -33,6 +33,7 @@ dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb @@ -127425,10 +127443,10 @@ index 0000000..fc1e39b + }; +}; -From 962f055d35c983953dac08caa79a80823206f90c Mon Sep 17 00:00:00 2001 +From 58f834d50fb0e6eb0f1a8c48bdb3551866addc62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 7 Mar 2015 20:39:30 +0100 -Subject: [PATCH 095/154] dts: overlay: add support for MZ61581 display +Subject: [PATCH 095/216] dts: overlay: add support for MZ61581 display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127443,7 +127461,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/mz61581-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 3988c44..371d34a 100644 +index e83179f..f99eccf 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -25,6 +25,7 @@ dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb @@ -127570,10 +127588,10 @@ index 0000000..c06fe12 + }; +}; -From e242a6168a50206acb34628b1deff3278ae78505 Mon Sep 17 00:00:00 2001 +From 080c66dfc13694a3c6123d6732d6255361e49733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 7 Mar 2015 20:40:07 +0100 -Subject: [PATCH 096/154] dts: overlay: piscreen: set speed to 24MHz +Subject: [PATCH 096/216] dts: overlay: piscreen: set speed to 24MHz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127600,10 +127618,10 @@ index 8cd6a95..b7fd7ea 100644 bgr; fps = <30>; -From 3cd0c5268c5741ee7b6e6d479718ba6566359b27 Mon Sep 17 00:00:00 2001 +From c34aef0866b8605b64dd7b7c1bf4c1db77933089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 7 Mar 2015 20:40:43 +0100 -Subject: [PATCH 097/154] dts: overlay: rpi-display: pullup irq gpio +Subject: [PATCH 097/216] dts: overlay: rpi-display: pullup irq gpio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127629,10 +127647,10 @@ index 0578810..a8fa974 100644 }; }; -From f65dc605f7653a0d8e84a1bab1e55360eee58d56 Mon Sep 17 00:00:00 2001 +From 7268b2f16833d36f6568add569f15325b398497b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 24 Mar 2015 14:48:30 +0100 -Subject: [PATCH 098/154] BCM270x_DT: add bcm2835-dma entry +Subject: [PATCH 098/216] BCM270x_DT: add bcm2835-dma entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127696,7 +127714,7 @@ index c8aea5b..6a08e95 100644 #ifdef CONFIG_BCM2708_GPIO bcm_register_device_dt(&bcm2708_gpio_device); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 396c1e7..de60e37 100644 +index 259d552..3c1c1dc 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -879,7 +879,7 @@ void __init bcm2709_init(void) @@ -127709,10 +127727,10 @@ index 396c1e7..de60e37 100644 #ifdef CONFIG_BCM2708_GPIO bcm_register_device_dt(&bcm2708_gpio_device); -From 8bf4bde8c8342e8d2b8a42b8ed6710add71871a3 Mon Sep 17 00:00:00 2001 +From ccc2b25ac7ffe4252a482901541a1894c86bb4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 24 Mar 2015 14:50:19 +0100 -Subject: [PATCH 099/154] bcm270x: add mmc-bcm2835 clock +Subject: [PATCH 099/216] bcm270x: add mmc-bcm2835 clock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127739,7 +127757,7 @@ index 6a08e95..b5f22e2 100644 bcm2708_register_clkdev(clk, "bcm2708_i2c.0"); bcm2708_register_clkdev(clk, "bcm2708_i2c.1"); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index de60e37..5e70eab 100644 +index 3c1c1dc..e10667d 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -243,6 +243,7 @@ void __init bcm2709_init_clocks(void) @@ -127751,10 +127769,10 @@ index de60e37..5e70eab 100644 bcm2709_register_clkdev(clk, "bcm2708_i2c.0"); bcm2709_register_clkdev(clk, "bcm2708_i2c.1"); -From 5bd50eacb5ecebe294147362270426bee48ce1d5 Mon Sep 17 00:00:00 2001 +From 7520bcefca288277ace88e3df254045eee89c189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 24 Mar 2015 15:12:35 +0100 -Subject: [PATCH 100/154] BCM270x_DT: add bcm2835-mmc entry +Subject: [PATCH 100/216] BCM270x_DT: add bcm2835-mmc entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127909,7 +127927,7 @@ index b5f22e2..16ba248 100644 bcm2708_init_led(); for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 5e70eab..56d16a4 100644 +index e10667d..dcad008 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -909,7 +909,7 @@ void __init bcm2709_init(void) @@ -127922,10 +127940,10 @@ index 5e70eab..56d16a4 100644 bcm2709_init_led(); for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) -From c4e46a88eb70a37844ef0fe3209794835210af22 Mon Sep 17 00:00:00 2001 +From 7504524f3f951bf8c40c5decf231ea6538d1380b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Mar 2015 11:45:44 +0000 -Subject: [PATCH 101/154] BCM270x_DT: Refactor bcm2708.dtsi and bcm2709.dtsi +Subject: [PATCH 101/216] BCM270x_DT: Refactor bcm2708.dtsi and bcm2709.dtsi Extract the common elements, creating bcm2708_common.dtsi --- @@ -128346,10 +128364,10 @@ index bd6605d..5e0b935 100644 compatible = "arm,armv7-timer"; clock-frequency = <19200000>; -From cfb7979048f721c2731e8efa948154472365c415 Mon Sep 17 00:00:00 2001 +From 5d44aea95dbfd69851ffeb426ccf419f5894e70e Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 102/154] Add driver for rpi-proto +Subject: [PATCH 102/216] Add driver for rpi-proto Forward port of 3.10.x driver from https://github.com/koalo We are using a custom board and would like to use rpi 3.18.x @@ -128372,7 +128390,7 @@ Signed-off-by: Waldemar Brodkorb create mode 100644 sound/soc/bcm/rpi-proto.c diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 371d34a..eda0009 100644 +index f99eccf..daf51d2 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -24,6 +24,7 @@ dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb @@ -128624,10 +128642,10 @@ index 0000000..c6e45a0 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From c4d32dd8e87695a74125b0596d7b892e4a56335f Mon Sep 17 00:00:00 2001 +From b1c2c58f341642e8bcc337b592f19d5543ae51ad Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Thu, 2 Apr 2015 12:22:55 +0100 -Subject: [PATCH 103/154] Add Device Tree support for RPi-DAC. +Subject: [PATCH 103/216] Add Device Tree support for RPi-DAC. --- arch/arm/boot/dts/Makefile | 1 + @@ -128638,7 +128656,7 @@ Subject: [PATCH 103/154] Add Device Tree support for RPi-DAC. create mode 100644 arch/arm/boot/dts/rpi-dac-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index eda0009..2b8c692a 100644 +index daf51d2..980b78e0 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -24,6 +24,7 @@ dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb @@ -128757,24 +128775,24 @@ index b4eaa44..afe1b41 100644 }; -From b62355897570f675cbdce1f8fec722df790cd3b9 Mon Sep 17 00:00:00 2001 +From c3bd8511bef07e4a3ebf9e78fc1ed0889aaf1d62 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 104/154] config: Add default configs +Subject: [PATCH 104/216] config: Add default configs --- - arch/arm/configs/bcm2709_defconfig | 1192 ++++++++++++++++++++++++++++++++++++ - arch/arm/configs/bcmrpi_defconfig | 1187 +++++++++++++++++++++++++++++++++++ - 2 files changed, 2379 insertions(+) + arch/arm/configs/bcm2709_defconfig | 1191 ++++++++++++++++++++++++++++++++++++ + arch/arm/configs/bcmrpi_defconfig | 1186 +++++++++++++++++++++++++++++++++++ + 2 files changed, 2377 insertions(+) create mode 100644 arch/arm/configs/bcm2709_defconfig create mode 100644 arch/arm/configs/bcmrpi_defconfig diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig new file mode 100644 -index 0000000..23079b4 +index 0000000..7cec5f8 --- /dev/null +++ b/arch/arm/configs/bcm2709_defconfig -@@ -0,0 +1,1192 @@ +@@ -0,0 +1,1191 @@ +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +CONFIG_PHYS_OFFSET=0 +CONFIG_LOCALVERSION="-v7" @@ -129154,7 +129172,6 @@ index 0000000..23079b4 +CONFIG_BT_MRVL_SDIO=m +CONFIG_BT_ATH3K=m +CONFIG_BT_WILINK=m -+CONFIG_CFG80211_WEXT=y +CONFIG_MAC80211=m +CONFIG_MAC80211_MESH=y +CONFIG_WIMAX=m @@ -129969,10 +129986,10 @@ index 0000000..23079b4 +CONFIG_LIBCRC32C=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig new file mode 100644 -index 0000000..919e0b7 +index 0000000..e77173b --- /dev/null +++ b/arch/arm/configs/bcmrpi_defconfig -@@ -0,0 +1,1187 @@ +@@ -0,0 +1,1186 @@ +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +CONFIG_PHYS_OFFSET=0 +# CONFIG_LOCALVERSION_AUTO is not set @@ -130345,7 +130362,6 @@ index 0000000..919e0b7 +CONFIG_BT_MRVL_SDIO=m +CONFIG_BT_ATH3K=m +CONFIG_BT_WILINK=m -+CONFIG_CFG80211_WEXT=y +CONFIG_MAC80211=m +CONFIG_MAC80211_MESH=y +CONFIG_WIMAX=m @@ -131161,10 +131177,10 @@ index 0000000..919e0b7 +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From 9d99e3183e2eb323e971f91365fa2d202cd8c7b2 Mon Sep 17 00:00:00 2001 +From 196c354f9d8f85f9e56bd2ce11113883f98bccaa Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Mon, 2 Mar 2015 16:34:37 +0100 -Subject: [PATCH 105/154] bcm2708: fix uart1 parameters +Subject: [PATCH 105/216] bcm2708: fix uart1 parameters System clock is 250MHz, but the device uses a non-standard oversampling rate (8 instead of 16) hence the clock rate @@ -131199,189 +131215,10 @@ index 16ba248..b848e4a 100644 {}, }; -From f36bd72cd2b1a780caca8b621d212a1337ffeffe Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 13 Apr 2015 23:34:50 +0100 -Subject: [PATCH 106/154] bcm2835-mmc: Add range of debug options for slowing - things down - ---- - drivers/mmc/host/bcm2835-mmc.c | 92 ++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 84 insertions(+), 8 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 28b00d3..776476e 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -71,6 +71,8 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) - - -+static unsigned mmc_debug; -+ - struct bcm2835_host { - spinlock_t lock; - -@@ -131,20 +133,94 @@ struct bcm2835_host { - }; - - -+static inline u32 bcm2835_mmc_axi_outstanding_reads(void) -+{ -+#ifdef CONFIG_ARCH_BCM2709 -+ u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT)); -+#else -+ u32 r = 0; -+#endif -+ return (r >> 0) & 0x3ff; -+} -+ -+static inline u32 bcm2835_mmc_axi_outstanding_writes(void) -+{ -+#ifdef CONFIG_ARCH_BCM2709 -+ u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT)); -+#else -+ u32 r = 0; -+#endif -+ return (r >> 16) & 0x3ff; -+} -+ - static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) - { -+ u32 delay; -+ if (mmc_debug & (1<<0)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<1)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); -+ - writel(val, host->ioaddr + reg); - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); -+ -+ delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -+ if (delay) -+ udelay(delay); -+ -+ if (mmc_debug & (1<<2)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<3)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); - } - - static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) - { -+ u32 delay; -+ if (mmc_debug & (1<<4)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<5)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); -+ - writel(val, host->ioaddr + reg); -+ -+ delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -+ if (delay) -+ udelay(delay); -+ -+ if (mmc_debug & (1<<6)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<7)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); - } - - static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) - { -- return readl(host->ioaddr + reg); -+ u32 ret; -+ if (mmc_debug & (1<<8)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<9)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); -+ -+ ret = readl(host->ioaddr + reg); -+ -+ if (mmc_debug & (1<<10)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<11)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); -+ return ret; - } - - static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int reg) -@@ -1263,9 +1339,7 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - { - struct mmc_host *mmc = host->mmc; - struct device *dev = mmc->parent; --#ifndef FORCE_PIO - struct dma_slave_config cfg; --#endif - int ret; - - bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -@@ -1289,10 +1363,11 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - spin_lock_init(&host->lock); - --#ifdef FORCE_PIO -+dev_info(dev, "mmc_debug:%x\n", mmc_debug); -+if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - host->have_dma = false; --#else -+} else { - if (IS_ERR_OR_NULL(host->dma_chan_tx) || - IS_ERR_OR_NULL(host->dma_chan_rx)) { - dev_err(dev, "%s: Unable to initialise DMA channels. Falling back to PIO\n", -@@ -1316,7 +1391,7 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - cfg.dst_addr = 0; - ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); - } --#endif -+} - mmc->max_segs = 128; - mmc->max_req_size = 524288; - mmc->max_seg_size = mmc->max_req_size; -@@ -1386,7 +1461,7 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) - - host->phys_addr = iomem->start + BCM2835_VCMMU_SHIFT; - --#ifndef FORCE_PIO -+if (!(mmc_debug & (1<<12))) { - if (node) { - host->dma_chan_tx = of_dma_request_slave_channel(node, "tx"); - host->dma_chan_rx = of_dma_request_slave_channel(node, "rx"); -@@ -1399,7 +1474,7 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) - host->dma_chan_tx = dma_request_channel(mask, NULL, NULL); - host->dma_chan_rx = dma_request_channel(mask, NULL, NULL); - } --#endif -+} - clk = devm_clk_get(dev, NULL); - if (IS_ERR(clk)) { - dev_err(dev, "could not get clk\n"); -@@ -1500,6 +1575,7 @@ static struct platform_driver bcm2835_mmc_driver = { - }; - module_platform_driver(bcm2835_mmc_driver); - -+module_param(mmc_debug, uint, 0644); - MODULE_ALIAS("platform:mmc-bcm2835"); - MODULE_DESCRIPTION("BCM2835 SDHCI driver"); - MODULE_LICENSE("GPL v2"); - -From c81f2f73fe75be1e7116b6a973ee358f88299fc4 Mon Sep 17 00:00:00 2001 +From 8243fc28ee2c92452173c695fdb7990e3758fdc3 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Fri, 20 Mar 2015 15:26:11 +0100 -Subject: [PATCH 107/154] spi: bcm2835: fix all checkpath --strict messages +Subject: [PATCH 106/216] spi: bcm2835: fix all checkpath --strict messages The following errors/warnings issued by checkpatch.pl --strict have been fixed: drivers/spi/spi-bcm2835.c:182: CHECK: Alignment should match open parenthesis @@ -131467,10 +131304,10 @@ index 419a782..779d3a8 100644 dev_err(&pdev->dev, "could not request IRQ: %d\n", err); goto out_clk_disable; -From 9520a8428a85248b6c09c2fc596f805b26dbfb01 Mon Sep 17 00:00:00 2001 +From 54e38f321ea8bb1990d6f496c0710532224a35ad Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Mon, 23 Mar 2015 15:11:53 +0100 -Subject: [PATCH 108/154] spi: bcm2835: fill/drain SPI-fifo as much as possible +Subject: [PATCH 107/216] spi: bcm2835: fill/drain SPI-fifo as much as possible during interrupt Implement the recommendation from the BCM2835 data-sheet @@ -131611,10 +131448,10 @@ index 779d3a8..960dcce 100644 udelay(tfr->delay_usecs); -From ef109c1aa550a46350eb49f2962105b36f9eb08a Mon Sep 17 00:00:00 2001 +From 52469b2a3843dbd5aad2109a73e1b41371f83be3 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Thu, 19 Mar 2015 09:01:52 +0000 -Subject: [PATCH 109/154] spi: bcm2835: clock divider can be a multiple of 2 +Subject: [PATCH 108/216] spi: bcm2835: clock divider can be a multiple of 2 The official documentation is wrong in this respect. Has been tested empirically for dividers 2-1024 @@ -131642,10 +131479,10 @@ index 960dcce..8de1925 100644 if (cdiv >= 65536) cdiv = 0; /* 0 is the slowest we can go */ -From dfc9858b6b0ecce21436e94e2f69b1dd0f762ee7 Mon Sep 17 00:00:00 2001 +From b3622510de92a35d73778905be9ab4ad4235bd66 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Thu, 19 Mar 2015 09:01:53 +0000 -Subject: [PATCH 110/154] spi: bcm2835: enable support of 3-wire mode +Subject: [PATCH 109/216] spi: bcm2835: enable support of 3-wire mode Signed-off-by: Martin Sperl Signed-off-by: Mark Brown @@ -131678,10 +131515,10 @@ index 8de1925..3f93718 100644 cs |= BCM2835_SPI_CS_CPOL; if (spi->mode & SPI_CPHA) -From 941e9c41fb0d684fecf9814a4a67e9367a0317f9 Mon Sep 17 00:00:00 2001 +From c71501bcc7b07a82119e2f7b27309a62f90aa02a Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Thu, 26 Mar 2015 11:08:36 +0100 -Subject: [PATCH 111/154] spi: bcm2835: move to the transfer_one driver model +Subject: [PATCH 110/216] spi: bcm2835: move to the transfer_one driver model This also allows for GPIO-CS to get used removing the limitation of 2/3 SPI devises on the SPI bus. @@ -132042,10 +131879,10 @@ index 3f93718..31d80eb0 100644 BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX); -From a6eb700e27e979e9e1f48e07980da7338cd9254b Mon Sep 17 00:00:00 2001 +From cf51ed163d8109aa02dfc267633ed4c0a4a81f08 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Sun, 29 Mar 2015 16:03:23 +0200 -Subject: [PATCH 112/154] spi: bcm2835: fix code formatting issue +Subject: [PATCH 111/216] spi: bcm2835: fix code formatting issue Signed-off-by: Martin Sperl Tested-by: Martin Sperl @@ -132069,10 +131906,10 @@ index 31d80eb0..4aa80fd 100644 } -From 37f9415e2b665c56f8c9025c1cf982544af01560 Mon Sep 17 00:00:00 2001 +From 8f0e96a797cebd49ab5054b3c150386a5f840855 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Sun, 29 Mar 2015 16:03:25 +0200 -Subject: [PATCH 113/154] spi: bcm2835: fill FIFO before enabling interrupts to +Subject: [PATCH 112/216] spi: bcm2835: fill FIFO before enabling interrupts to reduce interrupts/message To reduce the number of interrupts/message we fill the FIFO before @@ -132118,10 +131955,10 @@ index 4aa80fd..321dbe2 100644 * Enable the HW block. This will immediately trigger a DONE (TX * empty) interrupt, upon which we will fill the TX FIFO with the -From 53bdf6040181dd14e4cbe133f564b8bf97187722 Mon Sep 17 00:00:00 2001 +From 31a827ccaeac10f8a5ac4ee4dc4fcdda68470eb7 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Mon, 6 Apr 2015 17:16:31 +0000 -Subject: [PATCH 114/154] spi: bcm2835: transform native-cs to gpio-cs on first +Subject: [PATCH 113/216] spi: bcm2835: transform native-cs to gpio-cs on first spi_setup Transforms the bcm-2835 native SPI-chip select to their gpio-cs equivalent. @@ -132214,10 +132051,10 @@ index 321dbe2..033b93f 100644 static int bcm2835_spi_probe(struct platform_device *pdev) -From e45ccf9253f127943bb6c87ad94c6b07a32bf7ea Mon Sep 17 00:00:00 2001 +From 776aadc5da23cf97862d5eb535d8d9b8a038552f Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Mon, 6 Apr 2015 17:16:30 +0000 -Subject: [PATCH 115/154] spi: bcm2835: enabling polling mode for transfers +Subject: [PATCH 114/216] spi: bcm2835: enabling polling mode for transfers shorter than 30us In cases of short transfer times the CPU is spending lots of time @@ -132400,10 +132237,10 @@ index 033b93f..44ee1f3 100644 static void bcm2835_spi_handle_err(struct spi_master *master, -From 49bbfbdf10a9f004fb6a50b858eea8f38f739c0f Mon Sep 17 00:00:00 2001 +From 0a92a30733013eae878dc15c597dfa718f2865f5 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Thu, 16 Apr 2015 21:18:47 +0100 -Subject: [PATCH 116/154] spi: bcm2835: change timeout of polling driver to 1s +Subject: [PATCH 115/216] spi: bcm2835: change timeout of polling driver to 1s The way that the timeout code is written in the polling function the timeout does also trigger when interrupted or rescheduled while @@ -132440,10 +132277,10 @@ index 44ee1f3..1a915e5 100644 while (bs->rx_len) { /* read from fifo as much as possible */ -From 6b23b3c1fd226b23b58c29a55bcbe43b7b88b0d4 Mon Sep 17 00:00:00 2001 +From a53606a32ae4bdadc08985d0a67a6924c09633f1 Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 117/154] smsx95xx: fix crimes against truesize +Subject: [PATCH 116/216] smsx95xx: fix crimes against truesize smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. @@ -132478,10 +132315,10 @@ index e29a323..aff63dc usbnet_skb_return(dev, ax_skb); } -From e2a06a85f9b686d7355a76e723f87e415ec1f804 Mon Sep 17 00:00:00 2001 +From a6f41e34aeb0834ce943e48ee5f6655716dd53c4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 118/154] smsc95xx: Disable turbo mode by default +Subject: [PATCH 117/216] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- @@ -132501,10 +132338,10 @@ index aff63dc..08a8a8c 100755 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); -From 5e29e90fd355af610012b11333016d4bf5516de8 Mon Sep 17 00:00:00 2001 +From d8512fe40402051a7fb3ec7e7ad25f38d0abab65 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 18 Mar 2015 18:06:52 +0100 -Subject: [PATCH 119/154] HiFiBerry Digi: set SPDIF status bits for sample rate +Subject: [PATCH 118/216] HiFiBerry Digi: set SPDIF status bits for sample rate The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. While this is optional, some DACs and receivers do not accept this signal. This patch @@ -132574,10 +132411,10 @@ index a294a1b..80732b8 100644 } -From 5aac453ca203bb564797bd8d8b2a3cfaccd07447 Mon Sep 17 00:00:00 2001 +From 496a822ba4493536df3181be27d4b2d2906d4fde Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 18 Apr 2015 17:20:14 +0100 -Subject: [PATCH 120/154] bcm2708-dmaengine: Add debug options +Subject: [PATCH 119/216] bcm2708-dmaengine: Add debug options --- drivers/dma/bcm2708-dmaengine.c | 8 +++++++- @@ -132624,234 +132461,10 @@ index 6150b8f..8182b16 100644 MODULE_DESCRIPTION("BCM2835 DMA engine driver"); MODULE_AUTHOR("Florian Meier "); -From 497dbba490e4a04b7db0dfe6a553c54a5ab14113 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 18 Apr 2015 17:21:12 +0100 -Subject: [PATCH 121/154] bcm2835-mmc: Add option to disable - MMC_QUIRK_BLK_NO_CMD23 - ---- - drivers/mmc/core/quirks.c | 2 ++ - drivers/mmc/host/bcm2835-mmc.c | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index f472082..8c90f3f 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -98,6 +98,8 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -+ extern unsigned mmc_debug; -+ if (!(mmc_debug & (1<<13))) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; - } - EXPORT_SYMBOL(mmc_fixup_device); -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 776476e..9b7f490 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -71,7 +71,7 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) - - --static unsigned mmc_debug; -+/*static */unsigned mmc_debug; - - struct bcm2835_host { - spinlock_t lock; - -From d2a4b3ddb4faa2251db5f42012b26beccffcf79e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 22 Apr 2015 20:31:12 +0100 -Subject: [PATCH 123/154] bcm2835-mmc: Add option to disable some delays - ---- - drivers/mmc/host/bcm2835-mmc.c | 34 ++++++++++++++++++---------------- - 1 file changed, 18 insertions(+), 16 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 9b7f490..7010204 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -72,6 +72,7 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - - - /*static */unsigned mmc_debug; -+/*static */unsigned mmc_debug2; - - struct bcm2835_host { - spinlock_t lock; -@@ -153,7 +154,7 @@ static inline u32 bcm2835_mmc_axi_outstanding_writes(void) - return (r >> 16) & 0x3ff; - } - --static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) -+static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) - { - u32 delay; - if (mmc_debug & (1<<0)) -@@ -167,7 +168,7 @@ static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int re - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); - - delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -- if (delay) -+ if (delay && !((1<shadow = newval; - else -- bcm2835_mmc_writel(host, newval, reg & ~3); -+ bcm2835_mmc_writel(host, newval, reg & ~3, 0); - - } - -@@ -247,7 +248,7 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg - u32 mask = 0xff << byte_shift; - u32 newval = (oldval & ~mask) | (val << byte_shift); - -- bcm2835_mmc_writel(host, newval, reg & ~3); -+ bcm2835_mmc_writel(host, newval, reg & ~3, 1); - } - - -@@ -279,7 +280,7 @@ static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) - ier &= ~clear; - /* change which requests generate IRQs - makes no difference to - the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ -- bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE); -+ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); - } - - -@@ -373,8 +374,8 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | - SDHCI_INT_RESPONSE; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); - - if (soft) { - /* force clock reconfiguration */ -@@ -596,8 +597,8 @@ static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) - else - host->ier = (host->ier & ~dma_irqs) | pio_irqs; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); - } - - -@@ -679,7 +680,7 @@ static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, - mode |= SDHCI_TRNS_AUTO_CMD12; - else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { - mode |= SDHCI_TRNS_AUTO_CMD23; -- bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2); -+ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); - } - } - -@@ -742,7 +743,7 @@ void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd - - bcm2835_mmc_prepare_data(host, cmd); - -- bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT); -+ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); - - bcm2835_mmc_set_transfer_mode(host, cmd); - -@@ -899,8 +900,8 @@ static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int en - else - host->ier &= ~SDHCI_INT_CARD_INT; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); - mmiowb(); - } - } -@@ -1047,7 +1048,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) - /* Clear selected interrupts. */ - mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | - SDHCI_INT_BUS_POWER); -- bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS); -+ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); - - - if (intmask & SDHCI_INT_CMD_MASK) -@@ -1077,7 +1078,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) - - if (intmask) { - unexpected |= intmask; -- bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS); -+ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); - } - - if (result == IRQ_NONE) -@@ -1363,7 +1364,7 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - spin_lock_init(&host->lock); - --dev_info(dev, "mmc_debug:%x\n", mmc_debug); -+dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); - if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - host->have_dma = false; -@@ -1576,6 +1577,7 @@ static struct platform_driver bcm2835_mmc_driver = { - module_platform_driver(bcm2835_mmc_driver); - - module_param(mmc_debug, uint, 0644); -+module_param(mmc_debug2, uint, 0644); - MODULE_ALIAS("platform:mmc-bcm2835"); - MODULE_DESCRIPTION("BCM2835 SDHCI driver"); - MODULE_LICENSE("GPL v2"); - -From 488911bc7cc59fa99f2d9f33d9c8bad421d8684a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 28 Apr 2015 19:29:54 +0100 -Subject: [PATCH 124/154] bcm2835-mmc: Default to disabling - MMC_QUIRK_BLK_NO_CMD23 - ---- - drivers/mmc/core/quirks.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index 8c90f3f..bc3bbad 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -71,6 +71,7 @@ static const struct mmc_fixup mmc_fixup_methods[] = { - - void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - { -+ extern unsigned mmc_debug; - const struct mmc_fixup *f; - u64 rev = cid_rev_card(card); - -@@ -98,8 +99,7 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -- extern unsigned mmc_debug; -- if (!(mmc_debug & (1<<13))) -+ if (mmc_debug & (1<<13)) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; - } - EXPORT_SYMBOL(mmc_fixup_device); - -From ff0caccc6072241e140c819873b102840a8a7135 Mon Sep 17 00:00:00 2001 +From 4dc3a781a0d5718153bc38b1f1294523d44b8f66 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 125/154] Add blk_pos parameter to mmc multi_io_quirk callback +Subject: [PATCH 120/216] Add blk_pos parameter to mmc multi_io_quirk callback --- drivers/mmc/card/block.c | 1 + @@ -132862,10 +132475,10 @@ Subject: [PATCH 125/154] Add blk_pos parameter to mmc multi_io_quirk callback 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index c69afb5..95a12fd 100644 +index ed2e71a..ce854a9 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c -@@ -1401,6 +1401,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, +@@ -1413,6 +1413,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, brq->data.blocks = card->host->ops->multi_io_quirk(card, (rq_data_dir(req) == READ) ? MMC_DATA_READ : MMC_DATA_WRITE, @@ -132904,7 +132517,7 @@ index 6906a90..1fb7577 100644 /* * In Renesas controllers, when performing a diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c -index a31c357..b04edb5 100644 +index dba7e1c..0c87f4f 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -1001,7 +1001,9 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) @@ -132934,27 +132547,27 @@ index c3b84a2..c1c3868f 100644 struct mmc_card; -From da9969b245bc29e30fd1eba1398d7303f9674374 Mon Sep 17 00:00:00 2001 +From 12b12cf1a7a825c46dcefa06bdde683cac053189 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 126/154] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 121/216] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. --- arch/arm/boot/dts/Makefile | 1 + - arch/arm/boot/dts/sdhost-overlay.dts | 64 ++ + arch/arm/boot/dts/sdhost-overlay.dts | 73 ++ arch/arm/configs/bcm2709_defconfig | 1 + arch/arm/configs/bcmrpi_defconfig | 1 + drivers/mmc/host/Kconfig | 10 + drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-sdhost.c | 1694 ++++++++++++++++++++++++++++++++++ + drivers/mmc/host/bcm2835-sdhost.c | 1685 ++++++++++++++++++++++++++++++++++ 7 files changed, 1772 insertions(+) create mode 100644 arch/arm/boot/dts/sdhost-overlay.dts create mode 100644 drivers/mmc/host/bcm2835-sdhost.c diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 2b8c692a..5effb3c 100644 +index 980b78e0..9cb5a2d 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -34,6 +34,7 @@ dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb @@ -132967,10 +132580,10 @@ index 2b8c692a..5effb3c 100644 dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb diff --git a/arch/arm/boot/dts/sdhost-overlay.dts b/arch/arm/boot/dts/sdhost-overlay.dts new file mode 100644 -index 0000000..234914f1 +index 0000000..33db96e --- /dev/null +++ b/arch/arm/boot/dts/sdhost-overlay.dts -@@ -0,0 +1,64 @@ +@@ -0,0 +1,73 @@ +/dts-v1/; +/plugin/; + @@ -132991,7 +132604,7 @@ index 0000000..234914f1 + dmas = <&dma 13>, + <&dma 13>; + dma-names = "tx", "rx"; -+ brcm,delay_after_stop = <0>; ++ brcm,delay-after-stop = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_pins>; + status = "okay"; @@ -133031,8 +132644,17 @@ index 0000000..234914f1 + }; + }; + ++ fragment@3 { ++ target-path = "/__overrides__"; ++ __overlay__ { ++ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; ++ }; ++ }; ++ + __overrides__ { -+ delay_after_stop = <&sdhost>,"brcm,delay_after_stop:0"; ++ delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; ++ force_pio = <&sdhost>,"brcm,force-pio?"; ++ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; + }; +}; diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig @@ -133094,10 +132716,10 @@ index 9d41de9..8a7e43e 100644 obj-$(CONFIG_MMC_AU1X) += au1xmmc.o diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c new file mode 100644 -index 0000000..cf5471f +index 0000000..0c311b5 --- /dev/null +++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -0,0 +1,1694 @@ +@@ -0,0 +1,1685 @@ +/* + * BCM2835 SD host driver. + * @@ -133215,7 +132837,7 @@ index 0000000..cf5471f +#ifdef CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER +#define PIO_DMA_BARRIER CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER +#else -+#define PIO_DMA_BARRIER 00 ++#define PIO_DMA_BARRIER 0 +#endif + +#define MIN_FREQ 400000 @@ -133276,6 +132898,7 @@ index 0000000..cf5471f + struct dma_chan *dma_chan_rx; /* DMA channel for reads */ + struct dma_chan *dma_chan_tx; /* DMA channel for writes */ + ++ bool allow_dma; + bool have_dma; + bool use_dma; + /*end of DMA part*/ @@ -133721,7 +133344,8 @@ index 0000000..cf5471f + bcm2835_sdhost_set_transfer_irqs(host); + + bcm2835_sdhost_write(host, data->blksz, SDHBCT); -+ bcm2835_sdhost_write(host, data->blocks, SDHBLC); ++ if (host->use_dma) ++ bcm2835_sdhost_write(host, data->blocks, SDHBLC); + + BUG_ON(!host->data); +} @@ -134335,53 +133959,41 @@ index 0000000..cf5471f + + 623->400KHz/27.8MHz + reset value (507)->491159/50MHz ++ ++ BUT, the 3-bit clock divisor in data mode is too small if the ++ core clock is higher than 250MHz, so instead use the SLOW_CARD ++ configuration bit to force the use of the ident clock divisor ++ at all times. + */ + + host->mmc->actual_clock = 0; + -+ if (clock <= 400000) { -+ /* It's an ident clock - don't worry about the lower bits */ -+ host->slow_card = true; -+ if (clock < 100000) { -+ /* Can't stop the clock, but make it as slow as possible -+ * to show willing -+ */ -+ host->cdiv = SDCDIV_MAX_CDIV; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ return; -+ } -+ div = host->max_clk / clock; -+ if ((host->max_clk / div) > 400000) -+ div++; -+ div -= 2; -+ -+ if (div > SDCDIV_MAX_CDIV) -+ div = SDCDIV_MAX_CDIV; -+ -+ host->mmc->actual_clock = host->max_clk / (div + 2); -+ } else { -+ /* It's a data clock - choose the lower bits, and make -+ the upper bits vaguely sensible */ -+ host->slow_card = false; -+ -+ for (div = 0x0; div < 0x7; div++) { -+ if ((host->max_clk / (div + 2)) <= clock) -+ break; -+ } -+ -+ host->mmc->actual_clock = host->max_clk / (div + 2); -+ -+ div |= (((host->max_clk / 400000) - 2) & ~0x7); -+ if ((host->max_clk / (div + 2)) > 400000) -+ div += 0x8; ++ if (clock < 100000) { ++ /* Can't stop the clock, but make it as slow as possible ++ * to show willing ++ */ ++ host->cdiv = SDCDIV_MAX_CDIV; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ return; + } + ++ div = host->max_clk / clock; ++ if (div < 2) ++ div = 2; ++ if ((host->max_clk / div) > clock) ++ div++; ++ div -= 2; ++ ++ if (div > SDCDIV_MAX_CDIV) ++ div = SDCDIV_MAX_CDIV; ++ ++ host->mmc->actual_clock = host->max_clk / (div + 2); ++ + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + -+ pr_debug(DRIVER_NAME ": cdiv=%x (actual clock %d, data clock %d)\n", -+ host->cdiv, host->mmc->actual_clock, -+ host->max_clk / ((div & 0x7) + 2)); ++ pr_debug(DRIVER_NAME ": clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", ++ clock, host->max_clk, host->cdiv, host->mmc->actual_clock); +} + +static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) @@ -134447,7 +134059,6 @@ index 0000000..cf5471f + + spin_lock_irqsave(&host->lock, flags); + -+ pr_debug("host->clock = %d\n", host->clock); + if (!ios->clock || ios->clock != host->clock) { + bcm2835_sdhost_set_clock(host, ios->clock); + host->clock = ios->clock; @@ -134460,9 +134071,8 @@ index 0000000..cf5471f + + host->hcfg |= SDHCFG_WIDE_INT_BUS; + -+ host->hcfg &= ~SDHCFG_SLOW_CARD; -+ if (host->slow_card || !ALLOW_FAST) -+ host->hcfg |= SDHCFG_SLOW_CARD; ++ /* Disable clever clock switching, to cope with fast core clocks */ ++ host->hcfg |= SDHCFG_SLOW_CARD; + + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + @@ -134490,7 +134100,7 @@ index 0000000..cf5471f +} + + -+static struct mmc_host_ops bcm2835_ops = { ++static struct mmc_host_ops bcm2835_sdhost_ops = { + .request = bcm2835_sdhost_request, + .set_ios = bcm2835_sdhost_set_ios, + .enable_sdio_irq = bcm2835_sdhost_enable_sdio_irq, @@ -134554,8 +134164,6 @@ index 0000000..cf5471f + + bcm2835_sdhost_reset(host); + -+ mmc->ops = &bcm2835_ops; -+ mmc->f_max = host->max_clk; + mmc->f_max = host->max_clk; + mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV; + @@ -134565,14 +134173,14 @@ index 0000000..cf5471f + mmc->max_busy_timeout = (1 << 27) / host->timeout_clk; +#endif + /* host controller capabilities */ -+ mmc->caps = /*XXX MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | ++ mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | + MMC_CAP_NEEDS_POLL | + (ALLOW_CMD23 * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + -+ if (ALLOW_DMA) { ++ if (host->allow_dma) { + if (!host->dma_chan_tx || !host->dma_chan_rx || + IS_ERR(host->dma_chan_tx) || IS_ERR(host->dma_chan_rx)) { + pr_err("%s: Unable to initialise DMA channels. Falling back to PIO\n", DRIVER_NAME); @@ -134659,7 +134267,7 @@ index 0000000..cf5471f + if (!mmc) + return -ENOMEM; + -+ mmc->ops = &bcm2835_ops; ++ mmc->ops = &bcm2835_sdhost_ops; + host = mmc_priv(mmc); + host->mmc = mmc; + host->timeout = msecs_to_jiffies(1000); @@ -134678,12 +134286,23 @@ index 0000000..cf5471f + (unsigned long)iomem->start, + (unsigned long)host->phys_addr); + -+ if (ALLOW_DMA) { ++ host->allow_dma = ALLOW_DMA; ++ ++ if (node) { ++ /* Read any custom properties */ ++ of_property_read_u32(node, ++ "brcm,delay-after-stop", ++ &host->delay_after_stop); ++ host->allow_dma = ALLOW_DMA && ++ !of_property_read_bool(node, "brcm,force-pio"); ++ } ++ ++ if (host->allow_dma) { + if (node) { + host->dma_chan_tx = -+ of_dma_request_slave_channel(node, "tx"); ++ dma_request_slave_channel(dev, "tx"); + host->dma_chan_rx = -+ of_dma_request_slave_channel(node, "rx"); ++ dma_request_slave_channel(dev, "rx"); + } else { + dma_cap_mask_t mask; + @@ -134697,12 +134316,6 @@ index 0000000..cf5471f + } + } + -+ if (node) { -+ /* Read any custom properties */ -+ of_property_read_u32(node, -+ "brcm,delay_after_stop", -+ &host->delay_after_stop); -+ } + clk = devm_clk_get(dev, NULL); + if (IS_ERR(clk)) { + dev_err(dev, "could not get clk\n"); @@ -134793,10 +134406,10 @@ index 0000000..cf5471f +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From d0ad183e75bf9660c672a66864c30f35e39c2285 Mon Sep 17 00:00:00 2001 +From 4504d17456cfc2f8b8b987d8709adcf759c8ea2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 28 Apr 2015 19:24:30 +0200 -Subject: [PATCH 127/154] BCM270x: Add memory and irq resources to dmaengine +Subject: [PATCH 122/216] BCM270x: Add memory and irq resources to dmaengine device and DT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -134934,7 +134547,7 @@ index b848e4a..703215d 100644 #if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 56d16a4..0179f25f 100644 +index dcad008..97116c3 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -56,7 +56,6 @@ @@ -135025,10 +134638,10 @@ index 56d16a4..0179f25f 100644 #if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) -From c738deeab4bb66c4e8d546c5ead7e6489adef231 Mon Sep 17 00:00:00 2001 +From 4111e2c08fdfcfaa72b531689e2b9bc2b8c29453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 28 Apr 2015 19:25:43 +0200 -Subject: [PATCH 128/154] dmaengine: bcm2708: Merge with arch dma.c driver and +Subject: [PATCH 123/216] dmaengine: bcm2708: Merge with arch dma.c driver and disable dma.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -135859,10 +135472,10 @@ index 0000000..2310e34 + +#endif /* _PLAT_BCM2708_DMA_H */ -From 0e5fbba02ca988fa8955301d3a2fe4859edf297f Mon Sep 17 00:00:00 2001 +From 2b9f3386a080d00da4e6335272fe3b94cc51cfef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 28 Apr 2015 19:26:59 +0200 -Subject: [PATCH 129/154] BCM270x: dma: Remove driver +Subject: [PATCH 124/216] BCM270x: dma: Remove driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136708,10 +136321,10 @@ index a5e58d1..0000000 - -MODULE_PARM_DESC(dmachans, "Bitmap of DMA channels available to the ARM"); -From 757e5f795ceb0d9c52dcda952e021d2a233e3064 Mon Sep 17 00:00:00 2001 +From d2647dd924553835bc9b8f6ec0dce6cc25662d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 28 Apr 2015 19:54:17 +0200 -Subject: [PATCH 130/154] BCM270x: Remove dmaman device +Subject: [PATCH 125/216] BCM270x: Remove dmaman device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136760,7 +136373,7 @@ index 703215d..486e090 100644 bcm_register_device(&bcm2708_vcio_device); #ifdef CONFIG_BCM2708_GPIO diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 0179f25f..dcd3b47 100644 +index 97116c3..44bfc50 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -257,21 +257,6 @@ static struct amba_device *amba_devs[] __initdata = { @@ -136794,10 +136407,10 @@ index 0179f25f..dcd3b47 100644 bcm_register_device(&bcm2708_vcio_device); #ifdef CONFIG_BCM2708_GPIO -From 4e2b210eeb03a1ff3cd5913626735d101a546ffd Mon Sep 17 00:00:00 2001 +From 149df0acaf7510d53047e19054e3b13607f60afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:24:02 +0200 -Subject: [PATCH 131/154] bcm2835: bcm2835_defconfig +Subject: [PATCH 126/216] bcm2835: bcm2835_defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136885,10 +136498,10 @@ index 31cb073..245aede 100644 CONFIG_EXT2_FS=y CONFIG_EXT2_FS_XATTR=y -From a7be6fff3d6583b745414afa57543e2478b72c65 Mon Sep 17 00:00:00 2001 +From 40cd8a80edbedd6bef0da2bcd55e777f80ef30ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:24:46 +0200 -Subject: [PATCH 132/154] mmc: bcm2835-mmc: Make available on ARCH_BCM2835 +Subject: [PATCH 127/216] mmc: bcm2835-mmc: Make available on ARCH_BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136914,10 +136527,10 @@ index 1666c6c..41d6e47 100644 This selects the MMC Interface on BCM2835. -From 5f6edf81dfb2f425b3a961c56cf811c9410a1cc6 Mon Sep 17 00:00:00 2001 +From 6c0c225509561cc261c594db00d429f2c032ebfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:28:22 +0200 -Subject: [PATCH 133/154] bcm2835: bcm2835_defconfig enable MMC_BCM2835 +Subject: [PATCH 128/216] bcm2835: bcm2835_defconfig enable MMC_BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136952,10 +136565,10 @@ index 245aede..cf2e7a6 100644 # CONFIG_IOMMU_SUPPORT is not set CONFIG_EXT2_FS=y -From 2e7d6a25e832b1fa62e790c318385d2d0af3aa1c Mon Sep 17 00:00:00 2001 +From 8bff84b0504771b895a12dcc5975b26345a3f9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:29:04 +0200 -Subject: [PATCH 134/154] bcm2835: Change to use bcm2835-mmc in Device Tree +Subject: [PATCH 129/216] bcm2835: Change to use bcm2835-mmc in Device Tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -137013,732 +136626,10 @@ index 3342cb1..f2dec21 100644 clk_i2c: clock@1 { -From 67fd2c5af2cdfa7a1659258e0f4f7ec8269a0dd6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 29 Apr 2015 16:42:21 +0100 -Subject: [PATCH 135/154] vchiq: Allocation does not need to be atomic - ---- - drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 7e7b09f..d7ebdfc 100644 ---- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -99,7 +99,7 @@ vchiq_platform_init(VCHIQ_STATE_T *state) - frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); - - g_slot_mem = dma_alloc_coherent(NULL, g_slot_mem_size + frag_mem_size, -- &g_slot_phys, GFP_ATOMIC); -+ &g_slot_phys, GFP_KERNEL); - - if (!g_slot_mem) { - vchiq_log_error(vchiq_arm_log_level, - -From aa6b3e63fae5d01a11706503841c141478d46536 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 1 May 2015 17:46:16 +0100 -Subject: [PATCH 136/154] bcm2835-mmc: Add option to disable delays on some - writeb calls - ---- - drivers/mmc/host/bcm2835-mmc.c | 29 +++++++++++++++++++++-------- - 1 file changed, 21 insertions(+), 8 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 7010204..8fb4cf8 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -240,7 +240,7 @@ static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int re - - } - --static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg) -+static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg, int from) - { - u32 oldval = bcm2835_mmc_readl(host, reg & ~3); - u32 byte_num = reg & 3; -@@ -248,7 +248,16 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg - u32 mask = 0xff << byte_shift; - u32 newval = (oldval & ~mask) | (val << byte_shift); - -- bcm2835_mmc_writel(host, newval, reg & ~3, 1); -+ if ((reg & ~3) == 0x28) // SDHCI_HOST_CONTROL, SDHCI_POWER_CONTROL, SDHCI_BLOCK_GAP_CONTROL, SDHCI_WAKE_UP_CONTROL -+ { -+ WARN_ON(oldval & ((1<<16)|(1<<17))); -+ } -+ else if ((reg & ~3) == 0x2C) // SDHCI_CLOCK_CONTROL, SDHCI_TIMEOUT_CONTROL, SDHCI_SOFTWARE_RESET -+ { -+ WARN_ON(oldval & ((1<<24)|(1<<25)|(1<<26))); -+ } -+ -+ bcm2835_mmc_writel(host, newval, reg & ~3, from + 10); - } - - -@@ -333,7 +342,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - { - unsigned long timeout; - -- bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET); -+ bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET, 0); - - if (mask & SDHCI_RESET_ALL) - host->clock = 0; -@@ -347,7 +356,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - pr_err("%s: Reset 0x%x never completed.\n", - mmc_hostname(host->mmc), (int)mask); - bcm2835_mmc_dumpregs(host); -- return; -+ goto exit; - } - timeout--; - mdelay(1); -@@ -357,6 +366,9 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - host->max_delay = 100-timeout; - pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); - } -+exit: -+ if ((mmc_debug & (1<<15))) -+ bcm2835_mmc_writeb(host, TIMEOUT_VAL, SDHCI_TIMEOUT_CONTROL, 1); - } - - static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); -@@ -609,9 +621,10 @@ static void bcm2835_mmc_prepare_data(struct bcm2835_host *host, struct mmc_comma - - WARN_ON(host->data); - -+ if (!(mmc_debug & (1<<14))) - if (data || (cmd->flags & MMC_RSP_BUSY)) { - count = TIMEOUT_VAL; -- bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL); -+ bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL, 1); - } - - if (!data) -@@ -1237,7 +1250,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - if (host->pwr != SDHCI_POWER_330) { - host->pwr = SDHCI_POWER_330; -- bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL); -+ bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL, 2); - } - - ctrl = bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL); -@@ -1252,7 +1265,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - ctrl &= ~SDHCI_CTRL_HISPD; /* NO_HISPD_BIT */ - - -- bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL, 3); - /* - * We only need to set Driver Strength if the - * preset value enable is not set. -@@ -1273,7 +1286,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - /* Re-enable SD Clock */ - bcm2835_mmc_set_clock(host, host->clock); -- bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL, 4); - - mmiowb(); - - -From 39315a8ea76cfb3aae6853aedd409e89886d8fd4 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 1 May 2015 17:46:56 +0100 -Subject: [PATCH 137/154] bcm2835-mmc: warn on accesses without spinlock - ---- - drivers/mmc/host/bcm2835-mmc.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 8fb4cf8..7315e58 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -164,6 +164,7 @@ static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int re - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -+ WARN_ON(!spin_is_locked(&host->lock)); - writel(val, host->ioaddr + reg); - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); - -@@ -189,6 +190,7 @@ static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -+ WARN_ON(!spin_is_locked(&host->lock)); - writel(val, host->ioaddr + reg); - - delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -@@ -213,6 +215,7 @@ static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -+ WARN_ON(!spin_is_locked(&host->lock)); - ret = readl(host->ioaddr + reg); - - if (mmc_debug & (1<<10)) -@@ -586,11 +589,14 @@ static void bcm2835_mmc_transfer_dma(struct bcm2835_host *host) - dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); - } - if (desc) { -+ unsigned long flags; -+ spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_unsignal_irqs(host, SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL); - host->tx_desc = desc; - desc->callback = bcm2835_mmc_dma_complete; - desc->callback_param = host; -+ spin_unlock_irqrestore(&host->lock, flags); - dmaengine_submit(desc); - dma_async_issue_pending(dma_chan); - } -@@ -1349,7 +1355,7 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param) - - - --int bcm2835_mmc_add_host(struct bcm2835_host *host) -+static int bcm2835_mmc_add_host(struct bcm2835_host *host) - { - struct mmc_host *mmc = host->mmc; - struct device *dev = mmc->parent; -@@ -1375,8 +1381,6 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - host->flags = SDHCI_AUTO_CMD23; - -- spin_lock_init(&host->lock); -- - dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); - if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - -From 547b7363c0a41772fa3b8eb4b34f7cf343a2e9a2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 1 May 2015 18:35:38 +0100 -Subject: [PATCH 138/154] bcm2835-mmc: Add locks when accessing sdhost - registers - ---- - drivers/mmc/host/bcm2835-mmc.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 7315e58..2d00e0f 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -344,7 +344,11 @@ static void bcm2835_mmc_dumpregs(struct bcm2835_host *host) - static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - { - unsigned long timeout; -+ unsigned long flags; -+ -+ BUG_ON(spin_is_locked(&host->lock)); - -+ spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET, 0); - - if (mask & SDHCI_RESET_ALL) -@@ -362,7 +366,9 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - goto exit; - } - timeout--; -+ spin_unlock_irqrestore(&host->lock, flags); - mdelay(1); -+ spin_lock_irqsave(&host->lock, flags); - } - - if (100-timeout > 10 && 100-timeout > host->max_delay) { -@@ -372,12 +378,14 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - exit: - if ((mmc_debug & (1<<15))) - bcm2835_mmc_writeb(host, TIMEOUT_VAL, SDHCI_TIMEOUT_CONTROL, 1); -+ spin_unlock_irqrestore(&host->lock, flags); - } - - static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); - - static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - { -+ unsigned long flags; - if (soft) - bcm2835_mmc_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA); - else -@@ -389,8 +397,10 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | - SDHCI_INT_RESPONSE; - -+ spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); - bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); -+ spin_unlock_irqrestore(&host->lock, flags); - - if (soft) { - /* force clock reconfiguration */ -@@ -1339,8 +1349,10 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param) - (mrq->data && (mrq->data->error || - (mrq->data->stop && mrq->data->stop->error))))) { - -+ spin_unlock_irqrestore(&host->lock, flags); - bcm2835_mmc_reset(host, SDHCI_RESET_CMD); - bcm2835_mmc_reset(host, SDHCI_RESET_DATA); -+ spin_lock_irqsave(&host->lock, flags); - } - - host->mrq = NULL; - -From fdc5e42967bafe096808671f3955d110bbb65764 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 1 May 2015 17:35:50 +0100 -Subject: [PATCH 139/154] squash: sdhost support for faster core clocks, and - force-pio mode - ---- - arch/arm/boot/dts/sdhost-overlay.dts | 13 ++++- - drivers/mmc/host/bcm2835-sdhost.c | 101 ++++++++++++++++------------------- - 2 files changed, 57 insertions(+), 57 deletions(-) - -diff --git a/arch/arm/boot/dts/sdhost-overlay.dts b/arch/arm/boot/dts/sdhost-overlay.dts -index 234914f1..33db96e 100644 ---- a/arch/arm/boot/dts/sdhost-overlay.dts -+++ b/arch/arm/boot/dts/sdhost-overlay.dts -@@ -18,7 +18,7 @@ - dmas = <&dma 13>, - <&dma 13>; - dma-names = "tx", "rx"; -- brcm,delay_after_stop = <0>; -+ brcm,delay-after-stop = <0>; - pinctrl-names = "default"; - pinctrl-0 = <&sdhost_pins>; - status = "okay"; -@@ -58,7 +58,16 @@ - }; - }; - -+ fragment@3 { -+ target-path = "/__overrides__"; -+ __overlay__ { -+ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; -+ }; -+ }; -+ - __overrides__ { -- delay_after_stop = <&sdhost>,"brcm,delay_after_stop:0"; -+ delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; -+ force_pio = <&sdhost>,"brcm,force-pio?"; -+ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; - }; - }; -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index cf5471f..98bbd96 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -115,7 +115,7 @@ - #ifdef CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER - #define PIO_DMA_BARRIER CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER - #else --#define PIO_DMA_BARRIER 00 -+#define PIO_DMA_BARRIER 0 - #endif - - #define MIN_FREQ 400000 -@@ -176,6 +176,7 @@ struct bcm2835_host { - struct dma_chan *dma_chan_rx; /* DMA channel for reads */ - struct dma_chan *dma_chan_tx; /* DMA channel for writes */ - -+ bool allow_dma; - bool have_dma; - bool use_dma; - /*end of DMA part*/ -@@ -621,7 +622,8 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - bcm2835_sdhost_set_transfer_irqs(host); - - bcm2835_sdhost_write(host, data->blksz, SDHBCT); -- bcm2835_sdhost_write(host, data->blocks, SDHBLC); -+ if (host->use_dma) -+ bcm2835_sdhost_write(host, data->blocks, SDHBLC); - - BUG_ON(!host->data); - } -@@ -1235,53 +1237,41 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - - 623->400KHz/27.8MHz - reset value (507)->491159/50MHz -+ -+ BUT, the 3-bit clock divisor in data mode is too small if the -+ core clock is higher than 250MHz, so instead use the SLOW_CARD -+ configuration bit to force the use of the ident clock divisor -+ at all times. - */ - - host->mmc->actual_clock = 0; - -- if (clock <= 400000) { -- /* It's an ident clock - don't worry about the lower bits */ -- host->slow_card = true; -- if (clock < 100000) { -- /* Can't stop the clock, but make it as slow as possible -- * to show willing -- */ -- host->cdiv = SDCDIV_MAX_CDIV; -- bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -- return; -- } -- div = host->max_clk / clock; -- if ((host->max_clk / div) > 400000) -- div++; -- div -= 2; -- -- if (div > SDCDIV_MAX_CDIV) -- div = SDCDIV_MAX_CDIV; -- -- host->mmc->actual_clock = host->max_clk / (div + 2); -- } else { -- /* It's a data clock - choose the lower bits, and make -- the upper bits vaguely sensible */ -- host->slow_card = false; -+ if (clock < 100000) { -+ /* Can't stop the clock, but make it as slow as possible -+ * to show willing -+ */ -+ host->cdiv = SDCDIV_MAX_CDIV; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ return; -+ } - -- for (div = 0x0; div < 0x7; div++) { -- if ((host->max_clk / (div + 2)) <= clock) -- break; -- } -+ div = host->max_clk / clock; -+ if (div < 2) -+ div = 2; -+ if ((host->max_clk / div) > clock) -+ div++; -+ div -= 2; - -- host->mmc->actual_clock = host->max_clk / (div + 2); -+ if (div > SDCDIV_MAX_CDIV) -+ div = SDCDIV_MAX_CDIV; - -- div |= (((host->max_clk / 400000) - 2) & ~0x7); -- if ((host->max_clk / (div + 2)) > 400000) -- div += 0x8; -- } -+ host->mmc->actual_clock = host->max_clk / (div + 2); - - host->cdiv = div; - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - -- pr_debug(DRIVER_NAME ": cdiv=%x (actual clock %d, data clock %d)\n", -- host->cdiv, host->mmc->actual_clock, -- host->max_clk / ((div & 0x7) + 2)); -+ pr_debug(DRIVER_NAME ": clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", -+ clock, host->max_clk, host->cdiv, host->mmc->actual_clock); - } - - static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) -@@ -1347,7 +1337,6 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - spin_lock_irqsave(&host->lock, flags); - -- pr_debug("host->clock = %d\n", host->clock); - if (!ios->clock || ios->clock != host->clock) { - bcm2835_sdhost_set_clock(host, ios->clock); - host->clock = ios->clock; -@@ -1360,9 +1349,8 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - host->hcfg |= SDHCFG_WIDE_INT_BUS; - -- host->hcfg &= ~SDHCFG_SLOW_CARD; -- if (host->slow_card || !ALLOW_FAST) -- host->hcfg |= SDHCFG_SLOW_CARD; -+ /* Disable clever clock switching, to cope with fast core clocks */ -+ host->hcfg |= SDHCFG_SLOW_CARD; - - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - -@@ -1390,7 +1378,7 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, - } - - --static struct mmc_host_ops bcm2835_ops = { -+static struct mmc_host_ops bcm2835_sdhost_ops = { - .request = bcm2835_sdhost_request, - .set_ios = bcm2835_sdhost_set_ios, - .enable_sdio_irq = bcm2835_sdhost_enable_sdio_irq, -@@ -1454,8 +1442,6 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - - bcm2835_sdhost_reset(host); - -- mmc->ops = &bcm2835_ops; -- mmc->f_max = host->max_clk; - mmc->f_max = host->max_clk; - mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV; - -@@ -1465,14 +1451,14 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - mmc->max_busy_timeout = (1 << 27) / host->timeout_clk; - #endif - /* host controller capabilities */ -- mmc->caps = /*XXX MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | -+ mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | - MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | - MMC_CAP_NEEDS_POLL | - (ALLOW_CMD23 * MMC_CAP_CMD23); - - spin_lock_init(&host->lock); - -- if (ALLOW_DMA) { -+ if (host->allow_dma) { - if (!host->dma_chan_tx || !host->dma_chan_rx || - IS_ERR(host->dma_chan_tx) || IS_ERR(host->dma_chan_rx)) { - pr_err("%s: Unable to initialise DMA channels. Falling back to PIO\n", DRIVER_NAME); -@@ -1559,7 +1545,7 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - if (!mmc) - return -ENOMEM; - -- mmc->ops = &bcm2835_ops; -+ mmc->ops = &bcm2835_sdhost_ops; - host = mmc_priv(mmc); - host->mmc = mmc; - host->timeout = msecs_to_jiffies(1000); -@@ -1578,7 +1564,18 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - (unsigned long)iomem->start, - (unsigned long)host->phys_addr); - -- if (ALLOW_DMA) { -+ host->allow_dma = ALLOW_DMA; -+ -+ if (node) { -+ /* Read any custom properties */ -+ of_property_read_u32(node, -+ "brcm,delay-after-stop", -+ &host->delay_after_stop); -+ host->allow_dma = ALLOW_DMA && -+ !of_property_read_bool(node, "brcm,force-pio"); -+ } -+ -+ if (host->allow_dma) { - if (node) { - host->dma_chan_tx = - of_dma_request_slave_channel(node, "tx"); -@@ -1597,12 +1594,6 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - } - } - -- if (node) { -- /* Read any custom properties */ -- of_property_read_u32(node, -- "brcm,delay_after_stop", -- &host->delay_after_stop); -- } - clk = devm_clk_get(dev, NULL); - if (IS_ERR(clk)) { - dev_err(dev, "could not get clk\n"); - -From 503ce7c5d43ec5fa137fbcc4b764542e5c524b93 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 5 May 2015 10:39:39 +0100 -Subject: [PATCH 140/154] bcm2835-mmc/sdhost: of_dma_request_slave_channel - isn't exported... - -of_dma_request_slave_channel isn't an exported function, so can't be -used from within a module. Replace with dma_request_slave_channel, -which calls the of_ variant but IS exported. - -See: https://github.com/raspberrypi/linux/issues/952 - -Signed-off-by: Phil Elwell ---- - drivers/mmc/host/bcm2835-mmc.c | 4 ++-- - drivers/mmc/host/bcm2835-sdhost.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 2d00e0f..8edae29 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -1493,8 +1493,8 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) - - if (!(mmc_debug & (1<<12))) { - if (node) { -- host->dma_chan_tx = of_dma_request_slave_channel(node, "tx"); -- host->dma_chan_rx = of_dma_request_slave_channel(node, "rx"); -+ host->dma_chan_tx = dma_request_slave_channel(dev, "tx"); -+ host->dma_chan_rx = dma_request_slave_channel(dev, "rx"); - } else { - dma_cap_mask_t mask; - -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index 98bbd96..0c311b5 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -1578,9 +1578,9 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - if (host->allow_dma) { - if (node) { - host->dma_chan_tx = -- of_dma_request_slave_channel(node, "tx"); -+ dma_request_slave_channel(dev, "tx"); - host->dma_chan_rx = -- of_dma_request_slave_channel(node, "rx"); -+ dma_request_slave_channel(dev, "rx"); - } else { - dma_cap_mask_t mask; - - -From a80e690cd5f73b47a29d930983e663063d447541 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 14:44:41 +0100 -Subject: [PATCH 141/154] squash: bcm2709: Allow to build without SMP - ---- - arch/arm/mach-bcm2709/bcm2709.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index dcd3b47..439a2d6 100644 ---- a/arch/arm/mach-bcm2709/bcm2709.c -+++ b/arch/arm/mach-bcm2709/bcm2709.c -@@ -1197,6 +1197,7 @@ static void __init board_reserve(void) - } - - -+#ifdef CONFIG_SMP - #include - - #include -@@ -1299,6 +1300,7 @@ struct smp_operations bcm2709_smp_ops __initdata = { - .smp_secondary_init = bcm2709_secondary_init, - .smp_boot_secondary = bcm2709_boot_secondary, - }; -+#endif - - static const char * const bcm2709_compat[] = { - "brcm,bcm2709", -@@ -1308,7 +1310,9 @@ static const char * const bcm2709_compat[] = { - - MACHINE_START(BCM2709, "BCM2709") - /* Maintainer: Broadcom Europe Ltd. */ -+#ifdef CONFIG_SMP - .smp = smp_ops(bcm2709_smp_ops), -+#endif - .map_io = bcm2709_map_io, - .init_irq = bcm2709_init_irq, - .init_time = bcm2709_timer_init, -@@ -1321,7 +1325,9 @@ MACHINE_END - - MACHINE_START(BCM2708, "BCM2709") - /* Maintainer: Broadcom Europe Ltd. */ -+#ifdef CONFIG_SMP - .smp = smp_ops(bcm2709_smp_ops), -+#endif - .map_io = bcm2709_map_io, - .init_irq = bcm2709_init_irq, - .init_time = bcm2709_timer_init, - -From 12149d45facaf1a03592b41a7f4ed0ef64898258 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 14:45:00 +0100 -Subject: [PATCH 142/154] squash: entry_macro: Allow to build without SMP - ---- - arch/arm/mach-bcm2709/include/mach/entry-macro.S | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/arm/mach-bcm2709/include/mach/entry-macro.S b/arch/arm/mach-bcm2709/include/mach/entry-macro.S -index 101d9f1..08d184c 100644 ---- a/arch/arm/mach-bcm2709/include/mach/entry-macro.S -+++ b/arch/arm/mach-bcm2709/include/mach/entry-macro.S -@@ -35,7 +35,7 @@ - ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source - add \irqstat, \irqstat, \base, lsl #2 - ldr \tmp, [\irqstat] -- -+#ifdef CONFIG_SMP - /* test for mailbox0 (IPI) interrupt */ - tst \tmp, #0x10 - beq 1030f -@@ -53,7 +53,7 @@ - mov r1, sp - adr lr, BSYM(1b) - b do_IPI -- -+#endif - 1030: - /* check gpu interrupt */ - tst \tmp, #0x100 - -From ef2659470ba228678f2d46b4767b456d08ff6bef Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 14:45:12 +0100 -Subject: [PATCH 143/154] squash: dwc_otg: Allow to build without SMP - ---- - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -index 276ad0c7..7e0c726 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -@@ -78,7 +78,7 @@ void notrace _fiq_print(enum fiq_debug_level dbg_lvl, volatile struct fiq_state - * fiq_fsm_spin_lock() - ARMv6+ bare bones spinlock - * Must be called with local interrupts and FIQ disabled. - */ --#ifdef CONFIG_ARCH_BCM2709 -+#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) - inline void fiq_fsm_spin_lock(fiq_lock_t *lock) - { - unsigned long tmp; -@@ -111,7 +111,7 @@ inline void fiq_fsm_spin_lock(fiq_lock_t *lock) { } - /** - * fiq_fsm_spin_unlock() - ARMv6+ bare bones spinunlock - */ --#ifdef CONFIG_ARCH_BCM2709 -+#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) - inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) - { - smp_mb(); - -From 121d87c832937a71df50e83be0bfd7da9016e9b3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 14:56:45 +0100 -Subject: [PATCH 144/154] squash: bcm2709: Fix build with SYSTEM_TIMER defined - ---- - arch/arm/mach-bcm2709/bcm2709.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 439a2d6..44bfc50 100644 ---- a/arch/arm/mach-bcm2709/bcm2709.c -+++ b/arch/arm/mach-bcm2709/bcm2709.c -@@ -1103,7 +1103,7 @@ static void __init bcm2709_timer_init(void) - /* - * Make irqs happen for the system timer - */ -- setup_irq(IRQ_TIMER3, &bcm2708_timer_irq); -+ setup_irq(IRQ_TIMER3, &bcm2709_timer_irq); - - sched_clock_register(bcm2709_read_sched_clock, 32, STC_FREQ_HZ); - -@@ -1117,7 +1117,7 @@ static void __init bcm2709_timer_init(void) - timer0_clockevent.cpumask = cpumask_of(0); - clockevents_register_device(&timer0_clockevent); - -- register_current_timer_delay(&bcm2708_delay_timer); -+ register_current_timer_delay(&bcm2709_delay_timer); - } - - #else - -From cb9d41ece08a5675207633802d3a71b7b8c0897c Mon Sep 17 00:00:00 2001 +From 89df9a42f6e60b3c54c4b49b1fafff7ef201ac72 Mon Sep 17 00:00:00 2001 From: Christopher Freeman Date: Wed, 4 Mar 2015 01:16:58 -0800 -Subject: [PATCH 145/154] dmaengine: increment privatecnt when using +Subject: [PATCH 130/216] dmaengine: increment privatecnt when using dma_get_any_slave_channel Channels allocated via dma_get_any_slave_channel were not increasing @@ -137775,676 +136666,10 @@ index ac336a9..bb2b914 100644 } -From a7865cec5171ab86807a1c9e27d003149574fa1e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:00:01 +0100 -Subject: [PATCH 147/154] Revert "bcm2835-mmc: Add locks when accessing sdhost - registers" - -This reverts commit 547b7363c0a41772fa3b8eb4b34f7cf343a2e9a2. ---- - drivers/mmc/host/bcm2835-mmc.c | 12 ------------ - 1 file changed, 12 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 8edae29..3345612 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -344,11 +344,7 @@ static void bcm2835_mmc_dumpregs(struct bcm2835_host *host) - static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - { - unsigned long timeout; -- unsigned long flags; -- -- BUG_ON(spin_is_locked(&host->lock)); - -- spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET, 0); - - if (mask & SDHCI_RESET_ALL) -@@ -366,9 +362,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - goto exit; - } - timeout--; -- spin_unlock_irqrestore(&host->lock, flags); - mdelay(1); -- spin_lock_irqsave(&host->lock, flags); - } - - if (100-timeout > 10 && 100-timeout > host->max_delay) { -@@ -378,14 +372,12 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - exit: - if ((mmc_debug & (1<<15))) - bcm2835_mmc_writeb(host, TIMEOUT_VAL, SDHCI_TIMEOUT_CONTROL, 1); -- spin_unlock_irqrestore(&host->lock, flags); - } - - static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); - - static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - { -- unsigned long flags; - if (soft) - bcm2835_mmc_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA); - else -@@ -397,10 +389,8 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | - SDHCI_INT_RESPONSE; - -- spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); - bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); -- spin_unlock_irqrestore(&host->lock, flags); - - if (soft) { - /* force clock reconfiguration */ -@@ -1349,10 +1339,8 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param) - (mrq->data && (mrq->data->error || - (mrq->data->stop && mrq->data->stop->error))))) { - -- spin_unlock_irqrestore(&host->lock, flags); - bcm2835_mmc_reset(host, SDHCI_RESET_CMD); - bcm2835_mmc_reset(host, SDHCI_RESET_DATA); -- spin_lock_irqsave(&host->lock, flags); - } - - host->mrq = NULL; - -From 73f24007e994cb3df4c5726b875a49e8fa1093ab Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:00:10 +0100 -Subject: [PATCH 148/154] Revert "bcm2835-mmc: warn on accesses without - spinlock" - -This reverts commit 39315a8ea76cfb3aae6853aedd409e89886d8fd4. ---- - drivers/mmc/host/bcm2835-mmc.c | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 3345612..81e75d7 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -164,7 +164,6 @@ static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int re - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -- WARN_ON(!spin_is_locked(&host->lock)); - writel(val, host->ioaddr + reg); - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); - -@@ -190,7 +189,6 @@ static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -- WARN_ON(!spin_is_locked(&host->lock)); - writel(val, host->ioaddr + reg); - - delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -@@ -215,7 +213,6 @@ static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -- WARN_ON(!spin_is_locked(&host->lock)); - ret = readl(host->ioaddr + reg); - - if (mmc_debug & (1<<10)) -@@ -589,14 +586,11 @@ static void bcm2835_mmc_transfer_dma(struct bcm2835_host *host) - dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); - } - if (desc) { -- unsigned long flags; -- spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_unsignal_irqs(host, SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL); - host->tx_desc = desc; - desc->callback = bcm2835_mmc_dma_complete; - desc->callback_param = host; -- spin_unlock_irqrestore(&host->lock, flags); - dmaengine_submit(desc); - dma_async_issue_pending(dma_chan); - } -@@ -1355,7 +1349,7 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param) - - - --static int bcm2835_mmc_add_host(struct bcm2835_host *host) -+int bcm2835_mmc_add_host(struct bcm2835_host *host) - { - struct mmc_host *mmc = host->mmc; - struct device *dev = mmc->parent; -@@ -1381,6 +1375,8 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host) - - host->flags = SDHCI_AUTO_CMD23; - -+ spin_lock_init(&host->lock); -+ - dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); - if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - -From 95ae72d689b237f84ffc55c5d03d727fd004186b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:00:19 +0100 -Subject: [PATCH 149/154] Revert "bcm2835-mmc: Add option to disable delays on - some writeb calls" - -This reverts commit aa6b3e63fae5d01a11706503841c141478d46536. ---- - drivers/mmc/host/bcm2835-mmc.c | 29 ++++++++--------------------- - 1 file changed, 8 insertions(+), 21 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 81e75d7..a72304a 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -240,7 +240,7 @@ static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int re - - } - --static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg, int from) -+static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg) - { - u32 oldval = bcm2835_mmc_readl(host, reg & ~3); - u32 byte_num = reg & 3; -@@ -248,16 +248,7 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg - u32 mask = 0xff << byte_shift; - u32 newval = (oldval & ~mask) | (val << byte_shift); - -- if ((reg & ~3) == 0x28) // SDHCI_HOST_CONTROL, SDHCI_POWER_CONTROL, SDHCI_BLOCK_GAP_CONTROL, SDHCI_WAKE_UP_CONTROL -- { -- WARN_ON(oldval & ((1<<16)|(1<<17))); -- } -- else if ((reg & ~3) == 0x2C) // SDHCI_CLOCK_CONTROL, SDHCI_TIMEOUT_CONTROL, SDHCI_SOFTWARE_RESET -- { -- WARN_ON(oldval & ((1<<24)|(1<<25)|(1<<26))); -- } -- -- bcm2835_mmc_writel(host, newval, reg & ~3, from + 10); -+ bcm2835_mmc_writel(host, newval, reg & ~3, 1); - } - - -@@ -342,7 +333,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - { - unsigned long timeout; - -- bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET, 0); -+ bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET); - - if (mask & SDHCI_RESET_ALL) - host->clock = 0; -@@ -356,7 +347,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - pr_err("%s: Reset 0x%x never completed.\n", - mmc_hostname(host->mmc), (int)mask); - bcm2835_mmc_dumpregs(host); -- goto exit; -+ return; - } - timeout--; - mdelay(1); -@@ -366,9 +357,6 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - host->max_delay = 100-timeout; - pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); - } --exit: -- if ((mmc_debug & (1<<15))) -- bcm2835_mmc_writeb(host, TIMEOUT_VAL, SDHCI_TIMEOUT_CONTROL, 1); - } - - static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); -@@ -621,10 +609,9 @@ static void bcm2835_mmc_prepare_data(struct bcm2835_host *host, struct mmc_comma - - WARN_ON(host->data); - -- if (!(mmc_debug & (1<<14))) - if (data || (cmd->flags & MMC_RSP_BUSY)) { - count = TIMEOUT_VAL; -- bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL, 1); -+ bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL); - } - - if (!data) -@@ -1250,7 +1237,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - if (host->pwr != SDHCI_POWER_330) { - host->pwr = SDHCI_POWER_330; -- bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL, 2); -+ bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL); - } - - ctrl = bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL); -@@ -1265,7 +1252,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - ctrl &= ~SDHCI_CTRL_HISPD; /* NO_HISPD_BIT */ - - -- bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL, 3); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); - /* - * We only need to set Driver Strength if the - * preset value enable is not set. -@@ -1286,7 +1273,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - /* Re-enable SD Clock */ - bcm2835_mmc_set_clock(host, host->clock); -- bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL, 4); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); - - mmiowb(); - - -From a52246c79aa9d148e6b554d33fb6365d10397540 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:00:28 +0100 -Subject: [PATCH 150/154] Revert "bcm2835-mmc: Add option to disable some - delays" - -This reverts commit d2a4b3ddb4faa2251db5f42012b26beccffcf79e. ---- - drivers/mmc/host/bcm2835-mmc.c | 34 ++++++++++++++++------------------ - 1 file changed, 16 insertions(+), 18 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index a72304a..8ff54d6 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -72,7 +72,6 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - - - /*static */unsigned mmc_debug; --/*static */unsigned mmc_debug2; - - struct bcm2835_host { - spinlock_t lock; -@@ -154,7 +153,7 @@ static inline u32 bcm2835_mmc_axi_outstanding_writes(void) - return (r >> 16) & 0x3ff; - } - --static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) -+static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) - { - u32 delay; - if (mmc_debug & (1<<0)) -@@ -168,7 +167,7 @@ static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int re - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); - - delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -- if (delay && !((1<shadow = newval; - else -- bcm2835_mmc_writel(host, newval, reg & ~3, 0); -+ bcm2835_mmc_writel(host, newval, reg & ~3); - - } - -@@ -248,7 +247,7 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg - u32 mask = 0xff << byte_shift; - u32 newval = (oldval & ~mask) | (val << byte_shift); - -- bcm2835_mmc_writel(host, newval, reg & ~3, 1); -+ bcm2835_mmc_writel(host, newval, reg & ~3); - } - - -@@ -280,7 +279,7 @@ static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) - ier &= ~clear; - /* change which requests generate IRQs - makes no difference to - the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ -- bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); -+ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE); - } - - -@@ -374,8 +373,8 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | - SDHCI_INT_RESPONSE; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); - - if (soft) { - /* force clock reconfiguration */ -@@ -597,8 +596,8 @@ static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) - else - host->ier = (host->ier & ~dma_irqs) | pio_irqs; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); - } - - -@@ -680,7 +679,7 @@ static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, - mode |= SDHCI_TRNS_AUTO_CMD12; - else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { - mode |= SDHCI_TRNS_AUTO_CMD23; -- bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); -+ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2); - } - } - -@@ -743,7 +742,7 @@ void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd - - bcm2835_mmc_prepare_data(host, cmd); - -- bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); -+ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT); - - bcm2835_mmc_set_transfer_mode(host, cmd); - -@@ -900,8 +899,8 @@ static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int en - else - host->ier &= ~SDHCI_INT_CARD_INT; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); - mmiowb(); - } - } -@@ -1048,7 +1047,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) - /* Clear selected interrupts. */ - mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | - SDHCI_INT_BUS_POWER); -- bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); -+ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS); - - - if (intmask & SDHCI_INT_CMD_MASK) -@@ -1078,7 +1077,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) - - if (intmask) { - unexpected |= intmask; -- bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); -+ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS); - } - - if (result == IRQ_NONE) -@@ -1364,7 +1363,7 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - spin_lock_init(&host->lock); - --dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); -+dev_info(dev, "mmc_debug:%x\n", mmc_debug); - if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - host->have_dma = false; -@@ -1577,7 +1576,6 @@ static struct platform_driver bcm2835_mmc_driver = { - module_platform_driver(bcm2835_mmc_driver); - - module_param(mmc_debug, uint, 0644); --module_param(mmc_debug2, uint, 0644); - MODULE_ALIAS("platform:mmc-bcm2835"); - MODULE_DESCRIPTION("BCM2835 SDHCI driver"); - MODULE_LICENSE("GPL v2"); - -From 3fefacdc8e061a0929ad3a6342d717a4a1805bb7 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:01:39 +0100 -Subject: [PATCH 151/154] Revert "bcm2835-mmc: Default to disabling - MMC_QUIRK_BLK_NO_CMD23" - -This reverts commit 488911bc7cc59fa99f2d9f33d9c8bad421d8684a. ---- - drivers/mmc/core/quirks.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index bc3bbad..8c90f3f 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -71,7 +71,6 @@ static const struct mmc_fixup mmc_fixup_methods[] = { - - void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - { -- extern unsigned mmc_debug; - const struct mmc_fixup *f; - u64 rev = cid_rev_card(card); - -@@ -99,7 +98,8 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -- if (mmc_debug & (1<<13)) -+ extern unsigned mmc_debug; -+ if (!(mmc_debug & (1<<13))) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; - } - EXPORT_SYMBOL(mmc_fixup_device); - -From 4c0553ea01d701c23aa54168a85c34b5928ccd31 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:01:44 +0100 -Subject: [PATCH 152/154] Revert "bcm2835-mmc: Add option to disable - MMC_QUIRK_BLK_NO_CMD23" - -This reverts commit 497dbba490e4a04b7db0dfe6a553c54a5ab14113. ---- - drivers/mmc/core/quirks.c | 2 -- - drivers/mmc/host/bcm2835-mmc.c | 2 +- - 2 files changed, 1 insertion(+), 3 deletions(-) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index 8c90f3f..f472082 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -98,8 +98,6 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -- extern unsigned mmc_debug; -- if (!(mmc_debug & (1<<13))) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; - } - EXPORT_SYMBOL(mmc_fixup_device); -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 8ff54d6..96197da 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -71,7 +71,7 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) - - --/*static */unsigned mmc_debug; -+static unsigned mmc_debug; - - struct bcm2835_host { - spinlock_t lock; - -From b8a19a3a5279b15170aee2c67a13380413402f72 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:03:28 +0100 -Subject: [PATCH 153/154] Revert "bcm2835-mmc: Add range of debug options for - slowing things down" - -This reverts commit f36bd72cd2b1a780caca8b621d212a1337ffeffe. ---- - drivers/mmc/host/bcm2835-mmc.c | 92 ++++-------------------------------------- - 1 file changed, 8 insertions(+), 84 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 96197da..eef0d351 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -71,8 +71,6 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) - - --static unsigned mmc_debug; -- - struct bcm2835_host { - spinlock_t lock; - -@@ -133,94 +131,20 @@ struct bcm2835_host { - }; - - --static inline u32 bcm2835_mmc_axi_outstanding_reads(void) --{ --#ifdef CONFIG_ARCH_BCM2709 -- u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT)); --#else -- u32 r = 0; --#endif -- return (r >> 0) & 0x3ff; --} -- --static inline u32 bcm2835_mmc_axi_outstanding_writes(void) --{ --#ifdef CONFIG_ARCH_BCM2709 -- u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT)); --#else -- u32 r = 0; --#endif -- return (r >> 16) & 0x3ff; --} -- - static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) - { -- u32 delay; -- if (mmc_debug & (1<<0)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<1)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); -- - writel(val, host->ioaddr + reg); - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); -- -- delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -- if (delay) -- udelay(delay); -- -- if (mmc_debug & (1<<2)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<3)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); - } - - static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) - { -- u32 delay; -- if (mmc_debug & (1<<4)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<5)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); -- - writel(val, host->ioaddr + reg); -- -- delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -- if (delay) -- udelay(delay); -- -- if (mmc_debug & (1<<6)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<7)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); - } - - static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) - { -- u32 ret; -- if (mmc_debug & (1<<8)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<9)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); -- -- ret = readl(host->ioaddr + reg); -- -- if (mmc_debug & (1<<10)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<11)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); -- return ret; -+ return readl(host->ioaddr + reg); - } - - static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int reg) -@@ -1339,7 +1263,9 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - { - struct mmc_host *mmc = host->mmc; - struct device *dev = mmc->parent; -+#ifndef FORCE_PIO - struct dma_slave_config cfg; -+#endif - int ret; - - bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -@@ -1363,11 +1289,10 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - spin_lock_init(&host->lock); - --dev_info(dev, "mmc_debug:%x\n", mmc_debug); --if (mmc_debug & (1<<12)) { -+#ifdef FORCE_PIO - dev_info(dev, "Forcing PIO mode\n"); - host->have_dma = false; --} else { -+#else - if (IS_ERR_OR_NULL(host->dma_chan_tx) || - IS_ERR_OR_NULL(host->dma_chan_rx)) { - dev_err(dev, "%s: Unable to initialise DMA channels. Falling back to PIO\n", -@@ -1391,7 +1316,7 @@ if (mmc_debug & (1<<12)) { - cfg.dst_addr = 0; - ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); - } --} -+#endif - mmc->max_segs = 128; - mmc->max_req_size = 524288; - mmc->max_seg_size = mmc->max_req_size; -@@ -1461,7 +1386,7 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) - - host->phys_addr = iomem->start + BCM2835_VCMMU_SHIFT; - --if (!(mmc_debug & (1<<12))) { -+#ifndef FORCE_PIO - if (node) { - host->dma_chan_tx = dma_request_slave_channel(dev, "tx"); - host->dma_chan_rx = dma_request_slave_channel(dev, "rx"); -@@ -1474,7 +1399,7 @@ if (!(mmc_debug & (1<<12))) { - host->dma_chan_tx = dma_request_channel(mask, NULL, NULL); - host->dma_chan_rx = dma_request_channel(mask, NULL, NULL); - } --} -+#endif - clk = devm_clk_get(dev, NULL); - if (IS_ERR(clk)) { - dev_err(dev, "could not get clk\n"); -@@ -1575,7 +1500,6 @@ static struct platform_driver bcm2835_mmc_driver = { - }; - module_platform_driver(bcm2835_mmc_driver); - --module_param(mmc_debug, uint, 0644); - MODULE_ALIAS("platform:mmc-bcm2835"); - MODULE_DESCRIPTION("BCM2835 SDHCI driver"); - MODULE_LICENSE("GPL v2"); - -From fe2ea3e054df3bcbb5eb2a41f2760cc418ef7f70 Mon Sep 17 00:00:00 2001 +From 0ecdaeb739edb714add6d8ae452d12d2ce821573 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 1 May 2015 17:46:56 +0100 -Subject: [PATCH 154/154] bcm2835-mmc: Add locks when accessing sdhost +Subject: [PATCH 131/216] bcm2835-mmc: Add locks when accessing sdhost registers --- @@ -138565,3 +136790,19964 @@ index eef0d351..1c34f476 100644 #ifdef FORCE_PIO dev_info(dev, "Forcing PIO mode\n"); host->have_dma = false; + +From d7580af2f81793fd3312608de95a9009123d8710 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 13 Apr 2015 23:34:50 +0100 +Subject: [PATCH 132/216] bcm2835-mmc: Add range of debug options for slowing + things down + +bcm2835-mmc: Add option to disable some delays + +bcm2835-mmc: Add option to disable MMC_QUIRK_BLK_NO_CMD23 + +bcm2835-mmc: Default to disabling MMC_QUIRK_BLK_NO_CMD23 +--- + drivers/mmc/core/quirks.c | 2 ++ + drivers/mmc/host/bcm2835-mmc.c | 44 ++++++++++++++++++++++++++++-------------- + 2 files changed, 32 insertions(+), 14 deletions(-) + +diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c +index f472082..bc3bbad 100644 +--- a/drivers/mmc/core/quirks.c ++++ b/drivers/mmc/core/quirks.c +@@ -71,6 +71,7 @@ static const struct mmc_fixup mmc_fixup_methods[] = { + + void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + { ++ extern unsigned mmc_debug; + const struct mmc_fixup *f; + u64 rev = cid_rev_card(card); + +@@ -98,6 +99,7 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. + * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). + */ ++ if (mmc_debug & (1<<13)) + card->quirks |= MMC_QUIRK_BLK_NO_CMD23; + } + EXPORT_SYMBOL(mmc_fixup_device); +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +index 1c34f476..68314d5 100644 +--- a/drivers/mmc/host/bcm2835-mmc.c ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -71,6 +71,9 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) + #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) + + ++unsigned mmc_debug; ++unsigned mmc_debug2; ++ + struct bcm2835_host { + spinlock_t lock; + +@@ -131,17 +134,27 @@ struct bcm2835_host { + }; + + +-static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) ++static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) + { ++ unsigned delay; + lockdep_assert_held_once(&host->lock); + writel(val, host->ioaddr + reg); + udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); ++ ++ delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); ++ if (delay && !((1<lock); + writel(val, host->ioaddr + reg); ++ ++ delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); ++ if (delay) ++ udelay(delay); + } + + static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) +@@ -162,7 +175,7 @@ static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int re + if (reg == SDHCI_TRANSFER_MODE) + host->shadow = newval; + else +- bcm2835_mmc_writel(host, newval, reg & ~3); ++ bcm2835_mmc_writel(host, newval, reg & ~3, 0); + + } + +@@ -174,7 +187,7 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg + u32 mask = 0xff << byte_shift; + u32 newval = (oldval & ~mask) | (val << byte_shift); + +- bcm2835_mmc_writel(host, newval, reg & ~3); ++ bcm2835_mmc_writel(host, newval, reg & ~3, 1); + } + + +@@ -206,7 +219,7 @@ static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) + ier &= ~clear; + /* change which requests generate IRQs - makes no difference to + the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ +- bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE); ++ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); + } + + +@@ -307,8 +320,8 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) + SDHCI_INT_RESPONSE; + + spin_lock_irqsave(&host->lock, flags); +- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); +- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); + spin_unlock_irqrestore(&host->lock, flags); + + if (soft) { +@@ -534,8 +547,8 @@ static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) + else + host->ier = (host->ier & ~dma_irqs) | pio_irqs; + +- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); +- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); + } + + +@@ -617,7 +630,7 @@ static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, + mode |= SDHCI_TRNS_AUTO_CMD12; + else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { + mode |= SDHCI_TRNS_AUTO_CMD23; +- bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2); ++ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); + } + } + +@@ -680,7 +693,7 @@ void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd + + bcm2835_mmc_prepare_data(host, cmd); + +- bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT); ++ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); + + bcm2835_mmc_set_transfer_mode(host, cmd); + +@@ -837,8 +850,8 @@ static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int en + else + host->ier &= ~SDHCI_INT_CARD_INT; + +- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); +- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); + mmiowb(); + } + } +@@ -985,7 +998,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) + /* Clear selected interrupts. */ + mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | + SDHCI_INT_BUS_POWER); +- bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS); ++ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); + + + if (intmask & SDHCI_INT_CMD_MASK) +@@ -1015,7 +1028,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) + + if (intmask) { + unexpected |= intmask; +- bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS); ++ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); + } + + if (result == IRQ_NONE) +@@ -1303,6 +1316,7 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host) + + host->flags = SDHCI_AUTO_CMD23; + ++ dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); + #ifdef FORCE_PIO + dev_info(dev, "Forcing PIO mode\n"); + host->have_dma = false; +@@ -1514,6 +1528,8 @@ static struct platform_driver bcm2835_mmc_driver = { + }; + module_platform_driver(bcm2835_mmc_driver); + ++module_param(mmc_debug, uint, 0644); ++module_param(mmc_debug2, uint, 0644); + MODULE_ALIAS("platform:mmc-bcm2835"); + MODULE_DESCRIPTION("BCM2835 SDHCI driver"); + MODULE_LICENSE("GPL v2"); + +From e34578092803603a960a2a7bcccde5d0c8240b9a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 19:08:54 +0200 +Subject: [PATCH 133/216] BCM270x: Correct vcio device memory resource and add + irq resource +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The vcio driver hardcodes these resources, so this is the first +step in correcting this. Spell out the device name so we don't +have to include mach/vcio.h, since this header file will eventually +go away when the driver is later moved to drivers/mailbox. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/bcm2708.c | 17 ++++++++++------- + arch/arm/mach-bcm2708/include/mach/platform.h | 1 + + arch/arm/mach-bcm2709/bcm2709.c | 17 ++++++++++------- + arch/arm/mach-bcm2709/include/mach/platform.h | 1 + + 4 files changed, 22 insertions(+), 14 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 486e090..51f8efa 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -55,7 +55,6 @@ + #include + + #include +-#include + #include + + #include +@@ -414,17 +413,21 @@ static struct platform_device bcm2708_usb_device = { + }; + + static struct resource bcm2708_vcio_resources[] = { +- [0] = { /* mailbox/semaphore/doorbell access */ +- .start = MCORE_BASE, +- .end = MCORE_BASE + SZ_4K - 1, +- .flags = IORESOURCE_MEM, +- }, ++ { ++ .start = ARMCTRL_0_MAIL0_BASE, ++ .end = ARMCTRL_0_MAIL0_BASE + SZ_64 - 1, ++ .flags = IORESOURCE_MEM, ++ }, { ++ .start = IRQ_ARM_MAILBOX, ++ .end = IRQ_ARM_MAILBOX, ++ .flags = IORESOURCE_IRQ, ++ }, + }; + + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = BCM_VCIO_DRIVER_NAME, ++ .name = "bcm2708_vcio", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +diff --git a/arch/arm/mach-bcm2708/include/mach/platform.h b/arch/arm/mach-bcm2708/include/mach/platform.h +index 2e7e1bb..bef3e5a 100644 +--- a/arch/arm/mach-bcm2708/include/mach/platform.h ++++ b/arch/arm/mach-bcm2708/include/mach/platform.h +@@ -81,6 +81,7 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + + /* +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 44bfc50..8ed88b4 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -56,7 +56,6 @@ + #include + + #include +-#include + #include + + #include +@@ -433,17 +432,21 @@ static struct platform_device bcm2708_usb_device = { + }; + + static struct resource bcm2708_vcio_resources[] = { +- [0] = { /* mailbox/semaphore/doorbell access */ +- .start = MCORE_BASE, +- .end = MCORE_BASE + SZ_4K - 1, +- .flags = IORESOURCE_MEM, +- }, ++ { ++ .start = ARMCTRL_0_MAIL0_BASE, ++ .end = ARMCTRL_0_MAIL0_BASE + SZ_64 - 1, ++ .flags = IORESOURCE_MEM, ++ }, { ++ .start = IRQ_ARM_MAILBOX, ++ .end = IRQ_ARM_MAILBOX, ++ .flags = IORESOURCE_IRQ, ++ }, + }; + + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = BCM_VCIO_DRIVER_NAME, ++ .name = "bcm2708_vcio", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +diff --git a/arch/arm/mach-bcm2709/include/mach/platform.h b/arch/arm/mach-bcm2709/include/mach/platform.h +index 7157f38..5574bb5 100644 +--- a/arch/arm/mach-bcm2709/include/mach/platform.h ++++ b/arch/arm/mach-bcm2709/include/mach/platform.h +@@ -81,6 +81,7 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + + /* + +From 4b03fd4291b9ed1cd100b359967f1b1fdc39984a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 2 May 2015 09:55:53 +0200 +Subject: [PATCH 134/216] video: fbdev: bcm2708_fb: Don't panic on error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +No need to panic the kernel if the video driver fails. +Just print a message and return an error. + +Signed-off-by: Noralf Trønnes +--- + drivers/video/fbdev/bcm2708_fb.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +index 9179291..52e655a 100644 +--- a/drivers/video/fbdev/bcm2708_fb.c ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -325,8 +325,8 @@ static int bcm2708_fb_set_par(struct fb_info *info) + /* the console may currently be locked */ + console_trylock(); + console_unlock(); +- +- BUG(); /* what can we do here */ ++ pr_err("bcm2708_fb_set_par: Failed to set screen_base\n"); ++ return -EIO; + } + } + print_debug +@@ -677,7 +677,9 @@ static int bcm2708_fb_register(struct bcm2708_fb *fb) + */ + + fb_set_var(&fb->fb, &fb->fb.var); +- bcm2708_fb_set_par(&fb->fb); ++ ret = bcm2708_fb_set_par(&fb->fb); ++ if (ret) ++ return ret; + + print_debug("BCM2708FB: registering framebuffer (%dx%d@%d) (%d)\n", fbwidth, + fbheight, fbdepth, fbswap); + +From 1965f1d8dcc748e1f9ba3ff28c8fb5191e081a4d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 20:49:04 +0200 +Subject: [PATCH 135/216] BCM2708: vcio: Fix checkpatch issues +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +checkpatch.pl errors and warnings: +Many whitespace related issues in some form or another. +Consider using instead of . +braces {} are not necessary for single statement blocks. +Use pr_* instead of printk. +Do not initialise statics to 0 or NULL. +Avoid CamelCase. +sizeof size should be sizeof(size). +break is not useful after a goto or return. +struct file_operations should normally be const +Possible unnecessary 'out of memory' message +Comparison to NULL could be written "!res" +quoted string split across lines. + +This has not been adressed: +WARNING: consider using a completion + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/include/mach/vcio.h | 12 ++- + arch/arm/mach-bcm2708/vcio.c | 123 ++++++++++++++---------------- + 2 files changed, 62 insertions(+), 73 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/include/mach/vcio.h b/arch/arm/mach-bcm2708/include/mach/vcio.h +index 8e11d67e..58188b74 100644 +--- a/arch/arm/mach-bcm2708/include/mach/vcio.h ++++ b/arch/arm/mach-bcm2708/include/mach/vcio.h +@@ -12,10 +12,6 @@ + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef _MACH_BCM2708_VCIO_H + #define _MACH_BCM2708_VCIO_H +@@ -34,12 +30,14 @@ + #define MBOX_CHAN_COUNT 9 + + enum { +- VCMSG_PROCESS_REQUEST = 0x00000000 ++ VCMSG_PROCESS_REQUEST = 0x00000000 + }; ++ + enum { +- VCMSG_REQUEST_SUCCESSFUL = 0x80000000, +- VCMSG_REQUEST_FAILED = 0x80000001 ++ VCMSG_REQUEST_SUCCESSFUL = 0x80000000, ++ VCMSG_REQUEST_FAILED = 0x80000001 + }; ++ + /* Mailbox property tags */ + enum { + VCMSG_PROPERTY_END = 0x00000000, +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 700bff4..5e9e777 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -37,8 +37,7 @@ + #include + #include + +-#include +- ++#include + + #define DRIVER_NAME BCM_VCIO_DRIVER_NAME + +@@ -61,7 +60,9 @@ + #define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) + + #define MBOX_MAGIC 0xd0d0c0de +-static struct class *vcio_class = NULL; ++ ++static struct class *vcio_class; ++ + struct vc_mailbox { + struct device *dev; /* parent device */ + void __iomem *status; +@@ -102,9 +103,9 @@ static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) + { + int rc; + +- if (mbox->magic != MBOX_MAGIC) ++ if (mbox->magic != MBOX_MAGIC) { + rc = -EINVAL; +- else { ++ } else { + /* wait for the mailbox FIFO to have some space in it */ + while (0 != (readl(mbox->status) & ARM_MS_FULL)) + cpu_relax(); +@@ -119,9 +120,9 @@ static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) + { + int rc; + +- if (mbox->magic != MBOX_MAGIC) ++ if (mbox->magic != MBOX_MAGIC) { + rc = -EINVAL; +- else { ++ } else { + down(&mbox->sema[chan]); + *data28 = MBOX_DATA28(mbox->msg[chan]); + mbox->msg[chan] = 0; +@@ -133,17 +134,18 @@ static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) + static irqreturn_t mbox_irq(int irq, void *dev_id) + { + /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *) dev_id; ++ struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; + int status = readl(mbox->status); + int ret = IRQ_NONE; + + while (!(status & ARM_MS_EMPTY)) { + uint32_t msg = readl(mbox->read); + int chan = MBOX_CHAN(msg); ++ + if (chan < MBOX_CHAN_COUNT) { + if (mbox->msg[chan]) { + /* Overflow */ +- printk(KERN_ERR DRIVER_NAME ++ pr_err(DRIVER_NAME + ": mbox chan %d overflow - drop %08x\n", + chan, msg); + } else { +@@ -151,7 +153,7 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + up(&mbox->sema[chan]); + } + } else { +- printk(KERN_ERR DRIVER_NAME ++ pr_err(DRIVER_NAME + ": invalid channel selector (msg %08x)\n", msg); + } + ret = IRQ_HANDLED; +@@ -174,9 +176,9 @@ static struct device *mbox_dev; /* we assume there's only one! */ + + static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) + { ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); + int rc; + +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); + device_lock(dev); + rc = mbox_write(mailbox, chan, data28); + device_unlock(dev); +@@ -186,9 +188,9 @@ static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) + + static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) + { ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); + int rc; + +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); + device_lock(dev); + rc = mbox_read(mailbox, chan, data28); + device_unlock(dev); +@@ -221,41 +223,36 @@ static void dev_mbox_register(const char *dev_name, struct device *dev) + + static int mbox_copy_from_user(void *dst, const void *src, int size) + { +- if ( (uint32_t)src < TASK_SIZE) +- { ++ if ((uint32_t)src < TASK_SIZE) + return copy_from_user(dst, src, size); +- } +- else +- { +- memcpy( dst, src, size ); +- return 0; +- } ++ ++ memcpy(dst, src, size); ++ ++ return 0; + } + + static int mbox_copy_to_user(void *dst, const void *src, int size) + { +- if ( (uint32_t)dst < TASK_SIZE) +- { ++ if ((uint32_t)dst < TASK_SIZE) + return copy_to_user(dst, src, size); +- } +- else +- { +- memcpy( dst, src, size ); +- return 0; +- } ++ ++ memcpy(dst, src, size); ++ ++ return 0; + } + + static DEFINE_MUTEX(mailbox_lock); + extern int bcm_mailbox_property(void *data, int size) + { + uint32_t success; +- dma_addr_t mem_bus; /* the memory address accessed from videocore */ +- void *mem_kern; /* the memory address accessed from driver */ ++ dma_addr_t mem_bus; /* the memory address accessed from videocore */ ++ void *mem_kern; /* the memory address accessed from driver */ + int s = 0; + +- mutex_lock(&mailbox_lock); ++ mutex_lock(&mailbox_lock); + /* allocate some memory for the messages communicating with GPU */ +- mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, GFP_ATOMIC); ++ mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, ++ GFP_ATOMIC); + if (mem_kern) { + /* create the message */ + mbox_copy_from_user(mem_kern, data, size); +@@ -263,9 +260,8 @@ extern int bcm_mailbox_property(void *data, int size) + /* send the message */ + wmb(); + s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); +- if (s == 0) { ++ if (s == 0) + s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); +- } + if (s == 0) { + /* copy the response */ + rmb(); +@@ -276,9 +272,9 @@ extern int bcm_mailbox_property(void *data, int size) + s = -ENOMEM; + } + if (s != 0) +- printk(KERN_ERR DRIVER_NAME ": %s failed (%d)\n", __func__, s); ++ pr_err(DRIVER_NAME ": %s failed (%d)\n", __func__, s); + +- mutex_unlock(&mailbox_lock); ++ mutex_unlock(&mailbox_lock); + return s; + } + EXPORT_SYMBOL_GPL(bcm_mailbox_property); +@@ -291,7 +287,7 @@ EXPORT_SYMBOL_GPL(bcm_mailbox_property); + * Is the device open right now? Used to prevent + * concurent access into the same device + */ +-static int Device_Open = 0; ++static bool device_is_open; + + /* + * This is called whenever a process attempts to open the device file +@@ -301,10 +297,10 @@ static int device_open(struct inode *inode, struct file *file) + /* + * We don't want to talk to two processes at the same time + */ +- if (Device_Open) ++ if (device_is_open) + return -EBUSY; + +- Device_Open++; ++ device_is_open = true; + /* + * Initialize the message + */ +@@ -317,7 +313,7 @@ static int device_release(struct inode *inode, struct file *file) + /* + * We're now ready for our next caller + */ +- Device_Open--; ++ device_is_open = false; + + module_put(THIS_MODULE); + return 0; +@@ -333,9 +329,8 @@ static int device_release(struct inode *inode, struct file *file) + * calling process), the ioctl call returns the output of this function. + * + */ +-static long device_ioctl(struct file *file, /* see include/linux/fs.h */ +- unsigned int ioctl_num, /* number and param for ioctl */ +- unsigned long ioctl_param) ++static long device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) + { + unsigned size; + /* +@@ -348,11 +343,10 @@ static long device_ioctl(struct file *file, /* see include/linux/fs.h */ + * to be the device's message. Get the parameter given to + * ioctl by the process. + */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof size); ++ mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); + return bcm_mailbox_property((void *)ioctl_param, size); +- break; + default: +- printk(KERN_ERR DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); ++ pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); + return -EINVAL; + } + +@@ -368,7 +362,7 @@ static long device_ioctl(struct file *file, /* see include/linux/fs.h */ + * the devices table, it can't be local to + * init_module. NULL is for unimplemented functios. + */ +-struct file_operations fops = { ++const struct file_operations fops = { + .unlocked_ioctl = device_ioctl, + .open = device_open, + .release = device_release, /* a.k.a. close */ +@@ -380,17 +374,15 @@ static int bcm_vcio_probe(struct platform_device *pdev) + struct vc_mailbox *mailbox; + + mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL); +- if (NULL == mailbox) { +- printk(KERN_ERR DRIVER_NAME ": failed to allocate " +- "mailbox memory\n"); ++ if (!mailbox) { + ret = -ENOMEM; + } else { + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (res == NULL) { +- printk(KERN_ERR DRIVER_NAME ": failed to obtain memory " +- "resource\n"); ++ if (!res) { ++ pr_err(DRIVER_NAME ++ ": failed to obtain memory resource\n"); + ret = -ENODEV; + kfree(mailbox); + } else { +@@ -402,8 +394,8 @@ static int bcm_vcio_probe(struct platform_device *pdev) + + mbox_irqaction.dev_id = mailbox; + setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction); +- printk(KERN_INFO DRIVER_NAME ": mailbox at %p\n", +- __io_address(ARM_0_MAIL0_RD)); ++ dev_info(&pdev->dev, "mailbox at %p\n", ++ __io_address(ARM_0_MAIL0_RD)); + } + } + +@@ -417,17 +409,18 @@ static int bcm_vcio_probe(struct platform_device *pdev) + * Negative values signify an error + */ + if (ret < 0) { +- printk(KERN_ERR DRIVER_NAME +- "Failed registering the character device %d\n", ret); ++ pr_err(DRIVER_NAME ++ "Failed registering the character device %d\n", ++ ret); + return ret; + } + vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME); + if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- return ret ; ++ ret = PTR_ERR(vcio_class); ++ return ret; + } + device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); ++ "vcio"); + } + return ret; + } +@@ -456,20 +449,18 @@ static int __init bcm_mbox_init(void) + { + int ret; + +- printk(KERN_INFO "mailbox: Broadcom VideoCore Mailbox driver\n"); ++ pr_info("mailbox: Broadcom VideoCore Mailbox driver\n"); + + ret = platform_driver_register(&bcm_mbox_driver); +- if (ret != 0) { +- printk(KERN_ERR DRIVER_NAME ": failed to register " +- "on platform\n"); +- } ++ if (ret) ++ pr_err(DRIVER_NAME ": failed to register on platform\n"); + + return ret; + } + + static void __exit bcm_mbox_exit(void) + { +- device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0)); ++ device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); + class_destroy(vcio_class); + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); + platform_driver_unregister(&bcm_mbox_driver); + +From f7567a97143abdc87b5dc258b3b628ba115ce0b2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:02:44 +0200 +Subject: [PATCH 136/216] BCM2708: vcio: Remove unused code and compact + comments +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The config reference SERIAL_BCM_MBOX_CONSOLE does not exist, +so remove the whole clause as it will always be false. + +Remove includes that are not needed. +Add . +Also sort include headers alphabetically, since this +is now the preferred coding style. + +Remove vc_mailbox->dev since it is not used. + +Compact some comments to one line. +Remove superfluous comments. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 68 ++++++++++---------------------------------- + 1 file changed, 15 insertions(+), 53 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 5e9e777..270f126 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -12,39 +12,24 @@ + * VideoCore processor + */ + +-#if defined(CONFIG_SERIAL_BCM_MBOX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +-#define SUPPORT_SYSRQ +-#endif +- ++#include ++#include + #include +-#include +-#include +-#include + #include +-#include ++#include + #include +-#include +-#include +-#include +-#include +-#include +-#include + #include +-#include +- + #include ++#include ++#include ++#include ++#include + + #include + #include + +-#include +- + #define DRIVER_NAME BCM_VCIO_DRIVER_NAME + +-/* ---------------------------------------------------------------------- +- * Mailbox +- * -------------------------------------------------------------------- */ +- + /* offsets from a mail box base address */ + #define MAIL_WRT 0x00 /* write - and next 4 words */ + #define MAIL_RD 0x00 /* read - and next 4 words */ +@@ -64,7 +49,6 @@ + static struct class *vcio_class; + + struct vc_mailbox { +- struct device *dev; /* parent device */ + void __iomem *status; + void __iomem *config; + void __iomem *read; +@@ -79,7 +63,6 @@ static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, + { + int i; + +- mbox_out->dev = dev; + mbox_out->status = __io_address(addr_mbox + MAIL_STA); + mbox_out->config = __io_address(addr_mbox + MAIL_CNF); + mbox_out->read = __io_address(addr_mbox + MAIL_RD); +@@ -144,7 +127,6 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + + if (chan < MBOX_CHAN_COUNT) { + if (mbox->msg[chan]) { +- /* Overflow */ + pr_err(DRIVER_NAME + ": mbox chan %d overflow - drop %08x\n", + chan, msg); +@@ -168,9 +150,7 @@ static struct irqaction mbox_irqaction = { + .handler = mbox_irq, + }; + +-/* ---------------------------------------------------------------------- +- * Mailbox Methods +- * -------------------------------------------------------------------- */ ++/* Mailbox Methods */ + + static struct device *mbox_dev; /* we assume there's only one! */ + +@@ -279,9 +259,7 @@ extern int bcm_mailbox_property(void *data, int size) + } + EXPORT_SYMBOL_GPL(bcm_mailbox_property); + +-/* ---------------------------------------------------------------------- +- * Platform Device for Mailbox +- * -------------------------------------------------------------------- */ ++/* Platform Device for Mailbox */ + + /* + * Is the device open right now? Used to prevent +@@ -289,33 +267,26 @@ EXPORT_SYMBOL_GPL(bcm_mailbox_property); + */ + static bool device_is_open; + +-/* +- * This is called whenever a process attempts to open the device file +- */ ++/* This is called whenever a process attempts to open the device file */ + static int device_open(struct inode *inode, struct file *file) + { +- /* +- * We don't want to talk to two processes at the same time +- */ ++ /* We don't want to talk to two processes at the same time */ + if (device_is_open) + return -EBUSY; + + device_is_open = true; +- /* +- * Initialize the message +- */ + try_module_get(THIS_MODULE); ++ + return 0; + } + + static int device_release(struct inode *inode, struct file *file) + { +- /* +- * We're now ready for our next caller +- */ ++ /* We're now ready for our next caller */ + device_is_open = false; + + module_put(THIS_MODULE); ++ + return 0; + } + +@@ -333,9 +304,7 @@ static long device_ioctl(struct file *file, unsigned int ioctl_num, + unsigned long ioctl_param) + { + unsigned size; +- /* +- * Switch according to the ioctl called +- */ ++ + switch (ioctl_num) { + case IOCTL_MBOX_PROPERTY: + /* +@@ -400,14 +369,7 @@ static int bcm_vcio_probe(struct platform_device *pdev) + } + + if (ret == 0) { +- /* +- * Register the character device +- */ + ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- +- /* +- * Negative values signify an error +- */ + if (ret < 0) { + pr_err(DRIVER_NAME + "Failed registering the character device %d\n", + +From 406f0f628a2f978a1da4d25dda3b5eafb94cefd0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:10:18 +0200 +Subject: [PATCH 137/216] BCM2708: vcio: Move character device teardown to + driver remove +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +chrdev is created in the probe function, but teared down in module exit. +Move chrdev teardown to happen on device removal. +Also add missing mbox_dev disabling. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 270f126..cac8dd7 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -391,8 +391,12 @@ static int bcm_vcio_remove(struct platform_device *pdev) + { + struct vc_mailbox *mailbox = platform_get_drvdata(pdev); + ++ mbox_dev = NULL; + platform_set_drvdata(pdev, NULL); + kfree(mailbox); ++ device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); ++ class_destroy(vcio_class); ++ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); + + return 0; + } +@@ -422,9 +426,6 @@ static int __init bcm_mbox_init(void) + + static void __exit bcm_mbox_exit(void) + { +- device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); + platform_driver_unregister(&bcm_mbox_driver); + } + + +From fa189cd5d18e5cda8438873181a329fc489a6649 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:20:46 +0200 +Subject: [PATCH 138/216] BCM2708: vcio: Restructure error paths +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +No need to use if/else clauses on error when return can be used directly. +Also test for errors first if possible. +This is done to enhance readability. +bcm_vcio_probe() is not touched, it will be reworked later. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 48 +++++++++++++++++++------------------------- + 1 file changed, 21 insertions(+), 27 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index cac8dd7..36e0f1e 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -84,34 +84,28 @@ static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, + + static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) + { +- int rc; ++ if (mbox->magic != MBOX_MAGIC) ++ return -EINVAL; + +- if (mbox->magic != MBOX_MAGIC) { +- rc = -EINVAL; +- } else { +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->status) & ARM_MS_FULL)) +- cpu_relax(); ++ /* wait for the mailbox FIFO to have some space in it */ ++ while (0 != (readl(mbox->status) & ARM_MS_FULL)) ++ cpu_relax(); + +- writel(MBOX_MSG(chan, data28), mbox->write); +- rc = 0; +- } +- return rc; ++ writel(MBOX_MSG(chan, data28), mbox->write); ++ ++ return 0; + } + + static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) + { +- int rc; ++ if (mbox->magic != MBOX_MAGIC) ++ return -EINVAL; + +- if (mbox->magic != MBOX_MAGIC) { +- rc = -EINVAL; +- } else { +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- rc = 0; +- } +- return rc; ++ down(&mbox->sema[chan]); ++ *data28 = MBOX_DATA28(mbox->msg[chan]); ++ mbox->msg[chan] = 0; ++ ++ return 0; + } + + static irqreturn_t mbox_irq(int irq, void *dev_id) +@@ -180,19 +174,19 @@ static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) + + extern int bcm_mailbox_write(unsigned chan, uint32_t data28) + { +- if (mbox_dev) +- return dev_mbox_write(mbox_dev, chan, data28); +- else ++ if (!mbox_dev) + return -ENODEV; ++ ++ return dev_mbox_write(mbox_dev, chan, data28); + } + EXPORT_SYMBOL_GPL(bcm_mailbox_write); + + extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) + { +- if (mbox_dev) +- return dev_mbox_read(mbox_dev, chan, data28); +- else ++ if (!mbox_dev) + return -ENODEV; ++ ++ return dev_mbox_read(mbox_dev, chan, data28); + } + EXPORT_SYMBOL_GPL(bcm_mailbox_read); + + +From ce2c991a11f0a94679423655dceed9bb80604892 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:28:31 +0200 +Subject: [PATCH 139/216] BCM2708: vcio: Move some macros from header to driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Move some macros that are only used by the driver: +MAJOR_NUM +IOCTL_MBOX_PROPERTY +DEVICE_FILE_NAME + +This one becomes superfluous: BCM_VCIO_DRIVER_NAME + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/include/mach/vcio.h | 35 ------------------------------- + arch/arm/mach-bcm2708/vcio.c | 9 ++++++-- + 2 files changed, 7 insertions(+), 37 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/include/mach/vcio.h b/arch/arm/mach-bcm2708/include/mach/vcio.h +index 58188b74..95ad121 100644 +--- a/arch/arm/mach-bcm2708/include/mach/vcio.h ++++ b/arch/arm/mach-bcm2708/include/mach/vcio.h +@@ -20,8 +20,6 @@ + * (semaphores, doorbells, mailboxes) + */ + +-#define BCM_VCIO_DRIVER_NAME "bcm2708_vcio" +- + /* Constants shared with the ARM identifying separate mailbox channels */ + #define MBOX_CHAN_POWER 0 /* for use by the power management interface */ + #define MBOX_CHAN_FB 1 /* for use by the frame buffer */ +@@ -127,37 +125,4 @@ extern int /*rc*/ bcm_mailbox_read(unsigned chan, uint32_t *data28); + extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28); + extern int /*rc*/ bcm_mailbox_property(void *data, int size); + +-#include +- +-/* +- * The major device number. We can't rely on dynamic +- * registration any more, because ioctls need to know +- * it. +- */ +-#define MAJOR_NUM 100 +- +-/* +- * Set the message of the device driver +- */ +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +-/* +- * _IOWR means that we're creating an ioctl command +- * number for passing information from a user process +- * to the kernel module and from the kernel module to user process +- * +- * The first arguments, MAJOR_NUM, is the major device +- * number we're using. +- * +- * The second argument is the number of the command +- * (there could be several with different meanings). +- * +- * The third argument is the type we want to get from +- * the process to the kernel. +- */ +- +-/* +- * The name of the device file +- */ +-#define DEVICE_FILE_NAME "vcio" +- + #endif +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 36e0f1e..75cf955 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -28,7 +29,8 @@ + #include + #include + +-#define DRIVER_NAME BCM_VCIO_DRIVER_NAME ++#define DRIVER_NAME "bcm2708_vcio" ++#define DEVICE_FILE_NAME "vcio" + + /* offsets from a mail box base address */ + #define MAIL_WRT 0x00 /* write - and next 4 words */ +@@ -46,6 +48,9 @@ + + #define MBOX_MAGIC 0xd0d0c0de + ++#define MAJOR_NUM 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) ++ + static struct class *vcio_class; + + struct vc_mailbox { +@@ -370,7 +375,7 @@ static int bcm_vcio_probe(struct platform_device *pdev) + ret); + return ret; + } +- vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME); ++ vcio_class = class_create(THIS_MODULE, DRIVER_NAME); + if (IS_ERR(vcio_class)) { + ret = PTR_ERR(vcio_class); + return ret; + +From 71c6a7270af56930e1e31ff243048c1ac12ebc1f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:40:03 +0200 +Subject: [PATCH 140/216] BCM2708: vcio: Only store the register base address +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +No need to keep pointers to the sub registers. Only +store the base address. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 37 ++++++++++++++----------------------- + 1 file changed, 14 insertions(+), 23 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 75cf955..e67fa3e 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -33,12 +33,12 @@ + #define DEVICE_FILE_NAME "vcio" + + /* offsets from a mail box base address */ +-#define MAIL_WRT 0x00 /* write - and next 4 words */ +-#define MAIL_RD 0x00 /* read - and next 4 words */ +-#define MAIL_POL 0x10 /* read without popping the fifo */ +-#define MAIL_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL_STA 0x18 /* status */ +-#define MAIL_CNF 0x1C /* configuration */ ++#define MAIL0_RD 0x00 /* read - and next 4 words */ ++#define MAIL0_POL 0x10 /* read without popping the fifo */ ++#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ ++#define MAIL0_STA 0x18 /* status */ ++#define MAIL0_CNF 0x1C /* configuration */ ++#define MAIL1_WRT 0x20 /* write - and next 4 words */ + + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) + #define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +@@ -54,10 +54,7 @@ + static struct class *vcio_class; + + struct vc_mailbox { +- void __iomem *status; +- void __iomem *config; +- void __iomem *read; +- void __iomem *write; ++ void __iomem *regs; + uint32_t msg[MBOX_CHAN_COUNT]; + struct semaphore sema[MBOX_CHAN_COUNT]; + uint32_t magic; +@@ -68,13 +65,7 @@ static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, + { + int i; + +- mbox_out->status = __io_address(addr_mbox + MAIL_STA); +- mbox_out->config = __io_address(addr_mbox + MAIL_CNF); +- mbox_out->read = __io_address(addr_mbox + MAIL_RD); +- /* Write to the other mailbox */ +- mbox_out->write = +- __io_address((addr_mbox ^ ARM_0_MAIL0_WRT ^ ARM_0_MAIL1_WRT) + +- MAIL_WRT); ++ mbox_out->regs = __io_address(addr_mbox); + + for (i = 0; i < MBOX_CHAN_COUNT; i++) { + mbox_out->msg[i] = 0; +@@ -82,7 +73,7 @@ static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, + } + + /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->config); ++ writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); + + mbox_out->magic = MBOX_MAGIC; + } +@@ -93,10 +84,10 @@ static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) + return -EINVAL; + + /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->status) & ARM_MS_FULL)) ++ while (0 != (readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL)) + cpu_relax(); + +- writel(MBOX_MSG(chan, data28), mbox->write); ++ writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); + + return 0; + } +@@ -117,11 +108,11 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + { + /* wait for the mailbox FIFO to have some data in it */ + struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +- int status = readl(mbox->status); ++ int status = readl(mbox->regs + MAIL0_STA); + int ret = IRQ_NONE; + + while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->read); ++ uint32_t msg = readl(mbox->regs + MAIL0_RD); + int chan = MBOX_CHAN(msg); + + if (chan < MBOX_CHAN_COUNT) { +@@ -138,7 +129,7 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + ": invalid channel selector (msg %08x)\n", msg); + } + ret = IRQ_HANDLED; +- status = readl(mbox->status); ++ status = readl(mbox->regs + MAIL0_STA); + } + return ret; + } + +From 30e7622ceffd50a31b6544e3a3e05bb0743c3bc2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:44:39 +0200 +Subject: [PATCH 141/216] BCM2708: vcio: Do not print messages in module init +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It is not common practice to print messages from a +module init function that only register a driver. +Remove obsolete module alias. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index e67fa3e..ff50ebd 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -403,15 +403,7 @@ static struct platform_driver bcm_mbox_driver = { + + static int __init bcm_mbox_init(void) + { +- int ret; +- +- pr_info("mailbox: Broadcom VideoCore Mailbox driver\n"); +- +- ret = platform_driver_register(&bcm_mbox_driver); +- if (ret) +- pr_err(DRIVER_NAME ": failed to register on platform\n"); +- +- return ret; ++ return platform_driver_register(&bcm_mbox_driver); + } + + static void __exit bcm_mbox_exit(void) +@@ -425,4 +417,3 @@ module_exit(bcm_mbox_exit); + MODULE_AUTHOR("Gray Girling"); + MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); + MODULE_LICENSE("GPL"); +-MODULE_ALIAS("platform:bcm-mbox"); + +From 7a9128973d51200625a3d3f8ff72a4580cb9f14b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 23:33:43 +0200 +Subject: [PATCH 142/216] BCM2708: vcio: Use device resources +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use device resources instead of hardcoding them. +Use devm_* functions where possible. +Merge dev_mbox_register() with probe function. +Add Device Tree support. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 122 +++++++++++++++++++++---------------------- + 1 file changed, 61 insertions(+), 61 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index ff50ebd..c4c2bcd 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -21,13 +21,10 @@ + #include + #include + #include +-#include + #include +-#include + #include + + #include +-#include + + #define DRIVER_NAME "bcm2708_vcio" + #define DEVICE_FILE_NAME "vcio" +@@ -60,13 +57,10 @@ struct vc_mailbox { + uint32_t magic; + }; + +-static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, +- uint32_t addr_mbox) ++static void mbox_init(struct vc_mailbox *mbox_out) + { + int i; + +- mbox_out->regs = __io_address(addr_mbox); +- + for (i = 0; i < MBOX_CHAN_COUNT; i++) { + mbox_out->msg[i] = 0; + sema_init(&mbox_out->sema[i], 0); +@@ -104,7 +98,7 @@ static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) + return 0; + } + +-static irqreturn_t mbox_irq(int irq, void *dev_id) ++static irqreturn_t mbox_irq_handler(int irq, void *dev_id) + { + /* wait for the mailbox FIFO to have some data in it */ + struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +@@ -134,12 +128,6 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + return ret; + } + +-static struct irqaction mbox_irqaction = { +- .name = "ARM Mailbox IRQ", +- .flags = IRQF_DISABLED | IRQF_IRQPOLL, +- .handler = mbox_irq, +-}; +- + /* Mailbox Methods */ + + static struct device *mbox_dev; /* we assume there's only one! */ +@@ -186,11 +174,6 @@ extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) + } + EXPORT_SYMBOL_GPL(bcm_mailbox_read); + +-static void dev_mbox_register(const char *dev_name, struct device *dev) +-{ +- mbox_dev = dev; +-} +- + static int mbox_copy_from_user(void *dst, const void *src, int size) + { + if ((uint32_t)src < TASK_SIZE) +@@ -329,61 +312,71 @@ const struct file_operations fops = { + + static int bcm_vcio_probe(struct platform_device *pdev) + { +- int ret = 0; ++ struct device *dev = &pdev->dev; ++ struct device *vdev; + struct vc_mailbox *mailbox; ++ struct resource *res; ++ int irq, ret; ++ ++ mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); ++ if (!mailbox) ++ return -ENOMEM; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mailbox->regs = devm_ioremap_resource(dev, res); ++ if (IS_ERR(mailbox->regs)) ++ return PTR_ERR(mailbox->regs); ++ ++ irq = platform_get_irq(pdev, 0); ++ ret = devm_request_irq(dev, irq, mbox_irq_handler, ++ IRQF_DISABLED | IRQF_IRQPOLL, ++ dev_name(dev), mailbox); ++ if (ret) { ++ dev_err(dev, "Interrupt request failed %d\n", ret); ++ return ret; ++ } + +- mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL); +- if (!mailbox) { +- ret = -ENOMEM; +- } else { +- struct resource *res; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (!res) { +- pr_err(DRIVER_NAME +- ": failed to obtain memory resource\n"); +- ret = -ENODEV; +- kfree(mailbox); +- } else { +- /* should be based on the registers from res really */ +- mbox_init(mailbox, &pdev->dev, ARM_0_MAIL0_RD); +- +- platform_set_drvdata(pdev, mailbox); +- dev_mbox_register(DRIVER_NAME, &pdev->dev); ++ ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); ++ if (ret < 0) { ++ pr_err("Character device registration failed %d\n", ret); ++ return ret; ++ } + +- mbox_irqaction.dev_id = mailbox; +- setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction); +- dev_info(&pdev->dev, "mailbox at %p\n", +- __io_address(ARM_0_MAIL0_RD)); +- } ++ vcio_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vcio_class)) { ++ ret = PTR_ERR(vcio_class); ++ pr_err("Class creation failed %d\n", ret); ++ goto err_class; + } + +- if (ret == 0) { +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- if (ret < 0) { +- pr_err(DRIVER_NAME +- "Failed registering the character device %d\n", +- ret); +- return ret; +- } +- vcio_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- return ret; +- } +- device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); ++ vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, ++ "vcio"); ++ if (IS_ERR(vdev)) { ++ ret = PTR_ERR(vdev); ++ pr_err("Device creation failed %d\n", ret); ++ goto err_dev; + } ++ ++ mbox_init(mailbox); ++ platform_set_drvdata(pdev, mailbox); ++ mbox_dev = dev; ++ ++ dev_info(dev, "mailbox at %p\n", mailbox->regs); ++ ++ return 0; ++ ++err_dev: ++ class_destroy(vcio_class); ++err_class: ++ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); ++ + return ret; + } + + static int bcm_vcio_remove(struct platform_device *pdev) + { +- struct vc_mailbox *mailbox = platform_get_drvdata(pdev); +- + mbox_dev = NULL; + platform_set_drvdata(pdev, NULL); +- kfree(mailbox); + device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); + class_destroy(vcio_class); + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +@@ -391,6 +384,12 @@ static int bcm_vcio_remove(struct platform_device *pdev) + return 0; + } + ++static const struct of_device_id bcm_vcio_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-vcio", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); ++ + static struct platform_driver bcm_mbox_driver = { + .probe = bcm_vcio_probe, + .remove = bcm_vcio_remove, +@@ -398,6 +397,7 @@ static struct platform_driver bcm_mbox_driver = { + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, ++ .of_match_table = bcm_vcio_of_match_table, + }, + }; + + +From bb294088d80bcba531bc3d58b4a6c08b8cdcb0b0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 19:11:03 +0200 +Subject: [PATCH 143/216] mailbox: bcm2708: Add bcm2708-vcio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Copy the arch vcio.c driver to drivers/mailbox. +This is done to make it available on ARCH_BCM2835. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/Kconfig | 6 + + drivers/mailbox/Makefile | 2 + + drivers/mailbox/bcm2708-vcio.c | 426 ++++++++++++++++++++++++++ + include/linux/platform_data/mailbox-bcm2708.h | 126 ++++++++ + 4 files changed, 560 insertions(+) + create mode 100644 drivers/mailbox/bcm2708-vcio.c + create mode 100644 include/linux/platform_data/mailbox-bcm2708.h + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 84325f2..fdcb206 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -6,6 +6,12 @@ menuconfig MAILBOX + signals. Say Y if your platform supports hardware mailboxes. + + if MAILBOX ++config BCM2708_MBOX ++ bool "Broadcom BCM2708 Mailbox (vcio)" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ help ++ Broadcom BCM2708 Mailbox (vcio) ++ + config PL320_MBOX + bool "ARM PL320 Mailbox" + depends on ARM_AMBA +diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile +index 2e79231..c2d2bed 100644 +--- a/drivers/mailbox/Makefile ++++ b/drivers/mailbox/Makefile +@@ -2,6 +2,8 @@ + + obj-$(CONFIG_MAILBOX) += mailbox.o + ++obj-$(CONFIG_BCM2708_MBOX) += bcm2708-vcio.o ++ + obj-$(CONFIG_PL320_MBOX) += pl320-ipc.o + + obj-$(CONFIG_OMAP2PLUS_MBOX) += omap-mailbox.o +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +new file mode 100644 +index 0000000..ee3e778 +--- /dev/null ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -0,0 +1,426 @@ ++/* ++ * linux/arch/arm/mach-bcm2708/vcio.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * 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. ++ * ++ * This device provides a shared mechanism for writing to the mailboxes, ++ * semaphores, doorbells etc. that are shared between the ARM and the ++ * VideoCore processor ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DRIVER_NAME "bcm2708_vcio" ++#define DEVICE_FILE_NAME "vcio" ++ ++/* offsets from a mail box base address */ ++#define MAIL0_RD 0x00 /* read - and next 4 words */ ++#define MAIL0_POL 0x10 /* read without popping the fifo */ ++#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ ++#define MAIL0_STA 0x18 /* status */ ++#define MAIL0_CNF 0x1C /* configuration */ ++#define MAIL1_WRT 0x20 /* write - and next 4 words */ ++ ++/* On MACH_BCM270x these come through (arm_control.h ) */ ++#ifndef ARM_MS_EMPTY ++#define ARM_MS_EMPTY BIT(30) ++#define ARM_MS_FULL BIT(31) ++ ++#define ARM_MC_IHAVEDATAIRQEN BIT(0) ++#endif ++ ++#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) ++#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) ++#define MBOX_CHAN(msg) ((msg) & 0xf) ++#define MBOX_DATA28(msg) ((msg) & ~0xf) ++#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) ++ ++#define MBOX_MAGIC 0xd0d0c0de ++ ++#define MAJOR_NUM 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) ++ ++static struct class *vcio_class; ++ ++struct vc_mailbox { ++ void __iomem *regs; ++ uint32_t msg[MBOX_CHAN_COUNT]; ++ struct semaphore sema[MBOX_CHAN_COUNT]; ++ uint32_t magic; ++}; ++ ++static void mbox_init(struct vc_mailbox *mbox_out) ++{ ++ int i; ++ ++ for (i = 0; i < MBOX_CHAN_COUNT; i++) { ++ mbox_out->msg[i] = 0; ++ sema_init(&mbox_out->sema[i], 0); ++ } ++ ++ /* Enable the interrupt on data reception */ ++ writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); ++ ++ mbox_out->magic = MBOX_MAGIC; ++} ++ ++static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) ++{ ++ if (mbox->magic != MBOX_MAGIC) ++ return -EINVAL; ++ ++ /* wait for the mailbox FIFO to have some space in it */ ++ while (0 != (readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL)) ++ cpu_relax(); ++ ++ writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); ++ ++ return 0; ++} ++ ++static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) ++{ ++ if (mbox->magic != MBOX_MAGIC) ++ return -EINVAL; ++ ++ down(&mbox->sema[chan]); ++ *data28 = MBOX_DATA28(mbox->msg[chan]); ++ mbox->msg[chan] = 0; ++ ++ return 0; ++} ++ ++static irqreturn_t mbox_irq_handler(int irq, void *dev_id) ++{ ++ /* wait for the mailbox FIFO to have some data in it */ ++ struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; ++ int status = readl(mbox->regs + MAIL0_STA); ++ int ret = IRQ_NONE; ++ ++ while (!(status & ARM_MS_EMPTY)) { ++ uint32_t msg = readl(mbox->regs + MAIL0_RD); ++ int chan = MBOX_CHAN(msg); ++ ++ if (chan < MBOX_CHAN_COUNT) { ++ if (mbox->msg[chan]) { ++ pr_err(DRIVER_NAME ++ ": mbox chan %d overflow - drop %08x\n", ++ chan, msg); ++ } else { ++ mbox->msg[chan] = (msg | 0xf); ++ up(&mbox->sema[chan]); ++ } ++ } else { ++ pr_err(DRIVER_NAME ++ ": invalid channel selector (msg %08x)\n", msg); ++ } ++ ret = IRQ_HANDLED; ++ status = readl(mbox->regs + MAIL0_STA); ++ } ++ return ret; ++} ++ ++/* Mailbox Methods */ ++ ++static struct device *mbox_dev; /* we assume there's only one! */ ++ ++static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) ++{ ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); ++ int rc; ++ ++ device_lock(dev); ++ rc = mbox_write(mailbox, chan, data28); ++ device_unlock(dev); ++ ++ return rc; ++} ++ ++static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) ++{ ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); ++ int rc; ++ ++ device_lock(dev); ++ rc = mbox_read(mailbox, chan, data28); ++ device_unlock(dev); ++ ++ return rc; ++} ++ ++extern int bcm_mailbox_write(unsigned chan, uint32_t data28) ++{ ++ if (!mbox_dev) ++ return -ENODEV; ++ ++ return dev_mbox_write(mbox_dev, chan, data28); ++} ++EXPORT_SYMBOL_GPL(bcm_mailbox_write); ++ ++extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) ++{ ++ if (!mbox_dev) ++ return -ENODEV; ++ ++ return dev_mbox_read(mbox_dev, chan, data28); ++} ++EXPORT_SYMBOL_GPL(bcm_mailbox_read); ++ ++static int mbox_copy_from_user(void *dst, const void *src, int size) ++{ ++ if ((uint32_t)src < TASK_SIZE) ++ return copy_from_user(dst, src, size); ++ ++ memcpy(dst, src, size); ++ ++ return 0; ++} ++ ++static int mbox_copy_to_user(void *dst, const void *src, int size) ++{ ++ if ((uint32_t)dst < TASK_SIZE) ++ return copy_to_user(dst, src, size); ++ ++ memcpy(dst, src, size); ++ ++ return 0; ++} ++ ++static DEFINE_MUTEX(mailbox_lock); ++extern int bcm_mailbox_property(void *data, int size) ++{ ++ uint32_t success; ++ dma_addr_t mem_bus; /* the memory address accessed from videocore */ ++ void *mem_kern; /* the memory address accessed from driver */ ++ int s = 0; ++ ++ mutex_lock(&mailbox_lock); ++ /* allocate some memory for the messages communicating with GPU */ ++ mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, ++ GFP_ATOMIC); ++ if (mem_kern) { ++ /* create the message */ ++ mbox_copy_from_user(mem_kern, data, size); ++ ++ /* send the message */ ++ wmb(); ++ s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); ++ if (s == 0) ++ s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); ++ if (s == 0) { ++ /* copy the response */ ++ rmb(); ++ mbox_copy_to_user(data, mem_kern, size); ++ } ++ dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); ++ } else { ++ s = -ENOMEM; ++ } ++ if (s != 0) ++ pr_err(DRIVER_NAME ": %s failed (%d)\n", __func__, s); ++ ++ mutex_unlock(&mailbox_lock); ++ return s; ++} ++EXPORT_SYMBOL_GPL(bcm_mailbox_property); ++ ++/* Platform Device for Mailbox */ ++ ++/* ++ * Is the device open right now? Used to prevent ++ * concurent access into the same device ++ */ ++static bool device_is_open; ++ ++/* This is called whenever a process attempts to open the device file */ ++static int device_open(struct inode *inode, struct file *file) ++{ ++ /* We don't want to talk to two processes at the same time */ ++ if (device_is_open) ++ return -EBUSY; ++ ++ device_is_open = true; ++ try_module_get(THIS_MODULE); ++ ++ return 0; ++} ++ ++static int device_release(struct inode *inode, struct file *file) ++{ ++ /* We're now ready for our next caller */ ++ device_is_open = false; ++ ++ module_put(THIS_MODULE); ++ ++ return 0; ++} ++ ++/* ++ * This function is called whenever a process tries to do an ioctl on our ++ * device file. We get two extra parameters (additional to the inode and file ++ * structures, which all device functions get): the number of the ioctl called ++ * and the parameter given to the ioctl function. ++ * ++ * If the ioctl is write or read/write (meaning output is returned to the ++ * calling process), the ioctl call returns the output of this function. ++ * ++ */ ++static long device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ unsigned size; ++ ++ switch (ioctl_num) { ++ case IOCTL_MBOX_PROPERTY: ++ /* ++ * Receive a pointer to a message (in user space) and set that ++ * to be the device's message. Get the parameter given to ++ * ioctl by the process. ++ */ ++ mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); ++ return bcm_mailbox_property((void *)ioctl_param, size); ++ default: ++ pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/* Module Declarations */ ++ ++/* ++ * This structure will hold the functions to be called ++ * when a process does something to the device we ++ * created. Since a pointer to this structure is kept in ++ * the devices table, it can't be local to ++ * init_module. NULL is for unimplemented functios. ++ */ ++const struct file_operations fops = { ++ .unlocked_ioctl = device_ioctl, ++ .open = device_open, ++ .release = device_release, /* a.k.a. close */ ++}; ++ ++static int bcm_vcio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device *vdev; ++ struct vc_mailbox *mailbox; ++ struct resource *res; ++ int irq, ret; ++ ++ mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); ++ if (!mailbox) ++ return -ENOMEM; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mailbox->regs = devm_ioremap_resource(dev, res); ++ if (IS_ERR(mailbox->regs)) ++ return PTR_ERR(mailbox->regs); ++ ++ irq = platform_get_irq(pdev, 0); ++ ret = devm_request_irq(dev, irq, mbox_irq_handler, ++ IRQF_DISABLED | IRQF_IRQPOLL, ++ dev_name(dev), mailbox); ++ if (ret) { ++ dev_err(dev, "Interrupt request failed %d\n", ret); ++ return ret; ++ } ++ ++ ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); ++ if (ret < 0) { ++ pr_err("Character device registration failed %d\n", ret); ++ return ret; ++ } ++ ++ vcio_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vcio_class)) { ++ ret = PTR_ERR(vcio_class); ++ pr_err("Class creation failed %d\n", ret); ++ goto err_class; ++ } ++ ++ vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, ++ "vcio"); ++ if (IS_ERR(vdev)) { ++ ret = PTR_ERR(vdev); ++ pr_err("Device creation failed %d\n", ret); ++ goto err_dev; ++ } ++ ++ mbox_init(mailbox); ++ platform_set_drvdata(pdev, mailbox); ++ mbox_dev = dev; ++ ++ dev_info(dev, "mailbox at %p\n", mailbox->regs); ++ ++ return 0; ++ ++err_dev: ++ class_destroy(vcio_class); ++err_class: ++ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); ++ ++ return ret; ++} ++ ++static int bcm_vcio_remove(struct platform_device *pdev) ++{ ++ mbox_dev = NULL; ++ platform_set_drvdata(pdev, NULL); ++ device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); ++ class_destroy(vcio_class); ++ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm_vcio_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-vcio", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); ++ ++static struct platform_driver bcm_mbox_driver = { ++ .probe = bcm_vcio_probe, ++ .remove = bcm_vcio_remove, ++ ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm_vcio_of_match_table, ++ }, ++}; ++ ++static int __init bcm_mbox_init(void) ++{ ++ return platform_driver_register(&bcm_mbox_driver); ++} ++ ++static void __exit bcm_mbox_exit(void) ++{ ++ platform_driver_unregister(&bcm_mbox_driver); ++} ++ ++arch_initcall(bcm_mbox_init); /* Initialize early */ ++module_exit(bcm_mbox_exit); ++ ++MODULE_AUTHOR("Gray Girling"); ++MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); ++MODULE_LICENSE("GPL"); +diff --git a/include/linux/platform_data/mailbox-bcm2708.h b/include/linux/platform_data/mailbox-bcm2708.h +new file mode 100644 +index 0000000..cc284ed +--- /dev/null ++++ b/include/linux/platform_data/mailbox-bcm2708.h +@@ -0,0 +1,126 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++#ifndef _PLAT_MAILBOX_BCM2708_H ++#define _PLAT_MAILBOX_BCM2708_H ++ ++/* Routines to handle I/O via the VideoCore "ARM control" registers ++ * (semaphores, doorbells, mailboxes) ++ */ ++ ++/* Constants shared with the ARM identifying separate mailbox channels */ ++#define MBOX_CHAN_POWER 0 /* for use by the power management interface */ ++#define MBOX_CHAN_FB 1 /* for use by the frame buffer */ ++#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */ ++#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */ ++#define MBOX_CHAN_COUNT 9 ++ ++enum { ++ VCMSG_PROCESS_REQUEST = 0x00000000 ++}; ++ ++enum { ++ VCMSG_REQUEST_SUCCESSFUL = 0x80000000, ++ VCMSG_REQUEST_FAILED = 0x80000001 ++}; ++ ++/* Mailbox property tags */ ++enum { ++ VCMSG_PROPERTY_END = 0x00000000, ++ VCMSG_GET_FIRMWARE_REVISION = 0x00000001, ++ VCMSG_GET_BOARD_MODEL = 0x00010001, ++ VCMSG_GET_BOARD_REVISION = 0x00010002, ++ VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003, ++ VCMSG_GET_BOARD_SERIAL = 0x00010004, ++ VCMSG_GET_ARM_MEMORY = 0x00010005, ++ VCMSG_GET_VC_MEMORY = 0x00010006, ++ VCMSG_GET_CLOCKS = 0x00010007, ++ VCMSG_GET_COMMAND_LINE = 0x00050001, ++ VCMSG_GET_DMA_CHANNELS = 0x00060001, ++ VCMSG_GET_POWER_STATE = 0x00020001, ++ VCMSG_GET_TIMING = 0x00020002, ++ VCMSG_SET_POWER_STATE = 0x00028001, ++ VCMSG_GET_CLOCK_STATE = 0x00030001, ++ VCMSG_SET_CLOCK_STATE = 0x00038001, ++ VCMSG_GET_CLOCK_RATE = 0x00030002, ++ VCMSG_SET_CLOCK_RATE = 0x00038002, ++ VCMSG_GET_VOLTAGE = 0x00030003, ++ VCMSG_SET_VOLTAGE = 0x00038003, ++ VCMSG_GET_MAX_CLOCK = 0x00030004, ++ VCMSG_GET_MAX_VOLTAGE = 0x00030005, ++ VCMSG_GET_TEMPERATURE = 0x00030006, ++ VCMSG_GET_MIN_CLOCK = 0x00030007, ++ VCMSG_GET_MIN_VOLTAGE = 0x00030008, ++ VCMSG_GET_TURBO = 0x00030009, ++ VCMSG_GET_MAX_TEMPERATURE = 0x0003000a, ++ VCMSG_GET_STC = 0x0003000b, ++ VCMSG_SET_TURBO = 0x00038009, ++ VCMSG_SET_ALLOCATE_MEM = 0x0003000c, ++ VCMSG_SET_LOCK_MEM = 0x0003000d, ++ VCMSG_SET_UNLOCK_MEM = 0x0003000e, ++ VCMSG_SET_RELEASE_MEM = 0x0003000f, ++ VCMSG_SET_EXECUTE_CODE = 0x00030010, ++ VCMSG_SET_EXECUTE_QPU = 0x00030011, ++ VCMSG_SET_ENABLE_QPU = 0x00030012, ++ VCMSG_GET_RESOURCE_HANDLE = 0x00030014, ++ VCMSG_GET_EDID_BLOCK = 0x00030020, ++ VCMSG_GET_CUSTOMER_OTP = 0x00030021, ++ VCMSG_SET_CUSTOMER_OTP = 0x00038021, ++ VCMSG_SET_ALLOCATE_BUFFER = 0x00040001, ++ VCMSG_SET_RELEASE_BUFFER = 0x00048001, ++ VCMSG_SET_BLANK_SCREEN = 0x00040002, ++ VCMSG_TST_BLANK_SCREEN = 0x00044002, ++ VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003, ++ VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, ++ VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, ++ VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004, ++ VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, ++ VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, ++ VCMSG_GET_DEPTH = 0x00040005, ++ VCMSG_TST_DEPTH = 0x00044005, ++ VCMSG_SET_DEPTH = 0x00048005, ++ VCMSG_GET_PIXEL_ORDER = 0x00040006, ++ VCMSG_TST_PIXEL_ORDER = 0x00044006, ++ VCMSG_SET_PIXEL_ORDER = 0x00048006, ++ VCMSG_GET_ALPHA_MODE = 0x00040007, ++ VCMSG_TST_ALPHA_MODE = 0x00044007, ++ VCMSG_SET_ALPHA_MODE = 0x00048007, ++ VCMSG_GET_PITCH = 0x00040008, ++ VCMSG_TST_PITCH = 0x00044008, ++ VCMSG_SET_PITCH = 0x00048008, ++ VCMSG_GET_VIRTUAL_OFFSET = 0x00040009, ++ VCMSG_TST_VIRTUAL_OFFSET = 0x00044009, ++ VCMSG_SET_VIRTUAL_OFFSET = 0x00048009, ++ VCMSG_GET_OVERSCAN = 0x0004000a, ++ VCMSG_TST_OVERSCAN = 0x0004400a, ++ VCMSG_SET_OVERSCAN = 0x0004800a, ++ VCMSG_GET_PALETTE = 0x0004000b, ++ VCMSG_TST_PALETTE = 0x0004400b, ++ VCMSG_SET_PALETTE = 0x0004800b, ++ VCMSG_GET_LAYER = 0x0004000c, ++ VCMSG_TST_LAYER = 0x0004400c, ++ VCMSG_SET_LAYER = 0x0004800c, ++ VCMSG_GET_TRANSFORM = 0x0004000d, ++ VCMSG_TST_TRANSFORM = 0x0004400d, ++ VCMSG_SET_TRANSFORM = 0x0004800d, ++ VCMSG_TST_VSYNC = 0x0004400e, ++ VCMSG_SET_VSYNC = 0x0004800e, ++ VCMSG_SET_CURSOR_INFO = 0x00008010, ++ VCMSG_SET_CURSOR_STATE = 0x00008011, ++}; ++ ++int bcm_mailbox_read(unsigned chan, uint32_t *data28); ++int bcm_mailbox_write(unsigned chan, uint32_t data28); ++int bcm_mailbox_property(void *data, int size); ++ ++#endif + +From 1e5c7135fc145addcf195d02759a45e162f2daac Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 19:11:58 +0200 +Subject: [PATCH 144/216] BCM270x: power: Change initcall level to subsys +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Load ordering of modules are determined by the initcall used. +If it's the same initcall level, makefile ordering decides. +Now that the mailbox driver is being moved, it's no longer +placed before the power driver by the linker. +So use a later initcall level to let the mailbox driver +load first. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/power.c | 6 +++++- + arch/arm/mach-bcm2709/power.c | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/power.c b/arch/arm/mach-bcm2708/power.c +index 2696be9..0db355d 100644 +--- a/arch/arm/mach-bcm2708/power.c ++++ b/arch/arm/mach-bcm2708/power.c +@@ -189,7 +189,11 @@ static void __exit bcm_power_exit(void) + bcm_mailbox_write(MBOX_CHAN_POWER, 0); + } + +-arch_initcall(bcm_power_init); /* Initialize early */ ++/* ++ * Load after the mailbox driver is initialized (arch_initcall), ++ * but before depending drivers (module_init). ++ */ ++subsys_initcall(bcm_power_init); + module_exit(bcm_power_exit); + + MODULE_AUTHOR("Phil Elwell"); +diff --git a/arch/arm/mach-bcm2709/power.c b/arch/arm/mach-bcm2709/power.c +index 3421057..88c1e28 100644 +--- a/arch/arm/mach-bcm2709/power.c ++++ b/arch/arm/mach-bcm2709/power.c +@@ -187,7 +187,11 @@ static void __exit bcm_power_exit(void) + bcm_mailbox_write(MBOX_CHAN_POWER, 0); + } + +-arch_initcall(bcm_power_init); /* Initialize early */ ++/* ++ * Load after the mailbox driver is initialized (arch_initcall), ++ * but before depending drivers (module_init). ++ */ ++subsys_initcall(bcm_power_init); + module_exit(bcm_power_exit); + + MODULE_AUTHOR("Phil Elwell"); + +From 41e80f86dc78015856087cccd8e4f9a251042f9d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 2 May 2015 09:34:26 +0200 +Subject: [PATCH 145/216] BCM270x: Use bcm2708-vcio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use bcm2708-vcio instead of the arch version. +Change affected drivers to use linux/platform_data/mailbox-bcm2708.h + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2709_defconfig | 2 ++ + arch/arm/configs/bcmrpi_defconfig | 2 ++ + arch/arm/mach-bcm2708/Makefile | 2 +- + arch/arm/mach-bcm2708/power.c | 2 +- + arch/arm/mach-bcm2708/vc_mem.c | 2 +- + arch/arm/mach-bcm2709/Makefile | 2 +- + arch/arm/mach-bcm2709/power.c | 2 +- + arch/arm/mach-bcm2709/vc_mem.c | 2 +- + arch/arm/mach-bcm2709/vc_support.c | 2 +- + drivers/cpufreq/bcm2835-cpufreq.c | 2 +- + drivers/hwmon/bcm2835-hwmon.c | 2 +- + drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +- + drivers/thermal/bcm2835-thermal.c | 2 +- + drivers/video/fbdev/bcm2708_fb.c | 2 +- + 14 files changed, 16 insertions(+), 12 deletions(-) + mode change 100755 => 100644 arch/arm/mach-bcm2709/vc_support.c + mode change 100755 => 100644 drivers/cpufreq/bcm2835-cpufreq.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 367a04a..ff87581 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -1052,6 +1052,8 @@ CONFIG_FB_TFT_UPD161704=m + CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2708_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index db287f3..e339979 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -1045,6 +1045,8 @@ CONFIG_FB_TFT_UPD161704=m + CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2708_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile +index 454408c..c1e7d41 100644 +--- a/arch/arm/mach-bcm2708/Makefile ++++ b/arch/arm/mach-bcm2708/Makefile +@@ -2,6 +2,6 @@ + # Makefile for the linux kernel. + # + +-obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o vcio.o power.o ++obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o power.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2708/power.c b/arch/arm/mach-bcm2708/power.c +index 0db355d..796837f 100644 +--- a/arch/arm/mach-bcm2708/power.c ++++ b/arch/arm/mach-bcm2708/power.c +@@ -14,8 +14,8 @@ + #include + #include + #include ++#include + #include +-#include + #include + + #define DRIVER_NAME "bcm2708_power" +diff --git a/arch/arm/mach-bcm2708/vc_mem.c b/arch/arm/mach-bcm2708/vc_mem.c +index 2982af7..226b737 100644 +--- a/arch/arm/mach-bcm2708/vc_mem.c ++++ b/arch/arm/mach-bcm2708/vc_mem.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #ifdef CONFIG_ARCH_KONA + #include +@@ -31,7 +32,6 @@ + #endif + + #include "mach/vc_mem.h" +-#include + + #define DRIVER_NAME "vc-mem" + +diff --git a/arch/arm/mach-bcm2709/Makefile b/arch/arm/mach-bcm2709/Makefile +index f07c38b..77b8429 100644 +--- a/arch/arm/mach-bcm2709/Makefile ++++ b/arch/arm/mach-bcm2709/Makefile +@@ -2,6 +2,6 @@ + # Makefile for the linux kernel. + # + +-obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o vcio.o power.o ++obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o power.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2709/power.c b/arch/arm/mach-bcm2709/power.c +index 88c1e28..960e472 100644 +--- a/arch/arm/mach-bcm2709/power.c ++++ b/arch/arm/mach-bcm2709/power.c +@@ -14,8 +14,8 @@ + #include + #include + #include ++#include + #include +-#include + #include + + #define DRIVER_NAME "bcm2708_power" +diff --git a/arch/arm/mach-bcm2709/vc_mem.c b/arch/arm/mach-bcm2709/vc_mem.c +index ac578db..d2adfd1 100644 +--- a/arch/arm/mach-bcm2709/vc_mem.c ++++ b/arch/arm/mach-bcm2709/vc_mem.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #ifdef CONFIG_ARCH_KONA + #include +@@ -31,7 +32,6 @@ + #endif + + #include "mach/vc_mem.h" +-#include + + #define DRIVER_NAME "vc-mem" + +diff --git a/arch/arm/mach-bcm2709/vc_support.c b/arch/arm/mach-bcm2709/vc_support.c +old mode 100755 +new mode 100644 +index 0bc41c4..c4dc7d6 +--- a/arch/arm/mach-bcm2709/vc_support.c ++++ b/arch/arm/mach-bcm2709/vc_support.c +@@ -6,7 +6,7 @@ + */ + + #include +-#include ++#include + + #ifdef ECLIPSE_IGNORE + +diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c +old mode 100755 +new mode 100644 +index 447ca09..6735da9 +--- a/drivers/cpufreq/bcm2835-cpufreq.c ++++ b/drivers/cpufreq/bcm2835-cpufreq.c +@@ -26,7 +26,7 @@ + #include + #include + #include +-#include ++#include + + /* ---------- DEFINES ---------- */ + /*#define CPUFREQ_DEBUG_ENABLE*/ /* enable debugging */ +diff --git a/drivers/hwmon/bcm2835-hwmon.c b/drivers/hwmon/bcm2835-hwmon.c +index 5bbed45..d14502c 100644 +--- a/drivers/hwmon/bcm2835-hwmon.c ++++ b/drivers/hwmon/bcm2835-hwmon.c +@@ -17,9 +17,9 @@ + #include + #include + #include ++#include + #include + #include +-#include + #include + #include + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 8ec88bb..70e5086 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -40,13 +40,13 @@ + #include + #include + #include ++#include + #include + #include + + #include + + #include +-#include + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) + +diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c +index 85fceb5..0c556d1 100644 +--- a/drivers/thermal/bcm2835-thermal.c ++++ b/drivers/thermal/bcm2835-thermal.c +@@ -15,10 +15,10 @@ + #include + #include + #include ++#include + #include + #include + #include +-#include + #include + + +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +index 52e655a..345c15e 100644 +--- a/drivers/video/fbdev/bcm2708_fb.c ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -32,7 +33,6 @@ + + #include + #include +-#include + + #include + #include + +From 5bb0a0c80fc46ae0edea87f97244f28fb167dfe0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 2 May 2015 09:35:07 +0200 +Subject: [PATCH 146/216] BCM270x: Remove arch driver vcio.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Remove the arch vcio.c driver and header file. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/include/mach/vcio.h | 128 -------- + arch/arm/mach-bcm2708/vcio.c | 419 -------------------------- + arch/arm/mach-bcm2709/include/mach/vcio.h | 165 ---------- + arch/arm/mach-bcm2709/vcio.c | 484 ------------------------------ + 4 files changed, 1196 deletions(-) + delete mode 100644 arch/arm/mach-bcm2708/include/mach/vcio.h + delete mode 100644 arch/arm/mach-bcm2708/vcio.c + delete mode 100644 arch/arm/mach-bcm2709/include/mach/vcio.h + delete mode 100644 arch/arm/mach-bcm2709/vcio.c + +diff --git a/arch/arm/mach-bcm2708/include/mach/vcio.h b/arch/arm/mach-bcm2708/include/mach/vcio.h +deleted file mode 100644 +index 95ad121..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/vcio.h ++++ /dev/null +@@ -1,128 +0,0 @@ +-/* +- * arch/arm/mach-bcm2708/include/mach/vcio.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- */ +-#ifndef _MACH_BCM2708_VCIO_H +-#define _MACH_BCM2708_VCIO_H +- +-/* Routines to handle I/O via the VideoCore "ARM control" registers +- * (semaphores, doorbells, mailboxes) +- */ +- +-/* Constants shared with the ARM identifying separate mailbox channels */ +-#define MBOX_CHAN_POWER 0 /* for use by the power management interface */ +-#define MBOX_CHAN_FB 1 /* for use by the frame buffer */ +-#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */ +-#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */ +-#define MBOX_CHAN_COUNT 9 +- +-enum { +- VCMSG_PROCESS_REQUEST = 0x00000000 +-}; +- +-enum { +- VCMSG_REQUEST_SUCCESSFUL = 0x80000000, +- VCMSG_REQUEST_FAILED = 0x80000001 +-}; +- +-/* Mailbox property tags */ +-enum { +- VCMSG_PROPERTY_END = 0x00000000, +- VCMSG_GET_FIRMWARE_REVISION = 0x00000001, +- VCMSG_GET_BOARD_MODEL = 0x00010001, +- VCMSG_GET_BOARD_REVISION = 0x00010002, +- VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003, +- VCMSG_GET_BOARD_SERIAL = 0x00010004, +- VCMSG_GET_ARM_MEMORY = 0x00010005, +- VCMSG_GET_VC_MEMORY = 0x00010006, +- VCMSG_GET_CLOCKS = 0x00010007, +- VCMSG_GET_COMMAND_LINE = 0x00050001, +- VCMSG_GET_DMA_CHANNELS = 0x00060001, +- VCMSG_GET_POWER_STATE = 0x00020001, +- VCMSG_GET_TIMING = 0x00020002, +- VCMSG_SET_POWER_STATE = 0x00028001, +- VCMSG_GET_CLOCK_STATE = 0x00030001, +- VCMSG_SET_CLOCK_STATE = 0x00038001, +- VCMSG_GET_CLOCK_RATE = 0x00030002, +- VCMSG_SET_CLOCK_RATE = 0x00038002, +- VCMSG_GET_VOLTAGE = 0x00030003, +- VCMSG_SET_VOLTAGE = 0x00038003, +- VCMSG_GET_MAX_CLOCK = 0x00030004, +- VCMSG_GET_MAX_VOLTAGE = 0x00030005, +- VCMSG_GET_TEMPERATURE = 0x00030006, +- VCMSG_GET_MIN_CLOCK = 0x00030007, +- VCMSG_GET_MIN_VOLTAGE = 0x00030008, +- VCMSG_GET_TURBO = 0x00030009, +- VCMSG_GET_MAX_TEMPERATURE = 0x0003000a, +- VCMSG_GET_STC = 0x0003000b, +- VCMSG_SET_TURBO = 0x00038009, +- VCMSG_SET_ALLOCATE_MEM = 0x0003000c, +- VCMSG_SET_LOCK_MEM = 0x0003000d, +- VCMSG_SET_UNLOCK_MEM = 0x0003000e, +- VCMSG_SET_RELEASE_MEM = 0x0003000f, +- VCMSG_SET_EXECUTE_CODE = 0x00030010, +- VCMSG_SET_EXECUTE_QPU = 0x00030011, +- VCMSG_SET_ENABLE_QPU = 0x00030012, +- VCMSG_GET_RESOURCE_HANDLE = 0x00030014, +- VCMSG_GET_EDID_BLOCK = 0x00030020, +- VCMSG_GET_CUSTOMER_OTP = 0x00030021, +- VCMSG_SET_CUSTOMER_OTP = 0x00038021, +- VCMSG_SET_ALLOCATE_BUFFER = 0x00040001, +- VCMSG_SET_RELEASE_BUFFER = 0x00048001, +- VCMSG_SET_BLANK_SCREEN = 0x00040002, +- VCMSG_TST_BLANK_SCREEN = 0x00044002, +- VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003, +- VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, +- VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, +- VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004, +- VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +- VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, +- VCMSG_GET_DEPTH = 0x00040005, +- VCMSG_TST_DEPTH = 0x00044005, +- VCMSG_SET_DEPTH = 0x00048005, +- VCMSG_GET_PIXEL_ORDER = 0x00040006, +- VCMSG_TST_PIXEL_ORDER = 0x00044006, +- VCMSG_SET_PIXEL_ORDER = 0x00048006, +- VCMSG_GET_ALPHA_MODE = 0x00040007, +- VCMSG_TST_ALPHA_MODE = 0x00044007, +- VCMSG_SET_ALPHA_MODE = 0x00048007, +- VCMSG_GET_PITCH = 0x00040008, +- VCMSG_TST_PITCH = 0x00044008, +- VCMSG_SET_PITCH = 0x00048008, +- VCMSG_GET_VIRTUAL_OFFSET = 0x00040009, +- VCMSG_TST_VIRTUAL_OFFSET = 0x00044009, +- VCMSG_SET_VIRTUAL_OFFSET = 0x00048009, +- VCMSG_GET_OVERSCAN = 0x0004000a, +- VCMSG_TST_OVERSCAN = 0x0004400a, +- VCMSG_SET_OVERSCAN = 0x0004800a, +- VCMSG_GET_PALETTE = 0x0004000b, +- VCMSG_TST_PALETTE = 0x0004400b, +- VCMSG_SET_PALETTE = 0x0004800b, +- VCMSG_GET_LAYER = 0x0004000c, +- VCMSG_TST_LAYER = 0x0004400c, +- VCMSG_SET_LAYER = 0x0004800c, +- VCMSG_GET_TRANSFORM = 0x0004000d, +- VCMSG_TST_TRANSFORM = 0x0004400d, +- VCMSG_SET_TRANSFORM = 0x0004800d, +- VCMSG_TST_VSYNC = 0x0004400e, +- VCMSG_SET_VSYNC = 0x0004800e, +- VCMSG_SET_CURSOR_INFO = 0x00008010, +- VCMSG_SET_CURSOR_STATE = 0x00008011, +-}; +- +-extern int /*rc*/ bcm_mailbox_read(unsigned chan, uint32_t *data28); +-extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28); +-extern int /*rc*/ bcm_mailbox_property(void *data, int size); +- +-#endif +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +deleted file mode 100644 +index c4c2bcd..0000000 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ /dev/null +@@ -1,419 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/vcio.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for writing to the mailboxes, +- * semaphores, doorbells etc. that are shared between the ARM and the +- * VideoCore processor +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#define DRIVER_NAME "bcm2708_vcio" +-#define DEVICE_FILE_NAME "vcio" +- +-/* offsets from a mail box base address */ +-#define MAIL0_RD 0x00 /* read - and next 4 words */ +-#define MAIL0_POL 0x10 /* read without popping the fifo */ +-#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL0_STA 0x18 /* status */ +-#define MAIL0_CNF 0x1C /* configuration */ +-#define MAIL1_WRT 0x20 /* write - and next 4 words */ +- +-#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +-#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +-#define MBOX_CHAN(msg) ((msg) & 0xf) +-#define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) +- +-#define MBOX_MAGIC 0xd0d0c0de +- +-#define MAJOR_NUM 100 +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +- +-static struct class *vcio_class; +- +-struct vc_mailbox { +- void __iomem *regs; +- uint32_t msg[MBOX_CHAN_COUNT]; +- struct semaphore sema[MBOX_CHAN_COUNT]; +- uint32_t magic; +-}; +- +-static void mbox_init(struct vc_mailbox *mbox_out) +-{ +- int i; +- +- for (i = 0; i < MBOX_CHAN_COUNT; i++) { +- mbox_out->msg[i] = 0; +- sema_init(&mbox_out->sema[i], 0); +- } +- +- /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); +- +- mbox_out->magic = MBOX_MAGIC; +-} +- +-static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL)) +- cpu_relax(); +- +- writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); +- +- return 0; +-} +- +-static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- +- return 0; +-} +- +-static irqreturn_t mbox_irq_handler(int irq, void *dev_id) +-{ +- /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +- int status = readl(mbox->regs + MAIL0_STA); +- int ret = IRQ_NONE; +- +- while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->regs + MAIL0_RD); +- int chan = MBOX_CHAN(msg); +- +- if (chan < MBOX_CHAN_COUNT) { +- if (mbox->msg[chan]) { +- pr_err(DRIVER_NAME +- ": mbox chan %d overflow - drop %08x\n", +- chan, msg); +- } else { +- mbox->msg[chan] = (msg | 0xf); +- up(&mbox->sema[chan]); +- } +- } else { +- pr_err(DRIVER_NAME +- ": invalid channel selector (msg %08x)\n", msg); +- } +- ret = IRQ_HANDLED; +- status = readl(mbox->regs + MAIL0_STA); +- } +- return ret; +-} +- +-/* Mailbox Methods */ +- +-static struct device *mbox_dev; /* we assume there's only one! */ +- +-static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_write(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_read(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-extern int bcm_mailbox_write(unsigned chan, uint32_t data28) +-{ +- if (!mbox_dev) +- return -ENODEV; +- +- return dev_mbox_write(mbox_dev, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_write); +- +-extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) +-{ +- if (!mbox_dev) +- return -ENODEV; +- +- return dev_mbox_read(mbox_dev, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); +- +-static int mbox_copy_from_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)src < TASK_SIZE) +- return copy_from_user(dst, src, size); +- +- memcpy(dst, src, size); +- +- return 0; +-} +- +-static int mbox_copy_to_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)dst < TASK_SIZE) +- return copy_to_user(dst, src, size); +- +- memcpy(dst, src, size); +- +- return 0; +-} +- +-static DEFINE_MUTEX(mailbox_lock); +-extern int bcm_mailbox_property(void *data, int size) +-{ +- uint32_t success; +- dma_addr_t mem_bus; /* the memory address accessed from videocore */ +- void *mem_kern; /* the memory address accessed from driver */ +- int s = 0; +- +- mutex_lock(&mailbox_lock); +- /* allocate some memory for the messages communicating with GPU */ +- mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, +- GFP_ATOMIC); +- if (mem_kern) { +- /* create the message */ +- mbox_copy_from_user(mem_kern, data, size); +- +- /* send the message */ +- wmb(); +- s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); +- if (s == 0) +- s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); +- if (s == 0) { +- /* copy the response */ +- rmb(); +- mbox_copy_to_user(data, mem_kern, size); +- } +- dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); +- } else { +- s = -ENOMEM; +- } +- if (s != 0) +- pr_err(DRIVER_NAME ": %s failed (%d)\n", __func__, s); +- +- mutex_unlock(&mailbox_lock); +- return s; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_property); +- +-/* Platform Device for Mailbox */ +- +-/* +- * Is the device open right now? Used to prevent +- * concurent access into the same device +- */ +-static bool device_is_open; +- +-/* This is called whenever a process attempts to open the device file */ +-static int device_open(struct inode *inode, struct file *file) +-{ +- /* We don't want to talk to two processes at the same time */ +- if (device_is_open) +- return -EBUSY; +- +- device_is_open = true; +- try_module_get(THIS_MODULE); +- +- return 0; +-} +- +-static int device_release(struct inode *inode, struct file *file) +-{ +- /* We're now ready for our next caller */ +- device_is_open = false; +- +- module_put(THIS_MODULE); +- +- return 0; +-} +- +-/* +- * This function is called whenever a process tries to do an ioctl on our +- * device file. We get two extra parameters (additional to the inode and file +- * structures, which all device functions get): the number of the ioctl called +- * and the parameter given to the ioctl function. +- * +- * If the ioctl is write or read/write (meaning output is returned to the +- * calling process), the ioctl call returns the output of this function. +- * +- */ +-static long device_ioctl(struct file *file, unsigned int ioctl_num, +- unsigned long ioctl_param) +-{ +- unsigned size; +- +- switch (ioctl_num) { +- case IOCTL_MBOX_PROPERTY: +- /* +- * Receive a pointer to a message (in user space) and set that +- * to be the device's message. Get the parameter given to +- * ioctl by the process. +- */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); +- return bcm_mailbox_property((void *)ioctl_param, size); +- default: +- pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); +- return -EINVAL; +- } +- +- return 0; +-} +- +-/* Module Declarations */ +- +-/* +- * This structure will hold the functions to be called +- * when a process does something to the device we +- * created. Since a pointer to this structure is kept in +- * the devices table, it can't be local to +- * init_module. NULL is for unimplemented functios. +- */ +-const struct file_operations fops = { +- .unlocked_ioctl = device_ioctl, +- .open = device_open, +- .release = device_release, /* a.k.a. close */ +-}; +- +-static int bcm_vcio_probe(struct platform_device *pdev) +-{ +- struct device *dev = &pdev->dev; +- struct device *vdev; +- struct vc_mailbox *mailbox; +- struct resource *res; +- int irq, ret; +- +- mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); +- if (!mailbox) +- return -ENOMEM; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- mailbox->regs = devm_ioremap_resource(dev, res); +- if (IS_ERR(mailbox->regs)) +- return PTR_ERR(mailbox->regs); +- +- irq = platform_get_irq(pdev, 0); +- ret = devm_request_irq(dev, irq, mbox_irq_handler, +- IRQF_DISABLED | IRQF_IRQPOLL, +- dev_name(dev), mailbox); +- if (ret) { +- dev_err(dev, "Interrupt request failed %d\n", ret); +- return ret; +- } +- +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- if (ret < 0) { +- pr_err("Character device registration failed %d\n", ret); +- return ret; +- } +- +- vcio_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- pr_err("Class creation failed %d\n", ret); +- goto err_class; +- } +- +- vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); +- if (IS_ERR(vdev)) { +- ret = PTR_ERR(vdev); +- pr_err("Device creation failed %d\n", ret); +- goto err_dev; +- } +- +- mbox_init(mailbox); +- platform_set_drvdata(pdev, mailbox); +- mbox_dev = dev; +- +- dev_info(dev, "mailbox at %p\n", mailbox->regs); +- +- return 0; +- +-err_dev: +- class_destroy(vcio_class); +-err_class: +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return ret; +-} +- +-static int bcm_vcio_remove(struct platform_device *pdev) +-{ +- mbox_dev = NULL; +- platform_set_drvdata(pdev, NULL); +- device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return 0; +-} +- +-static const struct of_device_id bcm_vcio_of_match_table[] = { +- { .compatible = "brcm,bcm2708-vcio", }, +- {}, +-}; +-MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); +- +-static struct platform_driver bcm_mbox_driver = { +- .probe = bcm_vcio_probe, +- .remove = bcm_vcio_remove, +- +- .driver = { +- .name = DRIVER_NAME, +- .owner = THIS_MODULE, +- .of_match_table = bcm_vcio_of_match_table, +- }, +-}; +- +-static int __init bcm_mbox_init(void) +-{ +- return platform_driver_register(&bcm_mbox_driver); +-} +- +-static void __exit bcm_mbox_exit(void) +-{ +- platform_driver_unregister(&bcm_mbox_driver); +-} +- +-arch_initcall(bcm_mbox_init); /* Initialize early */ +-module_exit(bcm_mbox_exit); +- +-MODULE_AUTHOR("Gray Girling"); +-MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); +-MODULE_LICENSE("GPL"); +diff --git a/arch/arm/mach-bcm2709/include/mach/vcio.h b/arch/arm/mach-bcm2709/include/mach/vcio.h +deleted file mode 100644 +index 8e11d67e..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/vcio.h ++++ /dev/null +@@ -1,165 +0,0 @@ +-/* +- * arch/arm/mach-bcm2708/include/mach/vcio.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +-#ifndef _MACH_BCM2708_VCIO_H +-#define _MACH_BCM2708_VCIO_H +- +-/* Routines to handle I/O via the VideoCore "ARM control" registers +- * (semaphores, doorbells, mailboxes) +- */ +- +-#define BCM_VCIO_DRIVER_NAME "bcm2708_vcio" +- +-/* Constants shared with the ARM identifying separate mailbox channels */ +-#define MBOX_CHAN_POWER 0 /* for use by the power management interface */ +-#define MBOX_CHAN_FB 1 /* for use by the frame buffer */ +-#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */ +-#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */ +-#define MBOX_CHAN_COUNT 9 +- +-enum { +- VCMSG_PROCESS_REQUEST = 0x00000000 +-}; +-enum { +- VCMSG_REQUEST_SUCCESSFUL = 0x80000000, +- VCMSG_REQUEST_FAILED = 0x80000001 +-}; +-/* Mailbox property tags */ +-enum { +- VCMSG_PROPERTY_END = 0x00000000, +- VCMSG_GET_FIRMWARE_REVISION = 0x00000001, +- VCMSG_GET_BOARD_MODEL = 0x00010001, +- VCMSG_GET_BOARD_REVISION = 0x00010002, +- VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003, +- VCMSG_GET_BOARD_SERIAL = 0x00010004, +- VCMSG_GET_ARM_MEMORY = 0x00010005, +- VCMSG_GET_VC_MEMORY = 0x00010006, +- VCMSG_GET_CLOCKS = 0x00010007, +- VCMSG_GET_COMMAND_LINE = 0x00050001, +- VCMSG_GET_DMA_CHANNELS = 0x00060001, +- VCMSG_GET_POWER_STATE = 0x00020001, +- VCMSG_GET_TIMING = 0x00020002, +- VCMSG_SET_POWER_STATE = 0x00028001, +- VCMSG_GET_CLOCK_STATE = 0x00030001, +- VCMSG_SET_CLOCK_STATE = 0x00038001, +- VCMSG_GET_CLOCK_RATE = 0x00030002, +- VCMSG_SET_CLOCK_RATE = 0x00038002, +- VCMSG_GET_VOLTAGE = 0x00030003, +- VCMSG_SET_VOLTAGE = 0x00038003, +- VCMSG_GET_MAX_CLOCK = 0x00030004, +- VCMSG_GET_MAX_VOLTAGE = 0x00030005, +- VCMSG_GET_TEMPERATURE = 0x00030006, +- VCMSG_GET_MIN_CLOCK = 0x00030007, +- VCMSG_GET_MIN_VOLTAGE = 0x00030008, +- VCMSG_GET_TURBO = 0x00030009, +- VCMSG_GET_MAX_TEMPERATURE = 0x0003000a, +- VCMSG_GET_STC = 0x0003000b, +- VCMSG_SET_TURBO = 0x00038009, +- VCMSG_SET_ALLOCATE_MEM = 0x0003000c, +- VCMSG_SET_LOCK_MEM = 0x0003000d, +- VCMSG_SET_UNLOCK_MEM = 0x0003000e, +- VCMSG_SET_RELEASE_MEM = 0x0003000f, +- VCMSG_SET_EXECUTE_CODE = 0x00030010, +- VCMSG_SET_EXECUTE_QPU = 0x00030011, +- VCMSG_SET_ENABLE_QPU = 0x00030012, +- VCMSG_GET_RESOURCE_HANDLE = 0x00030014, +- VCMSG_GET_EDID_BLOCK = 0x00030020, +- VCMSG_GET_CUSTOMER_OTP = 0x00030021, +- VCMSG_SET_CUSTOMER_OTP = 0x00038021, +- VCMSG_SET_ALLOCATE_BUFFER = 0x00040001, +- VCMSG_SET_RELEASE_BUFFER = 0x00048001, +- VCMSG_SET_BLANK_SCREEN = 0x00040002, +- VCMSG_TST_BLANK_SCREEN = 0x00044002, +- VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003, +- VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, +- VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, +- VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004, +- VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +- VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, +- VCMSG_GET_DEPTH = 0x00040005, +- VCMSG_TST_DEPTH = 0x00044005, +- VCMSG_SET_DEPTH = 0x00048005, +- VCMSG_GET_PIXEL_ORDER = 0x00040006, +- VCMSG_TST_PIXEL_ORDER = 0x00044006, +- VCMSG_SET_PIXEL_ORDER = 0x00048006, +- VCMSG_GET_ALPHA_MODE = 0x00040007, +- VCMSG_TST_ALPHA_MODE = 0x00044007, +- VCMSG_SET_ALPHA_MODE = 0x00048007, +- VCMSG_GET_PITCH = 0x00040008, +- VCMSG_TST_PITCH = 0x00044008, +- VCMSG_SET_PITCH = 0x00048008, +- VCMSG_GET_VIRTUAL_OFFSET = 0x00040009, +- VCMSG_TST_VIRTUAL_OFFSET = 0x00044009, +- VCMSG_SET_VIRTUAL_OFFSET = 0x00048009, +- VCMSG_GET_OVERSCAN = 0x0004000a, +- VCMSG_TST_OVERSCAN = 0x0004400a, +- VCMSG_SET_OVERSCAN = 0x0004800a, +- VCMSG_GET_PALETTE = 0x0004000b, +- VCMSG_TST_PALETTE = 0x0004400b, +- VCMSG_SET_PALETTE = 0x0004800b, +- VCMSG_GET_LAYER = 0x0004000c, +- VCMSG_TST_LAYER = 0x0004400c, +- VCMSG_SET_LAYER = 0x0004800c, +- VCMSG_GET_TRANSFORM = 0x0004000d, +- VCMSG_TST_TRANSFORM = 0x0004400d, +- VCMSG_SET_TRANSFORM = 0x0004800d, +- VCMSG_TST_VSYNC = 0x0004400e, +- VCMSG_SET_VSYNC = 0x0004800e, +- VCMSG_SET_CURSOR_INFO = 0x00008010, +- VCMSG_SET_CURSOR_STATE = 0x00008011, +-}; +- +-extern int /*rc*/ bcm_mailbox_read(unsigned chan, uint32_t *data28); +-extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28); +-extern int /*rc*/ bcm_mailbox_property(void *data, int size); +- +-#include +- +-/* +- * The major device number. We can't rely on dynamic +- * registration any more, because ioctls need to know +- * it. +- */ +-#define MAJOR_NUM 100 +- +-/* +- * Set the message of the device driver +- */ +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +-/* +- * _IOWR means that we're creating an ioctl command +- * number for passing information from a user process +- * to the kernel module and from the kernel module to user process +- * +- * The first arguments, MAJOR_NUM, is the major device +- * number we're using. +- * +- * The second argument is the number of the command +- * (there could be several with different meanings). +- * +- * The third argument is the type we want to get from +- * the process to the kernel. +- */ +- +-/* +- * The name of the device file +- */ +-#define DEVICE_FILE_NAME "vcio" +- +-#endif +diff --git a/arch/arm/mach-bcm2709/vcio.c b/arch/arm/mach-bcm2709/vcio.c +deleted file mode 100644 +index 700bff4..0000000 +--- a/arch/arm/mach-bcm2709/vcio.c ++++ /dev/null +@@ -1,484 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/vcio.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for writing to the mailboxes, +- * semaphores, doorbells etc. that are shared between the ARM and the +- * VideoCore processor +- */ +- +-#if defined(CONFIG_SERIAL_BCM_MBOX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +-#define SUPPORT_SYSRQ +-#endif +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +- +- +-#define DRIVER_NAME BCM_VCIO_DRIVER_NAME +- +-/* ---------------------------------------------------------------------- +- * Mailbox +- * -------------------------------------------------------------------- */ +- +-/* offsets from a mail box base address */ +-#define MAIL_WRT 0x00 /* write - and next 4 words */ +-#define MAIL_RD 0x00 /* read - and next 4 words */ +-#define MAIL_POL 0x10 /* read without popping the fifo */ +-#define MAIL_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL_STA 0x18 /* status */ +-#define MAIL_CNF 0x1C /* configuration */ +- +-#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +-#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +-#define MBOX_CHAN(msg) ((msg) & 0xf) +-#define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) +- +-#define MBOX_MAGIC 0xd0d0c0de +-static struct class *vcio_class = NULL; +-struct vc_mailbox { +- struct device *dev; /* parent device */ +- void __iomem *status; +- void __iomem *config; +- void __iomem *read; +- void __iomem *write; +- uint32_t msg[MBOX_CHAN_COUNT]; +- struct semaphore sema[MBOX_CHAN_COUNT]; +- uint32_t magic; +-}; +- +-static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, +- uint32_t addr_mbox) +-{ +- int i; +- +- mbox_out->dev = dev; +- mbox_out->status = __io_address(addr_mbox + MAIL_STA); +- mbox_out->config = __io_address(addr_mbox + MAIL_CNF); +- mbox_out->read = __io_address(addr_mbox + MAIL_RD); +- /* Write to the other mailbox */ +- mbox_out->write = +- __io_address((addr_mbox ^ ARM_0_MAIL0_WRT ^ ARM_0_MAIL1_WRT) + +- MAIL_WRT); +- +- for (i = 0; i < MBOX_CHAN_COUNT; i++) { +- mbox_out->msg[i] = 0; +- sema_init(&mbox_out->sema[i], 0); +- } +- +- /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->config); +- +- mbox_out->magic = MBOX_MAGIC; +-} +- +-static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) +-{ +- int rc; +- +- if (mbox->magic != MBOX_MAGIC) +- rc = -EINVAL; +- else { +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->status) & ARM_MS_FULL)) +- cpu_relax(); +- +- writel(MBOX_MSG(chan, data28), mbox->write); +- rc = 0; +- } +- return rc; +-} +- +-static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) +-{ +- int rc; +- +- if (mbox->magic != MBOX_MAGIC) +- rc = -EINVAL; +- else { +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- rc = 0; +- } +- return rc; +-} +- +-static irqreturn_t mbox_irq(int irq, void *dev_id) +-{ +- /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *) dev_id; +- int status = readl(mbox->status); +- int ret = IRQ_NONE; +- +- while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->read); +- int chan = MBOX_CHAN(msg); +- if (chan < MBOX_CHAN_COUNT) { +- if (mbox->msg[chan]) { +- /* Overflow */ +- printk(KERN_ERR DRIVER_NAME +- ": mbox chan %d overflow - drop %08x\n", +- chan, msg); +- } else { +- mbox->msg[chan] = (msg | 0xf); +- up(&mbox->sema[chan]); +- } +- } else { +- printk(KERN_ERR DRIVER_NAME +- ": invalid channel selector (msg %08x)\n", msg); +- } +- ret = IRQ_HANDLED; +- status = readl(mbox->status); +- } +- return ret; +-} +- +-static struct irqaction mbox_irqaction = { +- .name = "ARM Mailbox IRQ", +- .flags = IRQF_DISABLED | IRQF_IRQPOLL, +- .handler = mbox_irq, +-}; +- +-/* ---------------------------------------------------------------------- +- * Mailbox Methods +- * -------------------------------------------------------------------- */ +- +-static struct device *mbox_dev; /* we assume there's only one! */ +- +-static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) +-{ +- int rc; +- +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- device_lock(dev); +- rc = mbox_write(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) +-{ +- int rc; +- +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- device_lock(dev); +- rc = mbox_read(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-extern int bcm_mailbox_write(unsigned chan, uint32_t data28) +-{ +- if (mbox_dev) +- return dev_mbox_write(mbox_dev, chan, data28); +- else +- return -ENODEV; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_write); +- +-extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) +-{ +- if (mbox_dev) +- return dev_mbox_read(mbox_dev, chan, data28); +- else +- return -ENODEV; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); +- +-static void dev_mbox_register(const char *dev_name, struct device *dev) +-{ +- mbox_dev = dev; +-} +- +-static int mbox_copy_from_user(void *dst, const void *src, int size) +-{ +- if ( (uint32_t)src < TASK_SIZE) +- { +- return copy_from_user(dst, src, size); +- } +- else +- { +- memcpy( dst, src, size ); +- return 0; +- } +-} +- +-static int mbox_copy_to_user(void *dst, const void *src, int size) +-{ +- if ( (uint32_t)dst < TASK_SIZE) +- { +- return copy_to_user(dst, src, size); +- } +- else +- { +- memcpy( dst, src, size ); +- return 0; +- } +-} +- +-static DEFINE_MUTEX(mailbox_lock); +-extern int bcm_mailbox_property(void *data, int size) +-{ +- uint32_t success; +- dma_addr_t mem_bus; /* the memory address accessed from videocore */ +- void *mem_kern; /* the memory address accessed from driver */ +- int s = 0; +- +- mutex_lock(&mailbox_lock); +- /* allocate some memory for the messages communicating with GPU */ +- mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, GFP_ATOMIC); +- if (mem_kern) { +- /* create the message */ +- mbox_copy_from_user(mem_kern, data, size); +- +- /* send the message */ +- wmb(); +- s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); +- if (s == 0) { +- s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); +- } +- if (s == 0) { +- /* copy the response */ +- rmb(); +- mbox_copy_to_user(data, mem_kern, size); +- } +- dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); +- } else { +- s = -ENOMEM; +- } +- if (s != 0) +- printk(KERN_ERR DRIVER_NAME ": %s failed (%d)\n", __func__, s); +- +- mutex_unlock(&mailbox_lock); +- return s; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_property); +- +-/* ---------------------------------------------------------------------- +- * Platform Device for Mailbox +- * -------------------------------------------------------------------- */ +- +-/* +- * Is the device open right now? Used to prevent +- * concurent access into the same device +- */ +-static int Device_Open = 0; +- +-/* +- * This is called whenever a process attempts to open the device file +- */ +-static int device_open(struct inode *inode, struct file *file) +-{ +- /* +- * We don't want to talk to two processes at the same time +- */ +- if (Device_Open) +- return -EBUSY; +- +- Device_Open++; +- /* +- * Initialize the message +- */ +- try_module_get(THIS_MODULE); +- return 0; +-} +- +-static int device_release(struct inode *inode, struct file *file) +-{ +- /* +- * We're now ready for our next caller +- */ +- Device_Open--; +- +- module_put(THIS_MODULE); +- return 0; +-} +- +-/* +- * This function is called whenever a process tries to do an ioctl on our +- * device file. We get two extra parameters (additional to the inode and file +- * structures, which all device functions get): the number of the ioctl called +- * and the parameter given to the ioctl function. +- * +- * If the ioctl is write or read/write (meaning output is returned to the +- * calling process), the ioctl call returns the output of this function. +- * +- */ +-static long device_ioctl(struct file *file, /* see include/linux/fs.h */ +- unsigned int ioctl_num, /* number and param for ioctl */ +- unsigned long ioctl_param) +-{ +- unsigned size; +- /* +- * Switch according to the ioctl called +- */ +- switch (ioctl_num) { +- case IOCTL_MBOX_PROPERTY: +- /* +- * Receive a pointer to a message (in user space) and set that +- * to be the device's message. Get the parameter given to +- * ioctl by the process. +- */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof size); +- return bcm_mailbox_property((void *)ioctl_param, size); +- break; +- default: +- printk(KERN_ERR DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); +- return -EINVAL; +- } +- +- return 0; +-} +- +-/* Module Declarations */ +- +-/* +- * This structure will hold the functions to be called +- * when a process does something to the device we +- * created. Since a pointer to this structure is kept in +- * the devices table, it can't be local to +- * init_module. NULL is for unimplemented functios. +- */ +-struct file_operations fops = { +- .unlocked_ioctl = device_ioctl, +- .open = device_open, +- .release = device_release, /* a.k.a. close */ +-}; +- +-static int bcm_vcio_probe(struct platform_device *pdev) +-{ +- int ret = 0; +- struct vc_mailbox *mailbox; +- +- mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL); +- if (NULL == mailbox) { +- printk(KERN_ERR DRIVER_NAME ": failed to allocate " +- "mailbox memory\n"); +- ret = -ENOMEM; +- } else { +- struct resource *res; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (res == NULL) { +- printk(KERN_ERR DRIVER_NAME ": failed to obtain memory " +- "resource\n"); +- ret = -ENODEV; +- kfree(mailbox); +- } else { +- /* should be based on the registers from res really */ +- mbox_init(mailbox, &pdev->dev, ARM_0_MAIL0_RD); +- +- platform_set_drvdata(pdev, mailbox); +- dev_mbox_register(DRIVER_NAME, &pdev->dev); +- +- mbox_irqaction.dev_id = mailbox; +- setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction); +- printk(KERN_INFO DRIVER_NAME ": mailbox at %p\n", +- __io_address(ARM_0_MAIL0_RD)); +- } +- } +- +- if (ret == 0) { +- /* +- * Register the character device +- */ +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- +- /* +- * Negative values signify an error +- */ +- if (ret < 0) { +- printk(KERN_ERR DRIVER_NAME +- "Failed registering the character device %d\n", ret); +- return ret; +- } +- vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- return ret ; +- } +- device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); +- } +- return ret; +-} +- +-static int bcm_vcio_remove(struct platform_device *pdev) +-{ +- struct vc_mailbox *mailbox = platform_get_drvdata(pdev); +- +- platform_set_drvdata(pdev, NULL); +- kfree(mailbox); +- +- return 0; +-} +- +-static struct platform_driver bcm_mbox_driver = { +- .probe = bcm_vcio_probe, +- .remove = bcm_vcio_remove, +- +- .driver = { +- .name = DRIVER_NAME, +- .owner = THIS_MODULE, +- }, +-}; +- +-static int __init bcm_mbox_init(void) +-{ +- int ret; +- +- printk(KERN_INFO "mailbox: Broadcom VideoCore Mailbox driver\n"); +- +- ret = platform_driver_register(&bcm_mbox_driver); +- if (ret != 0) { +- printk(KERN_ERR DRIVER_NAME ": failed to register " +- "on platform\n"); +- } +- +- return ret; +-} +- +-static void __exit bcm_mbox_exit(void) +-{ +- device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- platform_driver_unregister(&bcm_mbox_driver); +-} +- +-arch_initcall(bcm_mbox_init); /* Initialize early */ +-module_exit(bcm_mbox_exit); +- +-MODULE_AUTHOR("Gray Girling"); +-MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); +-MODULE_LICENSE("GPL"); +-MODULE_ALIAS("platform:bcm-mbox"); + +From ca452e4734877d6b36d1a836d473b81f3d561c3f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 23:00:15 +0200 +Subject: [PATCH 147/216] BCM270x_DT: Add mailbox bcm2708-vcio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add bcm2708-vcio to Device Tree and don't add the +platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 6 ++++++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + 3 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 065a424..1c8c1af 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -36,6 +36,12 @@ + #interrupt-cells = <2>; + }; + ++ mailbox: mailbox@7e00b800 { ++ compatible = "brcm,bcm2708-vcio"; ++ reg = <0x7e00b880 0x40>; ++ interrupts = <0 1>; ++ }; ++ + gpio: gpio { + compatible = "brcm,bcm2835-gpio"; + reg = <0x7e200000 0xb4>; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 51f8efa..7cc47c1 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -908,7 +908,7 @@ void __init bcm2708_init(void) + bcm2708_dt_init(); + + bcm_register_device_dt(&bcm2708_dmaengine_device); +- bcm_register_device(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_vcio_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); + #endif +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 8ed88b4..2c0a664 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -929,7 +929,7 @@ void __init bcm2709_init(void) + bcm2709_dt_init(); + + bcm_register_device_dt(&bcm2708_dmaengine_device); +- bcm_register_device(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_vcio_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); + #endif + +From 8cb40db6e93540a4cf0d45ee23eb9b0441050543 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 23:00:45 +0200 +Subject: [PATCH 148/216] bcm2835: bcm2835_defconfig enable BCM2708_MBOX +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Enable the mailbox driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2835_defconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index cf2e7a6..26b4c75 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -99,6 +99,8 @@ CONFIG_LEDS_TRIGGER_CAMERA=y + CONFIG_DMADEVICES=y + CONFIG_DMA_BCM2708=y + CONFIG_STAGING=y ++CONFIG_MAILBOX=y ++CONFIG_BCM2708_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXT2_FS=y + CONFIG_EXT2_FS_XATTR=y + +From c03f517d41d6da89f70794d6bf20974e81ac72f1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 23:02:46 +0200 +Subject: [PATCH 149/216] bcm2835: Add mailbox bcm2708-vcio to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add mailbox to Device Tree. There are no kernel users yet, +but it's available to userspace. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index f2dec21..06cba29 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -60,6 +60,12 @@ + reg = <0x7e104000 0x10>; + }; + ++ mailbox: mailbox@7e00b800 { ++ compatible = "brcm,bcm2708-vcio"; ++ reg = <0x7e00b880 0x40>; ++ interrupts = <0 1>; ++ }; ++ + gpio: gpio@7e200000 { + compatible = "brcm,bcm2835-gpio"; + reg = <0x7e200000 0xb4>; + +From 2010049aa53c210156598c979fd38dc893baa049 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 12 May 2015 11:48:18 +0200 +Subject: [PATCH 150/216] mailbox: bcm2708-vcio: Allocation does not need to be + atomic +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +No need to do atomic allocation in a context that can sleep. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/bcm2708-vcio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +index ee3e778..74a7fcb 100644 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -212,7 +212,7 @@ extern int bcm_mailbox_property(void *data, int size) + mutex_lock(&mailbox_lock); + /* allocate some memory for the messages communicating with GPU */ + mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, +- GFP_ATOMIC); ++ GFP_KERNEL); + if (mem_kern) { + /* create the message */ + mbox_copy_from_user(mem_kern, data, size); + +From f86559819816a393e05426b6dac30d84582fa13d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 12 May 2015 13:45:32 +0200 +Subject: [PATCH 151/216] mailbox: bcm2708-vcio: Check the correct status + register before writing +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With the VC reader blocked and the ARM writing, MAIL0_STA reads +empty permanently while MAIL1_STA goes from empty (0x40000000) +to non-empty (0x00000001-0x00000007) to full (0x80000008). + +Suggested-by: Phil Elwell +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/bcm2708-vcio.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +index 74a7fcb..19ecfe8 100644 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -35,6 +35,7 @@ + #define MAIL0_STA 0x18 /* status */ + #define MAIL0_CNF 0x1C /* configuration */ + #define MAIL1_WRT 0x20 /* write - and next 4 words */ ++#define MAIL1_STA 0x38 /* status */ + + /* On MACH_BCM270x these come through (arm_control.h ) */ + #ifndef ARM_MS_EMPTY +@@ -85,7 +86,7 @@ static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) + return -EINVAL; + + /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL)) ++ while (0 != (readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL)) + cpu_relax(); + + writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); + +From 94bbfc4066df94c006edec5a48fe4df6547a1b01 Mon Sep 17 00:00:00 2001 +From: Gordon Hollingworth +Date: Tue, 12 May 2015 14:47:56 +0100 +Subject: [PATCH 152/216] rpi-ft5406: Add touchscreen driver for pi LCD display + +--- + drivers/input/touchscreen/Kconfig | 7 + + drivers/input/touchscreen/Makefile | 1 + + drivers/input/touchscreen/rpi-ft5406.c | 258 ++++++++++++++++++++++++++ + include/linux/platform_data/mailbox-bcm2708.h | 1 + + 4 files changed, 267 insertions(+) + create mode 100644 drivers/input/touchscreen/rpi-ft5406.c + +diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig +index 6261fd6..e7e9416 100644 +--- a/drivers/input/touchscreen/Kconfig ++++ b/drivers/input/touchscreen/Kconfig +@@ -557,6 +557,13 @@ config TOUCHSCREEN_EDT_FT5X06 + To compile this driver as a module, choose M here: the + module will be called edt-ft5x06. + ++config TOUCHSCREEN_RPI_FT5406 ++ tristate "Raspberry Pi FT5406 driver" ++ depends on ARCH_BCM2708 || ARCH_BCM2709 ++ help ++ Say Y here to enable the Raspberry Pi memory based FT5406 device ++ ++ + config TOUCHSCREEN_MIGOR + tristate "Renesas MIGO-R touchscreen" + depends on SH_MIGOR && I2C +diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile +index 0242fea..e0268f0 100644 +--- a/drivers/input/touchscreen/Makefile ++++ b/drivers/input/touchscreen/Makefile +@@ -28,6 +28,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o + obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o + obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o + obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o ++obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o + obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o + obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o + obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +new file mode 100644 +index 0000000..f55151b +--- /dev/null ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -0,0 +1,258 @@ ++/* ++ * Driver for memory based ft5406 touchscreen ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * ++ * 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MAXIMUM_SUPPORTED_POINTS 10 ++struct ft5406_regs { ++ uint8_t device_mode; ++ uint8_t gesture_id; ++ uint8_t num_points; ++ struct ft5406_touch { ++ uint8_t xh; ++ uint8_t xl; ++ uint8_t yh; ++ uint8_t yl; ++ uint8_t res1; ++ uint8_t res2; ++ } point[MAXIMUM_SUPPORTED_POINTS]; ++}; ++ ++#define SCREEN_WIDTH 800 ++#define SCREEN_HEIGHT 480 ++ ++struct ft5406 { ++ struct platform_device * pdev; ++ struct input_dev * input_dev; ++ void __iomem * ts_base; ++ struct ft5406_regs * regs; ++ struct task_struct * thread; ++}; ++ ++ ++/* tag part of the message */ ++struct vc_msg_tag { ++ uint32_t tag_id; /* the message id */ ++ uint32_t buffer_size; /* size of the buffer (which in this case is always 8 bytes) */ ++ uint32_t data_size; /* amount of data being sent or received */ ++ uint32_t val; /* data buffer */ ++}; ++ ++/* message structure to be sent to videocore */ ++struct vc_msg { ++ uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ ++ uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ ++ struct vc_msg_tag tag; /* the tag structure above to make */ ++ uint32_t end_tag; /* an end identifier, should be set to NULL */ ++}; ++ ++/* Thread to poll for touchscreen events ++ * ++ * This thread polls the memory based register copy of the ft5406 registers ++ * using the number of points register to know whether the copy has been ++ * updated (we write 99 to the memory copy, the GPU will write between ++ * 0 - 10 points) ++ */ ++static int ft5406_thread(void *arg) ++{ ++ struct ft5406 *ts = (struct ft5406 *) arg; ++ struct ft5406_regs regs; ++ int known_ids = 0; ++ ++ while(!kthread_should_stop()) ++ { ++ // 60fps polling ++ msleep(17); ++ memcpy_fromio(®s, ts->regs, sizeof(*ts->regs)); ++ writel(99, &ts->regs->num_points); ++ // Do not output if theres no new information (num_points is 99) ++ // or we have no touch points and don't need to release any ++ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) ++ { ++ int i; ++ int modified_ids = 0, released_ids; ++ for(i = 0; i < regs.num_points; i++) ++ { ++ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; ++ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; ++ int touchid = (regs.point[i].yh >> 4) & 0xf; ++ ++ modified_ids |= 1 << touchid; ++ ++ if(!((1 << touchid) & known_ids)) ++ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); ++ ++ input_mt_slot(ts->input_dev, touchid); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); ++ ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); ++ ++ } ++ ++ released_ids = known_ids & ~modified_ids; ++ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) ++ { ++ if(released_ids & (1<pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); ++ input_mt_slot(ts->input_dev, i); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); ++ modified_ids &= ~(1 << i); ++ } ++ } ++ known_ids = modified_ids; ++ ++ input_mt_report_pointer_emulation(ts->input_dev, true); ++ input_sync(ts->input_dev); ++ } ++ ++ } ++ ++ return 0; ++} ++ ++static int ft5406_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct input_dev * input_dev = input_allocate_device(); ++ struct vc_msg request; ++ struct ft5406 * ts; ++ ++ dev_info(&pdev->dev, "Probing device\n"); ++ ++ ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); ++ ++ if (!ts || !input_dev) { ++ ret = -ENOMEM; ++ dev_err(&pdev->dev, "Failed to allocate memory\n"); ++ return ret; ++ } ++ ts->input_dev = input_dev; ++ platform_set_drvdata(pdev, ts); ++ ts->pdev = pdev; ++ ++ input_dev->name = "FT5406 memory based driver"; ++ ++ __set_bit(EV_KEY, input_dev->evbit); ++ __set_bit(EV_SYN, input_dev->evbit); ++ __set_bit(EV_ABS, input_dev->evbit); ++ ++ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, ++ SCREEN_WIDTH, 0, 0); ++ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, ++ SCREEN_HEIGHT, 0, 0); ++ ++ input_mt_init_slots(input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); ++ ++ input_set_drvdata(input_dev, ts); ++ ++ ret = input_register_device(input_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "could not register input device, %d\n", ++ ret); ++ return ret; ++ } ++ ++ memset(&request, 0, sizeof request); ++ ++ request.msg_size = sizeof request; ++ request.request_code = VCMSG_PROCESS_REQUEST; ++ request.tag.tag_id = VCMSG_GET_TOUCHBUF; ++ request.tag.buffer_size = 4; ++ request.tag.data_size = 4; ++ ++ bcm_mailbox_property(&request, sizeof(request)); ++ ++ if(request.request_code == VCMSG_REQUEST_SUCCESSFUL) ++ { ++ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", request.tag.val); ++ } ++ else ++ { ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ return -1; ++ } ++ ++ // mmap the physical memory ++ request.tag.val &= ~0xc0000000; ++ ts->ts_base = ioremap(request.tag.val, sizeof(*ts->regs)); ++ if(ts->ts_base == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to map physical address\n"); ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ return -1; ++ } ++ ++ ts->regs = (struct ft5406_regs *) ts->ts_base; ++ ++ // create thread to poll the touch events ++ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); ++ if(ts->thread == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to create kernel thread"); ++ iounmap(ts->ts_base); ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ } ++ ++ return 0; ++} ++ ++static int ft5406_remove(struct platform_device *pdev) ++{ ++ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); ++ ++ dev_info(&pdev->dev, "Removing rpi-ft5406\n"); ++ ++ kthread_stop(ts->thread); ++ iounmap(ts->ts_base); ++ input_unregister_device(ts->input_dev); ++ kzfree(ts); ++ ++ return 0; ++} ++ ++static const struct of_device_id ft5406_match[] = { ++ { .compatible = "rpi,rpi-ft5406", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ft5406_match); ++ ++static struct platform_driver ft5406_driver = { ++ .driver = { ++ .name = "rpi-ft5406", ++ .owner = THIS_MODULE, ++ .of_match_table = ft5406_match, ++ }, ++ .probe = ft5406_probe, ++ .remove = ft5406_remove, ++}; ++ ++module_platform_driver(ft5406_driver); ++ ++MODULE_AUTHOR("Gordon Hollingworth"); ++MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); ++MODULE_LICENSE("GPL"); +diff --git a/include/linux/platform_data/mailbox-bcm2708.h b/include/linux/platform_data/mailbox-bcm2708.h +index cc284ed..d3ea839 100644 +--- a/include/linux/platform_data/mailbox-bcm2708.h ++++ b/include/linux/platform_data/mailbox-bcm2708.h +@@ -115,6 +115,7 @@ enum { + VCMSG_SET_TRANSFORM = 0x0004800d, + VCMSG_TST_VSYNC = 0x0004400e, + VCMSG_SET_VSYNC = 0x0004800e, ++ VCMSG_GET_TOUCHBUF = 0x0004000f, + VCMSG_SET_CURSOR_INFO = 0x00008010, + VCMSG_SET_CURSOR_STATE = 0x00008011, + }; + +From 7a6f093876247b186c1465ef0f45132b0c804af2 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 7 May 2015 09:22:23 +0100 +Subject: [PATCH 153/216] bcm2835-sdhost: Error handling fix, and code + clarification + +--- + drivers/mmc/host/bcm2835-sdhost.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 0c311b5..542ae12 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -1041,13 +1041,14 @@ static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) + host->cmd->error = -EILSEQ; + + /* Use the block interrupt for writes after the first block */ +- if (!(host->data->flags & MMC_DATA_READ)) { ++ if (host->data->flags & MMC_DATA_WRITE) { + host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); + host->hcfg |= SDHCFG_BLOCK_IRPT_EN; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + if (host->data->error) + bcm2835_sdhost_finish_data(host); +- bcm2835_sdhost_transfer_pio(host); ++ else ++ bcm2835_sdhost_transfer_pio(host); + } else { + if (!host->data->error) { + bcm2835_sdhost_transfer_pio(host); +@@ -1132,12 +1133,12 @@ static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) + bcm2835_sdhost_dumpregs(host); + } + +- if (loops) +- early |= handled; +- + if (!handled) + break; + ++ if (loops) ++ early |= handled; ++ + result = IRQ_HANDLED; + + /* Clear all interrupts and notifications */ + +From d502512774e7121bd6787008f5956daefa3ac138 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 14 May 2015 11:48:40 +0100 +Subject: [PATCH 154/216] bcm2835-sdhost: Adding overclocking option + +Allow a different clock speed to be substitued for a requested 50MHz. +This option is exposed using the "overclock_50" DT parameter. +Note that the sdhost interface is restricted to integer divisions of +core_freq, and the highest sensible option for a core_freq of 250MHz +is 84 (250/3 = 83.3MHz), the next being 125 (250/2) which is much too +high. + +Use at your own risk. +--- + arch/arm/boot/dts/sdhost-overlay.dts | 6 ++++-- + drivers/mmc/host/bcm2835-sdhost.c | 17 +++++++++++++++-- + 2 files changed, 19 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/sdhost-overlay.dts b/arch/arm/boot/dts/sdhost-overlay.dts +index 33db96e..b2653e9 100644 +--- a/arch/arm/boot/dts/sdhost-overlay.dts ++++ b/arch/arm/boot/dts/sdhost-overlay.dts +@@ -13,14 +13,15 @@ + sdhost: sdhost@7e202000 { + compatible = "brcm,bcm2835-sdhost"; + reg = <0x7e202000 0x100>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; + interrupts = <2 24>; + clocks = <&clk_sdhost>; + dmas = <&dma 13>, + <&dma 13>; + dma-names = "tx", "rx"; + brcm,delay-after-stop = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&sdhost_pins>; ++ brcm,overclock-50 = <0>; + status = "okay"; + }; + +@@ -67,6 +68,7 @@ + + __overrides__ { + delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; ++ overclock_50 = <&sdhost>,"brcm,overclock-50:0"; + force_pio = <&sdhost>,"brcm,force-pio?"; + sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; + }; +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 542ae12..2a9eb9f 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -184,6 +184,7 @@ struct bcm2835_host { + int max_delay; /* maximum length of time spent waiting */ + struct timeval stop_time; /* when the last stop was issued */ + u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ ++ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + }; + + +@@ -1223,6 +1224,10 @@ static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id) + void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + { + int div = 0; /* Initialized for compiler warning */ ++ unsigned int input_clock = clock; ++ ++ if (host->overclock_50 && (clock == 50000000)) ++ clock = host->overclock_50 * 1000000; + + /* The SDCDIV register has 11 bits, and holds (div - 2). + But in data mode the max is 50MHz wihout a minimum, and only the +@@ -1266,13 +1271,18 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + if (div > SDCDIV_MAX_CDIV) + div = SDCDIV_MAX_CDIV; + +- host->mmc->actual_clock = host->max_clk / (div + 2); ++ clock = host->max_clk / (div + 2); ++ host->mmc->actual_clock = clock; ++ ++ if (clock > input_clock) ++ pr_warn("%s: Overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); + + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + + pr_debug(DRIVER_NAME ": clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", +- clock, host->max_clk, host->cdiv, host->mmc->actual_clock); ++ input_clock, host->max_clk, host->cdiv, host->mmc->actual_clock); + } + + static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) +@@ -1572,6 +1582,9 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + of_property_read_u32(node, + "brcm,delay-after-stop", + &host->delay_after_stop); ++ of_property_read_u32(node, ++ "brcm,overclock-50", ++ &host->overclock_50); + host->allow_dma = ALLOW_DMA && + !of_property_read_bool(node, "brcm,force-pio"); + } + +From ae7169ee054f60e3db61f1a5bb6eb1f52913886a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 14 May 2015 11:55:57 +0100 +Subject: [PATCH 155/216] bcm2835-mmc: Adding overclocking option + +Allow a different clock speed to be substitued for a requested 50MHz. +This option is exposed using the "overclock_50" DT parameter. +Note that the mmc interface is restricted to EVEN integer divisions of +250MHz, and the highest sensible option is 63 (250/4 = 62.5), the +next being 125 (250/2) which is much too high. + +Use at your own risk. +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/mmc-overlay.dts | 19 +++++++++++++++++++ + drivers/mmc/host/bcm2835-mmc.c | 25 ++++++++++++++++++++++--- + 3 files changed, 42 insertions(+), 3 deletions(-) + create mode 100644 arch/arm/boot/dts/mmc-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 9cb5a2d..a21afc5 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -27,6 +27,7 @@ dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += pcf2127-rtc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += pcf8523-rtc-overlay.dtb +diff --git a/arch/arm/boot/dts/mmc-overlay.dts b/arch/arm/boot/dts/mmc-overlay.dts +new file mode 100644 +index 0000000..0a37cf4 +--- /dev/null ++++ b/arch/arm/boot/dts/mmc-overlay.dts +@@ -0,0 +1,19 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&mmc>; ++ ++ __overlay__ { ++ brcm,overclock-50 = <0>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&mmc>,"brcm,overclock-50:0"; ++ force_pio = <&mmc>,"brcm,force-pio?"; ++ }; ++}; +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +index 68314d5..c7c2ca1 100644 +--- a/drivers/mmc/host/bcm2835-mmc.c ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -131,6 +131,8 @@ struct bcm2835_host { + #define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */ + #define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ + #define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ ++ ++ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + }; + + +@@ -1086,7 +1088,10 @@ void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) + int real_div = div, clk_mul = 1; + u16 clk = 0; + unsigned long timeout; ++ unsigned int input_clock = clock; + ++ if (host->overclock_50 && (clock == 50000000)) ++ clock = host->overclock_50 * 1000000; + + host->mmc->actual_clock = 0; + +@@ -1110,7 +1115,12 @@ void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) + div >>= 1; + + if (real_div) +- host->mmc->actual_clock = (host->max_clk * clk_mul) / real_div; ++ clock = (host->max_clk * clk_mul) / real_div; ++ host->mmc->actual_clock = clock; ++ ++ if (clock > input_clock) ++ pr_warn("%s: Overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); + + clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; + clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN) +@@ -1177,6 +1187,9 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + u8 ctrl; + u16 clk, ctrl_2; + ++ pr_debug("bcm2835_mmc_set_ios: clock %d, pwr %d, bus_width %d, timing %d, vdd %d, drv_type %d\n", ++ ios->clock, ios->power_mode, ios->bus_width, ++ ios->timing, ios->signal_voltage, ios->drv_type); + + spin_lock_irqsave(&host->lock, flags); + +@@ -1444,10 +1457,16 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) + goto err; + } + +- if (node) ++ if (node) { + mmc_of_parse(mmc); +- else ++ ++ /* Read any custom properties */ ++ of_property_read_u32(node, ++ "brcm,overclock-50", ++ &host->overclock_50); ++ } else { + mmc->caps |= MMC_CAP_4_BIT_DATA; ++ } + + ret = bcm2835_mmc_add_host(host); + if (ret) + +From 4b4b9568bc6fbfc222d59a28b2727ae5c725a92a Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Fri, 15 May 2015 14:21:32 +0200 +Subject: [PATCH 156/216] dmaengine: bcm2708: set residue_granularity field + +bcm2708-dmaengine supports residue reporting at burst level +but didn't report this via the residue_granularity field. + +Without this field set properly we get playback issues with I2S cards. +--- + drivers/dma/bcm2708-dmaengine.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c +index 937fd60..987ed53 100644 +--- a/drivers/dma/bcm2708-dmaengine.c ++++ b/drivers/dma/bcm2708-dmaengine.c +@@ -1112,6 +1112,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); ++ od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; + od->ddev.dev = &pdev->dev; + INIT_LIST_HEAD(&od->ddev.channels); + spin_lock_init(&od->lock); +@@ -1180,6 +1181,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); ++ od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; + od->ddev.dev = &pdev->dev; + INIT_LIST_HEAD(&od->ddev.channels); + spin_lock_init(&od->lock); + +From 1ddcc631437e913995361718209077d8247c10b0 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 12 May 2015 17:26:35 +0100 +Subject: [PATCH 157/216] BCM2708_DT: Adding starter Compute Module DTS files + +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 7 +++++++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 30 ++++++++++++++++++++++++++++++ + 3 files changed, 38 insertions(+) + create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dts + create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index a21afc5..f3558df 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -3,6 +3,7 @@ ifeq ($(CONFIG_OF),y) + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb + dtb-$(CONFIG_BCM2709_DT) += bcm2709-rpi-2-b.dtb + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b-plus.dtb ++dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-cm.dtb + + # Raspberry Pi + ifeq ($(CONFIG_BCM2708_DT),y) +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +new file mode 100755 +index 0000000..45f8244 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -0,0 +1,7 @@ ++/dts-v1/; ++ ++/include/ "bcm2708-rpi-cm.dtsi" ++ ++/ { ++ model = "Raspberry Pi Compute Module"; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +new file mode 100755 +index 0000000..d0a6fb8 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -0,0 +1,30 @@ ++/include/ "bcm2708.dtsi" ++ ++/ { ++ aliases { ++ soc = &soc; ++ gpio = &gpio; ++ intc = &intc; ++ leds = &leds; ++ sound = &sound; ++ }; ++ ++ sound: sound { ++ }; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; ++ ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ }; ++}; + +From 210157c8363fc0ac4c99273d3ed8f54ed9929b0f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 May 2015 11:57:29 +0100 +Subject: [PATCH 158/216] bcm2835-sdhost: Round up the overclock, so 62 works + for 62.5Mhz + +Also only warn once for each overclock setting. +--- + drivers/mmc/host/bcm2835-sdhost.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 2a9eb9f..eef8a24 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -185,6 +185,7 @@ struct bcm2835_host { + struct timeval stop_time; /* when the last stop was issued */ + u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ ++ u32 max_overclock; /* Highest reported */ + }; + + +@@ -1227,7 +1228,7 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + unsigned int input_clock = clock; + + if (host->overclock_50 && (clock == 50000000)) +- clock = host->overclock_50 * 1000000; ++ clock = host->overclock_50 * 1000000 + 999999; + + /* The SDCDIV register has 11 bits, and holds (div - 2). + But in data mode the max is 50MHz wihout a minimum, and only the +@@ -1274,9 +1275,11 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + clock = host->max_clk / (div + 2); + host->mmc->actual_clock = clock; + +- if (clock > input_clock) ++ if ((clock > input_clock) && (clock > host->max_overclock)) { + pr_warn("%s: Overclocking to %dHz\n", + mmc_hostname(host->mmc), clock); ++ host->max_overclock = clock; ++ } + + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + +From a946e70fd45a1f24f99816f72f5bbb0a7de0c1f3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 May 2015 12:29:42 +0100 +Subject: [PATCH 159/216] bcm2835-mmc: Round up the overclock, so 62 works for + 62.5Mhz + +Also only warn once for each overclock setting. +--- + drivers/mmc/host/bcm2835-mmc.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +index c7c2ca1..b7c4883 100644 +--- a/drivers/mmc/host/bcm2835-mmc.c ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -133,6 +133,7 @@ struct bcm2835_host { + #define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ + + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ ++ u32 max_overclock; /* Highest reported */ + }; + + +@@ -1091,7 +1092,7 @@ void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) + unsigned int input_clock = clock; + + if (host->overclock_50 && (clock == 50000000)) +- clock = host->overclock_50 * 1000000; ++ clock = host->overclock_50 * 1000000 + 999999; + + host->mmc->actual_clock = 0; + +@@ -1118,9 +1119,11 @@ void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) + clock = (host->max_clk * clk_mul) / real_div; + host->mmc->actual_clock = clock; + +- if (clock > input_clock) ++ if ((clock > input_clock) && (clock > host->max_overclock)) { + pr_warn("%s: Overclocking to %dHz\n", + mmc_hostname(host->mmc), clock); ++ host->max_overclock = clock; ++ } + + clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; + clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN) + +From f80dd3188715edaa5c23e3d99793170aa7dbd877 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 May 2015 13:05:27 +0100 +Subject: [PATCH 160/216] BCM2708_DT: Add missing CM aliases + +--- + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index d0a6fb8..8340c1e 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -3,6 +3,10 @@ + / { + aliases { + soc = &soc; ++ spi0 = &spi0; ++ i2c0 = &i2c0; ++ i2c1 = &i2c1; ++ i2s = &i2s; + gpio = &gpio; + intc = &intc; + leds = &leds; + +From 90c3a2ff9838fdf619c6f391c27ce2fe02f083cf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 15 May 2015 20:20:09 +0200 +Subject: [PATCH 161/216] usb: dwc_otg: Don't use dma_to_virt() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 6ce0d20 changes dma_to_virt() which breaks this driver. +Open code the old dma_to_virt() implementation to work around this. + +Limit the use of __bus_to_virt() to cases where transfer_buffer_length +is set and transfer_buffer is not set. This is done to increase the +chance that this driver will also work on ARCH_BCM2835. + +transfer_buffer should not be NULL if the length is set, but the +comment in the code indicates that there are situations where this +might happen. drivers/usb/isp1760/isp1760-hcd.c also has a similar +comment pointing to a possible: 'usb storage / SCSI bug'. + +Signed-off-by: Noralf Trønnes +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +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 1d28459..6aad9c4 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +@@ -766,16 +766,17 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, + !(usb_pipein(urb->pipe)))); + + buf = urb->transfer_buffer; +- if (hcd->self.uses_dma) { ++ if (hcd->self.uses_dma && !buf && urb->transfer_buffer_length) { + /* + * Calculate virtual address from physical address, + * because some class driver may not fill transfer_buffer. + * In Buffer DMA mode virual address is used, + * when handling non DWORD aligned buffers. + */ +- //buf = phys_to_virt(urb->transfer_dma); +- // DMA addresses are bus addresses not physical addresses! +- buf = dma_to_virt(&urb->dev->dev, urb->transfer_dma); ++ buf = (void *)__bus_to_virt((unsigned long)urb->transfer_dma); ++ dev_warn_once(&urb->dev->dev, ++ "USB transfer_buffer was NULL, will use __bus_to_virt(%pad)=%p\n", ++ &urb->transfer_dma, buf); + } + + if (!(urb->transfer_flags & URB_NO_INTERRUPT)) + +From 785584eaa255550270eb4496bdc31f241561b26c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 15 May 2015 20:20:26 +0200 +Subject: [PATCH 162/216] fixup: restore dma-mapping.h +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +dwc_otg has been fixed, so no need to revert 6ce0d20: +ARM: dma: Use dma_pfn_offset for dma address translation + +The pfn_to_dma/dma_to_pfn changes that came with that commit +is needed to use the 'dma-ranges' DT property on ARCH_BCM2835. +dma-ranges is needed by bcm2708_fb and vchiq on ARCH_BCM2835. +If not the mailbox call fails to hand over the correct +bus address to videocore. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/include/asm/dma-mapping.h | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h +index f5572d9..b52101d3 100644 +--- a/arch/arm/include/asm/dma-mapping.h ++++ b/arch/arm/include/asm/dma-mapping.h +@@ -58,21 +58,37 @@ static inline int dma_set_mask(struct device *dev, u64 mask) + #ifndef __arch_pfn_to_dma + static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn) + { ++ if (dev) ++ pfn -= dev->dma_pfn_offset; + return (dma_addr_t)__pfn_to_bus(pfn); + } + + static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr) + { +- return __bus_to_pfn(addr); ++ unsigned long pfn = __bus_to_pfn(addr); ++ ++ if (dev) ++ pfn += dev->dma_pfn_offset; ++ ++ return pfn; + } + + static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) + { ++ if (dev) { ++ unsigned long pfn = dma_to_pfn(dev, addr); ++ ++ return phys_to_virt(__pfn_to_phys(pfn)); ++ } ++ + return (void *)__bus_to_virt((unsigned long)addr); + } + + static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) + { ++ if (dev) ++ return pfn_to_dma(dev, virt_to_pfn(addr)); ++ + return (dma_addr_t)__virt_to_bus((unsigned long)(addr)); + } + + +From 1b1de68277ff97f836021328e6ac6fbb24494c73 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:18:28 +0200 +Subject: [PATCH 163/216] fbdev: bcm2708_fb: Add ARCH_BCM2835 support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree support. +Pass the device to dma_alloc_coherent() in order to get the +correct bus address on ARCH_BCM2835. +Use the new DMA legacy API header file. +Including is not necessary. + +Signed-off-by: Noralf Trønnes +--- + drivers/video/fbdev/bcm2708_fb.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +index 345c15e..f6ac7da 100644 +--- a/drivers/video/fbdev/bcm2708_fb.c ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -24,16 +24,13 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include + #include +- +-#include +-#include +- + #include + #include + #include +@@ -628,7 +625,7 @@ static int bcm2708_fb_register(struct bcm2708_fb *fb) + void *mem; + + mem = +- dma_alloc_coherent(NULL, PAGE_ALIGN(sizeof(*fb->info)), &dma, ++ dma_alloc_coherent(&fb->dev->dev, PAGE_ALIGN(sizeof(*fb->info)), &dma, + GFP_KERNEL); + + if (NULL == mem) { +@@ -783,12 +780,19 @@ static int bcm2708_fb_remove(struct platform_device *dev) + return 0; + } + ++static const struct of_device_id bcm2708_fb_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-fb", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2708_fb_of_match_table); ++ + static struct platform_driver bcm2708_fb_driver = { + .probe = bcm2708_fb_probe, + .remove = bcm2708_fb_remove, + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, ++ .of_match_table = bcm2708_fb_of_match_table, + }, + }; + + +From e6d3d3d4102639777a7261d9eb6f195176fc50bb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:20:00 +0200 +Subject: [PATCH 164/216] BCM270x: Remove header file mach/dma.h +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This header file can be removed since there are no more users. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/include/mach/dma.h | 2 -- + arch/arm/mach-bcm2709/include/mach/dma.h | 2 -- + 2 files changed, 4 deletions(-) + delete mode 100644 arch/arm/mach-bcm2708/include/mach/dma.h + delete mode 100644 arch/arm/mach-bcm2709/include/mach/dma.h + +diff --git a/arch/arm/mach-bcm2708/include/mach/dma.h b/arch/arm/mach-bcm2708/include/mach/dma.h +deleted file mode 100644 +index d826705..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/dma.h ++++ /dev/null +@@ -1,2 +0,0 @@ +-/* This file can be removed when all the drivers have been updated */ +-#include +diff --git a/arch/arm/mach-bcm2709/include/mach/dma.h b/arch/arm/mach-bcm2709/include/mach/dma.h +deleted file mode 100644 +index d826705..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/dma.h ++++ /dev/null +@@ -1,2 +0,0 @@ +-/* This file can be removed when all the drivers have been updated */ +-#include + +From 11e908510cac293a92b124f36476ae7fe4c581ec Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:21:31 +0200 +Subject: [PATCH 165/216] BCM270x_DT: Add bcm2708-fb device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add bcm2708-fb to Device Tree and don't add the +platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++++ + arch/arm/boot/dts/bcm2708_common.dtsi | 5 +++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + 6 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index f25563a..9a8fed0 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -49,6 +49,10 @@ + bus-width = <4>; + }; + ++&fb { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 17b4b8c..cf67ec9 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -49,6 +49,10 @@ + bus-width = <4>; + }; + ++&fb { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 1c8c1af..c5ed34b 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -109,6 +109,11 @@ + leds: leds { + compatible = "gpio-leds"; + }; ++ ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ status = "disabled"; ++ }; + }; + + clocks { +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index c73249b..1c865de 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -49,6 +49,10 @@ + bus-width = <4>; + }; + ++&fb { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 7cc47c1..cde2124 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -928,7 +928,7 @@ void __init bcm2708_init(void) + bcm_register_device_dt(&w1_device); + #endif + bcm_register_device(&bcm2708_systemtimer_device); +- bcm_register_device(&bcm2708_fb_device); ++ bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device(&bcm2708_usb_device); + bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 2c0a664..95db41ff 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -951,7 +951,7 @@ void __init bcm2709_init(void) + #ifdef SYSTEM_TIMER + bcm_register_device(&bcm2708_systemtimer_device); + #endif +- bcm_register_device(&bcm2708_fb_device); ++ bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device(&bcm2708_usb_device); + bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + +From 0abe9b6fa045617f9fb0f8afe64b69072821d241 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 5 May 2015 13:10:11 -0700 +Subject: [PATCH 166/216] ARM: bcm2835: Use 0x4 prefix for DMA bus addresses to + SDRAM. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There exists a tiny MMU, configurable only by the VC (running the +closed firmware), which maps from the ARM's physical addresses to bus +addresses. These bus addresses determine the caching behavior in the +VC's L1/L2 (note: separate from the ARM's L1/L2) according to the top +2 bits. The bits in the bus address mean: + +From the VideoCore processor: +0x0... L1 and L2 cache allocating and coherent +0x4... L1 non-allocating, but coherent. L2 allocating and coherent +0x8... L1 non-allocating, but coherent. L2 non-allocating, but coherent +0xc... SDRAM alias. Cache is bypassed. Not L1 or L2 allocating or coherent + +From the GPU peripherals (note: all peripherals bypass the L1 +cache. The ARM will see this view once through the VC MMU): +0x0... Do not use +0x4... L1 non-allocating, and incoherent. L2 allocating and coherent. +0x8... L1 non-allocating, and incoherent. L2 non-allocating, but coherent +0xc... SDRAM alias. Cache is bypassed. Not L1 or L2 allocating or coherent + +The 2835 firmware always configures the MMU to turn ARM physical +addresses with 0x0 top bits to 0x4, meaning present in L2 but +incoherent with L1. However, any bus addresses we were generating in +the kernel to be passed to a device had 0x0 bits. That would be a +reserved (possibly totally incoherent) value if sent to a GPU +peripheral like USB, or L1 allocating if sent to the VC (like a +firmware property request). By setting dma-ranges, all of the devices +below it get a dev->dma_pfn_offset, so that dma_alloc_coherent() and +friends return addresses with 0x4 bits and avoid cache incoherency. + +This matches the behavior in the downstream 2708 kernel (see +BUS_OFFSET in arch/arm/mach-bcm2708/include/mach/memory.h). + +Signed-off-by: Eric Anholt +Tested-by: Noralf Trønnes +Acked-by: Stephen Warren +Cc: popcornmix@gmail.com +--- + arch/arm/boot/dts/bcm2835.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 06cba29..f91db90 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -14,6 +14,7 @@ + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x7e000000 0x20000000 0x02000000>; ++ dma-ranges = <0x40000000 0x00000000 0x20000000>; + + timer@7e003000 { + compatible = "brcm,bcm2835-system-timer"; + +From fabd2cdba17ab122a41957bced0c06e993b559a8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:24:13 +0200 +Subject: [PATCH 167/216] bcm2835: Add bcm2708-fb to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add framebuffer device to Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 4 ++++ + arch/arm/boot/dts/bcm2835.dtsi | 5 +++++ + 2 files changed, 9 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index 9f4ed2f..f2ce803 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -49,3 +49,7 @@ + status = "okay"; + bus-width = <4>; + }; ++ ++&fb { ++ status = "okay"; ++}; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index f91db90..f3ab9b3 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -159,6 +159,11 @@ + arm-pmu { + compatible = "arm,arm1176-pmu"; + }; ++ ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ status = "disabled"; ++ }; + }; + + clocks { + +From 81530cfc1eb8c2069f7083fa2cc56b3b7470eb29 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:24:35 +0200 +Subject: [PATCH 168/216] bcm2835: bcm2835_defconfig use FB_BCM2708 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Enable the bcm2708 framebuffer driver. +Disable the simple framebuffer driver, which matches the +device handed over by u-boot. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2835_defconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 26b4c75..1af6069 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -72,7 +72,7 @@ CONFIG_SPI_BCM2835=y + CONFIG_GPIO_SYSFS=y + # CONFIG_HWMON is not set + CONFIG_FB=y +-CONFIG_FB_SIMPLE=y ++CONFIG_FB_BCM2708=y + CONFIG_FRAMEBUFFER_CONSOLE=y + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y + CONFIG_USB=y + +From 9e0da80c0836b21773e84b699f2e94e50680b485 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 19 May 2015 11:41:11 +0100 +Subject: [PATCH 169/216] BCM2708_DT: Enable mmc and fb in the CM dtsi + +--- + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 8340c1e..815a3a4 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -25,6 +25,15 @@ + }; + }; + ++&mmc { ++ status = "okay"; ++ bus-width = <4>; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ + / { + __overrides__ { + act_led_gpio = <&act_led>,"gpios:4"; + +From c95de8db34841f61ef2cb38afb8b84973bd9aa6c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 19 May 2015 13:31:50 +0200 +Subject: [PATCH 170/216] BCM270x: Add vchiq device to platform file and Device + Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Prepare to turn the vchiq module into a driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 6 ++++++ + arch/arm/mach-bcm2708/bcm2708.c | 26 ++++++++++++++++++++++++++ + arch/arm/mach-bcm2708/include/mach/platform.h | 1 + + arch/arm/mach-bcm2709/bcm2709.c | 26 ++++++++++++++++++++++++++ + arch/arm/mach-bcm2709/include/mach/platform.h | 1 + + 5 files changed, 60 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index c5ed34b..2d9bcd8 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -114,6 +114,12 @@ + compatible = "brcm,bcm2708-fb"; + status = "disabled"; + }; ++ ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ }; + }; + + clocks { +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index cde2124..81cc988 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -437,6 +437,31 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static struct resource bcm2708_vchiq_resources[] = { ++ { ++ .start = ARMCTRL_0_BELL_BASE, ++ .end = ARMCTRL_0_BELL_BASE + 16, ++ .flags = IORESOURCE_MEM, ++ }, { ++ .start = IRQ_ARM_DOORBELL_0, ++ .end = IRQ_ARM_DOORBELL_0, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 vchiq_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_vchiq_device = { ++ .name = "bcm2835_vchiq", ++ .id = -1, ++ .resource = bcm2708_vchiq_resources, ++ .num_resources = ARRAY_SIZE(bcm2708_vchiq_resources), ++ .dev = { ++ .dma_mask = &vchiq_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + #ifdef CONFIG_BCM2708_GPIO + #define BCM_GPIO_DRIVER_NAME "bcm2708_gpio" + +@@ -909,6 +934,7 @@ void __init bcm2708_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); + #endif +diff --git a/arch/arm/mach-bcm2708/include/mach/platform.h b/arch/arm/mach-bcm2708/include/mach/platform.h +index bef3e5a..69674e9 100644 +--- a/arch/arm/mach-bcm2708/include/mach/platform.h ++++ b/arch/arm/mach-bcm2708/include/mach/platform.h +@@ -81,6 +81,7 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_BELL_BASE (ARMCTRL_0_SBM_BASE + 0x40) /* User 0 (ARM)'s Doorbell */ + #define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 95db41ff..528bf6e 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -456,6 +456,31 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static struct resource bcm2708_vchiq_resources[] = { ++ { ++ .start = ARMCTRL_0_BELL_BASE, ++ .end = ARMCTRL_0_BELL_BASE + 16, ++ .flags = IORESOURCE_MEM, ++ }, { ++ .start = IRQ_ARM_DOORBELL_0, ++ .end = IRQ_ARM_DOORBELL_0, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 vchiq_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_vchiq_device = { ++ .name = "bcm2835_vchiq", ++ .id = -1, ++ .resource = bcm2708_vchiq_resources, ++ .num_resources = ARRAY_SIZE(bcm2708_vchiq_resources), ++ .dev = { ++ .dma_mask = &vchiq_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + #ifdef CONFIG_BCM2708_GPIO + #define BCM_GPIO_DRIVER_NAME "bcm2708_gpio" + +@@ -930,6 +955,7 @@ void __init bcm2709_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); + #endif +diff --git a/arch/arm/mach-bcm2709/include/mach/platform.h b/arch/arm/mach-bcm2709/include/mach/platform.h +index 5574bb5..be99733 100644 +--- a/arch/arm/mach-bcm2709/include/mach/platform.h ++++ b/arch/arm/mach-bcm2709/include/mach/platform.h +@@ -81,6 +81,7 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_BELL_BASE (ARMCTRL_0_SBM_BASE + 0x40) /* User 0 (ARM)'s Doorbell */ + #define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + + +From b723b4395acda96c805d6cd382d5732efa6e449c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 19 May 2015 13:32:34 +0200 +Subject: [PATCH 171/216] bcm2708: vchiq: Add Device Tree support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Turn vchiq into a driver and stop hardcoding resources. +Use devm_* functions in probe path to simplify cleanup. +A global variable is used to hold the register address. This is done +to keep this patch as small as possible. +Also make available on ARCH_BCM2835. +Based on work by Lubomir Rintel. + +Signed-off-by: Noralf Trønnes +--- + drivers/misc/vc04_services/Kconfig | 2 +- + .../interface/vchiq_arm/vchiq_2835_arm.c | 124 +++++++++------------ + .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 44 ++++---- + .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 7 +- + 4 files changed, 79 insertions(+), 98 deletions(-) + +diff --git a/drivers/misc/vc04_services/Kconfig b/drivers/misc/vc04_services/Kconfig +index b94e6cd..b4198c2 100644 +--- a/drivers/misc/vc04_services/Kconfig ++++ b/drivers/misc/vc04_services/Kconfig +@@ -1,6 +1,6 @@ + config BCM2708_VCHIQ + tristate "Videocore VCHIQ" +- depends on MACH_BCM2708 || MACH_BCM2709 ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 + default y + help + Kernel to VideoCore communication interface for the +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 70e5086..660aad2 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -35,22 +35,17 @@ + #include + #include + #include +-#include + #include + #include + #include + #include + #include ++#include + #include + #include + +-#include +- +-#include +- + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) + +-#define VCHIQ_DOORBELL_IRQ IRQ_ARM_DOORBELL_0 + #define VCHIQ_ARM_ADDRESS(x) ((void *)__virt_to_bus((unsigned)x)) + + #include "vchiq_arm.h" +@@ -60,14 +55,15 @@ + + #define MAX_FRAGMENTS (VCHIQ_NUM_CURRENT_BULKS * 2) + ++#define BELL0 0x00 ++#define BELL2 0x08 ++ + typedef struct vchiq_2835_state_struct { + int inited; + VCHIQ_ARM_STATE_T arm_state; + } VCHIQ_2835_ARM_STATE_T; + +-static char *g_slot_mem; +-static int g_slot_mem_size; +-dma_addr_t g_slot_phys; ++static void __iomem *g_regs; + static FRAGMENTS_T *g_fragments_base; + static FRAGMENTS_T *g_free_fragments; + struct semaphore g_free_fragments_sema; +@@ -86,43 +82,40 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + static void + free_pagelist(PAGELIST_T *pagelist, int actual); + +-int __init +-vchiq_platform_init(VCHIQ_STATE_T *state) ++int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + { ++ struct device *dev = &pdev->dev; + VCHIQ_SLOT_ZERO_T *vchiq_slot_zero; +- int frag_mem_size; +- int err; +- int i; ++ struct resource *res; ++ void *slot_mem; ++ dma_addr_t slot_phys; ++ int slot_mem_size, frag_mem_size; ++ int err, irq, i; + + /* Allocate space for the channels in coherent memory */ +- g_slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); ++ slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); + frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); + +- g_slot_mem = dma_alloc_coherent(NULL, g_slot_mem_size + frag_mem_size, +- &g_slot_phys, GFP_KERNEL); +- +- if (!g_slot_mem) { +- vchiq_log_error(vchiq_arm_log_level, +- "Unable to allocate channel memory"); +- err = -ENOMEM; +- goto failed_alloc; ++ slot_mem = dmam_alloc_coherent(dev, slot_mem_size + frag_mem_size, ++ &slot_phys, GFP_KERNEL); ++ if (!slot_mem) { ++ dev_err(dev, "could not allocate DMA memory\n"); ++ return -ENOMEM; + } + +- WARN_ON(((int)g_slot_mem & (PAGE_SIZE - 1)) != 0); ++ WARN_ON(((int)slot_mem & (PAGE_SIZE - 1)) != 0); + +- vchiq_slot_zero = vchiq_init_slots(g_slot_mem, g_slot_mem_size); +- if (!vchiq_slot_zero) { +- err = -EINVAL; +- goto failed_init_slots; +- } ++ vchiq_slot_zero = vchiq_init_slots(slot_mem, slot_mem_size); ++ if (!vchiq_slot_zero) ++ return -EINVAL; + + vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX] = +- (int)g_slot_phys + g_slot_mem_size; ++ (int)slot_phys + slot_mem_size; + vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX] = + MAX_FRAGMENTS; + +- g_fragments_base = (FRAGMENTS_T *)(g_slot_mem + g_slot_mem_size); +- g_slot_mem_size += frag_mem_size; ++ g_fragments_base = (FRAGMENTS_T *)(slot_mem + slot_mem_size); ++ slot_mem_size += frag_mem_size; + + g_free_fragments = g_fragments_base; + for (i = 0; i < (MAX_FRAGMENTS - 1); i++) { +@@ -132,54 +125,46 @@ vchiq_platform_init(VCHIQ_STATE_T *state) + *(FRAGMENTS_T **)&g_fragments_base[i] = NULL; + sema_init(&g_free_fragments_sema, MAX_FRAGMENTS); + +- if (vchiq_init_state(state, vchiq_slot_zero, 0/*slave*/) != +- VCHIQ_SUCCESS) { +- err = -EINVAL; +- goto failed_vchiq_init; ++ if (vchiq_init_state(state, vchiq_slot_zero, 0) != VCHIQ_SUCCESS) ++ return -EINVAL; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ g_regs = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(g_regs)) ++ return PTR_ERR(g_regs); ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq <= 0) { ++ dev_err(dev, "failed to get IRQ\n"); ++ return irq; + } + +- err = request_irq(VCHIQ_DOORBELL_IRQ, vchiq_doorbell_irq, +- IRQF_IRQPOLL, "VCHIQ doorbell", +- state); +- if (err < 0) { +- vchiq_log_error(vchiq_arm_log_level, "%s: failed to register " +- "irq=%d err=%d", __func__, +- VCHIQ_DOORBELL_IRQ, err); +- goto failed_request_irq; ++ err = devm_request_irq(dev, irq, vchiq_doorbell_irq, IRQF_IRQPOLL, ++ "VCHIQ doorbell", state); ++ if (err) { ++ dev_err(dev, "failed to register irq=%d\n", irq); ++ return err; + } + + /* Send the base address of the slots to VideoCore */ + + dsb(); /* Ensure all writes have completed */ + +- bcm_mailbox_write(MBOX_CHAN_VCHIQ, (unsigned int)g_slot_phys); ++ err = bcm_mailbox_write(MBOX_CHAN_VCHIQ, (unsigned int)slot_phys); ++ if (err) { ++ dev_err(dev, "mailbox write failed\n"); ++ return err; ++ } + + vchiq_log_info(vchiq_arm_log_level, +- "vchiq_init - done (slots %x, phys %x)", +- (unsigned int)vchiq_slot_zero, g_slot_phys); ++ "vchiq_init - done (slots %x, phys %pad)", ++ (unsigned int)vchiq_slot_zero, &slot_phys); + +- vchiq_call_connected_callbacks(); ++ vchiq_call_connected_callbacks(); + + return 0; +- +-failed_request_irq: +-failed_vchiq_init: +-failed_init_slots: +- dma_free_coherent(NULL, g_slot_mem_size, g_slot_mem, g_slot_phys); +- +-failed_alloc: +- return err; +-} +- +-void __exit +-vchiq_platform_exit(VCHIQ_STATE_T *state) +-{ +- free_irq(VCHIQ_DOORBELL_IRQ, state); +- dma_free_coherent(NULL, g_slot_mem_size, +- g_slot_mem, g_slot_phys); + } + +- + VCHIQ_STATUS_T + vchiq_platform_init_state(VCHIQ_STATE_T *state) + { +@@ -213,11 +198,8 @@ remote_event_signal(REMOTE_EVENT_T *event) + + dsb(); /* data barrier operation */ + +- if (event->armed) { +- /* trigger vc interrupt */ +- +- writel(0, __io_address(ARM_0_BELL2)); +- } ++ if (event->armed) ++ writel(0, g_regs + BELL2); /* trigger vc interrupt */ + } + + int +@@ -341,7 +323,7 @@ vchiq_doorbell_irq(int irq, void *dev_id) + unsigned int status; + + /* Read (and clear) the doorbell */ +- status = readl(__io_address(ARM_0_BELL0)); ++ status = readl(g_regs + BELL0); + + if (status & 0x4) { /* Was the doorbell rung? */ + remote_event_pollall(state); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +index 0ad9656..31e2cba 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + + #include "vchiq_core.h" + #include "vchiq_ioctl.h" +@@ -2790,15 +2791,7 @@ void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, + } + } + +- +-/**************************************************************************** +-* +-* vchiq_init - called when the module is loaded. +-* +-***************************************************************************/ +- +-static int __init +-vchiq_init(void) ++static int vchiq_probe(struct platform_device *pdev) + { + int err; + void *ptr_err; +@@ -2835,7 +2828,7 @@ vchiq_init(void) + if (IS_ERR(ptr_err)) + goto failed_device_create; + +- err = vchiq_platform_init(&g_state); ++ err = vchiq_platform_init(pdev, &g_state); + if (err != 0) + goto failed_platform_init; + +@@ -2862,23 +2855,32 @@ vchiq_init(void) + return err; + } + +-/**************************************************************************** +-* +-* vchiq_exit - called when the module is unloaded. +-* +-***************************************************************************/ +- +-static void __exit +-vchiq_exit(void) ++static int vchiq_remove(struct platform_device *pdev) + { +- vchiq_platform_exit(&g_state); + device_destroy(vchiq_class, vchiq_devid); + class_destroy(vchiq_class); + cdev_del(&vchiq_cdev); + unregister_chrdev_region(vchiq_devid, 1); ++ ++ return 0; + } + +-module_init(vchiq_init); +-module_exit(vchiq_exit); ++static const struct of_device_id vchiq_of_match[] = { ++ { .compatible = "brcm,bcm2835-vchiq", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, vchiq_of_match); ++ ++static struct platform_driver vchiq_driver = { ++ .driver = { ++ .name = "bcm2835_vchiq", ++ .owner = THIS_MODULE, ++ .of_match_table = vchiq_of_match, ++ }, ++ .probe = vchiq_probe, ++ .remove = vchiq_remove, ++}; ++module_platform_driver(vchiq_driver); ++ + MODULE_LICENSE("GPL"); + MODULE_AUTHOR("Broadcom Corporation"); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +index d1e2741..9740e1a 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +@@ -36,6 +36,7 @@ + #define VCHIQ_ARM_H + + #include ++#include + #include + #include + #include "vchiq_core.h" +@@ -128,11 +129,7 @@ typedef struct vchiq_arm_state_struct { + extern int vchiq_arm_log_level; + extern int vchiq_susp_log_level; + +-extern int __init +-vchiq_platform_init(VCHIQ_STATE_T *state); +- +-extern void __exit +-vchiq_platform_exit(VCHIQ_STATE_T *state); ++int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state); + + extern VCHIQ_STATE_T * + vchiq_get_state(void); + +From a368d9389c5c346a4e5b6ee63a5b28c45184aa20 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 19 May 2015 13:32:50 +0200 +Subject: [PATCH 172/216] bcm2835: Add bcm2835-vchiq to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add vchiq to Device Tree. There are no kernel users yet, +but it's available to userspace (vcgencmd). + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index f3ab9b3..72d0354 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -164,6 +164,12 @@ + compatible = "brcm,bcm2708-fb"; + status = "disabled"; + }; ++ ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ }; + }; + + clocks { + +From 0bf6760b3d81238fcfac05e88f66252192c5745d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 20 May 2015 09:29:46 +0100 +Subject: [PATCH 173/216] i2c-bcm2708: When using DT, leave the GPIO setup to + pinctrl + +--- + drivers/i2c/busses/i2c-bcm2708.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c +index 81e9374..8773203 100644 +--- a/drivers/i2c/busses/i2c-bcm2708.c ++++ b/drivers/i2c/busses/i2c-bcm2708.c +@@ -382,7 +382,8 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + goto out_clk_put; + } + +- bcm2708_i2c_init_pinmode(pdev->id); ++ if (!pdev->dev.of_node) ++ bcm2708_i2c_init_pinmode(pdev->id); + + bi = kzalloc(sizeof(*bi), GFP_KERNEL); + if (!bi) + +From aa0aca81361683205b07ecc895256795ea771528 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 21 May 2015 11:36:31 +0100 +Subject: [PATCH 174/216] vchiq: Change logging level for inbound data + +--- + drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +index 835688b..2c98da4 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +@@ -1782,7 +1782,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) + service->remoteport); + break; + case VCHIQ_MSG_DATA: +- vchiq_log_trace(vchiq_core_log_level, ++ vchiq_log_info(vchiq_core_log_level, + "%d: prs DATA@%x,%x (%d->%d)", + state->id, (unsigned int)header, size, + remoteport, localport); + +From 32477cf579fd64092395855bfacf907c7da8e3d8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 21 May 2015 13:24:35 +0200 +Subject: [PATCH 175/216] BCM270x: Add onboard sound device to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree support to alsa driver. +Add device to Device Tree. +Don't add platform devices when booting in DT mode. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 4 ++ + arch/arm/boot/dts/bcm2708_common.dtsi | 7 +++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + sound/arm/Kconfig | 3 +- + sound/arm/bcm2835.c | 91 ++++++++++++++++++++++++++++++++ + 9 files changed, 118 insertions(+), 3 deletions(-) + mode change 100755 => 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi + mode change 100755 => 100644 sound/arm/bcm2835.c + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 9a8fed0..6323c5b 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -53,6 +53,10 @@ + status = "okay"; + }; + ++&audio { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index cf67ec9..e1fe6a4 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -53,6 +53,10 @@ + status = "okay"; + }; + ++&audio { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +old mode 100755 +new mode 100644 +index 815a3a4..1c2cfcf +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -34,6 +34,10 @@ + status = "okay"; + }; + ++&audio { ++ status = "okay"; ++}; ++ + / { + __overrides__ { + act_led_gpio = <&act_led>,"gpios:4"; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 2d9bcd8..4bf6960 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -3,6 +3,13 @@ + / { + interrupt-parent = <&intc>; + ++ /* Onboard audio */ ++ audio: audio { ++ compatible = "brcm,bcm2835-audio"; ++ brcm,pwm-channels = <8>; ++ status = "disabled"; ++ }; ++ + soc: soc { + compatible = "simple-bus"; + #address-cells = <1>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 1c865de..921add1 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -53,6 +53,10 @@ + status = "okay"; + }; + ++&audio { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 81cc988..e451187 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -964,7 +964,7 @@ void __init bcm2708_init(void) + #endif + bcm2708_init_led(); + for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) +- bcm_register_device(&bcm2708_alsa_devices[i]); ++ bcm_register_device_dt(&bcm2708_alsa_devices[i]); + + bcm_register_device_dt(&bcm2708_spi_device); + +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 528bf6e..06c2c74 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -987,7 +987,7 @@ void __init bcm2709_init(void) + #endif + bcm2709_init_led(); + for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) +- bcm_register_device(&bcm2708_alsa_devices[i]); ++ bcm_register_device_dt(&bcm2708_alsa_devices[i]); + + bcm_register_device_dt(&bcm2708_spi_device); + +diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig +index ada7ba2..fcbe9d7 100644 +--- a/sound/arm/Kconfig ++++ b/sound/arm/Kconfig +@@ -41,7 +41,8 @@ config SND_PXA2XX_AC97 + + config SND_BCM2835 + tristate "BCM2835 ALSA driver" +- depends on (ARCH_BCM2708 || ARCH_BCM2709) && BCM2708_VCHIQ && SND ++ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) \ ++ && BCM2708_VCHIQ && SND + select SND_PCM + help + Say Y or M if you want to support BCM2835 Alsa pcm card driver +diff --git a/sound/arm/bcm2835.c b/sound/arm/bcm2835.c +old mode 100755 +new mode 100644 +index 7ed5079..6b545e7 +--- a/sound/arm/bcm2835.c ++++ b/sound/arm/bcm2835.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #include "bcm2835.h" + +@@ -81,6 +82,86 @@ static int snd_bcm2835_create(struct snd_card *card, + return 0; + } + ++static int snd_bcm2835_alsa_probe_dt(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ bcm2835_chip_t *chip; ++ struct snd_card *card; ++ u32 numchans; ++ int err, i; ++ ++ err = of_property_read_u32(dev->of_node, "brcm,pwm-channels", ++ &numchans); ++ if (err) { ++ dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'"); ++ return err; ++ } ++ ++ if (numchans == 0 || numchans > MAX_SUBSTREAMS) { ++ numchans = MAX_SUBSTREAMS; ++ dev_warn(dev, "Illegal 'brcm,pwm-channels' value, will use %u\n", ++ numchans); ++ } ++ ++ err = snd_card_new(NULL, -1, NULL, THIS_MODULE, 0, &card); ++ if (err) { ++ dev_err(dev, "Failed to create soundcard structure\n"); ++ return err; ++ } ++ ++ snd_card_set_dev(card, dev); ++ strcpy(card->driver, "bcm2835"); ++ strcpy(card->shortname, "bcm2835 ALSA"); ++ sprintf(card->longname, "%s", card->shortname); ++ ++ err = snd_bcm2835_create(card, pdev, &chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create bcm2835 chip\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_pcm(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 pcm device\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_spdif_pcm(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 spdif pcm device\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_ctl(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 ctl\n"); ++ goto err_free; ++ } ++ ++ for (i = 0; i < numchans; i++) { ++ chip->avail_substreams |= (1 << i); ++ chip->pdev[i] = pdev; ++ } ++ ++ err = snd_card_register(card); ++ if (err) { ++ dev_err(dev, "Failed to register bcm2835 ALSA card \n"); ++ goto err_free; ++ } ++ ++ g_card = card; ++ g_chip = chip; ++ platform_set_drvdata(pdev, card); ++ audio_info("bcm2835 ALSA card created with %u channels\n", numchans); ++ ++ return 0; ++ ++err_free: ++ snd_card_free(card); ++ ++ return err; ++} ++ + static int snd_bcm2835_alsa_probe(struct platform_device *pdev) + { + static int dev; +@@ -88,6 +169,9 @@ static int snd_bcm2835_alsa_probe(struct platform_device *pdev) + struct snd_card *card; + int err; + ++ if (pdev->dev.of_node) ++ return snd_bcm2835_alsa_probe_dt(pdev); ++ + if (dev >= MAX_SUBSTREAMS) + return -ENODEV; + +@@ -224,6 +308,12 @@ static int snd_bcm2835_alsa_resume(struct platform_device *pdev) + + #endif + ++static const struct of_device_id snd_bcm2835_of_match_table[] = { ++ { .compatible = "brcm,bcm2835-audio", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table); ++ + static struct platform_driver bcm2835_alsa0_driver = { + .probe = snd_bcm2835_alsa_probe, + .remove = snd_bcm2835_alsa_remove, +@@ -234,6 +324,7 @@ static struct platform_driver bcm2835_alsa0_driver = { + .driver = { + .name = "bcm2835_AUD0", + .owner = THIS_MODULE, ++ .of_match_table = snd_bcm2835_of_match_table, + }, + }; + + +From a8d9f167700bc9fd113a303b4944272519fc40f0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 21 May 2015 13:25:32 +0200 +Subject: [PATCH 176/216] bcm2835: Add bcm2835-audio to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add onboard sound device to Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index f2ce803..f23835e 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -14,6 +14,12 @@ + linux,default-trigger = "heartbeat"; + }; + }; ++ ++ /* Onboard audio */ ++ audio: audio { ++ compatible = "brcm,bcm2835-audio"; ++ brcm,pwm-channels = <8>; ++ }; + }; + + &gpio { + +From ead779a26fcab730a6d4be4c7b48c62b22afd8a5 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 18 May 2015 16:59:02 +0100 +Subject: [PATCH 177/216] config: Add CONFIG_CIFS_UPCALL + +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index ff87581..6fdd9bb 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -1118,6 +1118,7 @@ CONFIG_NFSD_V3_ACL=y + CONFIG_NFSD_V4=y + CONFIG_CIFS=m + CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y + CONFIG_CIFS_XATTR=y + CONFIG_CIFS_POSIX=y + CONFIG_9P_FS=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index e339979..93b3de1 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -1111,6 +1111,7 @@ CONFIG_NFSD_V3_ACL=y + CONFIG_NFSD_V4=y + CONFIG_CIFS=m + CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y + CONFIG_CIFS_XATTR=y + CONFIG_CIFS_POSIX=y + CONFIG_9P_FS=m + +From 2728618d457e238f4f95d96ad9303a1d816109a9 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 18 May 2015 16:59:13 +0100 +Subject: [PATCH 178/216] config: Add CONFIG_FB_SSD1307=m + +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 6fdd9bb..9daaeb7 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -769,6 +769,7 @@ CONFIG_VIDEO_OV7640=m + CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y ++CONFIG_FB_SSD1307=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 93b3de1..dc27aeb 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -762,6 +762,7 @@ CONFIG_VIDEO_OV7640=m + CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y ++CONFIG_FB_SSD1307=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y + +From 25b5c8e286f3a2b1779c63754b8993107bb416b0 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 13 Oct 2014 11:47:53 +0100 +Subject: [PATCH 179/216] Improve __copy_to_user and __copy_from_user + performance + +Provide a __copy_from_user that uses memcpy. On BCM2708, use +optimised memcpy/memmove/memcmp/memset implementations. +--- + arch/arm/include/asm/string.h | 5 + + arch/arm/include/asm/uaccess.h | 1 + + arch/arm/lib/Makefile | 15 +- + arch/arm/lib/arm-mem.h | 159 ++++++++++++ + arch/arm/lib/copy_from_user.S | 4 +- + arch/arm/lib/exports_rpi.c | 37 +++ + arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ + arch/arm/lib/memcpy_rpi.S | 59 +++++ + arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ + arch/arm/lib/memmove_rpi.S | 61 +++++ + arch/arm/lib/memset_rpi.S | 121 +++++++++ + arch/arm/lib/uaccess_with_memcpy.c | 112 +++++++- + 12 files changed, 1359 insertions(+), 6 deletions(-) + create mode 100644 arch/arm/lib/arm-mem.h + create mode 100644 arch/arm/lib/exports_rpi.c + create mode 100644 arch/arm/lib/memcmp_rpi.S + create mode 100644 arch/arm/lib/memcpy_rpi.S + create mode 100644 arch/arm/lib/memcpymove.h + create mode 100644 arch/arm/lib/memmove_rpi.S + create mode 100644 arch/arm/lib/memset_rpi.S + +diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h +index cf4f3aa..9fe7780 100644 +--- a/arch/arm/include/asm/string.h ++++ b/arch/arm/include/asm/string.h +@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); + #define __HAVE_ARCH_MEMSET + extern void * memset(void *, int, __kernel_size_t); + ++#ifdef CONFIG_MACH_BCM2708 ++#define __HAVE_ARCH_MEMCMP ++extern int memcmp(const void *, const void *, size_t); ++#endif ++ + extern void __memzero(void *ptr, __kernel_size_t n); + + #define memset(p,v,n) \ +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index ce0786e..b85b93d 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -475,6 +475,7 @@ do { \ + + #ifdef CONFIG_MMU + extern unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n); ++extern unsigned long __must_check __copy_from_user_std(void *to, const void __user *from, unsigned long n); + extern unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n); + extern unsigned long __must_check __copy_to_user_std(void __user *to, const void *from, unsigned long n); + extern unsigned long __must_check __clear_user(void __user *addr, unsigned long n); +diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile +index d8a7807..9c7dc5b 100644 +--- a/arch/arm/lib/Makefile ++++ b/arch/arm/lib/Makefile +@@ -6,9 +6,8 @@ + + lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ +- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ +- memmove.o memset.o memzero.o setbit.o \ +- strchr.o strrchr.o \ ++ delay.o delay-loop.o findbit.o memchr.o memzero.o \ ++ setbit.o strchr.o strrchr.o \ + testchangebit.o testclearbit.o testsetbit.o \ + ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ + ucmpdi2.o lib1funcs.o div64.o \ +@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ + copy_from_user.o copy_to_user.o + ++# Choose optimised implementations for Raspberry Pi ++ifeq ($(CONFIG_MACH_BCM2708),y) ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 ++ obj-$(CONFIG_MODULES) += exports_rpi.o ++ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o ++else ++ lib-y += memcpy.o memmove.o memset.o ++endif ++ + # using lib_ here won't override already available weak symbols + obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o + +diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h +new file mode 100644 +index 0000000..5d4bda1 +--- /dev/null ++++ b/arch/arm/lib/arm-mem.h +@@ -0,0 +1,159 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++.macro myfunc fname ++ .func fname ++ .global fname ++fname: ++.endm ++ ++.macro preload_leading_step1 backwards, ptr, base ++/* If the destination is already 16-byte aligned, then we need to preload ++ * between 0 and prefetch_distance (inclusive) cache lines ahead so there ++ * are no gaps when the inner loop starts. ++ */ ++ .if backwards ++ sub ptr, base, #1 ++ bic ptr, ptr, #31 ++ .else ++ bic ptr, base, #31 ++ .endif ++ .set OFFSET, 0 ++ .rept prefetch_distance+1 ++ pld [ptr, #OFFSET] ++ .if backwards ++ .set OFFSET, OFFSET-32 ++ .else ++ .set OFFSET, OFFSET+32 ++ .endif ++ .endr ++.endm ++ ++.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp ++/* However, if the destination is not 16-byte aligned, we may need to ++ * preload one more cache line than that. The question we need to ask is: ++ * are the leading bytes more than the amount by which the source ++ * pointer will be rounded down for preloading, and if so, by how many ++ * cache lines? ++ */ ++ .if backwards ++/* Here we compare against how many bytes we are into the ++ * cache line, counting down from the highest such address. ++ * Effectively, we want to calculate ++ * leading_bytes = dst&15 ++ * cacheline_offset = 31-((src-leading_bytes-1)&31) ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0, or rearranging: ++ * leading_bytes + (src-leading_bytes-1)&31 <= 31 ++ */ ++ mov tmp, base, lsl #32-5 ++ sbc tmp, tmp, leading_bytes, lsl #32-5 ++ adds tmp, tmp, leading_bytes, lsl #32-5 ++ bcc 61f ++ pld [ptr, #-32*(prefetch_distance+1)] ++ .else ++/* Effectively, we want to calculate ++ * leading_bytes = (-dst)&15 ++ * cacheline_offset = (src+leading_bytes)&31 ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0. ++ */ ++ mov tmp, base, lsl #32-5 ++ add tmp, tmp, leading_bytes, lsl #32-5 ++ rsbs tmp, tmp, leading_bytes, lsl #32-5 ++ bls 61f ++ pld [ptr, #32*(prefetch_distance+1)] ++ .endif ++61: ++.endm ++ ++.macro preload_trailing backwards, base, remain, tmp ++ /* We need either 0, 1 or 2 extra preloads */ ++ .if backwards ++ rsb tmp, base, #0 ++ mov tmp, tmp, lsl #32-5 ++ .else ++ mov tmp, base, lsl #32-5 ++ .endif ++ adds tmp, tmp, remain, lsl #32-5 ++ adceqs tmp, tmp, #0 ++ /* The instruction above has two effects: ensures Z is only ++ * set if C was clear (so Z indicates that both shifted quantities ++ * were 0), and clears C if Z was set (so C indicates that the sum ++ * of the shifted quantities was greater and not equal to 32) */ ++ beq 82f ++ .if backwards ++ sub tmp, base, #1 ++ bic tmp, tmp, #31 ++ .else ++ bic tmp, base, #31 ++ .endif ++ bcc 81f ++ .if backwards ++ pld [tmp, #-32*(prefetch_distance+1)] ++81: ++ pld [tmp, #-32*prefetch_distance] ++ .else ++ pld [tmp, #32*(prefetch_distance+2)] ++81: ++ pld [tmp, #32*(prefetch_distance+1)] ++ .endif ++82: ++.endm ++ ++.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 ++ .if backwards ++ sub tmp0, base, #1 ++ bic tmp0, tmp0, #31 ++ pld [tmp0] ++ sub tmp1, base, remain, lsl #shift ++ .else ++ bic tmp0, base, #31 ++ pld [tmp0] ++ add tmp1, base, remain, lsl #shift ++ sub tmp1, tmp1, #1 ++ .endif ++ bic tmp1, tmp1, #31 ++ cmp tmp1, tmp0 ++ beq 92f ++ .if narrow_case ++ /* In this case, all the data fits in either 1 or 2 cache lines */ ++ pld [tmp1] ++ .else ++91: ++ .if backwards ++ sub tmp0, tmp0, #32 ++ .else ++ add tmp0, tmp0, #32 ++ .endif ++ cmp tmp0, tmp1 ++ pld [tmp0] ++ bne 91b ++ .endif ++92: ++.endm +diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S +index 7a235b9..8aff879 100644 +--- a/arch/arm/lib/copy_from_user.S ++++ b/arch/arm/lib/copy_from_user.S +@@ -89,11 +89,13 @@ + + .text + +-ENTRY(__copy_from_user) ++ENTRY(__copy_from_user_std) ++WEAK(__copy_from_user) + + #include "copy_template.S" + + ENDPROC(__copy_from_user) ++ENDPROC(__copy_from_user_std) + + .pushsection .fixup,"ax" + .align 0 +diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c +new file mode 100644 +index 0000000..1f82604 +--- /dev/null ++++ b/arch/arm/lib/exports_rpi.c +@@ -0,0 +1,37 @@ ++/** ++ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions, and the following disclaimer, ++ * without modification. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS ++ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include ++#include ++ ++EXPORT_SYMBOL(memcmp); +diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S +new file mode 100644 +index 0000000..bf6e4ed +--- /dev/null ++++ b/arch/arm/lib/memcmp_rpi.S +@@ -0,0 +1,285 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include ++#include "arm-mem.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++.macro memcmp_process_head unaligned ++ .if unaligned ++ ldr DAT0, [S_1], #4 ++ ldr DAT1, [S_1], #4 ++ ldr DAT2, [S_1], #4 ++ ldr DAT3, [S_1], #4 ++ .else ++ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} ++ .endif ++ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} ++.endm ++ ++.macro memcmp_process_tail ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ cmpeq DAT3, DAT7 ++ bne 200f ++.endm ++ ++.macro memcmp_leading_31bytes ++ movs DAT0, OFF, lsl #31 ++ ldrmib DAT0, [S_1], #1 ++ ldrcsh DAT1, [S_1], #2 ++ ldrmib DAT4, [S_2], #1 ++ ldrcsh DAT5, [S_2], #2 ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ submi N, N, #1 ++ subcs N, N, #2 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++ movs DAT0, OFF, lsl #29 ++ ldrmi DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ ldrcs DAT2, [S_1], #4 ++ ldrmi DAT4, [S_2], #4 ++ ldmcsia S_2!, {DAT5, DAT6} ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movcc DAT2, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ movcc DAT6, #0 ++ submi N, N, #4 ++ subcs N, N, #8 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ tst OFF, #16 ++ beq 105f ++ memcmp_process_head 1 ++ sub N, N, #16 ++ memcmp_process_tail ++105: ++.endm ++ ++.macro memcmp_trailing_15bytes unaligned ++ movs N, N, lsl #29 ++ .if unaligned ++ ldrcs DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ .else ++ ldmcsia S_1!, {DAT0, DAT1} ++ .endif ++ ldrmi DAT2, [S_1], #4 ++ ldmcsia S_2!, {DAT4, DAT5} ++ ldrmi DAT6, [S_2], #4 ++ movcc DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT2, #0 ++ movcc DAT4, #0 ++ movcc DAT5, #0 ++ movpl DAT6, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ movs N, N, lsl #2 ++ ldrcsh DAT0, [S_1], #2 ++ ldrmib DAT1, [S_1] ++ ldrcsh DAT4, [S_2], #2 ++ ldrmib DAT5, [S_2] ++ movcc DAT0, #0 ++ movpl DAT1, #0 ++ movcc DAT4, #0 ++ movpl DAT5, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++.endm ++ ++.macro memcmp_long_inner_loop unaligned ++110: ++ memcmp_process_head unaligned ++ pld [S_2, #prefetch_distance*32 + 16] ++ memcmp_process_tail ++ memcmp_process_head unaligned ++ pld [S_1, OFF] ++ memcmp_process_tail ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, ++ * deal with final preloads */ ++ preload_trailing 0, S_1, N, DAT0 ++ preload_trailing 0, S_2, N, DAT0 ++ add N, N, #(prefetch_distance+2)*32 - 16 ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm ++ ++.macro memcmp_short_inner_loop unaligned ++ subs N, N, #16 /* simplifies inner loop termination */ ++ blo 122f ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++122: /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm ++ ++/* ++ * int memcmp(const void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to buffer 1 ++ * a2 = pointer to buffer 2 ++ * a3 = number of bytes to compare (as unsigned chars) ++ * On exit: ++ * a1 = >0/=0/<0 if s1 >/=/< s2 ++ */ ++ ++.set prefetch_distance, 2 ++ ++ENTRY(memcmp) ++ S_1 .req a1 ++ S_2 .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req ip ++ OFF .req lr ++ ++ push {DAT1-DAT6, lr} ++ setend be /* lowest-addressed bytes are most significant */ ++ ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 170f ++ ++ /* Long case */ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 0, DAT0, S_1 ++ preload_leading_step1 0, DAT1, S_2 ++ tst S_2, #31 ++ beq 154f ++ rsb OFF, S_2, #0 /* no need to AND with 15 here */ ++ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 ++ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 ++ memcmp_leading_31bytes ++154: /* Second source now cacheline (32-byte) aligned; we have at ++ * least one prefetch to go. */ ++ /* Prefetch offset is best selected such that it lies in the ++ * first 8 of each 32 bytes - but it's just as easy to aim for ++ * the first one */ ++ and OFF, S_1, #31 ++ rsb OFF, OFF, #32*prefetch_distance ++ tst S_1, #3 ++ bne 140f ++ memcmp_long_inner_loop 0 ++140: memcmp_long_inner_loop 1 ++ ++170: /* Short case */ ++ teq N, #0 ++ beq 199f ++ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 ++ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 ++ tst S_2, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ ldrb DAT0, [S_1], #1 ++ ldrb DAT4, [S_2], #1 ++ cmp DAT0, DAT4 ++ bne 200f ++ tst S_2, #3 ++ bne 172b ++174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ ++ tst S_1, #3 ++ bne 140f ++ memcmp_short_inner_loop 0 ++140: memcmp_short_inner_loop 1 ++ ++200: /* Difference found: determine sign. */ ++ movhi a1, #1 ++ movlo a1, #-1 ++ setend le ++ pop {DAT1-DAT6, pc} ++ ++ .unreq S_1 ++ .unreq S_2 ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq OFF ++ENDPROC(memcmp) +diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S +new file mode 100644 +index 0000000..15ff2bd +--- /dev/null ++++ b/arch/arm/lib/memcpy_rpi.S +@@ -0,0 +1,59 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include ++#include "arm-mem.h" ++#include "memcpymove.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ ++ ++.set prefetch_distance, 3 ++ ++ENTRY(memcpy) ++ memcpy 0 ++ENDPROC(memcpy) +diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h +new file mode 100644 +index 0000000..d8be584 +--- /dev/null ++++ b/arch/arm/lib/memcpymove.h +@@ -0,0 +1,506 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 ++ .if words == 1 ++ .if backwards ++ mov r1, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r1, r1, r0, lsr #align*8 ++ str r1, [D, #-4]! ++ .else ++ mov r0, r1, lsr #align*8 ++ ldr r1, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ str r0, [D], #4 ++ .endif ++ .elseif words == 2 ++ .if backwards ++ ldr r1, [S, #-4]! ++ mov r2, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2} ++ .else ++ ldr r1, [S, #4]! ++ mov r0, r2, lsr #align*8 ++ ldr r2, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ stmia D!, {r0, r1} ++ .endif ++ .elseif words == 4 ++ .if backwards ++ ldmdb S!, {r2, r3} ++ mov r4, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1} ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2} ++ mov r0, r4, lsr #align*8 ++ ldmib S!, {r3, r4} ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ .endif ++ .elseif words == 8 ++ .if backwards ++ ldmdb S!, {r4, r5, r6, r7} ++ mov r8, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1, r2, r3} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r8, r8, r7, lsr #align*8 ++ mov r7, r7, lsl #32-align*8 ++ orr r7, r7, r6, lsr #align*8 ++ mov r6, r6, lsl #32-align*8 ++ orr r6, r6, r5, lsr #align*8 ++ mov r5, r5, lsl #32-align*8 ++ orr r5, r5, r4, lsr #align*8 ++ mov r4, r4, lsl #32-align*8 ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r5, r6, r7, r8} ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2, r3, r4} ++ mov r0, r8, lsr #align*8 ++ ldmib S!, {r5, r6, r7, r8} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ mov r4, r4, lsr #align*8 ++ orr r4, r4, r5, lsl #32-align*8 ++ mov r5, r5, lsr #align*8 ++ orr r5, r5, r6, lsl #32-align*8 ++ mov r6, r6, lsr #align*8 ++ orr r6, r6, r7, lsl #32-align*8 ++ mov r7, r7, lsr #align*8 ++ orr r7, r7, r8, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ stmia D!, {r4, r5, r6, r7} ++ .endif ++ .endif ++.endm ++ ++.macro memcpy_leading_15bytes backwards, align ++ movs DAT1, DAT2, lsl #31 ++ sub N, N, DAT2 ++ .if backwards ++ ldrmib DAT0, [S, #-1]! ++ ldrcsh DAT1, [S, #-2]! ++ strmib DAT0, [D, #-1]! ++ strcsh DAT1, [D, #-2]! ++ .else ++ ldrmib DAT0, [S], #1 ++ ldrcsh DAT1, [S], #2 ++ strmib DAT0, [D], #1 ++ strcsh DAT1, [D], #2 ++ .endif ++ movs DAT1, DAT2, lsl #29 ++ .if backwards ++ ldrmi DAT0, [S, #-4]! ++ .if align == 0 ++ ldmcsdb S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT2, [S, #-4]! ++ ldrcs DAT1, [S, #-4]! ++ .endif ++ strmi DAT0, [D, #-4]! ++ stmcsdb D!, {DAT1, DAT2} ++ .else ++ ldrmi DAT0, [S], #4 ++ .if align == 0 ++ ldmcsia S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT1, [S], #4 ++ ldrcs DAT2, [S], #4 ++ .endif ++ strmi DAT0, [D], #4 ++ stmcsia D!, {DAT1, DAT2} ++ .endif ++.endm ++ ++.macro memcpy_trailing_15bytes backwards, align ++ movs N, N, lsl #29 ++ .if backwards ++ .if align == 0 ++ ldmcsdb S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT1, [S, #-4]! ++ ldrcs DAT0, [S, #-4]! ++ .endif ++ ldrmi DAT2, [S, #-4]! ++ stmcsdb D!, {DAT0, DAT1} ++ strmi DAT2, [D, #-4]! ++ .else ++ .if align == 0 ++ ldmcsia S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT0, [S], #4 ++ ldrcs DAT1, [S], #4 ++ .endif ++ ldrmi DAT2, [S], #4 ++ stmcsia D!, {DAT0, DAT1} ++ strmi DAT2, [D], #4 ++ .endif ++ movs N, N, lsl #2 ++ .if backwards ++ ldrcsh DAT0, [S, #-2]! ++ ldrmib DAT1, [S, #-1] ++ strcsh DAT0, [D, #-2]! ++ strmib DAT1, [D, #-1] ++ .else ++ ldrcsh DAT0, [S], #2 ++ ldrmib DAT1, [S] ++ strcsh DAT0, [D], #2 ++ strmib DAT1, [D] ++ .endif ++.endm ++ ++.macro memcpy_long_inner_loop backwards, align ++ .if align != 0 ++ .if backwards ++ ldr DAT0, [S, #-align]! ++ .else ++ ldr LAST, [S, #-align]! ++ .endif ++ .endif ++110: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ ++ preload_trailing backwards, S, N, OFF ++ add N, N, #(prefetch_distance+2)*32 - 32 ++120: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 120b ++ tst N, #16 ++ .if align == 0 ++ .if backwards ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ .else ++ beq 130f ++ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST ++130: ++ .endif ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ .if align != 0 ++ add S, S, #align ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {DAT3, DAT4, DAT5, DAT6, DAT7} ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy_medium_inner_loop backwards, align ++120: ++ .if backwards ++ .if align == 0 ++ ldmdb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr LAST, [S, #-4]! ++ ldr DAT2, [S, #-4]! ++ ldr DAT1, [S, #-4]! ++ ldr DAT0, [S, #-4]! ++ .endif ++ stmdb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr DAT0, [S], #4 ++ ldr DAT1, [S], #4 ++ ldr DAT2, [S], #4 ++ ldr LAST, [S], #4 ++ .endif ++ stmia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy_short_inner_loop backwards, align ++ tst N, #16 ++ .if backwards ++ .if align == 0 ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne LAST, [S, #-4]! ++ ldrne DAT2, [S, #-4]! ++ ldrne DAT1, [S, #-4]! ++ ldrne DAT0, [S, #-4]! ++ .endif ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne DAT0, [S], #4 ++ ldrne DAT1, [S], #4 ++ ldrne DAT2, [S], #4 ++ ldrne LAST, [S], #4 ++ .endif ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy backwards ++ D .req a1 ++ S .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req sl ++ LAST .req ip ++ OFF .req lr ++ ++ .cfi_startproc ++ ++ push {D, DAT1, DAT2, lr} ++ ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_undefined S ++ .cfi_undefined N ++ .cfi_undefined DAT0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_undefined LAST ++ .cfi_rel_offset lr, 12 ++ ++ .if backwards ++ add D, D, N ++ add S, S, N ++ .endif ++ ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 160f ++ ++ /* Long case */ ++ push {DAT3, DAT4, DAT5, DAT6, DAT7} ++ ++ .cfi_def_cfa_offset 36 ++ .cfi_rel_offset D, 20 ++ .cfi_rel_offset DAT1, 24 ++ .cfi_rel_offset DAT2, 28 ++ .cfi_rel_offset DAT3, 0 ++ .cfi_rel_offset DAT4, 4 ++ .cfi_rel_offset DAT5, 8 ++ .cfi_rel_offset DAT6, 12 ++ .cfi_rel_offset DAT7, 16 ++ .cfi_rel_offset lr, 32 ++ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 backwards, DAT0, S ++ .if backwards ++ /* Bug in GAS: it accepts, but mis-assembles the instruction ++ * ands DAT2, D, #60, 2 ++ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) ++ */ ++ .word 0xE210513C ++ beq 154f ++ .else ++ ands DAT2, D, #15 ++ beq 154f ++ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ ++ .endif ++ preload_leading_step2 backwards, DAT0, S, DAT2, OFF ++ memcpy_leading_15bytes backwards, 1 ++154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ ++ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ ++ .if backwards ++ rsb OFF, S, #3 ++ and OFF, OFF, #28 ++ sub OFF, OFF, #32*(prefetch_distance+1) ++ .else ++ and OFF, S, #28 ++ rsb OFF, OFF, #32*prefetch_distance ++ .endif ++ movs DAT0, S, lsl #31 ++ bhi 157f ++ bcs 156f ++ bmi 155f ++ memcpy_long_inner_loop backwards, 0 ++155: memcpy_long_inner_loop backwards, 1 ++156: memcpy_long_inner_loop backwards, 2 ++157: memcpy_long_inner_loop backwards, 3 ++ ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_same_value DAT3 ++ .cfi_same_value DAT4 ++ .cfi_same_value DAT5 ++ .cfi_same_value DAT6 ++ .cfi_same_value DAT7 ++ .cfi_rel_offset lr, 12 ++ ++160: /* Medium case */ ++ preload_all backwards, 0, 0, S, N, DAT2, OFF ++ sub N, N, #16 /* simplifies inner loop termination */ ++ .if backwards ++ ands DAT2, D, #15 ++ beq 164f ++ .else ++ ands DAT2, D, #15 ++ beq 164f ++ rsb DAT2, DAT2, #16 ++ .endif ++ memcpy_leading_15bytes backwards, align ++164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ ++ tst S, #3 ++ bne 140f ++ memcpy_medium_inner_loop backwards, 0 ++140: memcpy_medium_inner_loop backwards, 1 ++ ++170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ ++ teq N, #0 ++ beq 199f ++ preload_all backwards, 1, 0, S, N, DAT2, LAST ++ tst D, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ .if backwards ++ ldrb DAT0, [S, #-1]! ++ strb DAT0, [D, #-1]! ++ .else ++ ldrb DAT0, [S], #1 ++ strb DAT0, [D], #1 ++ .endif ++ tst D, #3 ++ bne 172b ++174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ ++ tst S, #3 ++ bne 140f ++ memcpy_short_inner_loop backwards, 0 ++140: memcpy_short_inner_loop backwards, 1 ++ ++ .cfi_endproc ++ ++ .unreq D ++ .unreq S ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq LAST ++ .unreq OFF ++.endm +diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S +new file mode 100644 +index 0000000..8b0760c +--- /dev/null ++++ b/arch/arm/lib/memmove_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include ++#include "arm-mem.h" ++#include "memcpymove.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memmove(void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ ++ ++.set prefetch_distance, 3 ++ ++ENTRY(memmove) ++ cmp a2, a1 ++ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ ++ memcpy 1 ++ENDPROC(memmove) +diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S +new file mode 100644 +index 0000000..2cde883 +--- /dev/null ++++ b/arch/arm/lib/memset_rpi.S +@@ -0,0 +1,121 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include ++#include "arm-mem.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memset(void *s, int c, size_t n); ++ * On entry: ++ * a1 = pointer to buffer to fill ++ * a2 = byte pattern to fill with (caller-narrowed) ++ * a3 = number of bytes to fill ++ * On exit: ++ * a1 preserved ++ */ ++ENTRY(memset) ++ S .req a1 ++ DAT0 .req a2 ++ N .req a3 ++ DAT1 .req a4 ++ DAT2 .req ip ++ DAT3 .req lr ++ ++ orr DAT0, DAT0, lsl #8 ++ push {S, lr} ++ orr DAT0, DAT0, lsl #16 ++ mov DAT1, DAT0 ++ ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ ++161: sub N, N, #16 /* simplifies inner loop termination */ ++ /* Leading words and bytes */ ++ tst S, #15 ++ beq 164f ++ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ ++ movs DAT2, DAT3, lsl #31 ++ submi N, N, #1 ++ strmib DAT0, [S], #1 ++ subcs N, N, #2 ++ strcsh DAT0, [S], #2 ++ movs DAT2, DAT3, lsl #29 ++ submi N, N, #4 ++ strmi DAT0, [S], #4 ++ subcs N, N, #8 ++ stmcsia S!, {DAT0, DAT1} ++164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ /* Now the inner loop of 16-byte stores */ ++165: stmia S!, {DAT0, DAT1, DAT2, DAT3} ++ subs N, N, #16 ++ bhs 165b ++166: /* Trailing words and bytes */ ++ movs N, N, lsl #29 ++ stmcsia S!, {DAT0, DAT1} ++ strmi DAT0, [S], #4 ++ movs N, N, lsl #2 ++ strcsh DAT0, [S], #2 ++ strmib DAT0, [S] ++199: pop {S, pc} ++ ++170: /* Short case */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ tst S, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199b ++ strb DAT0, [S], #1 ++ tst S, #3 ++ bne 172b ++174: tst N, #16 ++ stmneia S!, {DAT0, DAT1, DAT2, DAT3} ++ b 166b ++ ++ .unreq S ++ .unreq DAT0 ++ .unreq N ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ENDPROC(memset) +diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c +index 3e58d71..0622891 100644 +--- a/arch/arm/lib/uaccess_with_memcpy.c ++++ b/arch/arm/lib/uaccess_with_memcpy.c +@@ -22,6 +22,14 @@ + #include + #include + ++#ifndef COPY_FROM_USER_THRESHOLD ++#define COPY_FROM_USER_THRESHOLD 64 ++#endif ++ ++#ifndef COPY_TO_USER_THRESHOLD ++#define COPY_TO_USER_THRESHOLD 64 ++#endif ++ + static int + pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + { +@@ -85,7 +93,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + return 1; + } + +-static unsigned long noinline ++static int ++pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) ++{ ++ unsigned long addr = (unsigned long)_addr; ++ pgd_t *pgd; ++ pmd_t *pmd; ++ pte_t *pte; ++ pud_t *pud; ++ spinlock_t *ptl; ++ ++ pgd = pgd_offset(current->mm, addr); ++ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) ++ { ++ return 0; ++ } ++ pud = pud_offset(pgd, addr); ++ if (unlikely(pud_none(*pud) || pud_bad(*pud))) ++ { ++ return 0; ++ } ++ ++ pmd = pmd_offset(pud, addr); ++ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) ++ return 0; ++ ++ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); ++ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { ++ pte_unmap_unlock(pte, ptl); ++ return 0; ++ } ++ ++ *ptep = pte; ++ *ptlp = ptl; ++ ++ return 1; ++} ++ ++unsigned long noinline + __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) + { + int atomic; +@@ -135,6 +180,54 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) + return n; + } + ++unsigned long noinline ++__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) ++{ ++ int atomic; ++ ++ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { ++ memcpy(to, (const void *)from, n); ++ return 0; ++ } ++ ++ /* the mmap semaphore is taken only if not in an atomic context */ ++ atomic = in_atomic(); ++ ++ if (!atomic) ++ down_read(¤t->mm->mmap_sem); ++ while (n) { ++ pte_t *pte; ++ spinlock_t *ptl; ++ int tocopy; ++ ++ while (!pin_page_for_read(from, &pte, &ptl)) { ++ char temp; ++ if (!atomic) ++ up_read(¤t->mm->mmap_sem); ++ if (__get_user(temp, (char __user *)from)) ++ goto out; ++ if (!atomic) ++ down_read(¤t->mm->mmap_sem); ++ } ++ ++ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; ++ if (tocopy > n) ++ tocopy = n; ++ ++ memcpy(to, (const void *)from, tocopy); ++ to += tocopy; ++ from += tocopy; ++ n -= tocopy; ++ ++ pte_unmap_unlock(pte, ptl); ++ } ++ if (!atomic) ++ up_read(¤t->mm->mmap_sem); ++ ++out: ++ return n; ++} ++ + unsigned long + __copy_to_user(void __user *to, const void *from, unsigned long n) + { +@@ -145,10 +238,25 @@ __copy_to_user(void __user *to, const void *from, unsigned long n) + * With frame pointer disabled, tail call optimization kicks in + * as well making this test almost invisible. + */ +- if (n < 64) ++ if (n < COPY_TO_USER_THRESHOLD) + return __copy_to_user_std(to, from, n); + return __copy_to_user_memcpy(to, from, n); + } ++ ++unsigned long ++__copy_from_user(void *to, const void __user *from, unsigned long n) ++{ ++ /* ++ * This test is stubbed out of the main function above to keep ++ * the overhead for small copies low by avoiding a large ++ * register dump on the stack just to reload them right away. ++ * With frame pointer disabled, tail call optimization kicks in ++ * as well making this test almost invisible. ++ */ ++ if (n < COPY_FROM_USER_THRESHOLD) ++ return __copy_from_user_std(to, from, n); ++ return __copy_from_user_memcpy(to, from, n); ++} + + static unsigned long noinline + __clear_user_memset(void __user *addr, unsigned long n) + +From ee5567b6efdbf9cbdf4cacaabc7623c5f6d45064 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 19 May 2015 18:49:06 +0100 +Subject: [PATCH 180/216] vcsm: Add ioctl for custom cache flushing + +--- + arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h | 15 +++++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 49 ++++++++++++++++++++++ + 2 files changed, 64 insertions(+) + +diff --git a/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h b/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h +index 42d0eb0..334f36d 100644 +--- a/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h ++++ b/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h +@@ -61,6 +61,8 @@ enum vmcs_sm_cmd_e { + VMCS_SM_CMD_HOST_WALK_PID_ALLOC, + VMCS_SM_CMD_HOST_WALK_PID_MAP, + ++ VMCS_SM_CMD_CLEAN_INVALID, ++ + VMCS_SM_CMD_LAST /* Do no delete */ + }; + +@@ -163,6 +165,16 @@ struct vmcs_sm_ioctl_cache { + unsigned int size; + }; + ++struct vmcs_sm_ioctl_clean_invalid { ++ /* user -> kernel */ ++ struct { ++ unsigned int cmd; ++ unsigned int handle; ++ unsigned int addr; ++ unsigned int size; ++ } s[8]; ++}; ++ + /* IOCTL numbers */ + #define VMCS_SM_IOCTL_MEM_ALLOC\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ +@@ -191,6 +203,9 @@ struct vmcs_sm_ioctl_cache { + #define VMCS_SM_IOCTL_MEM_INVALID\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_INVALID,\ + struct vmcs_sm_ioctl_cache) ++#define VMCS_SM_IOCTL_MEM_CLEAN_INVALID\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID,\ ++ struct vmcs_sm_ioctl_clean_invalid) + + #define VMCS_SM_IOCTL_SIZE_USR_HDL\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index da1c523..39a8971 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2732,6 +2732,55 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + break; + ++ /* Flush/Invalidate the cache for a given mapping. */ ++ case VMCS_SM_CMD_CLEAN_INVALID: ++ { ++ int i; ++ struct vmcs_sm_ioctl_clean_invalid ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ for (i=0; ires_cached) { ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ ++ /* L1/L2 cache flush */ ++ down_read(¤t->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range(base, end); ++ up_read(¤t->mm->mmap_sem); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ } ++ break; ++ } ++ } ++ } ++ break; ++ + default: + { + ret = -EINVAL; + +From 6f9e2f739661f49e2375be580025549b367444b2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 17 Mar 2015 16:07:48 +0100 +Subject: [PATCH 181/216] dts: overlay: add generic support for ads7846 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add generic support for the ADS7846 touch controller. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/ads7846-overlay.dts | 83 +++++++++++++++++++++++++++++++++++ + 2 files changed, 84 insertions(+) + create mode 100644 arch/arm/boot/dts/ads7846-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index f3558df..0e77296 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -13,6 +13,7 @@ ifeq ($(CONFIG_BCM2709_DT),y) + RPI_DT_OVERLAYS=y + endif + ++dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += ds1307-rtc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb +diff --git a/arch/arm/boot/dts/ads7846-overlay.dts b/arch/arm/boot/dts/ads7846-overlay.dts +new file mode 100644 +index 0000000..6a92cd1 +--- /dev/null ++++ b/arch/arm/boot/dts/ads7846-overlay.dts +@@ -0,0 +1,83 @@ ++/* ++ * Generic Device Tree overlay for the ADS7846 touch controller ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ ads7846_pins: ads7846_pins { ++ brcm,pins = <255>; /* illegal default value */ ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ads7846: ads7846@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ads7846_pins>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <255 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 255 0>; ++ ++ /* driver defaults */ ++ ti,x-min = /bits/ 16 <0>; ++ ti,y-min = /bits/ 16 <0>; ++ ti,x-max = /bits/ 16 <0x0FFF>; ++ ti,y-max = /bits/ 16 <0x0FFF>; ++ ti,pressure-min = /bits/ 16 <0>; ++ ti,pressure-max = /bits/ 16 <0xFFFF>; ++ ti,x-plate-ohms = /bits/ 16 <400>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ cs = <&ads7846>,"reg:0"; ++ speed = <&ads7846>,"spi-max-frequency:0"; ++ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ ++ <&ads7846>,"interrupts:0", ++ <&ads7846>,"pendown-gpio:4"; ++ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; ++ swapxy = <&ads7846>,"ti,swap-xy?"; ++ xmin = <&ads7846>,"ti,x-min;0"; ++ ymin = <&ads7846>,"ti,y-min;0"; ++ xmax = <&ads7846>,"ti,x-max;0"; ++ ymax = <&ads7846>,"ti,y-max;0"; ++ pmin = <&ads7846>,"ti,pressure-min;0"; ++ pmax = <&ads7846>,"ti,pressure-max;0"; ++ xohms = <&ads7846>,"ti,x-plate-ohms;0"; ++ }; ++}; + +From beda21eb0afb05805e46419c37f1127bf35fa775 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Sun, 24 May 2015 19:12:01 +0200 +Subject: [PATCH 182/216] bcm270x: add dtparam for audio node + +The audio node is enabled by default and can be disabled +with dtparam=audio=off in config.txt +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 ++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 2 ++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 6323c5b..609d004 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -126,5 +126,7 @@ + pwr_led_gpio = <&pwr_led>,"gpios:4"; + pwr_led_activelow = <&pwr_led>,"gpios:8"; + pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index e1fe6a4..e601194 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -116,5 +116,7 @@ + act_led_gpio = <&act_led>,"gpios:4"; + act_led_activelow = <&act_led>,"gpios:8"; + act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 921add1..fe282e4 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -126,5 +126,7 @@ + pwr_led_gpio = <&pwr_led>,"gpios:4"; + pwr_led_activelow = <&pwr_led>,"gpios:8"; + pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; + }; + }; + +From c40ce86818e2ccd1521b5072cfa0bc102893ca7a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 27 May 2015 17:22:15 +0100 +Subject: [PATCH 183/216] bcm2835-audio: Create the platform device if the DT + node is disabled + +For backwards compatibility, allow the built-in ALSA driver to be enabled +either by loading the module from /etc/modules or by enabling the "/audio" +node in DT. +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ---- + arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ---- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ---- + arch/arm/mach-bcm2708/bcm2708.c | 10 ++++++++-- + arch/arm/mach-bcm2709/bcm2709.c | 10 ++++++++-- + 5 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 609d004..75df21c 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -53,10 +53,6 @@ + status = "okay"; + }; + +-&audio { +- status = "okay"; +-}; +- + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index e601194..df12b7d 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -53,10 +53,6 @@ + status = "okay"; + }; + +-&audio { +- status = "okay"; +-}; +- + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index fe282e4..78bc756 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -53,10 +53,6 @@ + status = "okay"; + }; + +-&audio { +- status = "okay"; +-}; +- + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index e451187..06438df 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -963,8 +963,14 @@ void __init bcm2708_init(void) + bcm_register_device_dt(&bcm2835_emmc_device); + #endif + bcm2708_init_led(); +- for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) +- bcm_register_device_dt(&bcm2708_alsa_devices[i]); ++ ++ /* Only create the platform devices for the ALSA driver in the ++ absence of an enabled "audio" DT node */ ++ if (!use_dt || ++ !of_device_is_available(of_find_node_by_path("/audio"))) { ++ for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) ++ bcm_register_device(&bcm2708_alsa_devices[i]); ++ } + + bcm_register_device_dt(&bcm2708_spi_device); + +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 06c2c74..ce06b7d 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -986,8 +986,14 @@ void __init bcm2709_init(void) + bcm_register_device_dt(&bcm2835_emmc_device); + #endif + bcm2709_init_led(); +- for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) +- bcm_register_device_dt(&bcm2708_alsa_devices[i]); ++ ++ /* Only create the platform devices for the ALSA driver in the ++ absence of an enabled "audio" DT node */ ++ if (!use_dt || ++ !of_device_is_available(of_find_node_by_path("/audio"))) { ++ for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) ++ bcm_register_device(&bcm2708_alsa_devices[i]); ++ } + + bcm_register_device_dt(&bcm2708_spi_device); + + +From 9f10489e52092f350c72745c2ac3d0afbbf4cd44 Mon Sep 17 00:00:00 2001 +From: Martin Sperl +Date: Wed, 27 May 2015 14:39:55 +0000 +Subject: [PATCH 184/216] device-tree: spi: make spi-bcm2835 the default spi + driver and prepare for dma + +* make spi-bcm2835 the default driver for spi +* add a fallback spi-bcm2708 overlay +* add dma entries to device tree for future updates +* add default cs-gpios entry showing how to extend the number of chip-selects. + +Signed-off-by: Martin Sperl +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm2708_common.dtsi | 10 +++++++++- + arch/arm/boot/dts/spi-bcm2708-overlay.dts | 18 ++++++++++++++++++ + 3 files changed, 28 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/boot/dts/spi-bcm2708-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 0e77296..9124dfb 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -41,6 +41,7 @@ dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb + + dtb-$(CONFIG_MACH_ASM9260) += \ + alphascale-asm9260-devkit.dtb +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 4bf6960..3f8af85 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -84,13 +84,21 @@ + }; + + spi0: spi@7e204000 { +- compatible = "brcm,bcm2708-spi"; ++ compatible = "brcm,bcm2835-spi"; + reg = <0x7e204000 0x1000>; + interrupts = <2 22>; + clocks = <&clk_spi>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; ++ /* the dma channels */ ++ dmas = <&dma 6>, <&dma 7>; ++ dma-names = "tx", "rx"; ++ /* the chipselects used - <0> means native GPIO ++ * add more gpios if necessary as <&gpio 6 1> ++ * (but do not forget to make them output!) ++ */ ++ cs-gpios = <0>, <0>; + }; + + i2c0: i2c@7e205000 { +diff --git a/arch/arm/boot/dts/spi-bcm2708-overlay.dts b/arch/arm/boot/dts/spi-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e378ef1 +--- /dev/null ++++ b/arch/arm/boot/dts/spi-bcm2708-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay for spi-bcm2835 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* setting up compatiblity to allow loading the spi-bcm2835 driver */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ compatible = "brcm,bcm2708-spi"; ++ }; ++ }; ++}; + +From 8c5dd3fb2ef21f3dc20a7c999fd2659354afa975 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 23 May 2015 23:30:36 +0200 +Subject: [PATCH 185/216] BCM270x: Move power module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make the power module available on ARCH_BCM2835 by moving it. +The module turns on USB power making it possible to boot +ARCH_BCM2835 directly with the VC bootloader. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/Makefile | 2 +- + arch/arm/mach-bcm2708/include/mach/arm_power.h | 62 -------- + arch/arm/mach-bcm2708/include/mach/power.h | 26 ---- + arch/arm/mach-bcm2708/power.c | 201 ------------------------- + arch/arm/mach-bcm2709/Makefile | 2 +- + arch/arm/mach-bcm2709/include/mach/arm_power.h | 62 -------- + arch/arm/mach-bcm2709/include/mach/power.h | 26 ---- + arch/arm/mach-bcm2709/power.c | 199 ------------------------ + drivers/soc/Kconfig | 1 + + drivers/soc/Makefile | 1 + + drivers/soc/bcm2835/Kconfig | 9 ++ + drivers/soc/bcm2835/Makefile | 1 + + drivers/soc/bcm2835/bcm2708-power.c | 200 ++++++++++++++++++++++++ + include/soc/bcm2835/power.h | 61 ++++++++ + 14 files changed, 275 insertions(+), 578 deletions(-) + delete mode 100644 arch/arm/mach-bcm2708/include/mach/arm_power.h + delete mode 100644 arch/arm/mach-bcm2708/include/mach/power.h + delete mode 100644 arch/arm/mach-bcm2708/power.c + delete mode 100644 arch/arm/mach-bcm2709/include/mach/arm_power.h + delete mode 100644 arch/arm/mach-bcm2709/include/mach/power.h + delete mode 100644 arch/arm/mach-bcm2709/power.c + create mode 100644 drivers/soc/bcm2835/Kconfig + create mode 100644 drivers/soc/bcm2835/Makefile + create mode 100644 drivers/soc/bcm2835/bcm2708-power.c + create mode 100644 include/soc/bcm2835/power.h + +diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile +index c1e7d41..5552ae8 100644 +--- a/arch/arm/mach-bcm2708/Makefile ++++ b/arch/arm/mach-bcm2708/Makefile +@@ -2,6 +2,6 @@ + # Makefile for the linux kernel. + # + +-obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o power.o ++obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2708/include/mach/arm_power.h b/arch/arm/mach-bcm2708/include/mach/arm_power.h +deleted file mode 100644 +index d3bf245..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/arm_power.h ++++ /dev/null +@@ -1,62 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/include/mach/arm_power.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#ifndef _ARM_POWER_H +-#define _ARM_POWER_H +- +-/* Use meaningful names on each side */ +-#ifdef __VIDEOCORE__ +-#define PREFIX(x) ARM_##x +-#else +-#define PREFIX(x) BCM_##x +-#endif +- +-enum { +- PREFIX(POWER_SDCARD_BIT), +- PREFIX(POWER_UART_BIT), +- PREFIX(POWER_MINIUART_BIT), +- PREFIX(POWER_USB_BIT), +- PREFIX(POWER_I2C0_BIT), +- PREFIX(POWER_I2C1_BIT), +- PREFIX(POWER_I2C2_BIT), +- PREFIX(POWER_SPI_BIT), +- PREFIX(POWER_CCP2TX_BIT), +- PREFIX(POWER_DSI_BIT), +- +- PREFIX(POWER_MAX) +-}; +- +-enum { +- PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), +- PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), +- PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), +- PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), +- PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), +- PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), +- PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), +- PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), +- PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), +- PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), +- +- PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, +- PREFIX(POWER_NONE) = 0 +-}; +- +-#endif +diff --git a/arch/arm/mach-bcm2708/include/mach/power.h b/arch/arm/mach-bcm2708/include/mach/power.h +deleted file mode 100644 +index 52b3b02..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/power.h ++++ /dev/null +@@ -1,26 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/power.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for controlling the power to +- * VideoCore subsystems. +- */ +- +-#ifndef _MACH_BCM2708_POWER_H +-#define _MACH_BCM2708_POWER_H +- +-#include +-#include +- +-typedef unsigned int BCM_POWER_HANDLE_T; +- +-extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); +-extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); +-extern int bcm_power_close(BCM_POWER_HANDLE_T handle); +- +-#endif +diff --git a/arch/arm/mach-bcm2708/power.c b/arch/arm/mach-bcm2708/power.c +deleted file mode 100644 +index 796837f..0000000 +--- a/arch/arm/mach-bcm2708/power.c ++++ /dev/null +@@ -1,201 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/power.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for controlling the power to +- * VideoCore subsystems. +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define DRIVER_NAME "bcm2708_power" +- +-#define BCM_POWER_MAXCLIENTS 4 +-#define BCM_POWER_NOCLIENT (1<<31) +- +-/* Some drivers expect there devices to be permanently powered */ +- +-#ifdef CONFIG_USB +-#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) +-#endif +- +-#if 1 +-#define DPRINTK printk +-#else +-#define DPRINTK if (0) printk +-#endif +- +-struct state_struct { +- uint32_t global_request; +- uint32_t client_request[BCM_POWER_MAXCLIENTS]; +- struct semaphore client_mutex; +- struct semaphore mutex; +-} g_state; +- +-int bcm_power_open(BCM_POWER_HANDLE_T *handle) +-{ +- BCM_POWER_HANDLE_T i; +- int ret = -EBUSY; +- +- down(&g_state.client_mutex); +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { +- if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { +- g_state.client_request[i] = BCM_POWER_NONE; +- *handle = i; +- ret = 0; +- break; +- } +- } +- +- up(&g_state.client_mutex); +- +- DPRINTK("bcm_power_open() -> %d\n", *handle); +- +- return ret; +-} +-EXPORT_SYMBOL_GPL(bcm_power_open); +- +-int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) +-{ +- int rc = 0; +- +- DPRINTK("bcm_power_request(%d, %x)\n", handle, request); +- +- if ((handle < BCM_POWER_MAXCLIENTS) && +- (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { +- if (down_interruptible(&g_state.mutex) != 0) { +- DPRINTK("bcm_power_request -> interrupted\n"); +- return -EINTR; +- } +- +- if (request != g_state.client_request[handle]) { +- uint32_t others_request = 0; +- uint32_t global_request; +- BCM_POWER_HANDLE_T i; +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { +- if (i != handle) +- others_request |= +- g_state.client_request[i]; +- } +- others_request &= ~BCM_POWER_NOCLIENT; +- +- global_request = request | others_request; +- if (global_request != g_state.global_request) { +- uint32_t actual; +- +- /* Send a request to VideoCore */ +- bcm_mailbox_write(MBOX_CHAN_POWER, +- global_request << 4); +- +- /* Wait for a response during power-up */ +- if (global_request & ~g_state.global_request) { +- rc = bcm_mailbox_read(MBOX_CHAN_POWER, +- &actual); +- DPRINTK +- ("bcm_mailbox_read -> %08x, %d\n", +- actual, rc); +- actual >>= 4; +- } else { +- rc = 0; +- actual = global_request; +- } +- +- if (rc == 0) { +- if (actual != global_request) { +- printk(KERN_ERR +- "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", +- __func__, +- g_state.global_request, +- global_request, actual, request, others_request); +- /* A failure */ +- BUG_ON((others_request & actual) +- != others_request); +- request &= actual; +- rc = -EIO; +- } +- +- g_state.global_request = actual; +- g_state.client_request[handle] = +- request; +- } +- } +- } +- up(&g_state.mutex); +- } else { +- rc = -EINVAL; +- } +- DPRINTK("bcm_power_request -> %d\n", rc); +- return rc; +-} +-EXPORT_SYMBOL_GPL(bcm_power_request); +- +-int bcm_power_close(BCM_POWER_HANDLE_T handle) +-{ +- int rc; +- +- DPRINTK("bcm_power_close(%d)\n", handle); +- +- rc = bcm_power_request(handle, BCM_POWER_NONE); +- if (rc == 0) +- g_state.client_request[handle] = BCM_POWER_NOCLIENT; +- +- return rc; +-} +-EXPORT_SYMBOL_GPL(bcm_power_close); +- +-static int __init bcm_power_init(void) +-{ +-#if defined(BCM_POWER_ALWAYS_ON) +- BCM_POWER_HANDLE_T always_on_handle; +-#endif +- int rc = 0; +- int i; +- +- printk(KERN_INFO "bcm_power: Broadcom power driver\n"); +- bcm_mailbox_write(MBOX_CHAN_POWER, 0); +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) +- g_state.client_request[i] = BCM_POWER_NOCLIENT; +- +- sema_init(&g_state.client_mutex, 1); +- sema_init(&g_state.mutex, 1); +- +- g_state.global_request = 0; +- +-#if defined(BCM_POWER_ALWAYS_ON) +- if (BCM_POWER_ALWAYS_ON) { +- bcm_power_open(&always_on_handle); +- bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); +- } +-#endif +- +- return rc; +-} +- +-static void __exit bcm_power_exit(void) +-{ +- bcm_mailbox_write(MBOX_CHAN_POWER, 0); +-} +- +-/* +- * Load after the mailbox driver is initialized (arch_initcall), +- * but before depending drivers (module_init). +- */ +-subsys_initcall(bcm_power_init); +-module_exit(bcm_power_exit); +- +-MODULE_AUTHOR("Phil Elwell"); +-MODULE_DESCRIPTION("Interface to BCM2708 power management"); +-MODULE_LICENSE("GPL"); +diff --git a/arch/arm/mach-bcm2709/Makefile b/arch/arm/mach-bcm2709/Makefile +index 77b8429..706116f 100644 +--- a/arch/arm/mach-bcm2709/Makefile ++++ b/arch/arm/mach-bcm2709/Makefile +@@ -2,6 +2,6 @@ + # Makefile for the linux kernel. + # + +-obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o power.o ++obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2709/include/mach/arm_power.h b/arch/arm/mach-bcm2709/include/mach/arm_power.h +deleted file mode 100644 +index d3bf245..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/arm_power.h ++++ /dev/null +@@ -1,62 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/include/mach/arm_power.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#ifndef _ARM_POWER_H +-#define _ARM_POWER_H +- +-/* Use meaningful names on each side */ +-#ifdef __VIDEOCORE__ +-#define PREFIX(x) ARM_##x +-#else +-#define PREFIX(x) BCM_##x +-#endif +- +-enum { +- PREFIX(POWER_SDCARD_BIT), +- PREFIX(POWER_UART_BIT), +- PREFIX(POWER_MINIUART_BIT), +- PREFIX(POWER_USB_BIT), +- PREFIX(POWER_I2C0_BIT), +- PREFIX(POWER_I2C1_BIT), +- PREFIX(POWER_I2C2_BIT), +- PREFIX(POWER_SPI_BIT), +- PREFIX(POWER_CCP2TX_BIT), +- PREFIX(POWER_DSI_BIT), +- +- PREFIX(POWER_MAX) +-}; +- +-enum { +- PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), +- PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), +- PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), +- PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), +- PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), +- PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), +- PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), +- PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), +- PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), +- PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), +- +- PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, +- PREFIX(POWER_NONE) = 0 +-}; +- +-#endif +diff --git a/arch/arm/mach-bcm2709/include/mach/power.h b/arch/arm/mach-bcm2709/include/mach/power.h +deleted file mode 100644 +index 52b3b02..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/power.h ++++ /dev/null +@@ -1,26 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/power.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for controlling the power to +- * VideoCore subsystems. +- */ +- +-#ifndef _MACH_BCM2708_POWER_H +-#define _MACH_BCM2708_POWER_H +- +-#include +-#include +- +-typedef unsigned int BCM_POWER_HANDLE_T; +- +-extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); +-extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); +-extern int bcm_power_close(BCM_POWER_HANDLE_T handle); +- +-#endif +diff --git a/arch/arm/mach-bcm2709/power.c b/arch/arm/mach-bcm2709/power.c +deleted file mode 100644 +index 960e472..0000000 +--- a/arch/arm/mach-bcm2709/power.c ++++ /dev/null +@@ -1,199 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/power.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for controlling the power to +- * VideoCore subsystems. +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define DRIVER_NAME "bcm2708_power" +- +-#define BCM_POWER_MAXCLIENTS 4 +-#define BCM_POWER_NOCLIENT (1<<31) +- +-/* Some drivers expect there devices to be permanently powered */ +-#ifdef CONFIG_USB +-#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) +-#endif +- +-#if 1 +-#define DPRINTK printk +-#else +-#define DPRINTK if (0) printk +-#endif +- +-struct state_struct { +- uint32_t global_request; +- uint32_t client_request[BCM_POWER_MAXCLIENTS]; +- struct semaphore client_mutex; +- struct semaphore mutex; +-} g_state; +- +-int bcm_power_open(BCM_POWER_HANDLE_T *handle) +-{ +- BCM_POWER_HANDLE_T i; +- int ret = -EBUSY; +- +- down(&g_state.client_mutex); +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { +- if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { +- g_state.client_request[i] = BCM_POWER_NONE; +- *handle = i; +- ret = 0; +- break; +- } +- } +- +- up(&g_state.client_mutex); +- +- DPRINTK("bcm_power_open() -> %d\n", *handle); +- +- return ret; +-} +-EXPORT_SYMBOL_GPL(bcm_power_open); +- +-int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) +-{ +- int rc = 0; +- +- DPRINTK("bcm_power_request(%d, %x)\n", handle, request); +- +- if ((handle < BCM_POWER_MAXCLIENTS) && +- (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { +- if (down_interruptible(&g_state.mutex) != 0) { +- DPRINTK("bcm_power_request -> interrupted\n"); +- return -EINTR; +- } +- +- if (request != g_state.client_request[handle]) { +- uint32_t others_request = 0; +- uint32_t global_request; +- BCM_POWER_HANDLE_T i; +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { +- if (i != handle) +- others_request |= +- g_state.client_request[i]; +- } +- others_request &= ~BCM_POWER_NOCLIENT; +- +- global_request = request | others_request; +- if (global_request != g_state.global_request) { +- uint32_t actual; +- +- /* Send a request to VideoCore */ +- bcm_mailbox_write(MBOX_CHAN_POWER, +- global_request << 4); +- +- /* Wait for a response during power-up */ +- if (global_request & ~g_state.global_request) { +- rc = bcm_mailbox_read(MBOX_CHAN_POWER, +- &actual); +- DPRINTK +- ("bcm_mailbox_read -> %08x, %d\n", +- actual, rc); +- actual >>= 4; +- } else { +- rc = 0; +- actual = global_request; +- } +- +- if (rc == 0) { +- if (actual != global_request) { +- printk(KERN_ERR +- "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", +- __func__, +- g_state.global_request, +- global_request, actual, request, others_request); +- /* A failure */ +- BUG_ON((others_request & actual) +- != others_request); +- request &= actual; +- rc = -EIO; +- } +- +- g_state.global_request = actual; +- g_state.client_request[handle] = +- request; +- } +- } +- } +- up(&g_state.mutex); +- } else { +- rc = -EINVAL; +- } +- DPRINTK("bcm_power_request -> %d\n", rc); +- return rc; +-} +-EXPORT_SYMBOL_GPL(bcm_power_request); +- +-int bcm_power_close(BCM_POWER_HANDLE_T handle) +-{ +- int rc; +- +- DPRINTK("bcm_power_close(%d)\n", handle); +- +- rc = bcm_power_request(handle, BCM_POWER_NONE); +- if (rc == 0) +- g_state.client_request[handle] = BCM_POWER_NOCLIENT; +- +- return rc; +-} +-EXPORT_SYMBOL_GPL(bcm_power_close); +- +-static int __init bcm_power_init(void) +-{ +-#if defined(BCM_POWER_ALWAYS_ON) +- BCM_POWER_HANDLE_T always_on_handle; +-#endif +- int rc = 0; +- int i; +- +- printk(KERN_INFO "bcm_power: Broadcom power driver\n"); +- bcm_mailbox_write(MBOX_CHAN_POWER, 0); +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) +- g_state.client_request[i] = BCM_POWER_NOCLIENT; +- +- sema_init(&g_state.client_mutex, 1); +- sema_init(&g_state.mutex, 1); +- +- g_state.global_request = 0; +-#if defined(BCM_POWER_ALWAYS_ON) +- if (BCM_POWER_ALWAYS_ON) { +- bcm_power_open(&always_on_handle); +- bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); +- } +-#endif +- +- return rc; +-} +- +-static void __exit bcm_power_exit(void) +-{ +- bcm_mailbox_write(MBOX_CHAN_POWER, 0); +-} +- +-/* +- * Load after the mailbox driver is initialized (arch_initcall), +- * but before depending drivers (module_init). +- */ +-subsys_initcall(bcm_power_init); +-module_exit(bcm_power_exit); +- +-MODULE_AUTHOR("Phil Elwell"); +-MODULE_DESCRIPTION("Interface to BCM2708 power management"); +-MODULE_LICENSE("GPL"); +diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig +index 76d6bd4..aed58f4 100644 +--- a/drivers/soc/Kconfig ++++ b/drivers/soc/Kconfig +@@ -1,5 +1,6 @@ + menu "SOC (System On Chip) specific Drivers" + ++source "drivers/soc/bcm2835/Kconfig" + source "drivers/soc/qcom/Kconfig" + source "drivers/soc/ti/Kconfig" + source "drivers/soc/versatile/Kconfig" +diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile +index 063113d..897de0c5 100644 +--- a/drivers/soc/Makefile ++++ b/drivers/soc/Makefile +@@ -2,6 +2,7 @@ + # Makefile for the Linux Kernel SOC specific device drivers. + # + ++obj-y += bcm2835/ + obj-$(CONFIG_ARCH_QCOM) += qcom/ + obj-$(CONFIG_ARCH_TEGRA) += tegra/ + obj-$(CONFIG_SOC_TI) += ti/ +diff --git a/drivers/soc/bcm2835/Kconfig b/drivers/soc/bcm2835/Kconfig +new file mode 100644 +index 0000000..c2980f3 +--- /dev/null ++++ b/drivers/soc/bcm2835/Kconfig +@@ -0,0 +1,9 @@ ++# ++# BCM2835 Soc drivers ++# ++config BCM2708_POWER ++ tristate "BCM2708 legacy power driver" ++ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) && BCM2708_MBOX ++ default y ++ help ++ Turns on USB power and provides an API for controlling power. +diff --git a/drivers/soc/bcm2835/Makefile b/drivers/soc/bcm2835/Makefile +new file mode 100644 +index 0000000..3614ad9 +--- /dev/null ++++ b/drivers/soc/bcm2835/Makefile +@@ -0,0 +1 @@ ++obj-$(CONFIG_BCM2708_POWER) += bcm2708-power.o +diff --git a/drivers/soc/bcm2835/bcm2708-power.c b/drivers/soc/bcm2835/bcm2708-power.c +new file mode 100644 +index 0000000..e7931a9 +--- /dev/null ++++ b/drivers/soc/bcm2835/bcm2708-power.c +@@ -0,0 +1,200 @@ ++/* ++ * linux/arch/arm/mach-bcm2708/power.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * 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. ++ * ++ * This device provides a shared mechanism for controlling the power to ++ * VideoCore subsystems. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define DRIVER_NAME "bcm2708_power" ++ ++#define BCM_POWER_MAXCLIENTS 4 ++#define BCM_POWER_NOCLIENT (1<<31) ++ ++/* Some drivers expect there devices to be permanently powered */ ++ ++#ifdef CONFIG_USB ++#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) ++#endif ++ ++#if 1 ++#define DPRINTK printk ++#else ++#define DPRINTK if (0) printk ++#endif ++ ++struct state_struct { ++ uint32_t global_request; ++ uint32_t client_request[BCM_POWER_MAXCLIENTS]; ++ struct semaphore client_mutex; ++ struct semaphore mutex; ++} g_state; ++ ++int bcm_power_open(BCM_POWER_HANDLE_T *handle) ++{ ++ BCM_POWER_HANDLE_T i; ++ int ret = -EBUSY; ++ ++ down(&g_state.client_mutex); ++ ++ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { ++ if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { ++ g_state.client_request[i] = BCM_POWER_NONE; ++ *handle = i; ++ ret = 0; ++ break; ++ } ++ } ++ ++ up(&g_state.client_mutex); ++ ++ DPRINTK("bcm_power_open() -> %d\n", *handle); ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(bcm_power_open); ++ ++int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) ++{ ++ int rc = 0; ++ ++ DPRINTK("bcm_power_request(%d, %x)\n", handle, request); ++ ++ if ((handle < BCM_POWER_MAXCLIENTS) && ++ (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { ++ if (down_interruptible(&g_state.mutex) != 0) { ++ DPRINTK("bcm_power_request -> interrupted\n"); ++ return -EINTR; ++ } ++ ++ if (request != g_state.client_request[handle]) { ++ uint32_t others_request = 0; ++ uint32_t global_request; ++ BCM_POWER_HANDLE_T i; ++ ++ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { ++ if (i != handle) ++ others_request |= ++ g_state.client_request[i]; ++ } ++ others_request &= ~BCM_POWER_NOCLIENT; ++ ++ global_request = request | others_request; ++ if (global_request != g_state.global_request) { ++ uint32_t actual; ++ ++ /* Send a request to VideoCore */ ++ bcm_mailbox_write(MBOX_CHAN_POWER, ++ global_request << 4); ++ ++ /* Wait for a response during power-up */ ++ if (global_request & ~g_state.global_request) { ++ rc = bcm_mailbox_read(MBOX_CHAN_POWER, ++ &actual); ++ DPRINTK ++ ("bcm_mailbox_read -> %08x, %d\n", ++ actual, rc); ++ actual >>= 4; ++ } else { ++ rc = 0; ++ actual = global_request; ++ } ++ ++ if (rc == 0) { ++ if (actual != global_request) { ++ printk(KERN_ERR ++ "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", ++ __func__, ++ g_state.global_request, ++ global_request, actual, request, others_request); ++ /* A failure */ ++ BUG_ON((others_request & actual) ++ != others_request); ++ request &= actual; ++ rc = -EIO; ++ } ++ ++ g_state.global_request = actual; ++ g_state.client_request[handle] = ++ request; ++ } ++ } ++ } ++ up(&g_state.mutex); ++ } else { ++ rc = -EINVAL; ++ } ++ DPRINTK("bcm_power_request -> %d\n", rc); ++ return rc; ++} ++EXPORT_SYMBOL_GPL(bcm_power_request); ++ ++int bcm_power_close(BCM_POWER_HANDLE_T handle) ++{ ++ int rc; ++ ++ DPRINTK("bcm_power_close(%d)\n", handle); ++ ++ rc = bcm_power_request(handle, BCM_POWER_NONE); ++ if (rc == 0) ++ g_state.client_request[handle] = BCM_POWER_NOCLIENT; ++ ++ return rc; ++} ++EXPORT_SYMBOL_GPL(bcm_power_close); ++ ++static int __init bcm_power_init(void) ++{ ++#if defined(BCM_POWER_ALWAYS_ON) ++ BCM_POWER_HANDLE_T always_on_handle; ++#endif ++ int rc = 0; ++ int i; ++ ++ printk(KERN_INFO "bcm_power: Broadcom power driver\n"); ++ bcm_mailbox_write(MBOX_CHAN_POWER, 0); ++ ++ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) ++ g_state.client_request[i] = BCM_POWER_NOCLIENT; ++ ++ sema_init(&g_state.client_mutex, 1); ++ sema_init(&g_state.mutex, 1); ++ ++ g_state.global_request = 0; ++ ++#if defined(BCM_POWER_ALWAYS_ON) ++ if (BCM_POWER_ALWAYS_ON) { ++ bcm_power_open(&always_on_handle); ++ bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); ++ } ++#endif ++ ++ return rc; ++} ++ ++static void __exit bcm_power_exit(void) ++{ ++ bcm_mailbox_write(MBOX_CHAN_POWER, 0); ++} ++ ++/* ++ * Load after the mailbox driver is initialized (arch_initcall), ++ * but before depending drivers (module_init). ++ */ ++subsys_initcall(bcm_power_init); ++module_exit(bcm_power_exit); ++ ++MODULE_AUTHOR("Phil Elwell"); ++MODULE_DESCRIPTION("Interface to BCM2708 power management"); ++MODULE_LICENSE("GPL"); +diff --git a/include/soc/bcm2835/power.h b/include/soc/bcm2835/power.h +new file mode 100644 +index 0000000..bf22b26 +--- /dev/null ++++ b/include/soc/bcm2835/power.h +@@ -0,0 +1,61 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * ++ * 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. ++ * ++ * This device provides a shared mechanism for controlling the power to ++ * VideoCore subsystems. ++ */ ++ ++#ifndef _BCM2708_POWER_H ++#define _BCM2708_POWER_H ++ ++#include ++ ++/* Use meaningful names on each side */ ++#ifdef __VIDEOCORE__ ++#define PREFIX(x) ARM_##x ++#else ++#define PREFIX(x) BCM_##x ++#endif ++ ++enum { ++ PREFIX(POWER_SDCARD_BIT), ++ PREFIX(POWER_UART_BIT), ++ PREFIX(POWER_MINIUART_BIT), ++ PREFIX(POWER_USB_BIT), ++ PREFIX(POWER_I2C0_BIT), ++ PREFIX(POWER_I2C1_BIT), ++ PREFIX(POWER_I2C2_BIT), ++ PREFIX(POWER_SPI_BIT), ++ PREFIX(POWER_CCP2TX_BIT), ++ PREFIX(POWER_DSI_BIT), ++ ++ PREFIX(POWER_MAX) ++}; ++ ++enum { ++ PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), ++ PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), ++ PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), ++ PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), ++ PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), ++ PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), ++ PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), ++ PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), ++ PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), ++ PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), ++ ++ PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, ++ PREFIX(POWER_NONE) = 0 ++}; ++ ++typedef unsigned int BCM_POWER_HANDLE_T; ++ ++extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); ++extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); ++extern int bcm_power_close(BCM_POWER_HANDLE_T handle); ++ ++#endif + +From 7ea54e2541e0445c98c3b5bb4b0e80af76c5c197 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 23 May 2015 23:31:40 +0200 +Subject: [PATCH 186/216] bcm2835: Use empty bootargs in Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The VideoCore bootloader concatenates the bootargs property together +with /boot/cmdline.txt and includes it's own set of options. +Set bootargs to an empty string to behave like BCM270x. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 72d0354..40fc759 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -6,7 +6,7 @@ + interrupt-parent = <&intc>; + + chosen { +- bootargs = "earlyprintk console=ttyAMA0"; ++ bootargs = ""; + }; + + soc { + +From b340f9126d88eafd83e2ae6e0b593bea562f92f5 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 11 May 2015 09:00:42 +0100 +Subject: [PATCH 187/216] scripts: Add mkknlimg and knlinfo scripts from tools + repo + +The Raspberry Pi firmware looks for a trailer on the kernel image to +determine whether it was compiled with Device Tree support enabled. +If the firmware finds a kernel without this trailer, or which has a +trailer indicating that it isn't DT-capable, it disables DT support +and reverts to using ATAGs. + +The mkknlimg utility adds that trailer, having first analysed the +image to look for signs of DT support and the kernel version string. + +knlinfo displays the contents of the trailer in the given kernel image. +--- + scripts/knlinfo | 167 +++++++++++++++++++++++++++++++++++ + scripts/mkknlimg | 260 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 427 insertions(+) + create mode 100755 scripts/knlinfo + create mode 100755 scripts/mkknlimg + +diff --git a/scripts/knlinfo b/scripts/knlinfo +new file mode 100755 +index 0000000..9c9b42e3 +--- /dev/null ++++ b/scripts/knlinfo +@@ -0,0 +1,167 @@ ++#!/usr/bin/env perl ++# ---------------------------------------------------------------------- ++# knlinfo by Phil Elwell for Raspberry Pi ++# ++# (c) 2014,2015 Raspberry Pi (Trading) Limited ++# ++# Licensed under the terms of the GNU General Public License. ++# ---------------------------------------------------------------------- ++ ++use strict; ++use integer; ++ ++use Fcntl ":seek"; ++ ++my $trailer_magic = 'RPTL'; ++ ++my %atom_formats = ++( ++ 'DTOK' => \&format_bool, ++ 'KVer' => \&format_string, ++); ++ ++if (@ARGV != 1) ++{ ++ print ("Usage: knlinfo \n"); ++ exit(1); ++} ++ ++my $kernel_file = $ARGV[0]; ++ ++ ++my ($atoms, $pos) = read_trailer($kernel_file); ++ ++exit(1) if (!$atoms); ++ ++printf("Kernel trailer found at %d/0x%x:\n", $pos, $pos); ++ ++foreach my $atom (@$atoms) ++{ ++ printf(" %s: %s\n", $atom->[0], format_atom($atom)); ++} ++ ++exit(0); ++ ++sub read_trailer ++{ ++ my ($kernel_file) = @_; ++ my $fh; ++ ++ if (!open($fh, '<', $kernel_file)) ++ { ++ print ("* Failed to open '$kernel_file'\n"); ++ return undef; ++ } ++ ++ if (!seek($fh, -12, SEEK_END)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ my $last_bytes; ++ sysread($fh, $last_bytes, 12); ++ ++ my ($trailer_len, $data_len, $magic) = unpack('VVa4', $last_bytes); ++ ++ if (($magic ne $trailer_magic) || ($data_len != 4)) ++ { ++ print ("* no trailer\n"); ++ return undef; ++ } ++ if (!seek($fh, -12, SEEK_END)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ $trailer_len -= 12; ++ ++ while ($trailer_len > 0) ++ { ++ if ($trailer_len < 8) ++ { ++ print ("* truncated atom header in trailer\n"); ++ return undef; ++ } ++ if (!seek($fh, -8, SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ $trailer_len -= 8; ++ ++ my $atom_hdr; ++ sysread($fh, $atom_hdr, 8); ++ my ($atom_len, $atom_type) = unpack('Va4', $atom_hdr); ++ ++ if ($trailer_len < $atom_len) ++ { ++ print ("* truncated atom data in trailer\n"); ++ return undef; ++ } ++ ++ my $rounded_len = (($atom_len + 3) & ~3); ++ if (!seek($fh, -(8 + $rounded_len), SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ $trailer_len -= $rounded_len; ++ ++ my $atom_data; ++ sysread($fh, $atom_data, $atom_len); ++ ++ if (!seek($fh, -$atom_len, SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ push @$atoms, [ $atom_type, $atom_data ]; ++ } ++ ++ if (($$atoms[-1][0] eq "\x00\x00\x00\x00") && ++ ($$atoms[-1][1] eq "")) ++ { ++ pop @$atoms; ++ } ++ else ++ { ++ print ("* end marker missing from trailer\n"); ++ } ++ ++ return ($atoms, tell($fh)); ++} ++ ++sub format_atom ++{ ++ my ($atom) = @_; ++ ++ my $format_func = $atom_formats{$atom->[0]} || \&format_hex; ++ return $format_func->($atom->[1]); ++} ++ ++sub format_bool ++{ ++ my ($data) = @_; ++ return unpack('V', $data) ? 'true' : 'false'; ++} ++ ++sub format_int ++{ ++ my ($data) = @_; ++ return unpack('V', $data); ++} ++ ++sub format_string ++{ ++ my ($data) = @_; ++ return '"'.$data.'"'; ++} ++ ++sub format_hex ++{ ++ my ($data) = @_; ++ return unpack('H*', $data); ++} +diff --git a/scripts/mkknlimg b/scripts/mkknlimg +new file mode 100755 +index 0000000..ac829d0 +--- /dev/null ++++ b/scripts/mkknlimg +@@ -0,0 +1,260 @@ ++#!/usr/bin/env perl ++# ---------------------------------------------------------------------- ++# mkknlimg by Phil Elwell for Raspberry Pi ++# based on extract-ikconfig Dick Streefland ++# ++# (c) 2009,2010 Dick Streefland ++# (c) 2014,2015 Raspberry Pi (Trading) Limited ++# ++# Licensed under the terms of the GNU General Public License. ++# ---------------------------------------------------------------------- ++ ++use strict; ++use warnings; ++use integer; ++ ++my $trailer_magic = 'RPTL'; ++ ++my $tmpfile1 = "/tmp/mkknlimg_$$.1"; ++my $tmpfile2 = "/tmp/mkknlimg_$$.2"; ++ ++my $dtok = 0; ++ ++while (@ARGV && ($ARGV[0] =~ /^-/)) ++{ ++ my $arg = shift(@ARGV); ++ if ($arg eq '--dtok') ++ { ++ $dtok = 1; ++ } ++ else ++ { ++ print ("* Unknown option '$arg'\n"); ++ usage(); ++ } ++} ++ ++usage() if (@ARGV != 2); ++ ++my $kernel_file = $ARGV[0]; ++my $out_file = $ARGV[1]; ++ ++if (! -r $kernel_file) ++{ ++ print ("* File '$kernel_file' not found\n"); ++ usage(); ++} ++ ++my @wanted_config_lines = ++( ++ 'CONFIG_BCM2708_DT' ++); ++ ++my @wanted_strings = ++( ++ 'bcm2708_fb', ++ 'brcm,bcm2708-pinctrl', ++ 'brcm,bcm2835-gpio', ++ 'of_find_property' ++); ++ ++my $res = try_extract($kernel_file, $tmpfile1); ++$res = try_decompress('\037\213\010', 'xy', 'gunzip', 0, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('BZh', 'xy', 'bunzip2', 0, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('\211\114\132', 'xy', 'lzop -d', 0, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++ ++my $append_trailer; ++my $trailer; ++my $kver = '?'; ++ ++$append_trailer = $dtok; ++ ++if ($res) ++{ ++ $kver = $res->{''} || '?'; ++ print("Version: $kver\n"); ++ ++ $append_trailer = $dtok; ++ if (!$dtok) ++ { ++ if (config_bool($res, 'bcm2708_fb')) ++ { ++ $dtok ||= config_bool($res, 'CONFIG_BCM2708_DT'); ++ $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); ++ $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); ++ $append_trailer = 1; ++ } ++ else ++ { ++ print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); ++ } ++ } ++} ++elsif (!$dtok) ++{ ++ print ("* Is this a valid kernel? In pass-through mode.\n"); ++} ++ ++if ($append_trailer) ++{ ++ printf("DT: %s\n", $dtok ? "y" : "n"); ++ ++ my @atoms; ++ ++ push @atoms, [ $trailer_magic, pack('V', 0) ]; ++ push @atoms, [ 'KVer', $kver ]; ++ push @atoms, [ 'DTOK', pack('V', $dtok) ]; ++ ++ $trailer = pack_trailer(\@atoms); ++ $atoms[0]->[1] = pack('V', length($trailer)); ++ ++ $trailer = pack_trailer(\@atoms); ++} ++ ++my $ofh; ++my $total_len = 0; ++ ++if ($out_file eq $kernel_file) ++{ ++ die "* Failed to open '$out_file' for append\n" ++ if (!open($ofh, '>>', $out_file)); ++ $total_len = tell($ofh); ++} ++else ++{ ++ die "* Failed to open '$kernel_file'\n" ++ if (!open(my $ifh, '<', $kernel_file)); ++ die "* Failed to create '$out_file'\n" ++ if (!open($ofh, '>', $out_file)); ++ ++ my $copybuf; ++ while (1) ++ { ++ my $bytes = sysread($ifh, $copybuf, 64*1024); ++ last if (!$bytes); ++ syswrite($ofh, $copybuf, $bytes); ++ $total_len += $bytes; ++ } ++ close($ifh); ++} ++ ++if ($trailer) ++{ ++ # Pad to word-alignment ++ syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3)); ++ syswrite($ofh, $trailer); ++} ++ ++close($ofh); ++ ++exit($trailer ? 0 : 1); ++ ++END { ++ unlink($tmpfile1) if ($tmpfile1); ++ unlink($tmpfile2) if ($tmpfile2); ++} ++ ++ ++sub usage ++{ ++ print ("Usage: mkknlimg [--dtok] \n"); ++ exit(1); ++} ++ ++sub try_extract ++{ ++ my ($knl, $tmp) = @_; ++ ++ my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`; ++ ++ return undef if (!$ver); ++ ++ chomp($ver); ++ ++ my $res = { ''=>$ver }; ++ my $string_pattern = '^('.join('|', @wanted_strings).')$'; ++ ++ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; ++ foreach my $match (@matches) ++ { ++ chomp($match); ++ $res->{$match} = 1; ++ } ++ ++ my $config_pattern = '^('.join('|', @wanted_config_lines).')=(.*)$'; ++ my $cf1 = 'IKCFG_ST\037\213\010'; ++ my $cf2 = '0123456789'; ++ ++ my $pos = `tr "$cf1\n$cf2" "\n$cf2=" < "$knl" | grep -abo "^$cf2"`; ++ if ($pos) ++ { ++ $pos =~ s/:.*[\r\n]*$//s; ++ $pos += 8; ++ my $err = (system("tail -c+$pos \"$knl\" | zcat > $tmp 2> /dev/null") >> 8); ++ if (($err == 0) || ($err == 2)) ++ { ++ if (open(my $fh, '<', $tmp)) ++ { ++ while (my $line = <$fh>) ++ { ++ chomp($line); ++ $res->{$1} = $2 if ($line =~ /$config_pattern/); ++ } ++ ++ close($fh); ++ } ++ } ++ } ++ ++ return $res; ++} ++ ++ ++sub try_decompress ++{ ++ my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_; ++ ++ my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`; ++ if ($pos) ++ { ++ chomp($pos); ++ $pos = (split(/[\r\n]+/, $pos))[$idx]; ++ return undef if (!defined($pos)); ++ $pos =~ s/:.*[\r\n]*$//s; ++ my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null"; ++ my $err = (system($cmd) >> 8); ++ return undef if (($err != 0) && ($err != 2)); ++ ++ return try_extract($tmp2, $tmp1); ++ } ++ ++ return undef; ++} ++ ++sub pack_trailer ++{ ++ my ($atoms) = @_; ++ my $trailer = pack('VV', 0, 0); ++ for (my $i = $#$atoms; $i>=0; $i--) ++ { ++ my $atom = $atoms->[$i]; ++ $trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]); ++ } ++ return $trailer; ++} ++ ++sub config_bool ++{ ++ my ($configs, $wanted) = @_; ++ my $val = $configs->{$wanted} || 'n'; ++ return (($val eq 'y') || ($val eq '1')); ++} + +From 2ab7f22fc98a7e6f66c3924d0eff9a721b159029 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 28 May 2015 18:35:44 +0100 +Subject: [PATCH 188/216] scripts/mkknlimg: Add support for ARCH_BCM2835 + +Add a new trailer field indicating whether this is an ARCH_BCM2835 +build, as opposed to MACH_BCM2708/9. If the loader finds this flag +is set it changes the default base dtb file name from bcm270x... +to bcm283y... + +Also update knlinfo to show the status of the field. +--- + scripts/knlinfo | 1 + + scripts/mkknlimg | 25 ++++++++++++++++++++----- + 2 files changed, 21 insertions(+), 5 deletions(-) + +diff --git a/scripts/knlinfo b/scripts/knlinfo +index 9c9b42e3..a0e8663 100755 +--- a/scripts/knlinfo ++++ b/scripts/knlinfo +@@ -18,6 +18,7 @@ my %atom_formats = + ( + 'DTOK' => \&format_bool, + 'KVer' => \&format_string, ++ '283x' => \&format_bool, + ); + + if (@ARGV != 1) +diff --git a/scripts/mkknlimg b/scripts/mkknlimg +index ac829d0..3dff948 100755 +--- a/scripts/mkknlimg ++++ b/scripts/mkknlimg +@@ -1,7 +1,7 @@ + #!/usr/bin/env perl + # ---------------------------------------------------------------------- + # mkknlimg by Phil Elwell for Raspberry Pi +-# based on extract-ikconfig Dick Streefland ++# based on extract-ikconfig by Dick Streefland + # + # (c) 2009,2010 Dick Streefland + # (c) 2014,2015 Raspberry Pi (Trading) Limited +@@ -19,6 +19,7 @@ my $tmpfile1 = "/tmp/mkknlimg_$$.1"; + my $tmpfile2 = "/tmp/mkknlimg_$$.2"; + + my $dtok = 0; ++my $is_283x = 0; + + while (@ARGV && ($ARGV[0] =~ /^-/)) + { +@@ -27,6 +28,10 @@ while (@ARGV && ($ARGV[0] =~ /^-/)) + { + $dtok = 1; + } ++ elsif ($arg eq '--283x') ++ { ++ $is_283x = 1; ++ } + else + { + print ("* Unknown option '$arg'\n"); +@@ -47,15 +52,18 @@ if (! -r $kernel_file) + + my @wanted_config_lines = + ( +- 'CONFIG_BCM2708_DT' ++ 'CONFIG_BCM2708_DT', ++ 'CONFIG_ARCH_BCM2835' + ); + + my @wanted_strings = + ( + 'bcm2708_fb', ++ 'brcm,bcm2835-mmc', ++ 'brcm,bcm2835-sdhost', + 'brcm,bcm2708-pinctrl', + 'brcm,bcm2835-gpio', +- 'of_find_property' ++ 'brcm,bcm2835-pm-wdt' + ); + + my $res = try_extract($kernel_file, $tmpfile1); +@@ -86,11 +94,16 @@ if ($res) + $append_trailer = $dtok; + if (!$dtok) + { +- if (config_bool($res, 'bcm2708_fb')) ++ if (config_bool($res, 'bcm2708_fb') || ++ config_bool($res, 'brcm,bcm2835-mmc') || ++ config_bool($res, 'brcm,bcm2835-sdhost')) + { + $dtok ||= config_bool($res, 'CONFIG_BCM2708_DT'); ++ $dtok ||= config_bool($res, 'CONFIG_ARCH_BCM2835'); + $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); + $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); ++ $is_283x ||= config_bool($res, 'CONFIG_ARCH_BCM2835'); ++ $is_283x ||= config_bool($res, 'brcm,bcm2835-pm-wdt'); + $append_trailer = 1; + } + else +@@ -107,12 +120,14 @@ elsif (!$dtok) + if ($append_trailer) + { + printf("DT: %s\n", $dtok ? "y" : "n"); ++ printf("283x: %s\n", $is_283x ? "y" : "n"); + + my @atoms; + + push @atoms, [ $trailer_magic, pack('V', 0) ]; + push @atoms, [ 'KVer', $kver ]; + push @atoms, [ 'DTOK', pack('V', $dtok) ]; ++ push @atoms, [ '283x', pack('V', $is_283x) ]; + + $trailer = pack_trailer(\@atoms); + $atoms[0]->[1] = pack('V', length($trailer)); +@@ -166,7 +181,7 @@ END { + + sub usage + { +- print ("Usage: mkknlimg [--dtok] \n"); ++ print ("Usage: mkknlimg [--dtok] [--283x] \n"); + exit(1); + } + + +From 73bb23f8980890aad84dc6b852f0aac91ab71981 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 10 Mar 2015 18:35:18 +0100 +Subject: [PATCH 189/216] config: add KEYBOARD_GPIO + +--- + arch/arm/configs/bcm2709_defconfig | 3 ++- + arch/arm/configs/bcmrpi_defconfig | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 9daaeb7..5ce9a01 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -520,7 +520,8 @@ CONFIG_INPUT_POLLDEV=m + # CONFIG_INPUT_MOUSEDEV_PSAUX is not set + CONFIG_INPUT_JOYDEV=m + CONFIG_INPUT_EVDEV=m +-# CONFIG_INPUT_KEYBOARD is not set ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m + # CONFIG_INPUT_MOUSE is not set + CONFIG_INPUT_JOYSTICK=y + CONFIG_JOYSTICK_IFORCE=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index dc27aeb..da443da 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -513,7 +513,8 @@ CONFIG_INPUT_POLLDEV=m + # CONFIG_INPUT_MOUSEDEV_PSAUX is not set + CONFIG_INPUT_JOYDEV=m + CONFIG_INPUT_EVDEV=m +-# CONFIG_INPUT_KEYBOARD is not set ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m + # CONFIG_INPUT_MOUSE is not set + CONFIG_INPUT_JOYSTICK=y + CONFIG_JOYSTICK_IFORCE=m + +From d7d347201d595ccc495da617ab583fdb3e282829 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 10 Mar 2015 18:35:59 +0100 +Subject: [PATCH 190/216] dts: overlay: add support for tinylcd.com 3.5" + display +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree overlay for 3.5" display by tinylcd.com + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/tinylcd35-overlay.dts | 216 ++++++++++++++++++++++++++++++++ + 2 files changed, 217 insertions(+) + create mode 100644 arch/arm/boot/dts/tinylcd35-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 9124dfb..25ea8eb 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -38,6 +38,7 @@ dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb +diff --git a/arch/arm/boot/dts/tinylcd35-overlay.dts b/arch/arm/boot/dts/tinylcd35-overlay.dts +new file mode 100644 +index 0000000..f7102c8 +--- /dev/null ++++ b/arch/arm/boot/dts/tinylcd35-overlay.dts +@@ -0,0 +1,216 @@ ++/* ++ * tinylcd35-overlay.dts ++ * ++ * ------------------------------------------------- ++ * www.tinlylcd.com ++ * ------------------------------------------------- ++ * Device---Driver-----BUS GPIO's ++ * display tinylcd35 spi0.0 25 24 18 ++ * touch ads7846 spi0.1 5 ++ * rtc ds1307 i2c1-0068 ++ * rtc pcf8563 i2c1-0051 ++ * keypad gpio-keys --------- 17 22 27 23 28 ++ * ++ * ++ * TinyLCD.com 3.5 inch TFT ++ * ++ * Version 001 ++ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework ++ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ tinylcd35_pins: tinylcd35_pins { ++ brcm,pins = <25 24 18>; ++ brcm,function = <1>; /* out */ ++ }; ++ tinylcd35_ts_pins: tinylcd35_ts_pins { ++ brcm,pins = <5>; ++ brcm,function = <0>; /* in */ ++ }; ++ keypad_pins: keypad_pins { ++ brcm,pins = <4 17 22 23 27>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <1>; /* down */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tinylcd35: tinylcd35@0{ ++ compatible = "neosec,tinylcd"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&tinylcd35_pins>, ++ <&tinylcd35_ts_pins>; ++ ++ spi-max-frequency = <48000000>; ++ rotate = <270>; ++ fps = <20>; ++ bgr; ++ buswidth = <8>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ ++ init = <0x10000B0 0x80 ++ 0x10000C0 0x0A 0x0A ++ 0x10000C1 0x01 0x01 ++ 0x10000C2 0x33 ++ 0x10000C5 0x00 0x42 0x80 ++ 0x10000B1 0xD0 0x11 ++ 0x10000B4 0x02 ++ 0x10000B6 0x00 0x22 0x3B ++ 0x10000B7 0x07 ++ 0x1000036 0x58 ++ 0x10000F0 0x36 0xA5 0xD3 ++ 0x10000E5 0x80 ++ 0x10000E5 0x01 ++ 0x10000B3 0x00 ++ 0x10000E5 0x00 ++ 0x10000F0 0x36 0xA5 0x53 ++ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 ++ 0x100003A 0x55 ++ 0x1000011 ++ 0x2000001 ++ 0x1000029>; ++ }; ++ ++ tinylcd35_ts: tinylcd35_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ status = "disabled"; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 5 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ ++ /* RTC */ ++ ++ fragment@3 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* ++ * Values for input event code is found under the ++ * 'Keys and buttons' heading in include/uapi/linux/input.h ++ */ ++ fragment@5 { ++ target-path = "/soc"; ++ __overlay__ { ++ keypad: keypad { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&keypad_pins>; ++ status = "disabled"; ++ autorepeat; ++ ++ button@17 { ++ label = "GPIO KEY_UP"; ++ linux,code = <103>; ++ gpios = <&gpio 17 0>; ++ }; ++ button@22 { ++ label = "GPIO KEY_DOWN"; ++ linux,code = <108>; ++ gpios = <&gpio 22 0>; ++ }; ++ button@27 { ++ label = "GPIO KEY_LEFT"; ++ linux,code = <105>; ++ gpios = <&gpio 27 0>; ++ }; ++ button@23 { ++ label = "GPIO KEY_RIGHT"; ++ linux,code = <106>; ++ gpios = <&gpio 23 0>; ++ }; ++ button@4 { ++ label = "GPIO KEY_ENTER"; ++ linux,code = <28>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&tinylcd35>,"spi-max-frequency:0"; ++ rotate = <&tinylcd35>,"rotate:0"; ++ fps = <&tinylcd35>,"fps:0"; ++ debug = <&tinylcd35>,"debug:0"; ++ touch = <&tinylcd35_ts>,"status"; ++ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", ++ <&tinylcd35_ts>,"interrupts:0", ++ <&tinylcd35_ts>,"pendown-gpio:4"; ++ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; ++ rtc-pcf = <&i2c1>,"status", ++ <&pcf8563>,"status"; ++ rtc-ds = <&i2c1>,"status", ++ <&ds1307>,"status"; ++ keypad = <&keypad>,"status"; ++ }; ++}; + +From 4b843d5be018d8d392a4be34a7fdfe3640e3c2a7 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 29 May 2015 14:16:47 +0100 +Subject: [PATCH 191/216] BCM270X_DT: Move the overlays into a subdirectory, + adding the README + +--- + arch/arm/boot/dts/Makefile | 31 +- + arch/arm/boot/dts/ads7846-overlay.dts | 83 ---- + arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts | 23 - + arch/arm/boot/dts/ds1307-rtc-overlay.dts | 22 - + arch/arm/boot/dts/enc28j60-overlay.dts | 29 -- + arch/arm/boot/dts/hifiberry-amp-overlay.dts | 39 -- + arch/arm/boot/dts/hifiberry-dac-overlay.dts | 34 -- + arch/arm/boot/dts/hifiberry-dacplus-overlay.dts | 39 -- + arch/arm/boot/dts/hifiberry-digi-overlay.dts | 39 -- + arch/arm/boot/dts/hy28a-overlay.dts | 87 ---- + arch/arm/boot/dts/hy28b-overlay.dts | 142 ------- + arch/arm/boot/dts/i2c-rtc-overlay.dts | 43 -- + arch/arm/boot/dts/iqaudio-dac-overlay.dts | 39 -- + arch/arm/boot/dts/iqaudio-dacplus-overlay.dts | 39 -- + arch/arm/boot/dts/lirc-rpi-overlay.dts | 57 --- + arch/arm/boot/dts/mmc-overlay.dts | 19 - + arch/arm/boot/dts/mz61581-overlay.dts | 109 ----- + arch/arm/boot/dts/overlays/Makefile | 51 +++ + arch/arm/boot/dts/overlays/README | 470 +++++++++++++++++++++ + arch/arm/boot/dts/overlays/ads7846-overlay.dts | 83 ++++ + .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + + arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts | 22 + + arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 29 ++ + .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 ++ + .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 ++ + .../dts/overlays/hifiberry-dacplus-overlay.dts | 39 ++ + .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 ++ + arch/arm/boot/dts/overlays/hy28a-overlay.dts | 87 ++++ + arch/arm/boot/dts/overlays/hy28b-overlay.dts | 142 +++++++ + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 49 +++ + arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 39 ++ + .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 39 ++ + arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 +++ + arch/arm/boot/dts/overlays/mmc-overlay.dts | 19 + + arch/arm/boot/dts/overlays/mz61581-overlay.dts | 109 +++++ + arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts | 22 + + arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts | 22 + + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 94 +++++ + .../dts/overlays/pitft28-resistive-overlay.dts | 115 +++++ + arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 34 ++ + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 ++ + arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 82 ++++ + arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 ++ + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 75 ++++ + arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts | 18 + + arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts | 18 + + arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 216 ++++++++++ + arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 ++ + .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 ++ + arch/arm/boot/dts/pcf2127-rtc-overlay.dts | 22 - + arch/arm/boot/dts/pcf8523-rtc-overlay.dts | 22 - + arch/arm/boot/dts/piscreen-overlay.dts | 94 ----- + arch/arm/boot/dts/pitft28-resistive-overlay.dts | 115 ----- + arch/arm/boot/dts/pps-gpio-overlay.dts | 34 -- + arch/arm/boot/dts/rpi-dac-overlay.dts | 34 -- + arch/arm/boot/dts/rpi-display-overlay.dts | 82 ---- + arch/arm/boot/dts/rpi-proto-overlay.dts | 39 -- + arch/arm/boot/dts/sdhost-overlay.dts | 75 ---- + arch/arm/boot/dts/spi-bcm2708-overlay.dts | 18 - + arch/arm/boot/dts/spi-bcm2835-overlay.dts | 18 - + arch/arm/boot/dts/tinylcd35-overlay.dts | 216 ---------- + arch/arm/boot/dts/w1-gpio-overlay.dts | 39 -- + arch/arm/boot/dts/w1-gpio-pullup-overlay.dts | 41 -- + 63 files changed, 2220 insertions(+), 1722 deletions(-) + delete mode 100644 arch/arm/boot/dts/ads7846-overlay.dts + delete mode 100644 arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts + delete mode 100644 arch/arm/boot/dts/ds1307-rtc-overlay.dts + delete mode 100755 arch/arm/boot/dts/enc28j60-overlay.dts + delete mode 100644 arch/arm/boot/dts/hifiberry-amp-overlay.dts + delete mode 100644 arch/arm/boot/dts/hifiberry-dac-overlay.dts + delete mode 100644 arch/arm/boot/dts/hifiberry-dacplus-overlay.dts + delete mode 100644 arch/arm/boot/dts/hifiberry-digi-overlay.dts + delete mode 100644 arch/arm/boot/dts/hy28a-overlay.dts + delete mode 100644 arch/arm/boot/dts/hy28b-overlay.dts + delete mode 100644 arch/arm/boot/dts/i2c-rtc-overlay.dts + delete mode 100644 arch/arm/boot/dts/iqaudio-dac-overlay.dts + delete mode 100644 arch/arm/boot/dts/iqaudio-dacplus-overlay.dts + delete mode 100644 arch/arm/boot/dts/lirc-rpi-overlay.dts + delete mode 100644 arch/arm/boot/dts/mmc-overlay.dts + delete mode 100644 arch/arm/boot/dts/mz61581-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/Makefile + create mode 100644 arch/arm/boot/dts/overlays/README + create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts + delete mode 100644 arch/arm/boot/dts/pcf2127-rtc-overlay.dts + delete mode 100644 arch/arm/boot/dts/pcf8523-rtc-overlay.dts + delete mode 100644 arch/arm/boot/dts/piscreen-overlay.dts + delete mode 100644 arch/arm/boot/dts/pitft28-resistive-overlay.dts + delete mode 100644 arch/arm/boot/dts/pps-gpio-overlay.dts + delete mode 100644 arch/arm/boot/dts/rpi-dac-overlay.dts + delete mode 100644 arch/arm/boot/dts/rpi-display-overlay.dts + delete mode 100644 arch/arm/boot/dts/rpi-proto-overlay.dts + delete mode 100644 arch/arm/boot/dts/sdhost-overlay.dts + delete mode 100644 arch/arm/boot/dts/spi-bcm2708-overlay.dts + delete mode 100644 arch/arm/boot/dts/spi-bcm2835-overlay.dts + delete mode 100644 arch/arm/boot/dts/tinylcd35-overlay.dts + delete mode 100644 arch/arm/boot/dts/w1-gpio-overlay.dts + delete mode 100644 arch/arm/boot/dts/w1-gpio-pullup-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 25ea8eb..ea93e1d 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -13,36 +13,7 @@ ifeq ($(CONFIG_BCM2709_DT),y) + RPI_DT_OVERLAYS=y + endif + +-dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += ds1307-rtc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += pcf2127-rtc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += pcf8523-rtc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb ++subdir-$(RPI_DT_OVERLAYS) += overlays + + dtb-$(CONFIG_MACH_ASM9260) += \ + alphascale-asm9260-devkit.dtb +diff --git a/arch/arm/boot/dts/ads7846-overlay.dts b/arch/arm/boot/dts/ads7846-overlay.dts +deleted file mode 100644 +index 6a92cd1..0000000 +--- a/arch/arm/boot/dts/ads7846-overlay.dts ++++ /dev/null +@@ -1,83 +0,0 @@ +-/* +- * Generic Device Tree overlay for the ADS7846 touch controller +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- ads7846_pins: ads7846_pins { +- brcm,pins = <255>; /* illegal default value */ +- brcm,function = <0>; /* in */ +- brcm,pull = <0>; /* none */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- ads7846: ads7846@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- pinctrl-names = "default"; +- pinctrl-0 = <&ads7846_pins>; +- +- spi-max-frequency = <2000000>; +- interrupts = <255 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 255 0>; +- +- /* driver defaults */ +- ti,x-min = /bits/ 16 <0>; +- ti,y-min = /bits/ 16 <0>; +- ti,x-max = /bits/ 16 <0x0FFF>; +- ti,y-max = /bits/ 16 <0x0FFF>; +- ti,pressure-min = /bits/ 16 <0>; +- ti,pressure-max = /bits/ 16 <0xFFFF>; +- ti,x-plate-ohms = /bits/ 16 <400>; +- }; +- }; +- }; +- __overrides__ { +- cs = <&ads7846>,"reg:0"; +- speed = <&ads7846>,"spi-max-frequency:0"; +- penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ +- <&ads7846>,"interrupts:0", +- <&ads7846>,"pendown-gpio:4"; +- penirq_pull = <&ads7846_pins>,"brcm,pull:0"; +- swapxy = <&ads7846>,"ti,swap-xy?"; +- xmin = <&ads7846>,"ti,x-min;0"; +- ymin = <&ads7846>,"ti,y-min;0"; +- xmax = <&ads7846>,"ti,x-max;0"; +- ymax = <&ads7846>,"ti,y-max;0"; +- pmin = <&ads7846>,"ti,pressure-min;0"; +- pmax = <&ads7846>,"ti,pressure-max;0"; +- xohms = <&ads7846>,"ti,x-plate-ohms;0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts +deleted file mode 100644 +index b830bf2..0000000 +--- a/arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts ++++ /dev/null +@@ -1,23 +0,0 @@ +-// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- bmp085@77 { +- compatible = "bosch,bmp085"; +- reg = <0x77>; +- default-oversampling = <3>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/ds1307-rtc-overlay.dts b/arch/arm/boot/dts/ds1307-rtc-overlay.dts +deleted file mode 100644 +index 7d27044..0000000 +--- a/arch/arm/boot/dts/ds1307-rtc-overlay.dts ++++ /dev/null +@@ -1,22 +0,0 @@ +-// Definitions for DS1307 Real Time Clock +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- ds1307@68 { +- compatible = "maxim,ds1307"; +- reg = <0x68>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/enc28j60-overlay.dts b/arch/arm/boot/dts/enc28j60-overlay.dts +deleted file mode 100755 +index aa9b645..0000000 +--- a/arch/arm/boot/dts/enc28j60-overlay.dts ++++ /dev/null +@@ -1,29 +0,0 @@ +-// Overlay for the Microchip ENC28J60 Ethernet Controller +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- enc28j60@0{ +- compatible = "microchip,enc28j60"; +- reg = <0>; /* CE0 */ +- spi-max-frequency = <12000000>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/hifiberry-amp-overlay.dts +deleted file mode 100644 +index 2c81448..0000000 +--- a/arch/arm/boot/dts/hifiberry-amp-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for HiFiBerry Amp/Amp+ +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "hifiberry,hifiberry-amp"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- tas5713@1b { +- #sound-dai-cells = <0>; +- compatible = "ti,tas5713"; +- reg = <0x1b>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/hifiberry-dac-overlay.dts +deleted file mode 100644 +index 5e7633a..0000000 +--- a/arch/arm/boot/dts/hifiberry-dac-overlay.dts ++++ /dev/null +@@ -1,34 +0,0 @@ +-// Definitions for HiFiBerry DAC +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "hifiberry,hifiberry-dac"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target-path = "/"; +- __overlay__ { +- pcm5102a-codec { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm5102a"; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/hifiberry-dacplus-overlay.dts +deleted file mode 100644 +index deb9c625..0000000 +--- a/arch/arm/boot/dts/hifiberry-dacplus-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for HiFiBerry DAC+ +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "hifiberry,hifiberry-dacplus"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcm5122@4d { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm5122"; +- reg = <0x4d>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/hifiberry-digi-overlay.dts +deleted file mode 100644 +index d0e0d8a..0000000 +--- a/arch/arm/boot/dts/hifiberry-digi-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for HiFiBerry Digi +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "hifiberry,hifiberry-digi"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- wm8804@3b { +- #sound-dai-cells = <0>; +- compatible = "wlf,wm8804"; +- reg = <0x3b>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hy28a-overlay.dts b/arch/arm/boot/dts/hy28a-overlay.dts +deleted file mode 100644 +index 3cd3083..0000000 +--- a/arch/arm/boot/dts/hy28a-overlay.dts ++++ /dev/null +@@ -1,87 +0,0 @@ +-/* +- * Device Tree overlay for HY28A display +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- hy28a_pins: hy28a_pins { +- brcm,pins = <17 25 18>; +- brcm,function = <0 1 1>; /* in out out */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- hy28a: hy28a@0{ +- compatible = "ilitek,ili9320"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&hy28a_pins>; +- +- spi-max-frequency = <32000000>; +- spi-cpol; +- spi-cpha; +- rotate = <270>; +- bgr; +- fps = <50>; +- buswidth = <8>; +- startbyte = <0x70>; +- reset-gpios = <&gpio 25 0>; +- led-gpios = <&gpio 18 1>; +- debug = <0>; +- }; +- +- hy28a_ts: hy28a-ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <17 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 17 0>; +- ti,x-plate-ohms = /bits/ 16 <100>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&hy28a>,"spi-max-frequency:0"; +- rotate = <&hy28a>,"rotate:0"; +- fps = <&hy28a>,"fps:0"; +- debug = <&hy28a>,"debug:0"; +- xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; +- resetgpio = <&hy28a>,"reset-gpios:4", +- <&hy28a_pins>, "brcm,pins:1"; +- ledgpio = <&hy28a>,"led-gpios:4", +- <&hy28a_pins>, "brcm,pins:2"; +- }; +-}; +diff --git a/arch/arm/boot/dts/hy28b-overlay.dts b/arch/arm/boot/dts/hy28b-overlay.dts +deleted file mode 100644 +index f774c4a..0000000 +--- a/arch/arm/boot/dts/hy28b-overlay.dts ++++ /dev/null +@@ -1,142 +0,0 @@ +-/* +- * Device Tree overlay for HY28b display shield by Texy +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- hy28b_pins: hy28b_pins { +- brcm,pins = <17 25 18>; +- brcm,function = <0 1 1>; /* in out out */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- hy28b: hy28b@0{ +- compatible = "ilitek,ili9325"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&hy28b_pins>; +- +- spi-max-frequency = <48000000>; +- spi-cpol; +- spi-cpha; +- rotate = <270>; +- bgr; +- fps = <50>; +- buswidth = <8>; +- startbyte = <0x70>; +- reset-gpios = <&gpio 25 0>; +- led-gpios = <&gpio 18 1>; +- +- gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; +- +- init = <0x10000e7 0x0010 +- 0x1000000 0x0001 +- 0x1000001 0x0100 +- 0x1000002 0x0700 +- 0x1000003 0x1030 +- 0x1000004 0x0000 +- 0x1000008 0x0207 +- 0x1000009 0x0000 +- 0x100000a 0x0000 +- 0x100000c 0x0001 +- 0x100000d 0x0000 +- 0x100000f 0x0000 +- 0x1000010 0x0000 +- 0x1000011 0x0007 +- 0x1000012 0x0000 +- 0x1000013 0x0000 +- 0x2000032 +- 0x1000010 0x1590 +- 0x1000011 0x0227 +- 0x2000032 +- 0x1000012 0x009c +- 0x2000032 +- 0x1000013 0x1900 +- 0x1000029 0x0023 +- 0x100002b 0x000e +- 0x2000032 +- 0x1000020 0x0000 +- 0x1000021 0x0000 +- 0x2000032 +- 0x1000050 0x0000 +- 0x1000051 0x00ef +- 0x1000052 0x0000 +- 0x1000053 0x013f +- 0x1000060 0xa700 +- 0x1000061 0x0001 +- 0x100006a 0x0000 +- 0x1000080 0x0000 +- 0x1000081 0x0000 +- 0x1000082 0x0000 +- 0x1000083 0x0000 +- 0x1000084 0x0000 +- 0x1000085 0x0000 +- 0x1000090 0x0010 +- 0x1000092 0x0000 +- 0x1000093 0x0003 +- 0x1000095 0x0110 +- 0x1000097 0x0000 +- 0x1000098 0x0000 +- 0x1000007 0x0133 +- 0x1000020 0x0000 +- 0x1000021 0x0000 +- 0x2000064>; +- debug = <0>; +- }; +- +- hy28b_ts: hy28b-ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <17 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 17 0>; +- ti,x-plate-ohms = /bits/ 16 <100>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&hy28b>,"spi-max-frequency:0"; +- rotate = <&hy28b>,"rotate:0"; +- fps = <&hy28b>,"fps:0"; +- debug = <&hy28b>,"debug:0"; +- xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; +- resetgpio = <&hy28b>,"reset-gpios:4", +- <&hy28b_pins>, "brcm,pins:1"; +- ledgpio = <&hy28b>,"led-gpios:4", +- <&hy28b_pins>, "brcm,pins:2"; +- }; +-}; +diff --git a/arch/arm/boot/dts/i2c-rtc-overlay.dts b/arch/arm/boot/dts/i2c-rtc-overlay.dts +deleted file mode 100644 +index 5d5abb1..0000000 +--- a/arch/arm/boot/dts/i2c-rtc-overlay.dts ++++ /dev/null +@@ -1,43 +0,0 @@ +-// Definitions for several I2C based Real Time Clocks +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- ds1307: ds1307@68 { +- compatible = "maxim,ds1307"; +- reg = <0x68>; +- status = "disable"; +- }; +- ds3231: ds3231@68 { +- compatible = "maxim,ds3231"; +- reg = <0x68>; +- status = "disable"; +- }; +- pcf2127: pcf2127@51 { +- compatible = "nxp,pcf2127"; +- reg = <0x51>; +- status = "disable"; +- }; +- pcf8523: pcf8523@68 { +- compatible = "nxp,pcf8523"; +- reg = <0x68>; +- status = "disable"; +- }; +- }; +- }; +- __overrides__ { +- ds1307 = <&ds1307>,"status"; +- ds3231 = <&ds3231>,"status"; +- pcf2127 = <&pcf2127>,"status"; +- pcf8523 = <&pcf8523>,"status"; +- }; +-}; +diff --git a/arch/arm/boot/dts/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/iqaudio-dac-overlay.dts +deleted file mode 100644 +index ea8173e..0000000 +--- a/arch/arm/boot/dts/iqaudio-dac-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for IQaudIO DAC +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "iqaudio,iqaudio-dac"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcm5122@4c { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm5122"; +- reg = <0x4c>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/iqaudio-dacplus-overlay.dts +deleted file mode 100644 +index 735d8ab..0000000 +--- a/arch/arm/boot/dts/iqaudio-dacplus-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for IQaudIO DAC+ +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "iqaudio,iqaudio-dac"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcm5122@4c { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm5122"; +- reg = <0x4c>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/lirc-rpi-overlay.dts b/arch/arm/boot/dts/lirc-rpi-overlay.dts +deleted file mode 100644 +index 7d5d82b..0000000 +--- a/arch/arm/boot/dts/lirc-rpi-overlay.dts ++++ /dev/null +@@ -1,57 +0,0 @@ +-// Definitions for lirc-rpi module +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target-path = "/"; +- __overlay__ { +- lirc_rpi: lirc_rpi { +- compatible = "rpi,lirc-rpi"; +- pinctrl-names = "default"; +- pinctrl-0 = <&lirc_pins>; +- status = "okay"; +- +- // Override autodetection of IR receiver circuit +- // (0 = active high, 1 = active low, -1 = no override ) +- rpi,sense = <0xffffffff>; +- +- // Software carrier +- // (0 = off, 1 = on) +- rpi,softcarrier = <1>; +- +- // Invert output +- // (0 = off, 1 = on) +- rpi,invert = <0>; +- +- // Enable debugging messages +- // (0 = off, 1 = on) +- rpi,debug = <0>; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- lirc_pins: lirc_pins { +- brcm,pins = <17 18>; +- brcm,function = <1 0>; // out in +- brcm,pull = <0 1>; // off down +- }; +- }; +- }; +- +- __overrides__ { +- gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; +- gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; +- gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; +- +- sense = <&lirc_rpi>,"rpi,sense:0"; +- softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; +- invert = <&lirc_rpi>,"rpi,invert:0"; +- debug = <&lirc_rpi>,"rpi,debug:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/mmc-overlay.dts b/arch/arm/boot/dts/mmc-overlay.dts +deleted file mode 100644 +index 0a37cf4..0000000 +--- a/arch/arm/boot/dts/mmc-overlay.dts ++++ /dev/null +@@ -1,19 +0,0 @@ +-/dts-v1/; +-/plugin/; +- +-/{ +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&mmc>; +- +- __overlay__ { +- brcm,overclock-50 = <0>; +- }; +- }; +- +- __overrides__ { +- overclock_50 = <&mmc>,"brcm,overclock-50:0"; +- force_pio = <&mmc>,"brcm,force-pio?"; +- }; +-}; +diff --git a/arch/arm/boot/dts/mz61581-overlay.dts b/arch/arm/boot/dts/mz61581-overlay.dts +deleted file mode 100644 +index c06fe12..0000000 +--- a/arch/arm/boot/dts/mz61581-overlay.dts ++++ /dev/null +@@ -1,109 +0,0 @@ +-/* +- * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- mz61581_pins: mz61581_pins { +- brcm,pins = <4 15 18 25>; +- brcm,function = <0 1 1 1>; /* in out out out */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- mz61581: mz61581@0{ +- compatible = "samsung,s6d02a1"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&mz61581_pins>; +- +- spi-max-frequency = <128000000>; +- spi-cpol; +- spi-cpha; +- +- width = <320>; +- height = <480>; +- rotate = <270>; +- bgr; +- fps = <30>; +- buswidth = <8>; +- +- reset-gpios = <&gpio 15 0>; +- dc-gpios = <&gpio 25 0>; +- led-gpios = <&gpio 18 0>; +- +- init = <0x10000b0 00 +- 0x1000011 +- 0x20000ff +- 0x10000b3 0x02 0x00 0x00 0x00 +- 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 +- 0x10000c1 0x08 0x16 0x08 0x08 +- 0x10000c4 0x11 0x07 0x03 0x03 +- 0x10000c6 0x00 +- 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 +- 0x1000035 0x00 +- 0x1000036 0xa0 +- 0x100003a 0x55 +- 0x1000044 0x00 0x01 +- 0x10000d0 0x07 0x07 0x1d 0x03 +- 0x10000d1 0x03 0x30 0x10 +- 0x10000d2 0x03 0x14 0x04 +- 0x1000029 +- 0x100002c>; +- +- /* This is a workaround to make sure the init sequence slows down and doesn't fail */ +- debug = <3>; +- }; +- +- mz61581_ts: mz61581_ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <4 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 4 0>; +- +- ti,x-plate-ohms = /bits/ 16 <60>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&mz61581>, "spi-max-frequency:0"; +- rotate = <&mz61581>, "rotate:0"; +- fps = <&mz61581>, "fps:0"; +- debug = <&mz61581>, "debug:0"; +- xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +new file mode 100644 +index 0000000..d64e6b4 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -0,0 +1,51 @@ ++ifeq ($(CONFIG_OF),y) ++ ++# Overlays for the Raspberry Pi platform ++ ++ifeq ($(CONFIG_BCM2708_DT),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_BCM2709_DT),y) ++ RPI_DT_OVERLAYS=y ++endif ++ ++dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb ++ ++targets += dtbs dtbs_install ++targets += $(dtb-y) ++ ++endif ++ ++always := $(dtb-y) ++clean-files := *.dtb ++ ++# Enable fixups to support overlays on BCM2708 platforms ++ifeq ($(RPI_DT_OVERLAYS),y) ++ DTC_FLAGS ?= -@ ++endif +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +new file mode 100644 +index 0000000..c260612 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/README +@@ -0,0 +1,470 @@ ++Introduction ++============ ++ ++This directory contains Device Tree overlays. Device Tree makes it possible ++to support many hardware configurations with a single kernel and without the ++need to explicitly load or blacklist kernel modules. Note that this isn't a ++"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices ++are still configured by the board support code, but the intention is to ++eventually reach that goal. ++ ++On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By ++default, the Raspberry Pi kernel boots with device tree enabled. You can ++completely disable DT usage (for now) by adding: ++ ++ device_tree= ++ ++to your config.txt, which should cause your Pi to revert to the old way of ++doing things after a reboot. ++ ++In /boot you will find a .dtb for each base platform. This describes the ++hardware that is part of the Raspberry Pi board. The loader (start.elf and its ++siblings) selects the .dtb file appropriate for the platform by name, and reads ++it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) ++are disabled, but they can be enabled using Device Tree parameters: ++ ++ dtparam=i2c=on,i2s=on,spi=on ++ ++However, this shouldn't be necessary in many use cases because loading an ++overlay that requires one of those interfaces will cause it to be enabled ++automatically, and it is advisable to only enable interfaces if they are ++needed. ++ ++Configuring additional, optional hardware is done using Device Tree overlays ++(see below). ++ ++raspi-config ++============ ++ ++The Advanced Options section of the raspi-config utility can enable and disable ++Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it ++is possible to both enable an interface and blacklist the driver, if for some ++reason you should want to defer the loading. ++ ++Modules ++======= ++ ++As well as describing the hardware, Device Tree also gives enough information ++to allow suitable driver modules to be located and loaded, with the corollary ++that unneeded modules are not loaded. As a result it should be possible to ++remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can ++have its contents deleted (or commented out). ++ ++Using Overlays ++============== ++ ++Overlays are loaded using the "dtoverlay" directive. As an example, consider the ++popular lirc-rpi module, the Linux Infrared Remote Control driver. In the ++pre-DT world this would be loaded from /etc/modules, with an explicit ++"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, ++this becomes a line in config.txt: ++ ++ dtoverlay=lirc-rpi ++ ++This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By ++default it will use GPIOs 17 (out) and 18 (in), but this can be modified using ++DT parameters: ++ ++ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 ++ ++Parameters always have default values, although in some cases (e.g. "w1-gpio") ++it is necessary to provided multiple overlays in order to get the desired ++behaviour. See the list of overlays below for a description of the parameters and their defaults. ++ ++The Overlay and Parameter Reference ++=================================== ++ ++Name: ++Info: Configures the base Raspberry Pi hardware ++Load: ++Params: ++ i2c_arm Set to "on" to enable the ARM's i2c interface ++ (default "off") ++ ++ i2c_vc Set to "on" to enable the i2c interface ++ usually reserved for the VideoCore processor ++ (default "off") ++ ++ i2c An alias for i2c_arm ++ ++ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface ++ (default "100000") ++ ++ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface ++ (default "100000") ++ ++ i2c_baudrate An alias for i2c_arm_baudrate ++ ++ i2s Set to "on" to enable the i2s interface ++ (default "off") ++ ++ spi Set to "on" to enable the spi interfaces ++ (default "off") ++ ++ act_led_trigger Choose which activity the LED tracks. ++ Use "heartbeat" for a nice load indicator. ++ (default "mmc") ++ ++ act_led_activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ ++ act_led_gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ (default "16" on a non-Plus board, "47" on a ++ Plus or Pi 2) ++ ++ pwr_led_trigger ++ pwr_led_activelow ++ pwr_led_gpio ++ As for act_led_*, but using the PWR LED. ++ Not available on Model A/B boards. ++ ++ N.B. It is recommended to only enable those interfaces that are needed. ++ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc ++ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) ++ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical ++ interfaces i2c0 and i2c1. Use of the numeric variants is still possible ++ but deprecated because the ARM/VC assignments differ between board ++ revisions. The same board-specific mapping applies to i2c_baudrate, ++ and the other i2c baudrate parameters. ++ ++ ++Name: ads7846 ++Info: ADS7846 Touch controller ++Load: dtoverlay=ads7846,= ++Params: cs SPI bus Chip Select (default 1) ++ speed SPI bus speed (default 2Mhz, max 3.25MHz) ++ penirq GPIO used for PENIRQ. REQUIRED ++ penirq_pull Set GPIO pull (default 0=none, 2=pullup) ++ swapxy Swap x and y axis ++ xmin Minimum value on the X axis (default 0) ++ ymin Minimum value on the Y axis (default 0) ++ xmax Maximum value on the X axis (default 4095) ++ ymax Maximum value on the Y axis (default 4095) ++ pmin Minimum reported pressure value (default 0) ++ pmax Maximum reported pressure value (default 65535) ++ xohms Touchpanel sensitivity (X-plate resistance) ++ (default 400) ++ ++ penirq is required and usually xohms (60-100) has to be set as well. ++ Apart from that, pmax (255) and swapxy are also common. ++ The rest of the calibration can be done with xinput-calibrator. ++ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian ++ Device Tree binding document: ++ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt ++ ++ ++Name: bmp085_i2c-sensor ++Info: Configures the BMP085/BMP180 digital barometric pressure and temperature ++ sensors from Bosch Sensortec ++Load: dtoverlay=bmp085_i2c-sensor ++Params: ++ ++ ++[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: enc28j60 ++Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) ++Load: dtoverlay=enc28j60,= ++Params: int_pin GPIO used for INT (default 25) ++ ++ speed SPI bus speed (default 12000000) ++ ++ ++Name: hifiberry-amp ++Info: Configures the HifiBerry Amp and Amp+ audio cards ++Load: dtoverlay=hifiberry-amp ++Params: ++ ++ ++Name: hifiberry-dac ++Info: Configures the HifiBerry DAC audio card ++Load: dtoverlay=hifiberry-dac ++Params: ++ ++ ++Name: hifiberry-dacplus ++Info: Configures the HifiBerry DAC+ audio card ++Load: dtoverlay=hifiberry-dacplus ++Params: ++ ++ ++Name: hifiberry-digi ++Info: Configures the HifiBerry Digi audio card ++Load: dtoverlay=hifiberry-digi ++Params: ++ ++ ++Name: hy28a ++Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28a,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ resetgpio GPIO used to reset controller ++ ++ ledgpio GPIO used to control backlight ++ ++ ++Name: hy28b ++Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28b,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ resetgpio GPIO used to reset controller ++ ++ ledgpio GPIO used to control backlight ++ ++ ++Name: i2c-rtc ++Info: Adds support for a number of I2C Real Time Clock devices ++Load: dtoverlay=i2c-rtc, ++Params: ds1307 Select the DS1307 device ++ ++ ds3231 Select the DS3231 device ++ ++ pcf2127 Select the PCF2127 device ++ ++ pcf8523 Select the PCF8523 device ++ ++ pcf8563 Select the PCF8563 device ++ ++ ++Name: iqaudio-dac ++Info: Configures the IQaudio DAC audio card ++Load: dtoverlay=iqaudio-dac ++Params: ++ ++ ++Name: iqaudio-dacplus ++Info: Configures the IQaudio DAC+ audio card ++Load: dtoverlay=iqaudio-dacplus ++Params: ++ ++ ++Name: lirc-rpi ++Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) ++ Consult the module documentation for more details. ++Load: dtoverlay=lirc-rpi,=,... ++Params: gpio_out_pin GPIO for output (default "17") ++ ++ gpio_in_pin GPIO for input (default "18") ++ ++ gpio_in_pull Pull up/down/off on the input pin ++ (default "down") ++ ++ sense Override the IR receive auto-detection logic: ++ "1" = force active high ++ "0" = force active low ++ "-1" = use auto-detection ++ (default "-1") ++ ++ softcarrier Turn the software carrier "on" or "off" ++ (default "on") ++ ++ invert "on" = invert the output pin (default "off") ++ ++ debug "on" = enable additional debug messages ++ (default "off") ++ ++ ++Name: mmc ++Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock ++Load: dtoverlay=mmc,= ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ force_pio Disable DMA support ++ ++ ++Name: mz61581 ++Info: MZ61581 display by Tontec ++Load: dtoverlay=mz61581,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: piscreen ++Info: PiScreen display by OzzMaker.com ++Load: dtoverlay=piscreen,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pitft28-resistive ++Info: Adafruit PiTFT 2.8" resistive touch screen ++Load: dtoverlay=pitft28-resistive,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pps-gpio ++Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). ++Load: dtoverlay=pps-gpio,= ++Params: gpiopin Input GPIO (default "18") ++ ++ ++Name: rpi-dac ++Info: Configures the RPi DAC audio card ++Load: dtoverlay=rpi-dac ++Params: ++ ++ ++Name: rpi-display ++Info: RPi-Display - 2.8" Touch Display by Watterott ++Load: dtoverlay=rpi-display,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: rpi-proto ++Info: Configures the RPi Proto audio card ++Load: dtoverlay=rpi-proto ++Params: ++ ++ ++Name: sdhost ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock ++Load: dtoverlay=sdhost,= ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ force_pio Disable DMA support ++ ++ ++Name: spi-bcm2708 ++Info: Selects the bcm2708-spi SPI driver ++Load: dtoverlay=spi-bcm2708 ++Params: ++ ++ ++Name: spi-bcm2835 ++Info: Selects the bcm2835-spi SPI driver ++Load: dtoverlay=spi-bcm2835 ++Params: ++ ++ ++Name: tinylcd35 ++Info: 3.5" Color TFT Display by www.tinlylcd.com ++ Options: Touch, RTC, keypad ++Load: dtoverlay=tinylcd35,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch Enable touch panel ++ ++ touchgpio Touch controller IRQ GPIO ++ ++ xohms Touchpanel: Resistance of X-plate in ohms ++ ++ rtc-pcf PCF8563 Real Time Clock ++ ++ rtc-ds DS1307 Real Time Clock ++ ++ keypad Enable keypad ++ ++ Examples: ++ Display with touchpanel, PCF8563 RTC and keypad: ++ dtoverlay=tinylcd35,touch,rtc-pcf,keypad ++ Old touch display: ++ dtoverlay=tinylcd35,touch,touchgpio=3 ++ ++ ++Name: w1-gpio ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *don't* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio,= ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ ++Name: w1-gpio-pullup ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *do* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio-pullup,=,... ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ extpullup GPIO for external pullup (default "5") ++ ++ ++Troubleshooting ++=============== ++ ++If you are experiencing problems that you think are DT-related, enable DT ++diagnostic output by adding this to /boot/config.txt: ++ ++ dtdebug=on ++ ++and rebooting. Then run: ++ ++ sudo vcdbg log msg ++ ++and look for relevant messages. ++ ++Further reading ++=============== ++ ++This is only meant to be a quick introduction to the subject of Device Tree on ++Raspberry Pi. There is a more complete explanation here: ++ ++http://www.raspberrypi.org/documentation/configuration/device-tree.md +diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +new file mode 100644 +index 0000000..6a92cd1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +@@ -0,0 +1,83 @@ ++/* ++ * Generic Device Tree overlay for the ADS7846 touch controller ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ ads7846_pins: ads7846_pins { ++ brcm,pins = <255>; /* illegal default value */ ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ads7846: ads7846@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ads7846_pins>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <255 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 255 0>; ++ ++ /* driver defaults */ ++ ti,x-min = /bits/ 16 <0>; ++ ti,y-min = /bits/ 16 <0>; ++ ti,x-max = /bits/ 16 <0x0FFF>; ++ ti,y-max = /bits/ 16 <0x0FFF>; ++ ti,pressure-min = /bits/ 16 <0>; ++ ti,pressure-max = /bits/ 16 <0xFFFF>; ++ ti,x-plate-ohms = /bits/ 16 <400>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ cs = <&ads7846>,"reg:0"; ++ speed = <&ads7846>,"spi-max-frequency:0"; ++ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ ++ <&ads7846>,"interrupts:0", ++ <&ads7846>,"pendown-gpio:4"; ++ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; ++ swapxy = <&ads7846>,"ti,swap-xy?"; ++ xmin = <&ads7846>,"ti,x-min;0"; ++ ymin = <&ads7846>,"ti,y-min;0"; ++ xmax = <&ads7846>,"ti,x-max;0"; ++ ymax = <&ads7846>,"ti,y-max;0"; ++ pmin = <&ads7846>,"ti,pressure-min;0"; ++ pmax = <&ads7846>,"ti,pressure-max;0"; ++ xohms = <&ads7846>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +new file mode 100644 +index 0000000..b830bf2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +@@ -0,0 +1,23 @@ ++// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ bmp085@77 { ++ compatible = "bosch,bmp085"; ++ reg = <0x77>; ++ default-oversampling = <3>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts b/arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts +new file mode 100644 +index 0000000..7d27044 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts +@@ -0,0 +1,22 @@ ++// Definitions for DS1307 Real Time Clock ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +new file mode 100644 +index 0000000..aa9b645 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +@@ -0,0 +1,29 @@ ++// Overlay for the Microchip ENC28J60 Ethernet Controller ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ enc28j60@0{ ++ compatible = "microchip,enc28j60"; ++ reg = <0>; /* CE0 */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts +new file mode 100644 +index 0000000..2c81448 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Amp/Amp+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-amp"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ tas5713@1b { ++ #sound-dai-cells = <0>; ++ compatible = "ti,tas5713"; ++ reg = <0x1b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +new file mode 100644 +index 0000000..5e7633a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for HiFiBerry DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/"; ++ __overlay__ { ++ pcm5102a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +new file mode 100644 +index 0000000..deb9c625 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry DAC+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-dacplus"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +new file mode 100644 +index 0000000..d0e0d8a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Digi ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +new file mode 100644 +index 0000000..3cd3083 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +@@ -0,0 +1,87 @@ ++/* ++ * Device Tree overlay for HY28A display ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ hy28a_pins: hy28a_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28a: hy28a@0{ ++ compatible = "ilitek,ili9320"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28a_pins>; ++ ++ spi-max-frequency = <32000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ hy28a_ts: hy28a-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&hy28a>,"spi-max-frequency:0"; ++ rotate = <&hy28a>,"rotate:0"; ++ fps = <&hy28a>,"fps:0"; ++ debug = <&hy28a>,"debug:0"; ++ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28a>,"reset-gpios:4", ++ <&hy28a_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28a>,"led-gpios:4", ++ <&hy28a_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +new file mode 100644 +index 0000000..f774c4a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +@@ -0,0 +1,142 @@ ++/* ++ * Device Tree overlay for HY28b display shield by Texy ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ hy28b_pins: hy28b_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28b: hy28b@0{ ++ compatible = "ilitek,ili9325"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28b_pins>; ++ ++ spi-max-frequency = <48000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ ++ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; ++ ++ init = <0x10000e7 0x0010 ++ 0x1000000 0x0001 ++ 0x1000001 0x0100 ++ 0x1000002 0x0700 ++ 0x1000003 0x1030 ++ 0x1000004 0x0000 ++ 0x1000008 0x0207 ++ 0x1000009 0x0000 ++ 0x100000a 0x0000 ++ 0x100000c 0x0001 ++ 0x100000d 0x0000 ++ 0x100000f 0x0000 ++ 0x1000010 0x0000 ++ 0x1000011 0x0007 ++ 0x1000012 0x0000 ++ 0x1000013 0x0000 ++ 0x2000032 ++ 0x1000010 0x1590 ++ 0x1000011 0x0227 ++ 0x2000032 ++ 0x1000012 0x009c ++ 0x2000032 ++ 0x1000013 0x1900 ++ 0x1000029 0x0023 ++ 0x100002b 0x000e ++ 0x2000032 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000032 ++ 0x1000050 0x0000 ++ 0x1000051 0x00ef ++ 0x1000052 0x0000 ++ 0x1000053 0x013f ++ 0x1000060 0xa700 ++ 0x1000061 0x0001 ++ 0x100006a 0x0000 ++ 0x1000080 0x0000 ++ 0x1000081 0x0000 ++ 0x1000082 0x0000 ++ 0x1000083 0x0000 ++ 0x1000084 0x0000 ++ 0x1000085 0x0000 ++ 0x1000090 0x0010 ++ 0x1000092 0x0000 ++ 0x1000093 0x0003 ++ 0x1000095 0x0110 ++ 0x1000097 0x0000 ++ 0x1000098 0x0000 ++ 0x1000007 0x0133 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000064>; ++ debug = <0>; ++ }; ++ ++ hy28b_ts: hy28b-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&hy28b>,"spi-max-frequency:0"; ++ rotate = <&hy28b>,"rotate:0"; ++ fps = <&hy28b>,"fps:0"; ++ debug = <&hy28b>,"debug:0"; ++ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28b>,"reset-gpios:4", ++ <&hy28b_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28b>,"led-gpios:4", ++ <&hy28b_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +new file mode 100644 +index 0000000..6bccfdc +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -0,0 +1,49 @@ ++// Definitions for several I2C based Real Time Clocks ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ ds3231: ds3231@68 { ++ compatible = "maxim,ds3231"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf2127: pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ pcf8523: pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ }; ++ }; ++ __overrides__ { ++ ds1307 = <&ds1307>,"status"; ++ ds3231 = <&ds3231>,"status"; ++ pcf2127 = <&pcf2127>,"status"; ++ pcf8523 = <&pcf8523>,"status"; ++ pcf8563 = <&pcf8563>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +new file mode 100644 +index 0000000..ea8173e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for IQaudIO DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +new file mode 100644 +index 0000000..735d8ab +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for IQaudIO DAC+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +new file mode 100644 +index 0000000..7d5d82b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +@@ -0,0 +1,57 @@ ++// Definitions for lirc-rpi module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ lirc_rpi: lirc_rpi { ++ compatible = "rpi,lirc-rpi"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&lirc_pins>; ++ status = "okay"; ++ ++ // Override autodetection of IR receiver circuit ++ // (0 = active high, 1 = active low, -1 = no override ) ++ rpi,sense = <0xffffffff>; ++ ++ // Software carrier ++ // (0 = off, 1 = on) ++ rpi,softcarrier = <1>; ++ ++ // Invert output ++ // (0 = off, 1 = on) ++ rpi,invert = <0>; ++ ++ // Enable debugging messages ++ // (0 = off, 1 = on) ++ rpi,debug = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ lirc_pins: lirc_pins { ++ brcm,pins = <17 18>; ++ brcm,function = <1 0>; // out in ++ brcm,pull = <0 1>; // off down ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; ++ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; ++ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; ++ ++ sense = <&lirc_rpi>,"rpi,sense:0"; ++ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; ++ invert = <&lirc_rpi>,"rpi,invert:0"; ++ debug = <&lirc_rpi>,"rpi,debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts +new file mode 100644 +index 0000000..0a37cf4 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts +@@ -0,0 +1,19 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&mmc>; ++ ++ __overlay__ { ++ brcm,overclock-50 = <0>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&mmc>,"brcm,overclock-50:0"; ++ force_pio = <&mmc>,"brcm,force-pio?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +new file mode 100644 +index 0000000..c06fe12 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +@@ -0,0 +1,109 @@ ++/* ++ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mz61581_pins: mz61581_pins { ++ brcm,pins = <4 15 18 25>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mz61581: mz61581@0{ ++ compatible = "samsung,s6d02a1"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mz61581_pins>; ++ ++ spi-max-frequency = <128000000>; ++ spi-cpol; ++ spi-cpha; ++ ++ width = <320>; ++ height = <480>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ ++ reset-gpios = <&gpio 15 0>; ++ dc-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 0>; ++ ++ init = <0x10000b0 00 ++ 0x1000011 ++ 0x20000ff ++ 0x10000b3 0x02 0x00 0x00 0x00 ++ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 ++ 0x10000c1 0x08 0x16 0x08 0x08 ++ 0x10000c4 0x11 0x07 0x03 0x03 ++ 0x10000c6 0x00 ++ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 ++ 0x1000035 0x00 ++ 0x1000036 0xa0 ++ 0x100003a 0x55 ++ 0x1000044 0x00 0x01 ++ 0x10000d0 0x07 0x07 0x1d 0x03 ++ 0x10000d1 0x03 0x30 0x10 ++ 0x10000d2 0x03 0x14 0x04 ++ 0x1000029 ++ 0x100002c>; ++ ++ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ ++ debug = <3>; ++ }; ++ ++ mz61581_ts: mz61581_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <4 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 4 0>; ++ ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&mz61581>, "spi-max-frequency:0"; ++ rotate = <&mz61581>, "rotate:0"; ++ fps = <&mz61581>, "fps:0"; ++ debug = <&mz61581>, "debug:0"; ++ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts b/arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts +new file mode 100644 +index 0000000..01fc81d +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts +@@ -0,0 +1,22 @@ ++// Definitions for PCF2127 Real Time Clock ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts b/arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts +new file mode 100644 +index 0000000..0071f62 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts +@@ -0,0 +1,22 @@ ++// Definitions for PCF8523 Real Time Clock ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +new file mode 100644 +index 0000000..b7fd7ea +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -0,0 +1,94 @@ ++/* ++ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen_pins: piscreen_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ piscreen: piscreen@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen_pins>; ++ ++ spi-max-frequency = <24000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; ++ ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c2 0x44 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 ++ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x1000011 ++ 0x1000029>; ++ }; ++ ++ piscreen-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen>,"spi-max-frequency:0"; ++ rotate = <&piscreen>,"rotate:0"; ++ fps = <&piscreen>,"fps:0"; ++ debug = <&piscreen>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +new file mode 100644 +index 0000000..d506eae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +@@ -0,0 +1,115 @@ ++/* ++ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ ++ pitft_ts@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stmpe610"; ++ reg = <1>; ++ ++ spi-max-frequency = <500000>; ++ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ ++ interrupts = <24 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ interrupt-controller; ++ ++ stmpe_touchscreen { ++ compatible = "st,stmpe-ts"; ++ st,sample-time = <4>; ++ st,mod-12b = <1>; ++ st,ref-sel = <0>; ++ st,adc-freq = <2>; ++ st,ave-ctrl = <3>; ++ st,touch-det-delay = <4>; ++ st,settling = <2>; ++ st,fraction-z = <7>; ++ st,i-drive = <0>; ++ }; ++ ++ stmpe_gpio: stmpe_gpio { ++ #gpio-cells = <2>; ++ compatible = "st,stmpe-gpio"; ++ /* ++ * only GPIO2 is wired/available ++ * and it is wired to the backlight ++ */ ++ st,norequest-mask = <0x7b>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/soc"; ++ __overlay__ { ++ backlight { ++ compatible = "gpio-backlight"; ++ gpios = <&stmpe_gpio 2 0>; ++ default-on; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +new file mode 100644 +index 0000000..40bf0e1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +@@ -0,0 +1,34 @@ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ pps: pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pps_pins>; ++ gpios = <&gpio 18 0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pps_pins: pps_pins { ++ brcm,pins = <18>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&pps>,"gpios:4", ++ <&pps_pins>,"brcm,pins:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +new file mode 100644 +index 0000000..7fc6ac9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for RPi DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/"; ++ __overlay__ { ++ pcm1794a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm1794a"; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +new file mode 100644 +index 0000000..a8fa974 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +@@ -0,0 +1,82 @@ ++/* ++ * Device Tree overlay for rpi-display by Watterott ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ rpi_display_pins: rpi_display_pins { ++ brcm,pins = <18 23 24 25>; ++ brcm,function = <1 1 1 0>; /* out out out in */ ++ brcm,pull = <0 0 0 2>; /* - - - up */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rpidisplay: rpi-display@0{ ++ compatible = "ilitek,ili9341"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rpi_display_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ reset-gpios = <&gpio 23 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ rpidisplay_ts: rpi-display-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <25 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 25 0>; ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&rpidisplay>,"spi-max-frequency:0"; ++ rotate = <&rpidisplay>,"rotate:0"; ++ fps = <&rpidisplay>,"fps:0"; ++ debug = <&rpidisplay>,"debug:0"; ++ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +new file mode 100644 +index 0000000..2029930 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for Rpi-Proto ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-proto"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +new file mode 100644 +index 0000000..b2653e9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -0,0 +1,75 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ sdhost: sdhost@7e202000 { ++ compatible = "brcm,bcm2835-sdhost"; ++ reg = <0x7e202000 0x100>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ interrupts = <2 24>; ++ clocks = <&clk_sdhost>; ++ dmas = <&dma 13>, ++ <&dma 13>; ++ dma-names = "tx", "rx"; ++ brcm,delay-after-stop = <0>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ ++ clocks { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ clk_sdhost: clock@3 { ++ compatible = "fixed-clock"; ++ reg = <0>; ++ #clock-cells = <0>; ++ clock-output-names = "sdhost"; ++ clock-frequency = <250000000>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&mmc>; ++ __overlay__ { ++ /* Find a way to disable the other driver */ ++ compatible = ""; ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/__overrides__"; ++ __overlay__ { ++ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; ++ }; ++ }; ++ ++ __overrides__ { ++ delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; ++ overclock_50 = <&sdhost>,"brcm,overclock-50:0"; ++ force_pio = <&sdhost>,"brcm,force-pio?"; ++ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e378ef1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay for spi-bcm2835 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* setting up compatiblity to allow loading the spi-bcm2835 driver */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ compatible = "brcm,bcm2708-spi"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts b/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts +new file mode 100644 +index 0000000..fc1e39b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay for spi-bcm2835 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* setting up compatiblity to allow loading the spi-bcm2835 driver */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ compatible = "brcm,bcm2835-spi"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +new file mode 100644 +index 0000000..f7102c8 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +@@ -0,0 +1,216 @@ ++/* ++ * tinylcd35-overlay.dts ++ * ++ * ------------------------------------------------- ++ * www.tinlylcd.com ++ * ------------------------------------------------- ++ * Device---Driver-----BUS GPIO's ++ * display tinylcd35 spi0.0 25 24 18 ++ * touch ads7846 spi0.1 5 ++ * rtc ds1307 i2c1-0068 ++ * rtc pcf8563 i2c1-0051 ++ * keypad gpio-keys --------- 17 22 27 23 28 ++ * ++ * ++ * TinyLCD.com 3.5 inch TFT ++ * ++ * Version 001 ++ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework ++ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ tinylcd35_pins: tinylcd35_pins { ++ brcm,pins = <25 24 18>; ++ brcm,function = <1>; /* out */ ++ }; ++ tinylcd35_ts_pins: tinylcd35_ts_pins { ++ brcm,pins = <5>; ++ brcm,function = <0>; /* in */ ++ }; ++ keypad_pins: keypad_pins { ++ brcm,pins = <4 17 22 23 27>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <1>; /* down */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tinylcd35: tinylcd35@0{ ++ compatible = "neosec,tinylcd"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&tinylcd35_pins>, ++ <&tinylcd35_ts_pins>; ++ ++ spi-max-frequency = <48000000>; ++ rotate = <270>; ++ fps = <20>; ++ bgr; ++ buswidth = <8>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ ++ init = <0x10000B0 0x80 ++ 0x10000C0 0x0A 0x0A ++ 0x10000C1 0x01 0x01 ++ 0x10000C2 0x33 ++ 0x10000C5 0x00 0x42 0x80 ++ 0x10000B1 0xD0 0x11 ++ 0x10000B4 0x02 ++ 0x10000B6 0x00 0x22 0x3B ++ 0x10000B7 0x07 ++ 0x1000036 0x58 ++ 0x10000F0 0x36 0xA5 0xD3 ++ 0x10000E5 0x80 ++ 0x10000E5 0x01 ++ 0x10000B3 0x00 ++ 0x10000E5 0x00 ++ 0x10000F0 0x36 0xA5 0x53 ++ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 ++ 0x100003A 0x55 ++ 0x1000011 ++ 0x2000001 ++ 0x1000029>; ++ }; ++ ++ tinylcd35_ts: tinylcd35_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ status = "disabled"; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 5 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ ++ /* RTC */ ++ ++ fragment@3 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* ++ * Values for input event code is found under the ++ * 'Keys and buttons' heading in include/uapi/linux/input.h ++ */ ++ fragment@5 { ++ target-path = "/soc"; ++ __overlay__ { ++ keypad: keypad { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&keypad_pins>; ++ status = "disabled"; ++ autorepeat; ++ ++ button@17 { ++ label = "GPIO KEY_UP"; ++ linux,code = <103>; ++ gpios = <&gpio 17 0>; ++ }; ++ button@22 { ++ label = "GPIO KEY_DOWN"; ++ linux,code = <108>; ++ gpios = <&gpio 22 0>; ++ }; ++ button@27 { ++ label = "GPIO KEY_LEFT"; ++ linux,code = <105>; ++ gpios = <&gpio 27 0>; ++ }; ++ button@23 { ++ label = "GPIO KEY_RIGHT"; ++ linux,code = <106>; ++ gpios = <&gpio 23 0>; ++ }; ++ button@4 { ++ label = "GPIO KEY_ENTER"; ++ linux,code = <28>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&tinylcd35>,"spi-max-frequency:0"; ++ rotate = <&tinylcd35>,"rotate:0"; ++ fps = <&tinylcd35>,"fps:0"; ++ debug = <&tinylcd35>,"debug:0"; ++ touch = <&tinylcd35_ts>,"status"; ++ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", ++ <&tinylcd35_ts>,"interrupts:0", ++ <&tinylcd35_ts>,"pendown-gpio:4"; ++ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; ++ rtc-pcf = <&i2c1>,"status", ++ <&pcf8563>,"status"; ++ rtc-ds = <&i2c1>,"status", ++ <&ds1307>,"status"; ++ keypad = <&keypad>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +new file mode 100644 +index 0000000..29a3b48 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for w1-gpio module (without external pullup) ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in (initially) ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +new file mode 100644 +index 0000000..66a98f6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +@@ -0,0 +1,41 @@ ++// Definitions for w1-gpio module (with external pullup) ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>, <&gpio 5 1>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4 5>; ++ brcm,function = <0 1>; // in out ++ brcm,pull = <0 0>; // off off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ extpullup = <&w1>,"gpios:16", ++ <&w1_pins>,"brcm,pins:4"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/pcf2127-rtc-overlay.dts b/arch/arm/boot/dts/pcf2127-rtc-overlay.dts +deleted file mode 100644 +index 01fc81d..0000000 +--- a/arch/arm/boot/dts/pcf2127-rtc-overlay.dts ++++ /dev/null +@@ -1,22 +0,0 @@ +-// Definitions for PCF2127 Real Time Clock +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcf2127@51 { +- compatible = "nxp,pcf2127"; +- reg = <0x51>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/pcf8523-rtc-overlay.dts b/arch/arm/boot/dts/pcf8523-rtc-overlay.dts +deleted file mode 100644 +index 0071f62..0000000 +--- a/arch/arm/boot/dts/pcf8523-rtc-overlay.dts ++++ /dev/null +@@ -1,22 +0,0 @@ +-// Definitions for PCF8523 Real Time Clock +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcf8523@68 { +- compatible = "nxp,pcf8523"; +- reg = <0x68>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/piscreen-overlay.dts b/arch/arm/boot/dts/piscreen-overlay.dts +deleted file mode 100644 +index b7fd7ea..0000000 +--- a/arch/arm/boot/dts/piscreen-overlay.dts ++++ /dev/null +@@ -1,94 +0,0 @@ +-/* +- * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- piscreen_pins: piscreen_pins { +- brcm,pins = <17 25 24 22>; +- brcm,function = <0 1 1 1>; /* in out out out */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- piscreen: piscreen@0{ +- compatible = "ilitek,ili9486"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&piscreen_pins>; +- +- spi-max-frequency = <24000000>; +- rotate = <270>; +- bgr; +- fps = <30>; +- buswidth = <8>; +- regwidth = <16>; +- reset-gpios = <&gpio 25 0>; +- dc-gpios = <&gpio 24 0>; +- led-gpios = <&gpio 22 1>; +- debug = <0>; +- +- init = <0x10000b0 0x00 +- 0x1000011 +- 0x20000ff +- 0x100003a 0x55 +- 0x1000036 0x28 +- 0x10000c2 0x44 +- 0x10000c5 0x00 0x00 0x00 0x00 +- 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 +- 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 +- 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 +- 0x1000011 +- 0x1000029>; +- }; +- +- piscreen-ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <17 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 17 0>; +- ti,x-plate-ohms = /bits/ 16 <100>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&piscreen>,"spi-max-frequency:0"; +- rotate = <&piscreen>,"rotate:0"; +- fps = <&piscreen>,"fps:0"; +- debug = <&piscreen>,"debug:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/pitft28-resistive-overlay.dts +deleted file mode 100644 +index d506eae..0000000 +--- a/arch/arm/boot/dts/pitft28-resistive-overlay.dts ++++ /dev/null +@@ -1,115 +0,0 @@ +-/* +- * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- pitft_pins: pitft_pins { +- brcm,pins = <24 25>; +- brcm,function = <0 1>; /* in out */ +- brcm,pull = <2 0>; /* pullup none */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- pitft: pitft@0{ +- compatible = "ilitek,ili9340"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pitft_pins>; +- +- spi-max-frequency = <32000000>; +- rotate = <90>; +- fps = <25>; +- bgr; +- buswidth = <8>; +- dc-gpios = <&gpio 25 0>; +- debug = <0>; +- }; +- +- pitft_ts@1 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stmpe610"; +- reg = <1>; +- +- spi-max-frequency = <500000>; +- irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ +- interrupts = <24 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- interrupt-controller; +- +- stmpe_touchscreen { +- compatible = "st,stmpe-ts"; +- st,sample-time = <4>; +- st,mod-12b = <1>; +- st,ref-sel = <0>; +- st,adc-freq = <2>; +- st,ave-ctrl = <3>; +- st,touch-det-delay = <4>; +- st,settling = <2>; +- st,fraction-z = <7>; +- st,i-drive = <0>; +- }; +- +- stmpe_gpio: stmpe_gpio { +- #gpio-cells = <2>; +- compatible = "st,stmpe-gpio"; +- /* +- * only GPIO2 is wired/available +- * and it is wired to the backlight +- */ +- st,norequest-mask = <0x7b>; +- }; +- }; +- }; +- }; +- +- fragment@3 { +- target-path = "/soc"; +- __overlay__ { +- backlight { +- compatible = "gpio-backlight"; +- gpios = <&stmpe_gpio 2 0>; +- default-on; +- }; +- }; +- }; +- +- __overrides__ { +- speed = <&pitft>,"spi-max-frequency:0"; +- rotate = <&pitft>,"rotate:0"; +- fps = <&pitft>,"fps:0"; +- debug = <&pitft>,"debug:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/pps-gpio-overlay.dts b/arch/arm/boot/dts/pps-gpio-overlay.dts +deleted file mode 100644 +index 40bf0e1..0000000 +--- a/arch/arm/boot/dts/pps-gpio-overlay.dts ++++ /dev/null +@@ -1,34 +0,0 @@ +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- fragment@0 { +- target-path = "/"; +- __overlay__ { +- pps: pps { +- compatible = "pps-gpio"; +- pinctrl-names = "default"; +- pinctrl-0 = <&pps_pins>; +- gpios = <&gpio 18 0>; +- status = "okay"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- pps_pins: pps_pins { +- brcm,pins = <18>; +- brcm,function = <0>; // in +- brcm,pull = <0>; // off +- }; +- }; +- }; +- +- __overrides__ { +- gpiopin = <&pps>,"gpios:4", +- <&pps_pins>,"brcm,pins:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/rpi-dac-overlay.dts b/arch/arm/boot/dts/rpi-dac-overlay.dts +deleted file mode 100644 +index 7fc6ac9..0000000 +--- a/arch/arm/boot/dts/rpi-dac-overlay.dts ++++ /dev/null +@@ -1,34 +0,0 @@ +-// Definitions for RPi DAC +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "rpi,rpi-dac"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target-path = "/"; +- __overlay__ { +- pcm1794a-codec { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm1794a"; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/rpi-display-overlay.dts b/arch/arm/boot/dts/rpi-display-overlay.dts +deleted file mode 100644 +index a8fa974..0000000 +--- a/arch/arm/boot/dts/rpi-display-overlay.dts ++++ /dev/null +@@ -1,82 +0,0 @@ +-/* +- * Device Tree overlay for rpi-display by Watterott +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- rpi_display_pins: rpi_display_pins { +- brcm,pins = <18 23 24 25>; +- brcm,function = <1 1 1 0>; /* out out out in */ +- brcm,pull = <0 0 0 2>; /* - - - up */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- rpidisplay: rpi-display@0{ +- compatible = "ilitek,ili9341"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&rpi_display_pins>; +- +- spi-max-frequency = <32000000>; +- rotate = <270>; +- bgr; +- fps = <30>; +- buswidth = <8>; +- reset-gpios = <&gpio 23 0>; +- dc-gpios = <&gpio 24 0>; +- led-gpios = <&gpio 18 1>; +- debug = <0>; +- }; +- +- rpidisplay_ts: rpi-display-ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <25 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 25 0>; +- ti,x-plate-ohms = /bits/ 16 <60>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&rpidisplay>,"spi-max-frequency:0"; +- rotate = <&rpidisplay>,"rotate:0"; +- fps = <&rpidisplay>,"fps:0"; +- debug = <&rpidisplay>,"debug:0"; +- xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/rpi-proto-overlay.dts b/arch/arm/boot/dts/rpi-proto-overlay.dts +deleted file mode 100644 +index 2029930..0000000 +--- a/arch/arm/boot/dts/rpi-proto-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for Rpi-Proto +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "rpi,rpi-proto"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- wm8731@1a { +- #sound-dai-cells = <0>; +- compatible = "wlf,wm8731"; +- reg = <0x1a>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/sdhost-overlay.dts b/arch/arm/boot/dts/sdhost-overlay.dts +deleted file mode 100644 +index b2653e9..0000000 +--- a/arch/arm/boot/dts/sdhost-overlay.dts ++++ /dev/null +@@ -1,75 +0,0 @@ +-/dts-v1/; +-/plugin/; +- +-/{ +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&soc>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <1>; +- +- sdhost: sdhost@7e202000 { +- compatible = "brcm,bcm2835-sdhost"; +- reg = <0x7e202000 0x100>; +- pinctrl-names = "default"; +- pinctrl-0 = <&sdhost_pins>; +- interrupts = <2 24>; +- clocks = <&clk_sdhost>; +- dmas = <&dma 13>, +- <&dma 13>; +- dma-names = "tx", "rx"; +- brcm,delay-after-stop = <0>; +- brcm,overclock-50 = <0>; +- status = "okay"; +- }; +- +- clocks { +- #address-cells = <1>; +- #size-cells = <0>; +- +- clk_sdhost: clock@3 { +- compatible = "fixed-clock"; +- reg = <0>; +- #clock-cells = <0>; +- clock-output-names = "sdhost"; +- clock-frequency = <250000000>; +- }; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- sdhost_pins: sdhost_pins { +- brcm,pins = <48 49 50 51 52 53>; +- brcm,function = <4>; /* alt0 */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&mmc>; +- __overlay__ { +- /* Find a way to disable the other driver */ +- compatible = ""; +- status = "disabled"; +- }; +- }; +- +- fragment@3 { +- target-path = "/__overrides__"; +- __overlay__ { +- sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; +- }; +- }; +- +- __overrides__ { +- delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; +- overclock_50 = <&sdhost>,"brcm,overclock-50:0"; +- force_pio = <&sdhost>,"brcm,force-pio?"; +- sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/spi-bcm2708-overlay.dts b/arch/arm/boot/dts/spi-bcm2708-overlay.dts +deleted file mode 100644 +index e378ef1..0000000 +--- a/arch/arm/boot/dts/spi-bcm2708-overlay.dts ++++ /dev/null +@@ -1,18 +0,0 @@ +-/* +- * Device tree overlay for spi-bcm2835 +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; +- /* setting up compatiblity to allow loading the spi-bcm2835 driver */ +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- compatible = "brcm,bcm2708-spi"; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/spi-bcm2835-overlay.dts b/arch/arm/boot/dts/spi-bcm2835-overlay.dts +deleted file mode 100644 +index fc1e39b..0000000 +--- a/arch/arm/boot/dts/spi-bcm2835-overlay.dts ++++ /dev/null +@@ -1,18 +0,0 @@ +-/* +- * Device tree overlay for spi-bcm2835 +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; +- /* setting up compatiblity to allow loading the spi-bcm2835 driver */ +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- compatible = "brcm,bcm2835-spi"; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/tinylcd35-overlay.dts b/arch/arm/boot/dts/tinylcd35-overlay.dts +deleted file mode 100644 +index f7102c8..0000000 +--- a/arch/arm/boot/dts/tinylcd35-overlay.dts ++++ /dev/null +@@ -1,216 +0,0 @@ +-/* +- * tinylcd35-overlay.dts +- * +- * ------------------------------------------------- +- * www.tinlylcd.com +- * ------------------------------------------------- +- * Device---Driver-----BUS GPIO's +- * display tinylcd35 spi0.0 25 24 18 +- * touch ads7846 spi0.1 5 +- * rtc ds1307 i2c1-0068 +- * rtc pcf8563 i2c1-0051 +- * keypad gpio-keys --------- 17 22 27 23 28 +- * +- * +- * TinyLCD.com 3.5 inch TFT +- * +- * Version 001 +- * 5/3/2015 -- Noralf Trønnes Initial Device tree framework +- * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- tinylcd35_pins: tinylcd35_pins { +- brcm,pins = <25 24 18>; +- brcm,function = <1>; /* out */ +- }; +- tinylcd35_ts_pins: tinylcd35_ts_pins { +- brcm,pins = <5>; +- brcm,function = <0>; /* in */ +- }; +- keypad_pins: keypad_pins { +- brcm,pins = <4 17 22 23 27>; +- brcm,function = <0>; /* in */ +- brcm,pull = <1>; /* down */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- tinylcd35: tinylcd35@0{ +- compatible = "neosec,tinylcd"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&tinylcd35_pins>, +- <&tinylcd35_ts_pins>; +- +- spi-max-frequency = <48000000>; +- rotate = <270>; +- fps = <20>; +- bgr; +- buswidth = <8>; +- reset-gpios = <&gpio 25 0>; +- dc-gpios = <&gpio 24 0>; +- led-gpios = <&gpio 18 1>; +- debug = <0>; +- +- init = <0x10000B0 0x80 +- 0x10000C0 0x0A 0x0A +- 0x10000C1 0x01 0x01 +- 0x10000C2 0x33 +- 0x10000C5 0x00 0x42 0x80 +- 0x10000B1 0xD0 0x11 +- 0x10000B4 0x02 +- 0x10000B6 0x00 0x22 0x3B +- 0x10000B7 0x07 +- 0x1000036 0x58 +- 0x10000F0 0x36 0xA5 0xD3 +- 0x10000E5 0x80 +- 0x10000E5 0x01 +- 0x10000B3 0x00 +- 0x10000E5 0x00 +- 0x10000F0 0x36 0xA5 0x53 +- 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 +- 0x100003A 0x55 +- 0x1000011 +- 0x2000001 +- 0x1000029>; +- }; +- +- tinylcd35_ts: tinylcd35_ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- status = "disabled"; +- +- spi-max-frequency = <2000000>; +- interrupts = <5 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 5 0>; +- ti,x-plate-ohms = /bits/ 16 <100>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- +- /* RTC */ +- +- fragment@3 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- +- pcf8563: pcf8563@51 { +- compatible = "nxp,pcf8563"; +- reg = <0x51>; +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@4 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- +- ds1307: ds1307@68 { +- compatible = "maxim,ds1307"; +- reg = <0x68>; +- status = "disabled"; +- }; +- }; +- }; +- +- /* +- * Values for input event code is found under the +- * 'Keys and buttons' heading in include/uapi/linux/input.h +- */ +- fragment@5 { +- target-path = "/soc"; +- __overlay__ { +- keypad: keypad { +- compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&keypad_pins>; +- status = "disabled"; +- autorepeat; +- +- button@17 { +- label = "GPIO KEY_UP"; +- linux,code = <103>; +- gpios = <&gpio 17 0>; +- }; +- button@22 { +- label = "GPIO KEY_DOWN"; +- linux,code = <108>; +- gpios = <&gpio 22 0>; +- }; +- button@27 { +- label = "GPIO KEY_LEFT"; +- linux,code = <105>; +- gpios = <&gpio 27 0>; +- }; +- button@23 { +- label = "GPIO KEY_RIGHT"; +- linux,code = <106>; +- gpios = <&gpio 23 0>; +- }; +- button@4 { +- label = "GPIO KEY_ENTER"; +- linux,code = <28>; +- gpios = <&gpio 4 0>; +- }; +- }; +- }; +- }; +- +- __overrides__ { +- speed = <&tinylcd35>,"spi-max-frequency:0"; +- rotate = <&tinylcd35>,"rotate:0"; +- fps = <&tinylcd35>,"fps:0"; +- debug = <&tinylcd35>,"debug:0"; +- touch = <&tinylcd35_ts>,"status"; +- touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", +- <&tinylcd35_ts>,"interrupts:0", +- <&tinylcd35_ts>,"pendown-gpio:4"; +- xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; +- rtc-pcf = <&i2c1>,"status", +- <&pcf8563>,"status"; +- rtc-ds = <&i2c1>,"status", +- <&ds1307>,"status"; +- keypad = <&keypad>,"status"; +- }; +-}; +diff --git a/arch/arm/boot/dts/w1-gpio-overlay.dts b/arch/arm/boot/dts/w1-gpio-overlay.dts +deleted file mode 100644 +index 29a3b48..0000000 +--- a/arch/arm/boot/dts/w1-gpio-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for w1-gpio module (without external pullup) +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target-path = "/"; +- __overlay__ { +- +- w1: onewire@0 { +- compatible = "w1-gpio"; +- pinctrl-names = "default"; +- pinctrl-0 = <&w1_pins>; +- gpios = <&gpio 4 0>; +- rpi,parasitic-power = <0>; +- status = "okay"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- w1_pins: w1_pins { +- brcm,pins = <4>; +- brcm,function = <0>; // in (initially) +- brcm,pull = <0>; // off +- }; +- }; +- }; +- +- __overrides__ { +- gpiopin = <&w1>,"gpios:4", +- <&w1_pins>,"brcm,pins:0"; +- pullup = <&w1>,"rpi,parasitic-power:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/w1-gpio-pullup-overlay.dts +deleted file mode 100644 +index 66a98f6..0000000 +--- a/arch/arm/boot/dts/w1-gpio-pullup-overlay.dts ++++ /dev/null +@@ -1,41 +0,0 @@ +-// Definitions for w1-gpio module (with external pullup) +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target-path = "/"; +- __overlay__ { +- +- w1: onewire@0 { +- compatible = "w1-gpio"; +- pinctrl-names = "default"; +- pinctrl-0 = <&w1_pins>; +- gpios = <&gpio 4 0>, <&gpio 5 1>; +- rpi,parasitic-power = <0>; +- status = "okay"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- w1_pins: w1_pins { +- brcm,pins = <4 5>; +- brcm,function = <0 1>; // in out +- brcm,pull = <0 0>; // off off +- }; +- }; +- }; +- +- __overrides__ { +- gpiopin = <&w1>,"gpios:4", +- <&w1_pins>,"brcm,pins:0"; +- extpullup = <&w1>,"gpios:16", +- <&w1_pins>,"brcm,pins:4"; +- pullup = <&w1>,"rpi,parasitic-power:0"; +- }; +-}; + +From 9c2920928cae9f7d35cb3c0e4f677b7f266a7ae3 Mon Sep 17 00:00:00 2001 +From: mwilliams03 +Date: Fri, 3 Apr 2015 12:40:10 +0000 +Subject: [PATCH 192/216] Swap X Y axis of ads7846 touchscreen controller for + PiScreen TFT + +--- + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +index b7fd7ea..be1e2ec 100644 +--- a/arch/arm/boot/dts/overlays/piscreen-overlay.dts ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -80,6 +80,7 @@ + interrupts = <17 2>; /* high-to-low edge triggered */ + interrupt-parent = <&gpio>; + pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; + ti,x-plate-ohms = /bits/ 16 <100>; + ti,pressure-max = /bits/ 16 <255>; + }; + +From a4d119709c817d2bf6caea401b8266f55ad861c2 Mon Sep 17 00:00:00 2001 +From: mwilliams03 +Date: Wed, 8 Apr 2015 01:13:47 +0000 +Subject: [PATCH 193/216] Added optional parameter to set resistance of touch + plate(x-plate-ohms) + +--- + arch/arm/boot/dts/overlays/README | 2 ++ + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index c260612..9d4f283 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -329,6 +329,8 @@ Params: speed Display SPI bus speed + + debug Debug output level {0-7} + ++ xohms Touchpanel sensitivity (X-plate resistance) ++ + + Name: pitft28-resistive + Info: Adafruit PiTFT 2.8" resistive touch screen +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +index be1e2ec..ba4ad33 100644 +--- a/arch/arm/boot/dts/overlays/piscreen-overlay.dts ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -72,7 +72,7 @@ + 0x1000029>; + }; + +- piscreen-ts@1 { ++ piscreen_ts: piscreen-ts@1 { + compatible = "ti,ads7846"; + reg = <1>; + +@@ -91,5 +91,6 @@ + rotate = <&piscreen>,"rotate:0"; + fps = <&piscreen>,"fps:0"; + debug = <&piscreen>,"debug:0"; ++ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; + }; + }; + +From df11ad948112ccee4eae40b6f4810946a8dc5019 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 28 May 2015 18:50:21 +0200 +Subject: [PATCH 194/216] BCM270x: Move vc_mem +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make the vc_mem module available for ARCH_BCM2835 by moving it. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/Kconfig | 7 - + arch/arm/mach-bcm2708/Makefile | 1 - + arch/arm/mach-bcm2708/include/mach/vc_mem.h | 35 --- + arch/arm/mach-bcm2708/vc_mem.c | 431 ---------------------------- + arch/arm/mach-bcm2709/Kconfig | 7 - + arch/arm/mach-bcm2709/Makefile | 1 - + arch/arm/mach-bcm2709/include/mach/vc_mem.h | 35 --- + arch/arm/mach-bcm2709/vc_mem.c | 431 ---------------------------- + drivers/char/broadcom/Kconfig | 13 +- + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vc_mem.c | 423 +++++++++++++++++++++++++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 3 +- + include/linux/broadcom/vc_mem.h | 35 +++ + 13 files changed, 472 insertions(+), 951 deletions(-) + delete mode 100644 arch/arm/mach-bcm2708/include/mach/vc_mem.h + delete mode 100644 arch/arm/mach-bcm2708/vc_mem.c + delete mode 100644 arch/arm/mach-bcm2709/include/mach/vc_mem.h + delete mode 100644 arch/arm/mach-bcm2709/vc_mem.c + create mode 100644 drivers/char/broadcom/vc_mem.c + create mode 100644 include/linux/broadcom/vc_mem.h + +diff --git a/arch/arm/mach-bcm2708/Kconfig b/arch/arm/mach-bcm2708/Kconfig +index 4cfae55..68e3706 100644 +--- a/arch/arm/mach-bcm2708/Kconfig ++++ b/arch/arm/mach-bcm2708/Kconfig +@@ -28,13 +28,6 @@ config BCM2708_GPIO + help + Include support for the Broadcom(R) BCM2708 gpio. + +-config BCM2708_VCMEM +- bool "Videocore Memory" +- depends on MACH_BCM2708 +- default y +- help +- Helper for videocore memory access and total size allocation. +- + config BCM2708_NOL2CACHE + bool "Videocore L2 cache disable" + depends on MACH_BCM2708 +diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile +index 5552ae8..5120994 100644 +--- a/arch/arm/mach-bcm2708/Makefile ++++ b/arch/arm/mach-bcm2708/Makefile +@@ -4,4 +4,3 @@ + + obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o +-obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2708/include/mach/vc_mem.h b/arch/arm/mach-bcm2708/include/mach/vc_mem.h +deleted file mode 100644 +index 4a4a338..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/vc_mem.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#if !defined( VC_MEM_H ) +-#define VC_MEM_H +- +-#include +- +-#define VC_MEM_IOC_MAGIC 'v' +- +-#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) +-#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) +-#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) +-#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) +- +-#if defined( __KERNEL__ ) +-#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF +- +-extern unsigned long mm_vc_mem_phys_addr; +-extern unsigned int mm_vc_mem_size; +-extern int vc_mem_get_current_size( void ); +-#endif +- +-#endif /* VC_MEM_H */ +diff --git a/arch/arm/mach-bcm2708/vc_mem.c b/arch/arm/mach-bcm2708/vc_mem.c +deleted file mode 100644 +index 226b737..0000000 +--- a/arch/arm/mach-bcm2708/vc_mem.c ++++ /dev/null +@@ -1,431 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#ifdef CONFIG_ARCH_KONA +-#include +-#elif CONFIG_ARCH_BCM2708 +-#else +-#include +-#endif +- +-#include "mach/vc_mem.h" +- +-#define DRIVER_NAME "vc-mem" +- +-// Device (/dev) related variables +-static dev_t vc_mem_devnum = 0; +-static struct class *vc_mem_class = NULL; +-static struct cdev vc_mem_cdev; +-static int vc_mem_inited = 0; +- +-#ifdef CONFIG_DEBUG_FS +-static struct dentry *vc_mem_debugfs_entry; +-#endif +- +-/* +- * Videocore memory addresses and size +- * +- * Drivers that wish to know the videocore memory addresses and sizes should +- * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in +- * headers. This allows the other drivers to not be tied down to a a certain +- * address/size at compile time. +- * +- * In the future, the goal is to have the videocore memory virtual address and +- * size be calculated at boot time rather than at compile time. The decision of +- * where the videocore memory resides and its size would be in the hands of the +- * bootloader (and/or kernel). When that happens, the values of these variables +- * would be calculated and assigned in the init function. +- */ +-// in the 2835 VC in mapped above ARM, but ARM has full access to VC space +-unsigned long mm_vc_mem_phys_addr = 0x00000000; +-unsigned int mm_vc_mem_size = 0; +-unsigned int mm_vc_mem_base = 0; +- +-EXPORT_SYMBOL(mm_vc_mem_phys_addr); +-EXPORT_SYMBOL(mm_vc_mem_size); +-EXPORT_SYMBOL(mm_vc_mem_base); +- +-static uint phys_addr = 0; +-static uint mem_size = 0; +-static uint mem_base = 0; +- +- +-/**************************************************************************** +-* +-* vc_mem_open +-* +-***************************************************************************/ +- +-static int +-vc_mem_open(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_release +-* +-***************************************************************************/ +- +-static int +-vc_mem_release(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_size +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_size(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_base +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_base(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_current_size +-* +-***************************************************************************/ +- +-int +-vc_mem_get_current_size(void) +-{ +- return mm_vc_mem_size; +-} +- +-EXPORT_SYMBOL_GPL(vc_mem_get_current_size); +- +-/**************************************************************************** +-* +-* vc_mem_ioctl +-* +-***************************************************************************/ +- +-static long +-vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +-{ +- int rc = 0; +- +- (void) cmd; +- (void) arg; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- switch (cmd) { +- case VC_MEM_IOC_MEM_PHYS_ADDR: +- { +- pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", +- __func__, (void *) mm_vc_mem_phys_addr); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, +- sizeof (mm_vc_mem_phys_addr)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_SIZE: +- { +- // Get the videocore memory size first +- vc_mem_get_size(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, +- mm_vc_mem_size); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_size, +- sizeof (mm_vc_mem_size)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_BASE: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_LOAD: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- default: +- { +- return -ENOTTY; +- } +- } +- pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* vc_mem_mmap +-* +-***************************************************************************/ +- +-static int +-vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) +-{ +- int rc = 0; +- unsigned long length = vma->vm_end - vma->vm_start; +- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; +- +- pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", +- __func__, (long) vma->vm_start, (long) vma->vm_end, +- (long) vma->vm_pgoff); +- +- if (offset + length > mm_vc_mem_size) { +- pr_err("%s: length %ld is too big\n", __func__, length); +- return -EINVAL; +- } +- // Do not cache the memory map +- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +- +- rc = remap_pfn_range(vma, vma->vm_start, +- (mm_vc_mem_phys_addr >> PAGE_SHIFT) + +- vma->vm_pgoff, length, vma->vm_page_prot); +- if (rc != 0) { +- pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); +- } +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for the driver. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_mem_fops = { +- .owner = THIS_MODULE, +- .open = vc_mem_open, +- .release = vc_mem_release, +- .unlocked_ioctl = vc_mem_ioctl, +- .mmap = vc_mem_mmap, +-}; +- +-#ifdef CONFIG_DEBUG_FS +-static void vc_mem_debugfs_deinit(void) +-{ +- debugfs_remove_recursive(vc_mem_debugfs_entry); +- vc_mem_debugfs_entry = NULL; +-} +- +- +-static int vc_mem_debugfs_init( +- struct device *dev) +-{ +- vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); +- if (!vc_mem_debugfs_entry) { +- dev_warn(dev, "could not create debugfs entry\n"); +- return -EFAULT; +- } +- +- if (!debugfs_create_x32("vc_mem_phys_addr", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_phys_addr)) { +- dev_warn(dev, "%s:could not create vc_mem_phys entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_size", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_size)) { +- dev_warn(dev, "%s:could not create vc_mem_size entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_base", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_base)) { +- dev_warn(dev, "%s:could not create vc_mem_base entry\n", +- __func__); +- goto fail; +- } +- +- return 0; +- +-fail: +- vc_mem_debugfs_deinit(); +- return -EFAULT; +-} +- +-#endif /* CONFIG_DEBUG_FS */ +- +- +-/**************************************************************************** +-* +-* vc_mem_init +-* +-***************************************************************************/ +- +-static int __init +-vc_mem_init(void) +-{ +- int rc = -EFAULT; +- struct device *dev; +- +- pr_debug("%s: called\n", __func__); +- +- mm_vc_mem_phys_addr = phys_addr; +- mm_vc_mem_size = mem_size; +- mm_vc_mem_base = mem_base; +- +- vc_mem_get_size(); +- +- pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", +- mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); +- +- if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { +- pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", +- __func__, rc); +- goto out_err; +- } +- +- cdev_init(&vc_mem_cdev, &vc_mem_fops); +- if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { +- pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); +- goto out_unregister; +- } +- +- vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vc_mem_class)) { +- rc = PTR_ERR(vc_mem_class); +- pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); +- goto out_cdev_del; +- } +- +- dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, +- DRIVER_NAME); +- if (IS_ERR(dev)) { +- rc = PTR_ERR(dev); +- pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); +- goto out_class_destroy; +- } +- +-#ifdef CONFIG_DEBUG_FS +- /* don't fail if the debug entries cannot be created */ +- vc_mem_debugfs_init(dev); +-#endif +- +- vc_mem_inited = 1; +- return 0; +- +- device_destroy(vc_mem_class, vc_mem_devnum); +- +- out_class_destroy: +- class_destroy(vc_mem_class); +- vc_mem_class = NULL; +- +- out_cdev_del: +- cdev_del(&vc_mem_cdev); +- +- out_unregister: +- unregister_chrdev_region(vc_mem_devnum, 1); +- +- out_err: +- return -1; +-} +- +-/**************************************************************************** +-* +-* vc_mem_exit +-* +-***************************************************************************/ +- +-static void __exit +-vc_mem_exit(void) +-{ +- pr_debug("%s: called\n", __func__); +- +- if (vc_mem_inited) { +-#if CONFIG_DEBUG_FS +- vc_mem_debugfs_deinit(); +-#endif +- device_destroy(vc_mem_class, vc_mem_devnum); +- class_destroy(vc_mem_class); +- cdev_del(&vc_mem_cdev); +- unregister_chrdev_region(vc_mem_devnum, 1); +- } +-} +- +-module_init(vc_mem_init); +-module_exit(vc_mem_exit); +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Broadcom Corporation"); +- +-module_param(phys_addr, uint, 0644); +-module_param(mem_size, uint, 0644); +-module_param(mem_base, uint, 0644); +diff --git a/arch/arm/mach-bcm2709/Kconfig b/arch/arm/mach-bcm2709/Kconfig +index 4fb6e1b..d61ade0 100644 +--- a/arch/arm/mach-bcm2709/Kconfig ++++ b/arch/arm/mach-bcm2709/Kconfig +@@ -25,13 +25,6 @@ config BCM2708_GPIO + help + Include support for the Broadcom(R) BCM2709 gpio. + +-config BCM2708_VCMEM +- bool "Videocore Memory" +- depends on MACH_BCM2709 +- default y +- help +- Helper for videocore memory access and total size allocation. +- + config BCM2708_NOL2CACHE + bool "Videocore L2 cache disable" + depends on MACH_BCM2709 +diff --git a/arch/arm/mach-bcm2709/Makefile b/arch/arm/mach-bcm2709/Makefile +index 706116f..1ae8b80 100644 +--- a/arch/arm/mach-bcm2709/Makefile ++++ b/arch/arm/mach-bcm2709/Makefile +@@ -4,4 +4,3 @@ + + obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o +-obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2709/include/mach/vc_mem.h b/arch/arm/mach-bcm2709/include/mach/vc_mem.h +deleted file mode 100644 +index 4a4a338..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/vc_mem.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#if !defined( VC_MEM_H ) +-#define VC_MEM_H +- +-#include +- +-#define VC_MEM_IOC_MAGIC 'v' +- +-#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) +-#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) +-#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) +-#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) +- +-#if defined( __KERNEL__ ) +-#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF +- +-extern unsigned long mm_vc_mem_phys_addr; +-extern unsigned int mm_vc_mem_size; +-extern int vc_mem_get_current_size( void ); +-#endif +- +-#endif /* VC_MEM_H */ +diff --git a/arch/arm/mach-bcm2709/vc_mem.c b/arch/arm/mach-bcm2709/vc_mem.c +deleted file mode 100644 +index d2adfd1..0000000 +--- a/arch/arm/mach-bcm2709/vc_mem.c ++++ /dev/null +@@ -1,431 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#ifdef CONFIG_ARCH_KONA +-#include +-#elif defined(CONFIG_ARCH_BCM2708) || defined(CONFIG_ARCH_BCM2709) +-#else +-#include +-#endif +- +-#include "mach/vc_mem.h" +- +-#define DRIVER_NAME "vc-mem" +- +-// Device (/dev) related variables +-static dev_t vc_mem_devnum = 0; +-static struct class *vc_mem_class = NULL; +-static struct cdev vc_mem_cdev; +-static int vc_mem_inited = 0; +- +-#ifdef CONFIG_DEBUG_FS +-static struct dentry *vc_mem_debugfs_entry; +-#endif +- +-/* +- * Videocore memory addresses and size +- * +- * Drivers that wish to know the videocore memory addresses and sizes should +- * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in +- * headers. This allows the other drivers to not be tied down to a a certain +- * address/size at compile time. +- * +- * In the future, the goal is to have the videocore memory virtual address and +- * size be calculated at boot time rather than at compile time. The decision of +- * where the videocore memory resides and its size would be in the hands of the +- * bootloader (and/or kernel). When that happens, the values of these variables +- * would be calculated and assigned in the init function. +- */ +-// in the 2835 VC in mapped above ARM, but ARM has full access to VC space +-unsigned long mm_vc_mem_phys_addr = 0x00000000; +-unsigned int mm_vc_mem_size = 0; +-unsigned int mm_vc_mem_base = 0; +- +-EXPORT_SYMBOL(mm_vc_mem_phys_addr); +-EXPORT_SYMBOL(mm_vc_mem_size); +-EXPORT_SYMBOL(mm_vc_mem_base); +- +-static uint phys_addr = 0; +-static uint mem_size = 0; +-static uint mem_base = 0; +- +- +-/**************************************************************************** +-* +-* vc_mem_open +-* +-***************************************************************************/ +- +-static int +-vc_mem_open(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_release +-* +-***************************************************************************/ +- +-static int +-vc_mem_release(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_size +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_size(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_base +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_base(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_current_size +-* +-***************************************************************************/ +- +-int +-vc_mem_get_current_size(void) +-{ +- return mm_vc_mem_size; +-} +- +-EXPORT_SYMBOL_GPL(vc_mem_get_current_size); +- +-/**************************************************************************** +-* +-* vc_mem_ioctl +-* +-***************************************************************************/ +- +-static long +-vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +-{ +- int rc = 0; +- +- (void) cmd; +- (void) arg; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- switch (cmd) { +- case VC_MEM_IOC_MEM_PHYS_ADDR: +- { +- pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", +- __func__, (void *) mm_vc_mem_phys_addr); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, +- sizeof (mm_vc_mem_phys_addr)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_SIZE: +- { +- // Get the videocore memory size first +- vc_mem_get_size(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, +- mm_vc_mem_size); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_size, +- sizeof (mm_vc_mem_size)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_BASE: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_LOAD: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- default: +- { +- return -ENOTTY; +- } +- } +- pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* vc_mem_mmap +-* +-***************************************************************************/ +- +-static int +-vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) +-{ +- int rc = 0; +- unsigned long length = vma->vm_end - vma->vm_start; +- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; +- +- pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", +- __func__, (long) vma->vm_start, (long) vma->vm_end, +- (long) vma->vm_pgoff); +- +- if (offset + length > mm_vc_mem_size) { +- pr_err("%s: length %ld is too big\n", __func__, length); +- return -EINVAL; +- } +- // Do not cache the memory map +- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +- +- rc = remap_pfn_range(vma, vma->vm_start, +- (mm_vc_mem_phys_addr >> PAGE_SHIFT) + +- vma->vm_pgoff, length, vma->vm_page_prot); +- if (rc != 0) { +- pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); +- } +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for the driver. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_mem_fops = { +- .owner = THIS_MODULE, +- .open = vc_mem_open, +- .release = vc_mem_release, +- .unlocked_ioctl = vc_mem_ioctl, +- .mmap = vc_mem_mmap, +-}; +- +-#ifdef CONFIG_DEBUG_FS +-static void vc_mem_debugfs_deinit(void) +-{ +- debugfs_remove_recursive(vc_mem_debugfs_entry); +- vc_mem_debugfs_entry = NULL; +-} +- +- +-static int vc_mem_debugfs_init( +- struct device *dev) +-{ +- vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); +- if (!vc_mem_debugfs_entry) { +- dev_warn(dev, "could not create debugfs entry\n"); +- return -EFAULT; +- } +- +- if (!debugfs_create_x32("vc_mem_phys_addr", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_phys_addr)) { +- dev_warn(dev, "%s:could not create vc_mem_phys entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_size", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_size)) { +- dev_warn(dev, "%s:could not create vc_mem_size entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_base", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_base)) { +- dev_warn(dev, "%s:could not create vc_mem_base entry\n", +- __func__); +- goto fail; +- } +- +- return 0; +- +-fail: +- vc_mem_debugfs_deinit(); +- return -EFAULT; +-} +- +-#endif /* CONFIG_DEBUG_FS */ +- +- +-/**************************************************************************** +-* +-* vc_mem_init +-* +-***************************************************************************/ +- +-static int __init +-vc_mem_init(void) +-{ +- int rc = -EFAULT; +- struct device *dev; +- +- pr_debug("%s: called\n", __func__); +- +- mm_vc_mem_phys_addr = phys_addr; +- mm_vc_mem_size = mem_size; +- mm_vc_mem_base = mem_base; +- +- vc_mem_get_size(); +- +- pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", +- mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); +- +- if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { +- pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", +- __func__, rc); +- goto out_err; +- } +- +- cdev_init(&vc_mem_cdev, &vc_mem_fops); +- if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { +- pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); +- goto out_unregister; +- } +- +- vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vc_mem_class)) { +- rc = PTR_ERR(vc_mem_class); +- pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); +- goto out_cdev_del; +- } +- +- dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, +- DRIVER_NAME); +- if (IS_ERR(dev)) { +- rc = PTR_ERR(dev); +- pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); +- goto out_class_destroy; +- } +- +-#ifdef CONFIG_DEBUG_FS +- /* don't fail if the debug entries cannot be created */ +- vc_mem_debugfs_init(dev); +-#endif +- +- vc_mem_inited = 1; +- return 0; +- +- device_destroy(vc_mem_class, vc_mem_devnum); +- +- out_class_destroy: +- class_destroy(vc_mem_class); +- vc_mem_class = NULL; +- +- out_cdev_del: +- cdev_del(&vc_mem_cdev); +- +- out_unregister: +- unregister_chrdev_region(vc_mem_devnum, 1); +- +- out_err: +- return -1; +-} +- +-/**************************************************************************** +-* +-* vc_mem_exit +-* +-***************************************************************************/ +- +-static void __exit +-vc_mem_exit(void) +-{ +- pr_debug("%s: called\n", __func__); +- +- if (vc_mem_inited) { +-#if CONFIG_DEBUG_FS +- vc_mem_debugfs_deinit(); +-#endif +- device_destroy(vc_mem_class, vc_mem_devnum); +- class_destroy(vc_mem_class); +- cdev_del(&vc_mem_cdev); +- unregister_chrdev_region(vc_mem_devnum, 1); +- } +-} +- +-module_init(vc_mem_init); +-module_exit(vc_mem_exit); +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Broadcom Corporation"); +- +-module_param(phys_addr, uint, 0644); +-module_param(mem_size, uint, 0644); +-module_param(mem_base, uint, 0644); +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index fd23e00..c310d9d 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -7,16 +7,27 @@ menuconfig BRCM_CHAR_DRIVERS + help + Broadcom's char drivers + ++if BRCM_CHAR_DRIVERS ++ + config BCM_VC_CMA + bool "Videocore CMA" +- depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ ++ depends on CMA && BCM2708_VCHIQ + default n + help + Helper for videocore CMA access. + + config BCM_VC_SM + bool "VMCS Shared Memory" ++ select BCM2708_VCMEM + default n + help + Support for the VC shared memory on the Broadcom reference + design. Uses the VCHIQ stack. ++ ++config BCM2708_VCMEM ++ bool "Videocore Memory" ++ default y ++ help ++ Helper for videocore memory access and total size allocation. ++ ++endif +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 0bf7fdf..b4f8e39d 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,2 +1,3 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ ++obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/drivers/char/broadcom/vc_mem.c b/drivers/char/broadcom/vc_mem.c +new file mode 100644 +index 0000000..fcde6b1 +--- /dev/null ++++ b/drivers/char/broadcom/vc_mem.c +@@ -0,0 +1,423 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DRIVER_NAME "vc-mem" ++ ++// Device (/dev) related variables ++static dev_t vc_mem_devnum = 0; ++static struct class *vc_mem_class = NULL; ++static struct cdev vc_mem_cdev; ++static int vc_mem_inited = 0; ++ ++#ifdef CONFIG_DEBUG_FS ++static struct dentry *vc_mem_debugfs_entry; ++#endif ++ ++/* ++ * Videocore memory addresses and size ++ * ++ * Drivers that wish to know the videocore memory addresses and sizes should ++ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in ++ * headers. This allows the other drivers to not be tied down to a a certain ++ * address/size at compile time. ++ * ++ * In the future, the goal is to have the videocore memory virtual address and ++ * size be calculated at boot time rather than at compile time. The decision of ++ * where the videocore memory resides and its size would be in the hands of the ++ * bootloader (and/or kernel). When that happens, the values of these variables ++ * would be calculated and assigned in the init function. ++ */ ++// in the 2835 VC in mapped above ARM, but ARM has full access to VC space ++unsigned long mm_vc_mem_phys_addr = 0x00000000; ++unsigned int mm_vc_mem_size = 0; ++unsigned int mm_vc_mem_base = 0; ++ ++EXPORT_SYMBOL(mm_vc_mem_phys_addr); ++EXPORT_SYMBOL(mm_vc_mem_size); ++EXPORT_SYMBOL(mm_vc_mem_base); ++ ++static uint phys_addr = 0; ++static uint mem_size = 0; ++static uint mem_base = 0; ++ ++ ++/**************************************************************************** ++* ++* vc_mem_open ++* ++***************************************************************************/ ++ ++static int ++vc_mem_open(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_release ++* ++***************************************************************************/ ++ ++static int ++vc_mem_release(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_size ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_size(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_base ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_base(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_current_size ++* ++***************************************************************************/ ++ ++int ++vc_mem_get_current_size(void) ++{ ++ return mm_vc_mem_size; ++} ++ ++EXPORT_SYMBOL_GPL(vc_mem_get_current_size); ++ ++/**************************************************************************** ++* ++* vc_mem_ioctl ++* ++***************************************************************************/ ++ ++static long ++vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int rc = 0; ++ ++ (void) cmd; ++ (void) arg; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ switch (cmd) { ++ case VC_MEM_IOC_MEM_PHYS_ADDR: ++ { ++ pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", ++ __func__, (void *) mm_vc_mem_phys_addr); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, ++ sizeof (mm_vc_mem_phys_addr)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_SIZE: ++ { ++ // Get the videocore memory size first ++ vc_mem_get_size(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, ++ mm_vc_mem_size); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_size, ++ sizeof (mm_vc_mem_size)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_BASE: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_LOAD: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ default: ++ { ++ return -ENOTTY; ++ } ++ } ++ pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_mmap ++* ++***************************************************************************/ ++ ++static int ++vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) ++{ ++ int rc = 0; ++ unsigned long length = vma->vm_end - vma->vm_start; ++ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; ++ ++ pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", ++ __func__, (long) vma->vm_start, (long) vma->vm_end, ++ (long) vma->vm_pgoff); ++ ++ if (offset + length > mm_vc_mem_size) { ++ pr_err("%s: length %ld is too big\n", __func__, length); ++ return -EINVAL; ++ } ++ // Do not cache the memory map ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ ++ rc = remap_pfn_range(vma, vma->vm_start, ++ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + ++ vma->vm_pgoff, length, vma->vm_page_prot); ++ if (rc != 0) { ++ pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); ++ } ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for the driver. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_mem_fops = { ++ .owner = THIS_MODULE, ++ .open = vc_mem_open, ++ .release = vc_mem_release, ++ .unlocked_ioctl = vc_mem_ioctl, ++ .mmap = vc_mem_mmap, ++}; ++ ++#ifdef CONFIG_DEBUG_FS ++static void vc_mem_debugfs_deinit(void) ++{ ++ debugfs_remove_recursive(vc_mem_debugfs_entry); ++ vc_mem_debugfs_entry = NULL; ++} ++ ++ ++static int vc_mem_debugfs_init( ++ struct device *dev) ++{ ++ vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); ++ if (!vc_mem_debugfs_entry) { ++ dev_warn(dev, "could not create debugfs entry\n"); ++ return -EFAULT; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_phys_addr", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_phys_addr)) { ++ dev_warn(dev, "%s:could not create vc_mem_phys entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_size", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_size)) { ++ dev_warn(dev, "%s:could not create vc_mem_size entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_base", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_base)) { ++ dev_warn(dev, "%s:could not create vc_mem_base entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ return 0; ++ ++fail: ++ vc_mem_debugfs_deinit(); ++ return -EFAULT; ++} ++ ++#endif /* CONFIG_DEBUG_FS */ ++ ++ ++/**************************************************************************** ++* ++* vc_mem_init ++* ++***************************************************************************/ ++ ++static int __init ++vc_mem_init(void) ++{ ++ int rc = -EFAULT; ++ struct device *dev; ++ ++ pr_debug("%s: called\n", __func__); ++ ++ mm_vc_mem_phys_addr = phys_addr; ++ mm_vc_mem_size = mem_size; ++ mm_vc_mem_base = mem_base; ++ ++ vc_mem_get_size(); ++ ++ pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", ++ mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); ++ ++ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { ++ pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", ++ __func__, rc); ++ goto out_err; ++ } ++ ++ cdev_init(&vc_mem_cdev, &vc_mem_fops); ++ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { ++ pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); ++ goto out_unregister; ++ } ++ ++ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vc_mem_class)) { ++ rc = PTR_ERR(vc_mem_class); ++ pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); ++ goto out_cdev_del; ++ } ++ ++ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, ++ DRIVER_NAME); ++ if (IS_ERR(dev)) { ++ rc = PTR_ERR(dev); ++ pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); ++ goto out_class_destroy; ++ } ++ ++#ifdef CONFIG_DEBUG_FS ++ /* don't fail if the debug entries cannot be created */ ++ vc_mem_debugfs_init(dev); ++#endif ++ ++ vc_mem_inited = 1; ++ return 0; ++ ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ ++ out_class_destroy: ++ class_destroy(vc_mem_class); ++ vc_mem_class = NULL; ++ ++ out_cdev_del: ++ cdev_del(&vc_mem_cdev); ++ ++ out_unregister: ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ ++ out_err: ++ return -1; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_exit ++* ++***************************************************************************/ ++ ++static void __exit ++vc_mem_exit(void) ++{ ++ pr_debug("%s: called\n", __func__); ++ ++ if (vc_mem_inited) { ++#if CONFIG_DEBUG_FS ++ vc_mem_debugfs_deinit(); ++#endif ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ class_destroy(vc_mem_class); ++ cdev_del(&vc_mem_cdev); ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ } ++} ++ ++module_init(vc_mem_init); ++module_exit(vc_mem_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); ++ ++module_param(phys_addr, uint, 0644); ++module_param(mem_size, uint, 0644); ++module_param(mem_base, uint, 0644); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 39a8971..0bfb42e 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -15,6 +15,7 @@ + /* ---- Include Files ----------------------------------------------------- */ + + #include ++#include + #include + #include + #include +@@ -35,8 +36,6 @@ + #include + #include + +-#include +- + #include "vchiq_connected.h" + #include "vc_vchi_sm.h" + +diff --git a/include/linux/broadcom/vc_mem.h b/include/linux/broadcom/vc_mem.h +new file mode 100644 +index 0000000..20a4753 +--- /dev/null ++++ b/include/linux/broadcom/vc_mem.h +@@ -0,0 +1,35 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef _VC_MEM_H ++#define _VC_MEM_H ++ ++#include ++ ++#define VC_MEM_IOC_MAGIC 'v' ++ ++#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) ++#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) ++#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) ++#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) ++ ++#if defined( __KERNEL__ ) ++#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF ++ ++extern unsigned long mm_vc_mem_phys_addr; ++extern unsigned int mm_vc_mem_size; ++extern int vc_mem_get_current_size( void ); ++#endif ++ ++#endif /* _VC_MEM_H */ + +From 7495f032da212d310393adf5c4d1694190e6f309 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 1 Jun 2015 20:40:11 +0200 +Subject: [PATCH 195/216] BCM270x: Add USB controller to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree support to dwc_otg driver. +Add device to Device Tree. +Don't add platform devices when booting in DT mode. + +Tested on Pi1 and Pi2 with and without DT. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 8 ++++++++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + drivers/usb/host/dwc_otg/dwc_otg_driver.c | 7 +++++++ + 4 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 3f8af85..dc7df47 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -121,6 +121,14 @@ + status = "disabled"; + }; + ++ usb: usb@7e980000 { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ }; ++ + leds: leds { + compatible = "gpio-leds"; + }; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 06438df..6298309 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -955,7 +955,7 @@ void __init bcm2708_init(void) + #endif + bcm_register_device(&bcm2708_systemtimer_device); + bcm_register_device_dt(&bcm2708_fb_device); +- bcm_register_device(&bcm2708_usb_device); ++ bcm_register_device_dt(&bcm2708_usb_device); + bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index ce06b7d..d8c2336 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -978,7 +978,7 @@ void __init bcm2709_init(void) + bcm_register_device(&bcm2708_systemtimer_device); + #endif + bcm_register_device_dt(&bcm2708_fb_device); +- bcm_register_device(&bcm2708_usb_device); ++ bcm_register_device_dt(&bcm2708_usb_device); + bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +index dc7cd32..53307f0 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +@@ -1043,9 +1043,16 @@ static struct platform_device_id platform_ids[] = { + }; + MODULE_DEVICE_TABLE(platform, platform_ids); + ++static const struct of_device_id dwc_otg_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-usb", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, dwc_otg_of_match_table); ++ + static struct platform_driver dwc_otg_driver = { + .driver = { + .name = (char *)dwc_driver_name, ++ .of_match_table = dwc_otg_of_match_table, + }, + .id_table = platform_ids, + + +From da5345649e7ad4deb51692d4d969ba4a2f86974b Mon Sep 17 00:00:00 2001 +From: Martin Sperl +Date: Mon, 2 Mar 2015 17:57:30 +0000 +Subject: [PATCH 196/216] added mcp251x module to list of modules to get + compiled as well as the corresponding overlay + +--- + arch/arm/boot/dts/Makefile | 2 +- + arch/arm/boot/dts/overlays/Makefile | 1 + + .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 69 ++++++++++++++++++++++ + arch/arm/configs/bcm2709_defconfig | 5 ++ + arch/arm/configs/bcmrpi_defconfig | 8 +++ + 5 files changed, 84 insertions(+), 1 deletion(-) + create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index ea93e1d..d5b6a82 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1,9 +1,9 @@ + ifeq ($(CONFIG_OF),y) + + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb +-dtb-$(CONFIG_BCM2709_DT) += bcm2709-rpi-2-b.dtb + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b-plus.dtb + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-cm.dtb ++dtb-$(CONFIG_BCM2709_DT) += bcm2709-rpi-2-b.dtb + + # Raspberry Pi + ifeq ($(CONFIG_BCM2708_DT),y) +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index d64e6b4..d18a1f2 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -22,6 +22,7 @@ dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +new file mode 100755 +index 0000000..398d59c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device tree overlay for mcp251x/can0 on spi0.0 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.0 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ spidev@0{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ can0_pins: can0_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@2 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on SPI0.0 */ ++ can0_osc: can0_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can0: mcp2515@0 { ++ reg = <0>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can0_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can0_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can0_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can0>,"spi-max-frequency:0"; ++ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; ++ }; ++}; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 5ce9a01..2a1a15a 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -344,7 +344,12 @@ CONFIG_BAYCOM_SER_FDX=m + CONFIG_BAYCOM_SER_HDX=m + CONFIG_YAM=m + CONFIG_CAN=m ++CONFIG_CAN_RAW=m ++CONFIG_CAN_BCM=m ++CONFIG_CAN_GW=m + CONFIG_CAN_VCAN=m ++CONFIG_CAN_DEV=m ++CONFIG_CAN_CALC_BITTIMING=y + CONFIG_CAN_MCP251X=m + CONFIG_IRDA=m + CONFIG_IRLAN=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index da443da..a2d7291 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -335,6 +335,14 @@ CONFIG_6PACK=m + CONFIG_BPQETHER=m + CONFIG_BAYCOM_SER_FDX=m + CONFIG_BAYCOM_SER_HDX=m ++CONFIG_CAN=m ++CONFIG_CAN_RAW=m ++CONFIG_CAN_BCM=m ++CONFIG_CAN_GW=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_DEV=m ++CONFIG_CAN_CALC_BITTIMING=y ++CONFIG_CAN_MCP251X=m + CONFIG_YAM=m + CONFIG_CAN=m + CONFIG_CAN_VCAN=m + +From 8e999dc420b342d1304fc2bcd755ab6a36d6896c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 2 Jun 2015 13:55:05 +0200 +Subject: [PATCH 197/216] BCM270x: Move thermal sensor to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree support to bcm2835-thermal driver. +Add thermal sensor device to Device Tree. +Don't add platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 4 ++++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + drivers/thermal/bcm2835-thermal.c | 8 +++++++- + 4 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index dc7df47..fcb5828 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -143,6 +143,10 @@ + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; + }; ++ ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ }; + }; + + clocks { +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 6298309..e141c0b 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -984,7 +984,7 @@ void __init bcm2708_init(void) + } + + bcm_register_device(&bcm2835_hwmon_device); +- bcm_register_device(&bcm2835_thermal_device); ++ bcm_register_device_dt(&bcm2835_thermal_device); + + #if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE) + bcm_register_device_dt(&bcm2708_i2s_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index d8c2336..6dadb80 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -1007,7 +1007,7 @@ void __init bcm2709_init(void) + } + + bcm_register_device(&bcm2835_hwmon_device); +- bcm_register_device(&bcm2835_thermal_device); ++ bcm_register_device_dt(&bcm2835_thermal_device); + + #if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE) + bcm_register_device_dt(&bcm2708_i2s_device); +diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c +index 0c556d1..3bc80f1 100644 +--- a/drivers/thermal/bcm2835-thermal.c ++++ b/drivers/thermal/bcm2835-thermal.c +@@ -167,13 +167,19 @@ static struct thermal_zone_device_ops ops = { + .get_mode = bcm2835_get_mode, + }; + +-/* Thermal Driver */ ++static const struct of_device_id bcm2835_thermal_of_match_table[] = { ++ { .compatible = "brcm,bcm2835-thermal", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table); ++ + static struct platform_driver bcm2835_thermal_driver = { + .probe = bcm2835_thermal_probe, + .remove = bcm2835_thermal_remove, + .driver = { + .name = "bcm2835_thermal", + .owner = THIS_MODULE, ++ .of_match_table = bcm2835_thermal_of_match_table, + }, + }; + + +From fd724791a4d515e8069884b72f52752501ee0f92 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 2 Jun 2015 13:55:22 +0200 +Subject: [PATCH 198/216] bcm2835: Add thermal sensor to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add the BCM2835 thermal sensor to Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 40fc759..efaf4df 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -170,6 +170,10 @@ + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; + }; ++ ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ }; + }; + + clocks { + +From 34638ffefe49111b137c8b0927c47f9aab23215b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 2 Jun 2015 15:51:24 +0200 +Subject: [PATCH 199/216] BCM270x: Enable bcm2835_wdt and bcm2835-rng +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change the kconfig dependency to make bcm2835_wdt and bcm2835-rng +available on ARCH_BCM2708 and ARCH_BCM2709. +Enable them as loadable modules in bcmrpi_defconfig and +bcm2709_defconfig. + +There is a commit in linux-next that will move restart/pm_power_off +to bcm2835_wdt for ARCH_BCM2835. This will not affect ARCH_BCM270x +since arm_pm_restart (.restart = bcm2708_restart) and +pm_power_off (=bcm2708_power_off) is set in +arch/arm/mach-bcm270X/bcm270X.c and will take presedence. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2709_defconfig | 2 ++ + arch/arm/configs/bcmrpi_defconfig | 2 ++ + drivers/char/hw_random/Kconfig | 2 +- + drivers/watchdog/Kconfig | 2 +- + 4 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 2a1a15a..d08ae51 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -561,6 +561,7 @@ CONFIG_SERIAL_AMBA_PL011=y + CONFIG_SERIAL_AMBA_PL011_CONSOLE=y + CONFIG_TTY_PRINTK=y + CONFIG_HW_RANDOM=y ++CONFIG_HW_RANDOM_BCM2835=m + CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y +@@ -603,6 +604,7 @@ CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y + CONFIG_BCM2708_WDT=m ++CONFIG_BCM2835_WDT=m + CONFIG_UCB1400_CORE=m + CONFIG_MFD_STMPE=y + CONFIG_STMPE_SPI=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index a2d7291..11bbfac 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -557,6 +557,7 @@ CONFIG_SERIAL_AMBA_PL011=y + CONFIG_SERIAL_AMBA_PL011_CONSOLE=y + CONFIG_TTY_PRINTK=y + CONFIG_HW_RANDOM=y ++CONFIG_HW_RANDOM_BCM2835=m + CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y +@@ -599,6 +600,7 @@ CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y + CONFIG_BCM2708_WDT=m ++CONFIG_BCM2835_WDT=m + CONFIG_UCB1400_CORE=m + CONFIG_MFD_STMPE=y + CONFIG_STMPE_SPI=y +diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig +index 1c97093..0996083 100644 +--- a/drivers/char/hw_random/Kconfig ++++ b/drivers/char/hw_random/Kconfig +@@ -90,7 +90,7 @@ config HW_RANDOM_BCM63XX + + config HW_RANDOM_BCM2835 + tristate "Broadcom BCM2835 Random Number Generator support" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + default HW_RANDOM + ---help--- + This driver provides kernel-side support for the Random Number +diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig +index ca7d6463..e010420 100644 +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -1222,7 +1222,7 @@ config BCM63XX_WDT + + config BCM2835_WDT + tristate "Broadcom BCM2835 hardware watchdog" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + select WATCHDOG_CORE + help + Watchdog driver for the built in watchdog hardware in Broadcom + +From 6779bd793d41be8d73ee771b149606e13e13e0b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 2 Jun 2015 15:51:52 +0200 +Subject: [PATCH 200/216] BCM270X_DT: Add bcm2835-pm-wdt and bcm2835-rng +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This makes it possible to use the mainline watchdog and +random generator drivers: +dtparam=watchdog=on +dtparam=random=on + +bcm2708_wdog and bcm2708-rng can still be used. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 ++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 2 ++ + arch/arm/boot/dts/bcm2708_common.dtsi | 12 ++++++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 ++ + 4 files changed, 18 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 75df21c..52b1404 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -124,5 +124,7 @@ + pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + + audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index df12b7d..876dfca 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -114,5 +114,7 @@ + act_led_trigger = <&act_led>,"linux,default-trigger"; + + audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index fcb5828..a80b1a8 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -43,6 +43,18 @@ + #interrupt-cells = <2>; + }; + ++ watchdog: watchdog@7e100000 { ++ compatible = "brcm,bcm2835-pm-wdt"; ++ reg = <0x7e100000 0x28>; ++ status = "disabled"; ++ }; ++ ++ random: rng@7e104000 { ++ compatible = "brcm,bcm2835-rng"; ++ reg = <0x7e104000 0x10>; ++ status = "disabled"; ++ }; ++ + mailbox: mailbox@7e00b800 { + compatible = "brcm,bcm2708-vcio"; + reg = <0x7e00b880 0x40>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 78bc756..b226dfb 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -124,5 +124,7 @@ + pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + + audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; + }; + }; + +From 493b7b5c56b4afd21bd980e38deb0f9d7d06061c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:26:13 +0200 +Subject: [PATCH 201/216] ARM: bcm2835: Set Serial number and Revision +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The VideoCore bootloader passes in Serial number and +Revision number through Device Tree. Make these available to +userspace through /proc/cpuinfo. + +Mainline status: + +There is a commit in linux-next that standardize passing the serial +number through Device Tree (string: /serial-number): +ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo + +There was an attempt to do the same with the revision number, but it +didn't get in: +[PATCH v2 1/2] arm: devtree: Set system_rev from DT revision + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm/board_bcm2835.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c +index 70f2f39..f7fdacd 100644 +--- a/arch/arm/mach-bcm/board_bcm2835.c ++++ b/arch/arm/mach-bcm/board_bcm2835.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -107,6 +108,9 @@ static void __init bcm2835_map_io(void) + + static void __init bcm2835_init(void) + { ++ struct device_node *np = of_find_node_by_path("/system"); ++ u32 val; ++ u64 val64; + int ret; + + bcm2835_setup_restart(); +@@ -121,6 +125,11 @@ static void __init bcm2835_init(void) + pr_err("of_platform_populate failed: %d\n", ret); + BUG(); + } ++ ++ if (!of_property_read_u32(np, "linux,revision", &val)) ++ system_rev = val; ++ if (!of_property_read_u64(np, "linux,serial", &val64)) ++ system_serial_low = val64; + } + + static const char * const bcm2835_compat[] = { + +From e98419e0f836f39ae77a595f0d7218ba4b0576ab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:34:24 +0200 +Subject: [PATCH 202/216] bcm2835: Match BCM270X Device Trees +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 45 +++++++++++------ + arch/arm/boot/dts/bcm2835-rpi-b.dts | 29 +++++++---- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 85 +++++++++++++++++++++++++------- + arch/arm/boot/dts/bcm2835.dtsi | 12 ++--- + 4 files changed, 122 insertions(+), 49 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +index e479515..b0fb0e8 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +@@ -4,27 +4,40 @@ + / { + compatible = "raspberrypi,model-b-plus", "brcm,bcm2835"; + model = "Raspberry Pi Model B+"; ++}; ++ ++&gpio { ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; + +- leds { +- act { +- gpios = <&gpio 47 0>; +- }; ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&act_led { ++ gpios = <&gpio 47 0>; ++}; + +- pwr { +- label = "PWR"; +- gpios = <&gpio 35 0>; +- default-state = "keep"; +- linux,default-trigger = "default-on"; +- }; ++&leds { ++ pwr_led: pwr { ++ label = "led1"; ++ linux,default-trigger = "input"; ++ gpios = <&gpio 35 0>; + }; + }; + +-&gpio { +- pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>; ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; + +- /* I2S interface */ +- i2s_alt0: i2s_alt0 { +- brcm,pins = <18 19 20 21>; +- brcm,function = <4>; /* alt0 */ ++ pwr_led_gpio = <&pwr_led>,"gpios:4"; ++ pwr_led_activelow = <&pwr_led>,"gpios:8"; ++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts +index bafa46f..b867224 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts +@@ -5,19 +5,28 @@ + compatible = "raspberrypi,model-b", "brcm,bcm2835"; + model = "Raspberry Pi Model B"; + +- leds { +- act { +- gpios = <&gpio 16 1>; +- }; +- }; + }; + + &gpio { +- pinctrl-0 = <&gpioout &alt0 &i2s_alt2 &alt3>; +- +- /* I2S interface */ +- i2s_alt2: i2s_alt2 { ++ i2s_pins: i2s { + brcm,pins = <28 29 30 31>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&act_led { ++ gpios = <&gpio 16 1>; ++}; ++ ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index f23835e..466f02b 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -1,17 +1,29 @@ + /include/ "bcm2835.dtsi" + + / { ++ /* This is left here in case u-boot needs it */ + memory { + reg = <0 0x10000000>; + }; + +- leds { ++ aliases { ++ soc = &soc; ++ spi0 = &spi0; ++ i2c0 = &i2c0; ++ i2c1 = &i2c1; ++ i2s = &i2s; ++ gpio = &gpio; ++ intc = &intc; ++ leds = &leds; ++ sound = &sound; ++ }; ++ ++ leds: leds { + compatible = "gpio-leds"; + +- act { +- label = "ACT"; +- default-state = "keep"; +- linux,default-trigger = "heartbeat"; ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; + }; + }; + +@@ -19,35 +31,61 @@ + audio: audio { + compatible = "brcm,bcm2835-audio"; + brcm,pwm-channels = <8>; ++ status = "disabled"; ++ }; ++ ++ /* External sound card */ ++ sound: sound { + }; + }; + + &gpio { +- pinctrl-names = "default"; ++ spi0_pins: spi0_pins { ++ brcm,pins = <7 8 9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + +- gpioout: gpioout { +- brcm,pins = <6>; +- brcm,function = <1>; /* GPIO out */ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; + }; + +- alt0: alt0 { +- brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>; +- brcm,function = <4>; /* alt0 */ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; + }; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins>; + +- alt3: alt3 { +- brcm,pins = <48 49 50 51 52 53>; +- brcm,function = <7>; /* alt3 */ ++ spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; + }; + }; + + &i2c0 { +- status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; + clock-frequency = <100000>; + }; + + &i2c1 { +- status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; + clock-frequency = <100000>; + }; + +@@ -59,3 +97,16 @@ + &fb { + status = "okay"; + }; ++ ++/ { ++ __overrides__ { ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ audio = <&audio>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index efaf4df..4b6dd65f 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -9,7 +9,7 @@ + bootargs = ""; + }; + +- soc { ++ soc: soc { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; +@@ -51,12 +51,12 @@ + #interrupt-cells = <2>; + }; + +- watchdog@7e100000 { ++ watchdog: watchdog@7e100000 { + compatible = "brcm,bcm2835-pm-wdt"; + reg = <0x7e100000 0x28>; + }; + +- rng@7e104000 { ++ random: rng@7e104000 { + compatible = "brcm,bcm2835-rng"; + reg = <0x7e104000 0x10>; + }; +@@ -90,7 +90,7 @@ + #interrupt-cells = <2>; + }; + +- uart@7e201000 { ++ uart0: uart@7e201000 { + compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; + reg = <0x7e201000 0x1000>; + interrupts = <2 25>; +@@ -109,7 +109,7 @@ + status = "disabled"; + }; + +- spi: spi@7e204000 { ++ spi0: spi@7e204000 { + compatible = "brcm,bcm2835-spi"; + reg = <0x7e204000 0x1000>; + interrupts = <2 22>; +@@ -150,7 +150,7 @@ + status = "disabled"; + }; + +- usb@7e980000 { ++ usb: usb@7e980000 { + compatible = "brcm,bcm2835-usb"; + reg = <0x7e980000 0x10000>; + interrupts = <1 9>; + +From 3ac358b4ca8e0b71da28992689669218e0dbbacf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:35:11 +0200 +Subject: [PATCH 203/216] dts: Enable overlays on ARCH_BCM2835 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Build Device Tree overlays on ARCH_BCM2835. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/Makefile | 3 +++ + arch/arm/boot/dts/overlays/Makefile | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index d5b6a82..e7ce7c4 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -12,6 +12,9 @@ endif + ifeq ($(CONFIG_BCM2709_DT),y) + RPI_DT_OVERLAYS=y + endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif + + subdir-$(RPI_DT_OVERLAYS) += overlays + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index d18a1f2..c449c3f 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -8,6 +8,9 @@ endif + ifeq ($(CONFIG_BCM2709_DT),y) + RPI_DT_OVERLAYS=y + endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif + + dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb + +From 6c6321340ea33c79dbfb15441ad58db03ec94167 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:35:55 +0200 +Subject: [PATCH 204/216] bcm2835: Make camera and sound drivers available +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change kconfig dependency to make SND_BCM2708_SOC_* and +VIDEO_BCM2835 available on ARCH_BCM2835. + +Signed-off-by: Noralf Trønnes +--- + drivers/media/platform/bcm2835/Kconfig | 2 +- + sound/soc/bcm/Kconfig | 14 +++++++------- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/drivers/media/platform/bcm2835/Kconfig b/drivers/media/platform/bcm2835/Kconfig +index 2cb1a68..99a5cbc 100644 +--- a/drivers/media/platform/bcm2835/Kconfig ++++ b/drivers/media/platform/bcm2835/Kconfig +@@ -2,7 +2,7 @@ + + config VIDEO_BCM2835 + bool "Broadcom BCM2835 camera interface driver" +- depends on VIDEO_V4L2 && (ARCH_BCM2708 || ARCH_BCM2709) ++ depends on VIDEO_V4L2 && (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) + ---help--- + Say Y here to enable camera host interface devices for + Broadcom BCM2835 SoC. This operates over the VCHIQ interface +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 003ae28..516ab9d 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -21,49 +21,49 @@ config SND_BCM2708_SOC_I2S + + config SND_BCM2708_SOC_HIFIBERRY_DAC + tristate "Support for HifiBerry DAC" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_PCM5102A + help + Say Y or M if you want to add support for HifiBerry DAC. + + config SND_BCM2708_SOC_HIFIBERRY_DACPLUS + tristate "Support for HifiBerry DAC+" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_PCM512x + help + Say Y or M if you want to add support for HifiBerry DAC+. + + config SND_BCM2708_SOC_HIFIBERRY_DIGI + tristate "Support for HifiBerry Digi" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_WM8804 + help + Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. + + config SND_BCM2708_SOC_HIFIBERRY_AMP + tristate "Support for the HifiBerry Amp" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_TAS5713 + help + Say Y or M if you want to add support for the HifiBerry Amp amplifier board. + + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_PCM1794A + help + Say Y or M if you want to add support for RPi-DAC. + + config SND_BCM2708_SOC_RPI_PROTO + tristate "Support for Rpi-PROTO" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_WM8731 + help + Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). + + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_PCM512x_I2C + help + Say Y or M if you want to add support for IQaudIO-DAC. + +From b5b5fa6e2a877089b48daaaac9b135c95c71e24f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:36:19 +0200 +Subject: [PATCH 205/216] bcm2835: Merge bcm2835_defconfig with + bcmrpi_defconfig +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +These commands where used to make this commit: + +./scripts/diffconfig -m arch/arm/configs/bcm2835_defconfig arch/arm/configs/bcmrpi_defconfig > merge.cfg + +cat << EOF > filter +CONFIG_ARCH_BCM2708 +CONFIG_BCM2708_DT +CONFIG_ARM_PATCH_PHYS_VIRT +CONFIG_PHYS_OFFSET +CONFIG_CMDLINE +CONFIG_BCM2708_WDT +CONFIG_HW_RANDOM_BCM2708 +CONFIG_I2C_BCM2708 +CONFIG_SPI_BCM2708 +CONFIG_SND_BCM2708_SOC_I2S +CONFIG_USB_DWCOTG +CONFIG_LIRC_RPI +EOF + +grep -F -v -f filter merge.cfg > filtered.cfg + +cat << EOF > added.cfg +CONFIG_WATCHDOG=y +CONFIG_BCM2835_WDT=y +CONFIG_MISC_FILESYSTEMS=y +CONFIG_SND_BCM2835_SOC_I2S=m +EOF + +ARCH=arm scripts/kconfig/merge_config.sh arch/arm/configs/bcm2835_defconfig filtered.cfg added.cfg +ARCH=arm make oldconfig + +ARCH=arm make savedefconfig +cp defconfig arch/arm/configs/bcm2835_defconfig + +rm merge.cfg filter filtered.cfg added.cfg defconfig + +ARCH=arm make bcm2835_defconfig +ARCH=arm make oldconfig + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2835_defconfig | 1114 +++++++++++++++++++++++++++++++++++- + 1 file changed, 1097 insertions(+), 17 deletions(-) + +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 1af6069..2e8a95a 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -1,107 +1,1071 @@ + # CONFIG_LOCALVERSION_AUTO is not set + CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y + CONFIG_FHANDLE=y + CONFIG_NO_HZ=y + CONFIG_HIGH_RES_TIMERS=y + CONFIG_BSD_PROCESS_ACCT=y + CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y + CONFIG_LOG_BUF_SHIFT=18 + CONFIG_CGROUP_FREEZER=y + CONFIG_CGROUP_DEVICE=y + CONFIG_CPUSETS=y + CONFIG_CGROUP_CPUACCT=y ++CONFIG_MEMCG=y + CONFIG_CGROUP_PERF=y + CONFIG_CFS_BANDWIDTH=y + CONFIG_RT_GROUP_SCHED=y ++CONFIG_BLK_CGROUP=y + CONFIG_NAMESPACES=y + CONFIG_SCHED_AUTOGROUP=y +-CONFIG_RELAY=y + CONFIG_BLK_DEV_INITRD=y + CONFIG_CC_OPTIMIZE_FOR_SIZE=y +-CONFIG_KALLSYMS_ALL=y + CONFIG_EMBEDDED=y + # CONFIG_COMPAT_BRK is not set + CONFIG_PROFILING=y +-CONFIG_OPROFILE=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y + CONFIG_JUMP_LABEL=y + CONFIG_CC_STACKPROTECTOR_REGULAR=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y + CONFIG_ARCH_MULTI_V6=y + # CONFIG_ARCH_MULTI_V7 is not set + CONFIG_ARCH_BCM=y + CONFIG_ARCH_BCM2835=y +-CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_PREEMPT=y + CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y + CONFIG_KSM=y + CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_UACCESS_WITH_MEMCPY=y + CONFIG_SECCOMP=y ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 + CONFIG_KEXEC=y + CONFIG_CRASH_DUMP=y ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y + CONFIG_VFP=y + # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set ++CONFIG_BINFMT_MISC=m + # CONFIG_SUSPEND is not set + CONFIG_NET=y + CONFIG_PACKET=y + CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m + CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_LRO=m ++CONFIG_INET_DIAG=m ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y + CONFIG_NETWORK_SECMARK=y + CONFIG_NETFILTER=y +-CONFIG_CFG80211=y +-CONFIG_MAC80211=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m + CONFIG_DEVTMPFS=y + CONFIG_DEVTMPFS_MOUNT=y + # CONFIG_STANDALONE is not set ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m + CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set + CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m + CONFIG_SCSI_CONSTANTS=y + CONFIG_SCSI_SCAN_ASYNC=y ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m + CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m + CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m + CONFIG_USB_NET_SMSC95XX=y +-CONFIG_ZD1211RW=y +-CONFIG_INPUT_EVDEV=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_AT76C50X_USB=m ++CONFIG_USB_ZD1201=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_RTL8187=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_ATH_CARDS=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8192CU=m ++CONFIG_ZD1211RW=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y + # CONFIG_LEGACY_PTYS is not set + # CONFIG_DEVKMEM is not set + CONFIG_SERIAL_AMBA_PL011=y + CONFIG_SERIAL_AMBA_PL011_CONSOLE=y + CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_HW_RANDOM_BCM2835=m ++CONFIG_RAW_DRIVER=y ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VC_SM=y + CONFIG_I2C=y +-CONFIG_I2C_CHARDEV=y ++CONFIG_I2C_CHARDEV=m + CONFIG_I2C_BCM2835=y + CONFIG_SPI=y +-CONFIG_SPI_BCM2835=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m + CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m + # CONFIG_HWMON is not set ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=y ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y ++CONFIG_FB_SSD1307=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y + CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_PRINTER=m + CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m + CONFIG_USB_DWC2=y ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m + CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 + CONFIG_MMC_BCM2835=y + CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y + CONFIG_MMC_SDHCI=y + CONFIG_MMC_SDHCI_PLTFM=y + CONFIG_MMC_SDHCI_BCM2835=y +-CONFIG_NEW_LEDS=y ++CONFIG_MMC_SPI=m + CONFIG_LEDS_CLASS=y + CONFIG_LEDS_GPIO=y +-CONFIG_LEDS_TRIGGERS=y + CONFIG_LEDS_TRIGGER_TIMER=y + CONFIG_LEDS_TRIGGER_ONESHOT=y + CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y + CONFIG_LEDS_TRIGGER_CPU=y + CONFIG_LEDS_TRIGGER_GPIO=y + CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +-CONFIG_LEDS_TRIGGER_TRANSIENT=y +-CONFIG_LEDS_TRIGGER_CAMERA=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_DS3234=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_RX4581=m + CONFIG_DMADEVICES=y + CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m + CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m + CONFIG_EXT2_FS=y + CONFIG_EXT2_FS_XATTR=y + CONFIG_EXT2_FS_POSIX_ACL=y +@@ -109,18 +1073,110 @@ CONFIG_EXT3_FS=y + CONFIG_EXT3_FS_POSIX_ACL=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m + CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m + CONFIG_MSDOS_FS=y + CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y + CONFIG_TMPFS=y + CONFIG_TMPFS_POSIX_ACL=y +-# CONFIG_MISC_FILESYSTEMS is not set ++CONFIG_CONFIGFS_FS=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_F2FS_FS=y + CONFIG_NFS_FS=y +-CONFIG_NFSD=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" + CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m + CONFIG_NLS_ASCII=y +-CONFIG_NLS_ISO8859_1=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m + CONFIG_NLS_UTF8=y ++CONFIG_DLM=m + CONFIG_PRINTK_TIME=y + CONFIG_BOOT_PRINTK_DELAY=y + CONFIG_DYNAMIC_DEBUG=y +@@ -130,14 +1186,38 @@ CONFIG_DEBUG_INFO=y + CONFIG_UNUSED_SYMBOLS=y + CONFIG_DEBUG_MEMORY_INIT=y + CONFIG_LOCKUP_DETECTOR=y ++CONFIG_TIMER_STATS=y ++# CONFIG_DEBUG_PREEMPT is not set ++CONFIG_LATENCYTOP=y ++CONFIG_IRQSOFF_TRACER=y + CONFIG_SCHED_TRACER=y + CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set + CONFIG_FUNCTION_PROFILER=y + CONFIG_TEST_KSTRTOX=y + CONFIG_KGDB=y + CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y + CONFIG_STRICT_DEVMEM=y + CONFIG_DEBUG_LL=y + CONFIG_EARLY_PRINTK=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CRYPTD=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_SHA1_ARM=m ++CONFIG_CRYPTO_SHA512=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_AES_ARM=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++# CONFIG_CRYPTO_ANSI_CPRNG is not set ++# CONFIG_CRYPTO_HW is not set ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y + # CONFIG_XZ_DEC_ARM is not set + # CONFIG_XZ_DEC_ARMTHUMB is not set + +From c712b42d06623b5410a3921f71278963a9a45209 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 24 Mar 2015 16:57:04 +0000 +Subject: [PATCH 206/216] BCM270x_DT: Configure UART using DT + +See: https://github.com/raspberrypi/firmware/issues/393 +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 7 +++++++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 7 +++++++ + arch/arm/boot/dts/bcm2708_common.dtsi | 27 +++++++++++++++++++++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 7 +++++++ + arch/arm/mach-bcm2708/bcm2708.c | 9 +++++---- + arch/arm/mach-bcm2709/bcm2709.c | 9 +++++---- + 6 files changed, 58 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 52b1404..99ab3c9 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -16,6 +16,7 @@ + intc = &intc; + leds = &leds; + sound = &sound; ++ uart0 = &uart0; + }; + + sound: sound { +@@ -53,6 +54,10 @@ + status = "okay"; + }; + ++&uart0 { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +@@ -108,6 +113,8 @@ + + / { + __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 876dfca..e8c80cd 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -16,6 +16,7 @@ + intc = &intc; + leds = &leds; + sound = &sound; ++ uart0 = &uart0; + }; + + sound: sound { +@@ -53,6 +54,10 @@ + status = "okay"; + }; + ++&uart0 { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +@@ -102,6 +107,8 @@ + + / { + __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index a80b1a8..a09a3c7 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -84,6 +84,17 @@ + status = "disabled"; + }; + ++ uart0: uart@7e201000 { ++ compatible = "arm,pl011", "arm,primecell"; ++ reg = <0x7e201000 0x1000>; ++ interrupts = <2 25>; ++ clocks = <&clk_uart0 &clk_apb_p>; ++ clock-names = "uartclk","apb_pclk"; ++ arm,primecell-periphid = <0x00241011>; // For an explanation, see ++ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038 ++ status = "disabled"; ++ }; ++ + i2s: i2s@7e203000 { + compatible = "brcm,bcm2708-i2s"; + reg = <0x7e203000 0x20>, +@@ -188,5 +199,21 @@ + clock-output-names = "spi"; + clock-frequency = <250000000>; + }; ++ ++ clk_uart0: clock@3 { ++ compatible = "fixed-clock"; ++ reg = <3>; ++ #clock-cells = <0>; ++ clock-output-names = "uart0_pclk"; ++ clock-frequency = <3000000>; ++ }; ++ ++ clk_apb_p: clock@4 { ++ compatible = "fixed-clock"; ++ reg = <4>; ++ #clock-cells = <0>; ++ clock-output-names = "apb_pclk"; ++ clock-frequency = <126000000>; ++ }; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index b226dfb..39b6fd4 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -16,6 +16,7 @@ + intc = &intc; + leds = &leds; + sound = &sound; ++ uart0 = &uart0; + }; + + sound: sound { +@@ -53,6 +54,10 @@ + status = "okay"; + }; + ++&uart0 { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +@@ -108,6 +113,8 @@ + + / { + __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index e141c0b..e17c1de 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -1020,10 +1020,11 @@ void __init bcm2708_init(void) + i2c_register_board_info_dt(1, snd_pcm512x_i2c_devices, ARRAY_SIZE(snd_pcm512x_i2c_devices)); + #endif + +- +- for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { +- struct amba_device *d = amba_devs[i]; +- amba_device_register(d, &iomem_resource); ++ if (!use_dt) { ++ for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { ++ struct amba_device *d = amba_devs[i]; ++ amba_device_register(d, &iomem_resource); ++ } + } + system_rev = boardrev; + system_serial_low = serial; +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 6dadb80..8834a10 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -1043,10 +1043,11 @@ void __init bcm2709_init(void) + i2c_register_board_info_dt(1, snd_pcm512x_i2c_devices, ARRAY_SIZE(snd_pcm512x_i2c_devices)); + #endif + +- +- for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { +- struct amba_device *d = amba_devs[i]; +- amba_device_register(d, &iomem_resource); ++ if (!use_dt) { ++ for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { ++ struct amba_device *d = amba_devs[i]; ++ amba_device_register(d, &iomem_resource); ++ } + } + system_rev = boardrev; + system_serial_low = serial; + +From aa05d1fe61d794be63d7e6055881e36c33cdb09c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 4 Jun 2015 16:16:08 +0100 +Subject: [PATCH 207/216] vchiq_arm: ARCH_BCM2835 compatibility + +Use virt_to_dma (not ideal, I know) to calculate the virt-to-bus +offset. This will make use of the "dma-ranges" property, if +present. +--- + drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 660aad2..c739083 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -46,7 +46,7 @@ + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) + +-#define VCHIQ_ARM_ADDRESS(x) ((void *)__virt_to_bus((unsigned)x)) ++#define VCHIQ_ARM_ADDRESS(x) ((void *)((char *)x + g_virt_to_bus_offset)) + + #include "vchiq_arm.h" + #include "vchiq_2835.h" +@@ -66,7 +66,8 @@ typedef struct vchiq_2835_state_struct { + static void __iomem *g_regs; + static FRAGMENTS_T *g_fragments_base; + static FRAGMENTS_T *g_free_fragments; +-struct semaphore g_free_fragments_sema; ++static struct semaphore g_free_fragments_sema; ++static unsigned long g_virt_to_bus_offset; + + extern int vchiq_arm_log_level; + +@@ -92,6 +93,8 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + int slot_mem_size, frag_mem_size; + int err, irq, i; + ++ g_virt_to_bus_offset = virt_to_dma(dev, (void *)0); ++ + /* Allocate space for the channels in coherent memory */ + slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); + frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); + +From fa0a4bff157dddc6207cba9911a1581864cf2307 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 5 Jun 2015 14:00:54 +0100 +Subject: [PATCH 208/216] BCM270x_DT: Enable UART in the example Compute Module + DTS as well + +--- + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 11 +++++++++++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 1 + + arch/arm/boot/dts/bcm2708_common.dtsi | 3 ++- + 3 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 45f8244..238bd65 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -5,3 +5,14 @@ + / { + model = "Raspberry Pi Compute Module"; + }; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 1c2cfcf..43830a6 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -11,6 +11,7 @@ + intc = &intc; + leds = &leds; + sound = &sound; ++ uart0 = &uart0; + }; + + sound: sound { +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index a09a3c7..dc0346b 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -185,10 +185,11 @@ + clock-frequency = <250000000>; + }; + +- clk_i2c: i2c { ++ clk_i2c: clock@1 { + compatible = "fixed-clock"; + reg = <1>; + #clock-cells = <0>; ++ clock-output-names = "i2c"; + clock-frequency = <250000000>; + }; + + +From fae583caba82c37f9a1e0cff81fbaa4c3f768657 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 5 Jun 2015 15:59:08 +0100 +Subject: [PATCH 209/216] bcm270x defconfigs: Remove spurious entries + +--- + arch/arm/configs/bcm2709_defconfig | 5 ----- + arch/arm/configs/bcmrpi_defconfig | 8 -------- + 2 files changed, 13 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index d08ae51..78e1202 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -344,12 +344,7 @@ CONFIG_BAYCOM_SER_FDX=m + CONFIG_BAYCOM_SER_HDX=m + CONFIG_YAM=m + CONFIG_CAN=m +-CONFIG_CAN_RAW=m +-CONFIG_CAN_BCM=m +-CONFIG_CAN_GW=m + CONFIG_CAN_VCAN=m +-CONFIG_CAN_DEV=m +-CONFIG_CAN_CALC_BITTIMING=y + CONFIG_CAN_MCP251X=m + CONFIG_IRDA=m + CONFIG_IRLAN=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 11bbfac..c6a5db2 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -335,14 +335,6 @@ CONFIG_6PACK=m + CONFIG_BPQETHER=m + CONFIG_BAYCOM_SER_FDX=m + CONFIG_BAYCOM_SER_HDX=m +-CONFIG_CAN=m +-CONFIG_CAN_RAW=m +-CONFIG_CAN_BCM=m +-CONFIG_CAN_GW=m +-CONFIG_CAN_VCAN=m +-CONFIG_CAN_DEV=m +-CONFIG_CAN_CALC_BITTIMING=y +-CONFIG_CAN_MCP251X=m + CONFIG_YAM=m + CONFIG_CAN=m + CONFIG_CAN_VCAN=m + +From 549ff9d4fee2f6dc0abdeaa552754ce2197ba331 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 28 May 2015 09:00:01 +0100 +Subject: [PATCH 210/216] BCM270x_DT: Add a label to the clocks node, and a few + aliases + +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 ++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 2 ++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 2 ++ + arch/arm/boot/dts/bcm2708_common.dtsi | 2 +- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 ++ + 5 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 99ab3c9..c9053f8 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -15,8 +15,10 @@ + gpio = &gpio; + intc = &intc; + leds = &leds; ++ audio = &audio; + sound = &sound; + uart0 = &uart0; ++ clocks = &clocks; + }; + + sound: sound { +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index e8c80cd..32066c3 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -15,8 +15,10 @@ + gpio = &gpio; + intc = &intc; + leds = &leds; ++ audio = &audio; + sound = &sound; + uart0 = &uart0; ++ clocks = &clocks; + }; + + sound: sound { +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 43830a6..f38a0c2 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -10,8 +10,10 @@ + gpio = &gpio; + intc = &intc; + leds = &leds; ++ audio = &audio; + sound = &sound; + uart0 = &uart0; ++ clocks = &clocks; + }; + + sound: sound { +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index dc0346b..a9f1507 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -172,7 +172,7 @@ + }; + }; + +- clocks { ++ clocks: clocks { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 39b6fd4..a9adaf4 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -15,8 +15,10 @@ + gpio = &gpio; + intc = &intc; + leds = &leds; ++ audio = &audio; + sound = &sound; + uart0 = &uart0; ++ clocks = &clocks; + }; + + sound: sound { + +From 1b8bcc8ef9b600f7ac5e4d40bd70b507ad02aa01 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 28 May 2015 09:01:02 +0100 +Subject: [PATCH 211/216] sdhost-overlay: Move clock declaration out of /soc + +--- + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 29 +++++++++++++++------------ + 1 file changed, 16 insertions(+), 13 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +index b2653e9..8fb28e9 100644 +--- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -24,23 +24,26 @@ + brcm,overclock-50 = <0>; + status = "okay"; + }; ++ }; ++ }; + +- clocks { +- #address-cells = <1>; +- #size-cells = <0>; ++ fragment@1 { ++ target = <&clocks>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + +- clk_sdhost: clock@3 { +- compatible = "fixed-clock"; +- reg = <0>; +- #clock-cells = <0>; +- clock-output-names = "sdhost"; +- clock-frequency = <250000000>; +- }; ++ clk_sdhost: sdhost { ++ compatible = "fixed-clock"; ++ reg = <0>; ++ #clock-cells = <0>; ++ clock-output-names = "sdhost"; ++ clock-frequency = <250000000>; + }; + }; + }; + +- fragment@1 { ++ fragment@2 { + target = <&gpio>; + __overlay__ { + sdhost_pins: sdhost_pins { +@@ -50,7 +53,7 @@ + }; + }; + +- fragment@2 { ++ fragment@3 { + target = <&mmc>; + __overlay__ { + /* Find a way to disable the other driver */ +@@ -59,7 +62,7 @@ + }; + }; + +- fragment@3 { ++ fragment@4 { + target-path = "/__overrides__"; + __overlay__ { + sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; + +From 24d8164a16fb825c4bee4a8cca87f55a68f33edf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 6 Jun 2015 23:45:32 +0200 +Subject: [PATCH 212/216] BCM270X_DT: Enable 'make clean' on overlays directory +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Always add the overlays directory to subdir so it can be +cleaned with 'make clean'. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index e7ce7c4..d85583c 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -16,8 +16,6 @@ ifeq ($(CONFIG_ARCH_BCM2835),y) + RPI_DT_OVERLAYS=y + endif + +-subdir-$(RPI_DT_OVERLAYS) += overlays +- + dtb-$(CONFIG_MACH_ASM9260) += \ + alphascale-asm9260-devkit.dtb + # Keep at91 dtb files sorted alphabetically for each SoC +@@ -676,3 +674,5 @@ clean-files := *.dtb + ifeq ($(RPI_DT_OVERLAYS),y) + DTC_FLAGS ?= -@ + endif ++ ++subdir-y += overlays + +From 2b53c727bbb2ba40102236f127ea6e68b1148335 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sun, 7 Jun 2015 13:35:33 +0200 +Subject: [PATCH 213/216] hwmon: Remove bcm2835-hwmon +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +bcm2835-thermal combined with the configs HWMON=y and +THERMAL_HWMON=y, gives the same functionality. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/bcm2708.c | 5 - + arch/arm/mach-bcm2709/bcm2709.c | 5 - + drivers/hwmon/Kconfig | 10 -- + drivers/hwmon/Makefile | 1 - + drivers/hwmon/bcm2835-hwmon.c | 219 ---------------------------------------- + 5 files changed, 240 deletions(-) + delete mode 100644 drivers/hwmon/bcm2835-hwmon.c + +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index e17c1de..4f191d9 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -697,10 +697,6 @@ static struct platform_device bcm2708_bsc1_device = { + .resource = bcm2708_bsc1_resources, + }; + +-static struct platform_device bcm2835_hwmon_device = { +- .name = "bcm2835_hwmon", +-}; +- + static struct platform_device bcm2835_thermal_device = { + .name = "bcm2835_thermal", + }; +@@ -983,7 +979,6 @@ void __init bcm2708_init(void) + bcm_register_device_dt(&bcm2708_bsc1_device); + } + +- bcm_register_device(&bcm2835_hwmon_device); + bcm_register_device_dt(&bcm2835_thermal_device); + + #if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE) +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 8834a10..d61bb30 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -718,10 +718,6 @@ static struct platform_device bcm2708_bsc1_device = { + .resource = bcm2708_bsc1_resources, + }; + +-static struct platform_device bcm2835_hwmon_device = { +- .name = "bcm2835_hwmon", +-}; +- + static struct platform_device bcm2835_thermal_device = { + .name = "bcm2835_thermal", + }; +@@ -1006,7 +1002,6 @@ void __init bcm2709_init(void) + bcm_register_device_dt(&bcm2708_bsc1_device); + } + +- bcm_register_device(&bcm2835_hwmon_device); + bcm_register_device_dt(&bcm2835_thermal_device); + + #if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE) +diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig +index 8c4474d..110fade 100644 +--- a/drivers/hwmon/Kconfig ++++ b/drivers/hwmon/Kconfig +@@ -1703,16 +1703,6 @@ config SENSORS_ULTRA45 + This driver provides support for the Ultra45 workstation environmental + sensors. + +-config SENSORS_BCM2835 +- depends on THERMAL_BCM2835=n +- tristate "Broadcom BCM2835 HWMON Driver" +- help +- If you say yes here you get support for the hardware +- monitoring features of the BCM2835 Chip +- +- This driver can also be built as a module. If so, the module +- will be called bcm2835-hwmon. +- + if ACPI + + comment "ACPI drivers" +diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile +index e7c60cb..6c94147 100644 +--- a/drivers/hwmon/Makefile ++++ b/drivers/hwmon/Makefile +@@ -155,7 +155,6 @@ obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o + obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o + obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o + obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o +-obj-$(CONFIG_SENSORS_BCM2835) += bcm2835-hwmon.o + + obj-$(CONFIG_PMBUS) += pmbus/ + +diff --git a/drivers/hwmon/bcm2835-hwmon.c b/drivers/hwmon/bcm2835-hwmon.c +deleted file mode 100644 +index d14502c..0000000 +--- a/drivers/hwmon/bcm2835-hwmon.c ++++ /dev/null +@@ -1,219 +0,0 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define MODULE_NAME "bcm2835_hwmon" +- +-/*#define HWMON_DEBUG_ENABLE*/ +- +-#ifdef HWMON_DEBUG_ENABLE +-#define print_debug(fmt,...) printk(KERN_INFO "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) +-#else +-#define print_debug(fmt,...) +-#endif +-#define print_err(fmt,...) printk(KERN_ERR "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) +-#define print_info(fmt,...) printk(KERN_INFO "%s: "fmt"\n", MODULE_NAME, ##__VA_ARGS__) +- +-#define VC_TAG_GET_TEMP 0x00030006 +-#define VC_TAG_GET_MAX_TEMP 0x0003000A +- +-/* --- STRUCTS --- */ +-struct bcm2835_hwmon_data { +- struct device *hwmon_dev; +-}; +- +-/* tag part of the message */ +-struct vc_msg_tag { +- uint32_t tag_id; /* the tag ID for the temperature */ +- uint32_t buffer_size; /* size of the buffer (should be 8) */ +- uint32_t request_code; /* identifies message as a request (should be 0) */ +- uint32_t id; /* extra ID field (should be 0) */ +- uint32_t val; /* returned value of the temperature */ +-}; +- +-/* message structure to be sent to videocore */ +-struct vc_msg { +- uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ +- uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ +- struct vc_msg_tag tag; /* the tag structure above to make */ +- uint32_t end_tag; /* an end identifier, should be set to NULL */ +-}; +- +-typedef enum { +- TEMP, +- MAX_TEMP, +-} temp_type; +- +-/* --- PROTOTYPES --- */ +-static ssize_t bcm2835_get_temp(struct device *dev, struct device_attribute *attr, char *buf); +-static ssize_t bcm2835_get_name(struct device *dev, struct device_attribute *attr, char *buf); +- +-/* --- GLOBALS --- */ +- +-static struct bcm2835_hwmon_data *bcm2835_data; +-static struct platform_driver bcm2835_hwmon_driver; +- +-static SENSOR_DEVICE_ATTR(name, S_IRUGO,bcm2835_get_name,NULL,0); +-static SENSOR_DEVICE_ATTR(temp1_input,S_IRUGO,bcm2835_get_temp,NULL,TEMP); +-static SENSOR_DEVICE_ATTR(temp1_max,S_IRUGO,bcm2835_get_temp,NULL,MAX_TEMP); +- +-static struct attribute* bcm2835_attributes[] = { +- &sensor_dev_attr_name.dev_attr.attr, +- &sensor_dev_attr_temp1_input.dev_attr.attr, +- &sensor_dev_attr_temp1_max.dev_attr.attr, +- NULL, +-}; +- +-static struct attribute_group bcm2835_attr_group = { +- .attrs = bcm2835_attributes, +-}; +- +-/* --- FUNCTIONS --- */ +- +-static ssize_t bcm2835_get_name(struct device *dev, struct device_attribute *attr, char *buf) +-{ +- return sprintf(buf,"bcm2835_hwmon\n"); +-} +- +-static ssize_t bcm2835_get_temp(struct device *dev, struct device_attribute *attr, char *buf) +-{ +- struct vc_msg msg; +- int result; +- uint temp = 0; +- int index = ((struct sensor_device_attribute*)to_sensor_dev_attr(attr))->index; +- +- print_debug("IN"); +- +- /* wipe all previous message data */ +- memset(&msg, 0, sizeof msg); +- +- /* determine the message type */ +- if(index == TEMP) +- msg.tag.tag_id = VC_TAG_GET_TEMP; +- else if (index == MAX_TEMP) +- msg.tag.tag_id = VC_TAG_GET_MAX_TEMP; +- else +- { +- print_debug("Unknown temperature message!"); +- return -EINVAL; +- } +- +- msg.msg_size = sizeof msg; +- msg.tag.buffer_size = 8; +- +- /* send the message */ +- result = bcm_mailbox_property(&msg, sizeof msg); +- +- /* check if it was all ok and return the rate in milli degrees C */ +- if (result == 0 && (msg.request_code & 0x80000000)) +- temp = (uint)msg.tag.val; +- #ifdef HWMON_DEBUG_ENABLE +- else +- print_debug("Failed to get temperature!"); +- #endif +- print_debug("Got temperature as %u",temp); +- print_debug("OUT"); +- return sprintf(buf, "%u\n", temp); +-} +- +- +-static int bcm2835_hwmon_probe(struct platform_device *pdev) +-{ +- int err; +- +- print_debug("IN"); +- print_debug("HWMON Driver has been probed!"); +- +- /* check that the device isn't null!*/ +- if(pdev == NULL) +- { +- print_debug("Platform device is empty!"); +- return -ENODEV; +- } +- +- /* allocate memory for neccessary data */ +- bcm2835_data = kzalloc(sizeof(struct bcm2835_hwmon_data),GFP_KERNEL); +- if(!bcm2835_data) +- { +- print_debug("Unable to allocate memory for hwmon data!"); +- err = -ENOMEM; +- goto kzalloc_error; +- } +- +- /* create the sysfs files */ +- if(sysfs_create_group(&pdev->dev.kobj, &bcm2835_attr_group)) +- { +- print_debug("Unable to create sysfs files!"); +- err = -EFAULT; +- goto sysfs_error; +- } +- +- /* register the hwmon device */ +- bcm2835_data->hwmon_dev = hwmon_device_register(&pdev->dev); +- if (IS_ERR(bcm2835_data->hwmon_dev)) +- { +- err = PTR_ERR(bcm2835_data->hwmon_dev); +- goto hwmon_error; +- } +- print_debug("OUT"); +- return 0; +- +- /* error goto's */ +- hwmon_error: +- sysfs_remove_group(&pdev->dev.kobj, &bcm2835_attr_group); +- +- sysfs_error: +- kfree(bcm2835_data); +- +- kzalloc_error: +- +- return err; +- +-} +- +-static int bcm2835_hwmon_remove(struct platform_device *pdev) +-{ +- print_debug("IN"); +- hwmon_device_unregister(bcm2835_data->hwmon_dev); +- +- sysfs_remove_group(&pdev->dev.kobj, &bcm2835_attr_group); +- print_debug("OUT"); +- return 0; +-} +- +-/* Hwmon Driver */ +-static struct platform_driver bcm2835_hwmon_driver = { +- .probe = bcm2835_hwmon_probe, +- .remove = bcm2835_hwmon_remove, +- .driver = { +- .name = "bcm2835_hwmon", +- .owner = THIS_MODULE, +- }, +-}; +- +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Dorian Peake"); +-MODULE_DESCRIPTION("HW Monitor driver for bcm2835 chip"); +- +-module_platform_driver(bcm2835_hwmon_driver); + +From a4573f4e07996b61582f828189091bede1296d25 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 6 Jun 2015 22:59:28 +0200 +Subject: [PATCH 214/216] BCM270x: Make uart1 work with Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add uart1 to Device Tree. Enable it in AUXENB when it's used. +Remove old platform device. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 1 + + arch/arm/boot/dts/bcm2708-rpi-b.dts | 1 + + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 1 + + arch/arm/boot/dts/bcm2708_common.dtsi | 10 +++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 + + arch/arm/mach-bcm2708/bcm2708.c | 35 +++++++++++--------------------- + arch/arm/mach-bcm2709/bcm2709.c | 34 +++++++++++-------------------- + 7 files changed, 38 insertions(+), 45 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index c9053f8..0fa2210 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -18,6 +18,7 @@ + audio = &audio; + sound = &sound; + uart0 = &uart0; ++ uart1 = &uart1; + clocks = &clocks; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 32066c3..3fd49d0 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -18,6 +18,7 @@ + audio = &audio; + sound = &sound; + uart0 = &uart0; ++ uart1 = &uart1; + clocks = &clocks; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index f38a0c2..3da7d3b 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -13,6 +13,7 @@ + audio = &audio; + sound = &sound; + uart0 = &uart0; ++ uart1 = &uart1; + clocks = &clocks; + }; + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index a9f1507..8caa234 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -134,6 +134,16 @@ + status = "disabled"; + }; + ++ uart1: uart@7e215040 { ++ compatible = "brcm,bcm2835-aux-uart", "ns16550"; ++ reg = <0x7e215040 0x40>; ++ interrupts = <1 29>; ++ clock-frequency = <500000000>; ++ reg-shift = <2>; ++ no-loopback-test; ++ status = "disabled"; ++ }; ++ + i2c1: i2c@7e804000 { + compatible = "brcm,bcm2708-i2c"; + reg = <0x7e804000 0x1000>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index a9adaf4..8aaaf1f 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -18,6 +18,7 @@ + audio = &audio; + sound = &sound; + uart0 = &uart0; ++ uart1 = &uart1; + clocks = &clocks; + }; + +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 4f191d9..f1706366 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -353,28 +353,6 @@ static struct platform_device bcm2708_fb_device = { + }, + }; + +-static struct plat_serial8250_port bcm2708_uart1_platform_data[] = { +- { +- .mapbase = UART1_BASE + 0x40, +- .irq = IRQ_AUX, +- .uartclk = 500000000, +- .regshift = 2, +- .iotype = UPIO_MEM, +- .flags = UPF_SHARE_IRQ | UPF_FIXED_TYPE | UPF_FIXED_PORT | +- UPF_IOREMAP | UPF_SKIP_TEST, +- .type = PORT_16550, +- }, +- {}, +-}; +- +-static struct platform_device bcm2708_uart1_device = { +- .name = "serial8250", +- .id = PLAT8250_DEV_PLATFORM, +- .dev = { +- .platform_data = bcm2708_uart1_platform_data, +- }, +-}; +- + static struct resource bcm2708_usb_resources[] = { + [0] = { + .start = USB_BASE, +@@ -897,6 +875,17 @@ static void bcm2708_power_off(void) + } + } + ++static void __init bcm2708_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ pr_info("bcm2708: Mini UART enabled\n"); ++ writel(1, __io_address(UART1_BASE + 0x4)); ++ } ++} ++ + #ifdef CONFIG_OF + static void __init bcm2708_dt_init(void) + { +@@ -952,13 +941,13 @@ void __init bcm2708_init(void) + bcm_register_device(&bcm2708_systemtimer_device); + bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device_dt(&bcm2708_usb_device); +- bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + + #ifdef CONFIG_MMC_BCM2835 + bcm_register_device_dt(&bcm2835_emmc_device); + #endif + bcm2708_init_led(); ++ bcm2708_init_uart1(); + + /* Only create the platform devices for the ALSA driver in the + absence of an enabled "audio" DT node */ +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index d61bb30..ffa667e 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -363,27 +363,6 @@ static struct platform_device bcm2708_fb_device = { + }, + }; + +-static struct plat_serial8250_port bcm2708_uart1_platform_data[] = { +- { +- .mapbase = UART1_BASE + 0x40, +- .irq = IRQ_AUX, +- .uartclk = 125000000, +- .regshift = 2, +- .iotype = UPIO_MEM, +- .flags = UPF_FIXED_TYPE | UPF_IOREMAP | UPF_SKIP_TEST, +- .type = PORT_8250, +- }, +- {}, +-}; +- +-static struct platform_device bcm2708_uart1_device = { +- .name = "serial8250", +- .id = PLAT8250_DEV_PLATFORM, +- .dev = { +- .platform_data = bcm2708_uart1_platform_data, +- }, +-}; +- + static struct resource bcm2708_usb_resources[] = { + [0] = { + .start = USB_BASE, +@@ -918,6 +897,17 @@ static void bcm2709_power_off(void) + } + } + ++static void __init bcm2709_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ pr_info("bcm2709: Mini UART enabled\n"); ++ writel(1, __io_address(UART1_BASE + 0x4)); ++ } ++} ++ + #ifdef CONFIG_OF + static void __init bcm2709_dt_init(void) + { +@@ -975,13 +965,13 @@ void __init bcm2709_init(void) + #endif + bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device_dt(&bcm2708_usb_device); +- bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + + #ifdef CONFIG_MMC_BCM2835 + bcm_register_device_dt(&bcm2835_emmc_device); + #endif + bcm2709_init_led(); ++ bcm2709_init_uart1(); + + /* Only create the platform devices for the ALSA driver in the + absence of an enabled "audio" DT node */ + +From 31c0f40b228b657d4c8968c32768992a3bbcefb6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sun, 7 Jun 2015 20:42:35 +0200 +Subject: [PATCH 215/216] fixup: BCM2709: Remove unused clock implementation + +--- + arch/arm/mach-bcm2709/clock.c | 61 ------------------------------------------- + arch/arm/mach-bcm2709/clock.h | 24 ----------------- + 2 files changed, 85 deletions(-) + delete mode 100644 arch/arm/mach-bcm2709/clock.c + delete mode 100644 arch/arm/mach-bcm2709/clock.h + +diff --git a/arch/arm/mach-bcm2709/clock.c b/arch/arm/mach-bcm2709/clock.c +deleted file mode 100644 +index 4fc556e..0000000 +--- a/arch/arm/mach-bcm2709/clock.c ++++ /dev/null +@@ -1,61 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/clock.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include "clock.h" +- +-int clk_enable(struct clk *clk) +-{ +- return 0; +-} +-EXPORT_SYMBOL(clk_enable); +- +-void clk_disable(struct clk *clk) +-{ +-} +-EXPORT_SYMBOL(clk_disable); +- +-unsigned long clk_get_rate(struct clk *clk) +-{ +- return clk->rate; +-} +-EXPORT_SYMBOL(clk_get_rate); +- +-long clk_round_rate(struct clk *clk, unsigned long rate) +-{ +- return clk->rate; +-} +-EXPORT_SYMBOL(clk_round_rate); +- +-int clk_set_rate(struct clk *clk, unsigned long rate) +-{ +- return -EIO; +-} +-EXPORT_SYMBOL(clk_set_rate); +diff --git a/arch/arm/mach-bcm2709/clock.h b/arch/arm/mach-bcm2709/clock.h +deleted file mode 100644 +index 5f9d725..0000000 +--- a/arch/arm/mach-bcm2709/clock.h ++++ /dev/null +@@ -1,24 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/clock.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +-struct module; +- +-struct clk { +- unsigned long rate; +-}; + +From 6ae9c7a93909159bde1a92fd305e99443e4ac680 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sun, 7 Jun 2015 20:42:52 +0200 +Subject: [PATCH 216/216] BCM270x: Remove bcm2708_systemtimer and + bcm2708_powerman +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +These devices do not have a matching driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/bcm2708.c | 50 -------------------------------------- + arch/arm/mach-bcm2709/bcm2709.c | 54 ----------------------------------------- + 2 files changed, 104 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index f1706366..00fc5d6 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -465,33 +465,6 @@ static struct platform_device bcm2708_gpio_device = { + }; + #endif + +-static struct resource bcm2708_systemtimer_resources[] = { +- [0] = { /* system timer access */ +- .start = ST_BASE, +- .end = ST_BASE + SZ_4K - 1, +- .flags = IORESOURCE_MEM, +- }, +- { +- .start = IRQ_TIMER3, +- .end = IRQ_TIMER3, +- .flags = IORESOURCE_IRQ, +- } +- +-}; +- +-static u64 systemtimer_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); +- +-static struct platform_device bcm2708_systemtimer_device = { +- .name = "bcm2708_systemtimer", +- .id = -1, /* only one VideoCore I/O area */ +- .resource = bcm2708_systemtimer_resources, +- .num_resources = ARRAY_SIZE(bcm2708_systemtimer_resources), +- .dev = { +- .dma_mask = &systemtimer_dmamask, +- .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), +- }, +-}; +- + #ifdef CONFIG_MMC_BCM2835 /* Arasan emmc SD (new) */ + static struct resource bcm2835_emmc_resources[] = { + [0] = { +@@ -520,27 +493,6 @@ struct platform_device bcm2835_emmc_device = { + }; + #endif /* CONFIG_MMC_BCM2835 */ + +-static struct resource bcm2708_powerman_resources[] = { +- [0] = { +- .start = PM_BASE, +- .end = PM_BASE + SZ_256 - 1, +- .flags = IORESOURCE_MEM, +- }, +-}; +- +-static u64 powerman_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); +- +-struct platform_device bcm2708_powerman_device = { +- .name = "bcm2708_powerman", +- .id = 0, +- .num_resources = ARRAY_SIZE(bcm2708_powerman_resources), +- .resource = bcm2708_powerman_resources, +- .dev = { +- .dma_mask = &powerman_dmamask, +- .coherent_dma_mask = 0xffffffffUL}, +-}; +- +- + static struct platform_device bcm2708_alsa_devices[] = { + [0] = { + .name = "bcm2835_AUD0", +@@ -938,10 +890,8 @@ void __init bcm2708_init(void) + w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup; + bcm_register_device_dt(&w1_device); + #endif +- bcm_register_device(&bcm2708_systemtimer_device); + bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device_dt(&bcm2708_usb_device); +- bcm_register_device(&bcm2708_powerman_device); + + #ifdef CONFIG_MMC_BCM2835 + bcm_register_device_dt(&bcm2835_emmc_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index ffa667e..a5cac5b 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -485,35 +485,6 @@ static struct platform_device bcm2708_gpio_device = { + }; + #endif + +-#ifdef SYSTEM_TIMER +-static struct resource bcm2708_systemtimer_resources[] = { +- [0] = { /* system timer access */ +- .start = ST_BASE, +- .end = ST_BASE + SZ_4K - 1, +- .flags = IORESOURCE_MEM, +- }, +- { +- .start = IRQ_TIMER3, +- .end = IRQ_TIMER3, +- .flags = IORESOURCE_IRQ, +- } +- +-}; +- +-static u64 systemtimer_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); +- +-static struct platform_device bcm2708_systemtimer_device = { +- .name = "bcm2708_systemtimer", +- .id = -1, /* only one VideoCore I/O area */ +- .resource = bcm2708_systemtimer_resources, +- .num_resources = ARRAY_SIZE(bcm2708_systemtimer_resources), +- .dev = { +- .dma_mask = &systemtimer_dmamask, +- .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), +- }, +-}; +-#endif +- + #ifdef CONFIG_MMC_BCM2835 /* Arasan emmc SD (new) */ + static struct resource bcm2835_emmc_resources[] = { + [0] = { +@@ -542,27 +513,6 @@ struct platform_device bcm2835_emmc_device = { + }; + #endif /* CONFIG_MMC_BCM2835 */ + +-static struct resource bcm2708_powerman_resources[] = { +- [0] = { +- .start = PM_BASE, +- .end = PM_BASE + SZ_256 - 1, +- .flags = IORESOURCE_MEM, +- }, +-}; +- +-static u64 powerman_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); +- +-struct platform_device bcm2708_powerman_device = { +- .name = "bcm2708_powerman", +- .id = 0, +- .num_resources = ARRAY_SIZE(bcm2708_powerman_resources), +- .resource = bcm2708_powerman_resources, +- .dev = { +- .dma_mask = &powerman_dmamask, +- .coherent_dma_mask = 0xffffffffUL}, +-}; +- +- + static struct platform_device bcm2708_alsa_devices[] = { + [0] = { + .name = "bcm2835_AUD0", +@@ -960,12 +910,8 @@ void __init bcm2709_init(void) + w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup; + bcm_register_device_dt(&w1_device); + #endif +-#ifdef SYSTEM_TIMER +- bcm_register_device(&bcm2708_systemtimer_device); +-#endif + bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device_dt(&bcm2708_usb_device); +- bcm_register_device(&bcm2708_powerman_device); + + #ifdef CONFIG_MMC_BCM2835 + bcm_register_device_dt(&bcm2835_emmc_device); diff --git a/projects/RPi2/linux/linux.arm.conf b/projects/RPi2/linux/linux.arm.conf index 3dc33eda4e..a41d627cb1 100644 --- a/projects/RPi2/linux/linux.arm.conf +++ b/projects/RPi2/linux/linux.arm.conf @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm 4.0.4 Kernel Configuration +# Linux/arm 4.0.5 Kernel Configuration # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -319,7 +319,6 @@ CONFIG_MMU=y # CONFIG_ARCH_OMAP1 is not set CONFIG_ARCH_BCM2709=y CONFIG_BCM2708_GPIO=y -CONFIG_BCM2708_VCMEM=y CONFIG_BCM2708_NOL2CACHE=y CONFIG_BCM2708_SPIDEV=y @@ -1424,6 +1423,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y # CONFIG_IPMI_HANDLER is not set CONFIG_HW_RANDOM=y # CONFIG_HW_RANDOM_TIMERIOMEM is not set +CONFIG_HW_RANDOM_BCM2835=y CONFIG_HW_RANDOM_BCM2708=m # CONFIG_R3964 is not set # CONFIG_RAW_DRIVER is not set @@ -1431,6 +1431,7 @@ CONFIG_HW_RANDOM_BCM2708=m CONFIG_BRCM_CHAR_DRIVERS=y CONFIG_BCM_VC_CMA=y # CONFIG_BCM_VC_SM is not set +CONFIG_BCM2708_VCMEM=y # CONFIG_XILLYBUS is not set # @@ -1791,7 +1792,7 @@ CONFIG_THERMAL_BCM2835=y # Texas Instruments thermal drivers # CONFIG_WATCHDOG=y -# CONFIG_WATCHDOG_CORE is not set +CONFIG_WATCHDOG_CORE=y # CONFIG_WATCHDOG_NOWAYOUT is not set # @@ -1805,6 +1806,7 @@ CONFIG_WATCHDOG=y # CONFIG_DW_WATCHDOG is not set # CONFIG_MAX63XX_WATCHDOG is not set CONFIG_BCM2708_WDT=m +CONFIG_BCM2835_WDT=m # CONFIG_MEN_A21_WDT is not set # @@ -3067,7 +3069,10 @@ CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y # CONFIG_SH_TIMER_TMU is not set # CONFIG_EM_TIMER_STI is not set # CONFIG_CLKSRC_VERSATILE is not set -# CONFIG_MAILBOX is not set +CONFIG_MAILBOX=y +CONFIG_BCM2708_MBOX=y +# CONFIG_PL320_MBOX is not set +# CONFIG_ALTERA_MBOX is not set # CONFIG_IOMMU_SUPPORT is not set # @@ -3082,6 +3087,7 @@ CONFIG_ARM_ARCH_TIMER_EVTSTREAM=y # # SOC (System On Chip) specific Drivers # +CONFIG_BCM2708_POWER=y # CONFIG_SOC_TI is not set # CONFIG_PM_DEVFREQ is not set CONFIG_EXTCON=m diff --git a/projects/RPi2/patches/linux/linux-01-RPi_support.patch b/projects/RPi2/patches/linux/linux-01-RPi_support.patch index 6cf4846602..c1f57bb01c 100644 --- a/projects/RPi2/patches/linux/linux-01-RPi_support.patch +++ b/projects/RPi2/patches/linux/linux-01-RPi_support.patch @@ -1,7 +1,7 @@ -From a041b743ae97433e56b58a8f4c81f7c15af9e644 Mon Sep 17 00:00:00 2001 +From 0e7aaf92061593060fc62957aeec745534add9a4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 001/154] Main bcm2708 linux port +Subject: [PATCH 001/216] Main bcm2708 linux port Signed-off-by: popcornmix --- @@ -147,10 +147,10 @@ index eb7bb51..27c0f92 100644 machine-$(CONFIG_ARCH_CLPS711X) += clps711x machine-$(CONFIG_ARCH_CNS3XXX) += cns3xxx diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c -index fdfa3a7..f5ffaacb 100644 +index 2bf1a16..2915516 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c -@@ -166,6 +166,16 @@ void arch_cpu_idle_dead(void) +@@ -172,6 +172,16 @@ void arch_cpu_idle_dead(void) } #endif @@ -4559,7 +4559,7 @@ index 0000000..5e43e85 +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:bcm-mbox"); diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig -index 9b4f29e..0c5d4ac 100644 +index 9b4f29e5..0c5d4ac 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig @@ -358,7 +358,7 @@ config CPU_PJ4B @@ -4636,10 +4636,10 @@ index 0c8cbe5..c3b84a2 100644 mmc_pm_flag_t pm_caps; /* supported pm features */ -From cf0e6b17a6c03de2d0f88fc6a9d1691ba7057669 Mon Sep 17 00:00:00 2001 +From 6763b931593e5ce8e1b5e45de482527d61390f56 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 7 May 2013 14:32:27 +0100 -Subject: [PATCH 002/154] Add 2709 platform for Raspberry Pi 2 +Subject: [PATCH 002/216] Add 2709 platform for Raspberry Pi 2 --- arch/arm/Kconfig | 21 + @@ -4651,7 +4651,7 @@ Subject: [PATCH 002/154] Add 2709 platform for Raspberry Pi 2 arch/arm/mach-bcm2709/armctrl.c | 361 +++++++ arch/arm/mach-bcm2709/armctrl.h | 27 + arch/arm/mach-bcm2709/bcm2708_gpio.c | 426 ++++++++ - arch/arm/mach-bcm2709/bcm2709.c | 1257 ++++++++++++++++++++++ + arch/arm/mach-bcm2709/bcm2709.c | 1263 ++++++++++++++++++++++ arch/arm/mach-bcm2709/bcm2709.h | 49 + arch/arm/mach-bcm2709/clock.c | 61 ++ arch/arm/mach-bcm2709/clock.h | 24 + @@ -4686,7 +4686,7 @@ Subject: [PATCH 002/154] Add 2709 platform for Raspberry Pi 2 arch/arm/mm/proc-v7.S | 1 + arch/arm/tools/mach-types | 1 + drivers/clocksource/arm_arch_timer.c | 36 + - 44 files changed, 6061 insertions(+) + 44 files changed, 6067 insertions(+) create mode 100644 arch/arm/mach-bcm2709/Kconfig create mode 100644 arch/arm/mach-bcm2709/Makefile create mode 100644 arch/arm/mach-bcm2709/Makefile.boot @@ -5707,10 +5707,10 @@ index 0000000..c1e9254 +MODULE_LICENSE("GPL"); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c new file mode 100644 -index 0000000..da11ad1 +index 0000000..f8679bb --- /dev/null +++ b/arch/arm/mach-bcm2709/bcm2709.c -@@ -0,0 +1,1257 @@ +@@ -0,0 +1,1263 @@ +/* + * linux/arch/arm/mach-bcm2709/bcm2709.c + * @@ -6731,7 +6731,7 @@ index 0000000..da11ad1 + /* + * Make irqs happen for the system timer + */ -+ setup_irq(IRQ_TIMER3, &bcm2708_timer_irq); ++ setup_irq(IRQ_TIMER3, &bcm2709_timer_irq); + + sched_clock_register(bcm2709_read_sched_clock, 32, STC_FREQ_HZ); + @@ -6745,7 +6745,7 @@ index 0000000..da11ad1 + timer0_clockevent.cpumask = cpumask_of(0); + clockevents_register_device(&timer0_clockevent); + -+ register_current_timer_delay(&bcm2708_delay_timer); ++ register_current_timer_delay(&bcm2709_delay_timer); +} + +#else @@ -6825,6 +6825,7 @@ index 0000000..da11ad1 +} + + ++#ifdef CONFIG_SMP +#include + +#include @@ -6927,6 +6928,7 @@ index 0000000..da11ad1 + .smp_secondary_init = bcm2709_secondary_init, + .smp_boot_secondary = bcm2709_boot_secondary, +}; ++#endif + +static const char * const bcm2709_compat[] = { + "brcm,bcm2709", @@ -6936,7 +6938,9 @@ index 0000000..da11ad1 + +MACHINE_START(BCM2709, "BCM2709") + /* Maintainer: Broadcom Europe Ltd. */ ++#ifdef CONFIG_SMP + .smp = smp_ops(bcm2709_smp_ops), ++#endif + .map_io = bcm2709_map_io, + .init_irq = bcm2709_init_irq, + .init_time = bcm2709_timer_init, @@ -6949,7 +6953,9 @@ index 0000000..da11ad1 + +MACHINE_START(BCM2708, "BCM2709") + /* Maintainer: Broadcom Europe Ltd. */ ++#ifdef CONFIG_SMP + .smp = smp_ops(bcm2709_smp_ops), ++#endif + .map_io = bcm2709_map_io, + .init_irq = bcm2709_init_irq, + .init_time = bcm2709_timer_init, @@ -11086,10 +11092,10 @@ index a3025e7..4a2a601 100644 + return 0; +} -From 0c400d193883398993f26d6250a091c51b1377b9 Mon Sep 17 00:00:00 2001 +From ade70caa2a108d3a2257a32ce6873758ae968f97 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Oct 2014 18:50:05 +0100 -Subject: [PATCH 003/154] Add bcm2708_gpio driver +Subject: [PATCH 003/216] Add bcm2708_gpio driver Signed-off-by: popcornmix @@ -11693,10 +11699,10 @@ index 0000000..fb69624 + +#endif -From 775b3e09b76f068631e566e53fd8951108bd386a Mon Sep 17 00:00:00 2001 +From 2ca472651d3e308f62709f5e2536eaba99944b11 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 004/154] Add dwc_otg driver +Subject: [PATCH 004/216] Add dwc_otg driver Signed-off-by: popcornmix @@ -12109,6 +12115,8 @@ This edge case can be hit if the port is disabled while the FIQ is in the middle of a transaction. Make the effects less severe. Also get rid of the useless return value. + +squash: dwc_otg: Allow to build without SMP --- arch/arm/Kconfig | 1 + arch/arm/include/asm/irqflags.h | 16 +- @@ -46428,7 +46436,7 @@ index 0000000..6a8be63 +#endif diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c new file mode 100644 -index 0000000..276ad0c7 +index 0000000..7e0c726 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c @@ -0,0 +1,1346 @@ @@ -46512,7 +46520,7 @@ index 0000000..276ad0c7 + * fiq_fsm_spin_lock() - ARMv6+ bare bones spinlock + * Must be called with local interrupts and FIQ disabled. + */ -+#ifdef CONFIG_ARCH_BCM2709 ++#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) +inline void fiq_fsm_spin_lock(fiq_lock_t *lock) +{ + unsigned long tmp; @@ -46545,7 +46553,7 @@ index 0000000..276ad0c7 +/** + * fiq_fsm_spin_unlock() - ARMv6+ bare bones spinunlock + */ -+#ifdef CONFIG_ARCH_BCM2709 ++#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) +inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) +{ + smp_mb(); @@ -72935,10 +72943,10 @@ index 0000000..cdc9963 +test_main(); +0; -From c3a4819b87e839196b80d548bd1c092a9c86b6e0 Mon Sep 17 00:00:00 2001 +From 0876a9278a3227e3f8924b6e04c1af6c18d4e1e7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:54:32 +0100 -Subject: [PATCH 005/154] bcm2708 watchdog driver +Subject: [PATCH 005/216] bcm2708 watchdog driver Signed-off-by: popcornmix --- @@ -73366,10 +73374,10 @@ index 0000000..8a27d68 +MODULE_ALIAS_MISCDEV(TEMP_MINOR); +MODULE_LICENSE("GPL"); -From 0f320c21ab29d3d5b3a9ec8c13bdd50160ccd7c4 Mon Sep 17 00:00:00 2001 +From e32648d3db67d9954ee0a8bc13ab3f81345c50af Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:55:09 +0100 -Subject: [PATCH 006/154] bcm2708 framebuffer driver +Subject: [PATCH 006/216] bcm2708 framebuffer driver Signed-off-by: popcornmix @@ -76814,10 +76822,10 @@ index 3c14e43..7626beb6a 100644 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From 040ebd148dd7f1adbc7fe1172ff85712c503ddea Mon Sep 17 00:00:00 2001 +From 31a44367b5b2a156b2a45d34a1e6b65c55fe8c96 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 007/154] dmaengine: Add support for BCM2708 +Subject: [PATCH 007/216] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -76934,7 +76942,7 @@ index a4aac4c..d03e7b5 100644 /* return channel no or -ve error */ extern int bcm_dma_chan_alloc(unsigned preferred_feature_set, diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index da11ad1..fe467e2 100644 +index f8679bb..c4bd0a4 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -269,6 +269,11 @@ static struct platform_device bcm2708_dmaman_device = { @@ -77982,10 +77990,10 @@ index 0000000..6150b8f +MODULE_AUTHOR("Gellert Weisz "); +MODULE_LICENSE("GPL v2"); -From 086397f74b4a70f1d343083150526ce37bb51b1d Mon Sep 17 00:00:00 2001 +From 7ec18e818133424bf20d58993fa6822dd241e096 Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 008/154] MMC: added alternative MMC driver +Subject: [PATCH 008/216] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -78138,7 +78146,7 @@ index 6a7cfe0..9d41de9 100644 obj-$(CONFIG_MMC_OMAP) += omap.o diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c new file mode 100644 -index 0000000..28b00d3 +index 0000000..eef0d351 --- /dev/null +++ b/drivers/mmc/host/bcm2835-mmc.c @@ -0,0 +1,1506 @@ @@ -79532,8 +79540,8 @@ index 0000000..28b00d3 + +#ifndef FORCE_PIO + if (node) { -+ host->dma_chan_tx = of_dma_request_slave_channel(node, "tx"); -+ host->dma_chan_rx = of_dma_request_slave_channel(node, "rx"); ++ host->dma_chan_tx = dma_request_slave_channel(dev, "tx"); ++ host->dma_chan_rx = dma_request_slave_channel(dev, "rx"); + } else { + dma_cap_mask_t mask; + @@ -79649,10 +79657,10 @@ index 0000000..28b00d3 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 594665ed12b19a7e2b9729948854266eb323c126 Mon Sep 17 00:00:00 2001 +From 97f9d94720b108ba3e793621d4a500cc593fc775 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 009/154] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 009/216] cma: Add vc_cma driver to enable use of CMA Signed-off-by: popcornmix @@ -80977,10 +80985,10 @@ index 0000000..5325832 + +#endif /* VC_CMA_H */ -From fccbda977ca17339b97bbf5edd574b8e70fa4837 Mon Sep 17 00:00:00 2001 +From 6bafd180b5b7672ebbaea3878e78511d309007a0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 010/154] bcm2708: alsa sound driver +Subject: [PATCH 010/216] bcm2708: alsa sound driver Signed-off-by: popcornmix @@ -83648,10 +83656,10 @@ index 0000000..af3e6eb + +#endif // _VC_AUDIO_DEFS_H_ -From 97dda9a97ddf5f6203d61024c9ed196cc6547f71 Mon Sep 17 00:00:00 2001 +From ddf7318165c6faf5bc73597105a2eed9fece4225 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 011/154] bcm2708 vchiq driver +Subject: [PATCH 011/216] bcm2708 vchiq driver Signed-off-by: popcornmix @@ -83711,6 +83719,14 @@ vchiq: Include SIGSTOP and SIGCONT in list of signals not-masked by vchiq to all vchiq_arm: Complete support for SYNCHRONOUS mode vchiq: Remove inline from suspend/resume + +vchiq: Allocation does not need to be atomic + +vchiq: Fix wrong condition check + +The log level is checked from within the log call. Remove the check in the call. + +Signed-off-by: Pranith Kumar --- drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + @@ -85401,7 +85417,7 @@ index 0000000..7ea5c64 +#endif /* VCHIQ_2835_H */ diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c new file mode 100644 -index 0000000..7e7b09f +index 0000000..8ec88bb --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -0,0 +1,562 @@ @@ -85506,7 +85522,7 @@ index 0000000..7e7b09f + frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); + + g_slot_mem = dma_alloc_coherent(NULL, g_slot_mem_size + frag_mem_size, -+ &g_slot_phys, GFP_ATOMIC); ++ &g_slot_phys, GFP_KERNEL); + + if (!g_slot_mem) { + vchiq_log_error(vchiq_arm_log_level, @@ -85729,7 +85745,7 @@ index 0000000..7e7b09f +void +vchiq_dump_platform_use_state(VCHIQ_STATE_T *state) +{ -+ vchiq_log_info((vchiq_arm_log_level>=VCHIQ_LOG_INFO),"Suspend timer not in use"); ++ vchiq_log_info(vchiq_arm_log_level, "Suspend timer not in use"); +} +void +vchiq_platform_handle_timeout(VCHIQ_STATE_T *state) @@ -96773,10 +96789,10 @@ index 0000000..b6bfa21 + return vchiq_build_time; +} -From f4a8d547b219dcc32e45b4d1be94bd6f29b5c9d7 Mon Sep 17 00:00:00 2001 +From 859a7d70416a46048ab89165367891de2104ef6f Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 012/154] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 012/216] vcsm: VideoCore shared memory service for BCM2835 Add experimental support for the VideoCore shared memory service. This allows user processes to allocate memory from VideoCore's @@ -101118,10 +101134,10 @@ index 0000000..da1c523 +MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); +MODULE_LICENSE("GPL v2"); -From 773c64424de0413c0123f47b57ddf2d25af01cb7 Mon Sep 17 00:00:00 2001 +From 103cb0411fad640ec86640f3fda90a3da782aa68 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:51:55 +0100 -Subject: [PATCH 013/154] Add hwrng (hardware random number generator) driver +Subject: [PATCH 013/216] Add hwrng (hardware random number generator) driver --- drivers/char/hw_random/Kconfig | 11 ++++ @@ -101288,10 +101304,10 @@ index 0000000..340f004 +MODULE_DESCRIPTION("BCM2708 H/W Random Number Generator (RNG) driver"); +MODULE_LICENSE("GPL and additional rights"); -From 904a182ff0dfdbd150aa6ef19159ac9ba96066f5 Mon Sep 17 00:00:00 2001 +From 4e3072cbb7ce07057d091188fc1a3897e3169007 Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 014/154] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 014/216] lirc: added support for RaspberryPi GPIO lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others See: https://github.com/raspberrypi/linux/issues/525 @@ -102038,10 +102054,10 @@ index 0000000..8aa452d +module_param(debug, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Enable debugging messages"); -From 32d6e3231f6e018338992a265ba7b6f2179c4554 Mon Sep 17 00:00:00 2001 +From 123948742379f19e1c2764020d8c523d445550bf Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 015/154] Add cpufreq driver +Subject: [PATCH 015/216] Add cpufreq driver --- arch/arm/Kconfig | 1 + @@ -102325,10 +102341,10 @@ index 0000000..447ca09 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From d926a40edc92b086e4423d592e496449dfa5a9aa Mon Sep 17 00:00:00 2001 +From f563316302e117df98e91a8e1366dae653094f04 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 016/154] Added hwmon/thermal driver for reporting core +Subject: [PATCH 016/216] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian --- @@ -102850,10 +102866,10 @@ index 0000000..85fceb5 + +module_platform_driver(bcm2835_thermal_driver); -From 0d075f7303d4dfb9a68542c82da34adba9ad7b0d Mon Sep 17 00:00:00 2001 +From bb1c2fec8850e0e017e3b80f51df5dc850627555 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 4 Nov 2013 18:56:10 +0000 -Subject: [PATCH 017/154] Add Chris Boot's i2c and spi drivers. +Subject: [PATCH 017/216] Add Chris Boot's i2c and spi drivers. i2c-bcm2708: fixed baudrate @@ -104223,10 +104239,10 @@ index 0000000..b04a57d +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From b04b9accf510953206911fbd5aec5125d4b90cbc Mon Sep 17 00:00:00 2001 +From 530db15891390005623b20a03dda6ef6871607bc Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 018/154] bcm2835: add v4l2 camera device +Subject: [PATCH 018/216] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -111553,10 +111569,10 @@ index 0000000..9d1d11e + +#endif /* MMAL_VCHIQ_H */ -From c0d39b50f52eac29ab791e7e5cb71c4bf2625c28 Mon Sep 17 00:00:00 2001 +From 47303896a0462c49e8bf3e5ef31e744d891a30a4 Mon Sep 17 00:00:00 2001 From: notro Date: Sun, 6 Jul 2014 12:07:25 +0200 -Subject: [PATCH 019/154] spi-bcm2708: Prepare for Common Clock Framework +Subject: [PATCH 019/216] spi-bcm2708: Prepare for Common Clock Framework migration As part of migrating to use the Common Clock Framework, replace clk_enable() @@ -111601,10 +111617,10 @@ index b04a57d..349d21f 100644 free_irq(bs->irq, master); iounmap(bs->base); -From 191bc5b30c4d70ee25628836493b39fc58d3066d Mon Sep 17 00:00:00 2001 +From d8d78e0bb5731d6fb3f1f813dc795e98be064870 Mon Sep 17 00:00:00 2001 From: notro Date: Sun, 6 Jul 2014 12:09:30 +0200 -Subject: [PATCH 020/154] BCM2708: Migrate to the Common Clock Framework +Subject: [PATCH 020/216] BCM2708: Migrate to the Common Clock Framework As part of moving towards using Device Tree, the Common Clock Framework has to be used instead of the BCM2708 clock implementation. @@ -111874,10 +111890,10 @@ index 5f9d725..0000000 - unsigned long rate; -}; -From 671554aed0097da7a7aaadcb570ce9233daf1212 Mon Sep 17 00:00:00 2001 +From 5f8aad35cdb010ca9fc0c58cca2a5a11fce879ec Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 021/154] BCM2708: Add core Device Tree support +Subject: [PATCH 021/216] BCM2708: Add core Device Tree support Add the bare minimum needed to boot BCM2708 from a Device Tree. @@ -111907,7 +111923,7 @@ BCM2708_DT: Correct length of the peripheral space create mode 100644 arch/arm/boot/dts/bcm2709.dtsi diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index a1c776b..c86833d 100644 +index 992ea0b..25fbf52 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1,5 +1,17 @@ @@ -112508,10 +112524,10 @@ index 080e260..496cbcd 100644 module_param(boardrev, uint, 0644); -From dbecd2f191760388beaa8bc7d50b297f6b6ba9ac Mon Sep 17 00:00:00 2001 +From 55bd100cb5e042a279b944a4ff3c0f00c51ed64c Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 022/154] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 022/216] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -112604,10 +112620,10 @@ index fb795c3..fa72af0 100644 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -From a064f31e6bd2bc3c89c6f0f891c94c8d3ed79a99 Mon Sep 17 00:00:00 2001 +From ee44a85f3a6b76509c3de7ee16164e8d32eecc24 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 025/154] Speed up console framebuffer imageblit function +Subject: [PATCH 025/216] Speed up console framebuffer imageblit function Especially on platforms with a slower CPU but a relatively high framebuffer fill bandwidth, like current ARM devices, the existing @@ -112816,10 +112832,10 @@ index a2bb276..436494f 100644 start_index, pitch_index); } else -From 3fc041479669d18c335458796d9b7e81e5ee3696 Mon Sep 17 00:00:00 2001 +From 12b6956e3ba31498771d282025fc4a44b6648559 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 026/154] Allow mac address to be set in smsc95xx +Subject: [PATCH 026/216] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -112910,10 +112926,10 @@ index 26423ad..e29a323 100644 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { -From b74131aa0aa5883c5bb3074b0b08760b30612c72 Mon Sep 17 00:00:00 2001 +From 03ecfd1c727358b884730a06b05d072ef28ebffd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 027/154] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 027/216] enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module) 1-wire: Add support for configuring pin for w1-gpio kernel module @@ -113185,10 +113201,10 @@ index 2820924..fd0550f 100644 } } -From 511d5ff03dd5fb71d537fe5e712d128e2442030c Mon Sep 17 00:00:00 2001 +From 4624b823abd044524b26cb4d7111564f141e540f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 029/154] config: Enable CONFIG_MEMCG, but leave it disabled +Subject: [PATCH 029/216] config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. --- @@ -113243,10 +113259,10 @@ index b34ef4a..c2aa348 100644 /** -From dbb28fde0c6e74d7c5385ca1d5ba7dcaf77d903a Mon Sep 17 00:00:00 2001 +From 14913d5804e6cc14027404667dbacd69267fd032 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:33:38 +0100 -Subject: [PATCH 030/154] ASoC: Add support for BCM2708 +Subject: [PATCH 030/216] ASoC: Add support for BCM2708 This driver adds support for digital audio (I2S) for the BCM2708 SoC that is used by the @@ -114389,10 +114405,10 @@ index 0000000..6fdcbc1 + +#endif -From c0c4345041ac79f762c5a5ea91328bf323e201a8 Mon Sep 17 00:00:00 2001 +From 95f9b87c32e716eb0276c9d6d1228db5a9e38a0e Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 031/154] ASoC: Add support for PCM5102A codec +Subject: [PATCH 031/216] ASoC: Add support for PCM5102A codec Some definitions to support the PCM5102A codec by Texas Instruments. @@ -114517,10 +114533,10 @@ index 0000000..126f1e9 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 4102a7dbd70a7e71a1ab3d138d2b1effea0bcc21 Mon Sep 17 00:00:00 2001 +From b8442f0526d6de697deec639e36023a92a2d178a Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:04:54 +0100 -Subject: [PATCH 032/154] BCM2708: Add I2S support to board file +Subject: [PATCH 032/216] BCM2708: Add I2S support to board file Adds the required initializations for I2S to the board file of mach-bcm2708. @@ -114575,10 +114591,10 @@ index 5873f8b..7f4ebf4 100644 struct amba_device *d = amba_devs[i]; amba_device_register(d, &iomem_resource); -From 1054e906f33b25b716db57ae6c649a4009a16102 Mon Sep 17 00:00:00 2001 +From 40cf34f896f3ac88ad775464619175b5167ddacb Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 033/154] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 033/216] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -114727,10 +114743,10 @@ index 0000000..4b70b45 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From 1685814fc1a8b98fe0cbfb4eb88515d8642e8d05 Mon Sep 17 00:00:00 2001 +From c2ef063e2adb0e41654dc580ae959a86cde6f6f5 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 034/154] BCM2708: Add HifiBerry DAC to board file +Subject: [PATCH 034/216] BCM2708: Add HifiBerry DAC to board file This adds the initalization of the HifiBerry DAC to the mach-bcm2708 board file. @@ -114778,10 +114794,10 @@ index 7f4ebf4..94ce8fc 100644 struct amba_device *d = amba_devs[i]; amba_device_register(d, &iomem_resource); -From 5ec50b24ac72688ccf7f0fa46f3a1ed90beec8df Mon Sep 17 00:00:00 2001 +From 1de129c2113a6fb145e654260b683e6c7e30bb51 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 6 Dec 2013 20:50:28 +0100 -Subject: [PATCH 035/154] ASoC: BCM2708: Add support for RPi-DAC +Subject: [PATCH 035/216] ASoC: BCM2708: Add support for RPi-DAC This adds a machine driver for the RPi-DAC. @@ -115076,10 +115092,10 @@ index 0000000..b4eaa44 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 76bd7ab96dfa110f8996f50939e0a7fee9033b12 Mon Sep 17 00:00:00 2001 +From 11dea4325311685b8d38b791b519e74a561476ca Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 036/154] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 036/216] ASoC: wm8804: Implement MCLK configuration options, add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs for most sample rates. At 192kHz only 128xfs is supported. The existing driver selects 128xfs automatically for some lower samples rates. By using an @@ -115119,10 +115135,10 @@ index b2b0e68..ba2a0f8 100644 #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ -From aa032227a1ece45842be1d2ff3f8385e585eb1d5 Mon Sep 17 00:00:00 2001 +From 84aed3cc8e8d60407b60cd132fe7a673024fb1a4 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 037/154] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 037/216] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -115325,10 +115341,10 @@ index 0000000..446ecdd +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From 407d23d8a45300407b9f83a8a119b9e70836676b Mon Sep 17 00:00:00 2001 +From 4d5dd3c3d6019cf233add726cbe3aac6e543c540 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:26:08 +0100 -Subject: [PATCH 038/154] BCM2708: Added support for HiFiBerry Digi board Board +Subject: [PATCH 038/216] BCM2708: Added support for HiFiBerry Digi board Board initalization by I2C Signed-off-by: Daniel Matuschek @@ -115375,10 +115391,10 @@ index fb955755..0ad5343 100644 bcm_register_device_dt(&snd_rpi_dac_device); bcm_register_device_dt(&snd_pcm1794a_codec_device); -From fcd76211074648ab8dbec0960443cc5e43936786 Mon Sep 17 00:00:00 2001 +From 963fd96f5747dd0c693a87cbb23bc1239d3bda72 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 039/154] ASoC: wm8804: Set idle_bias_off to false Idle bias +Subject: [PATCH 039/216] ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup Signed-off-by: Daniel Matuschek @@ -115400,10 +115416,10 @@ index ba2a0f8..91974f9 100644 .controls = wm8804_snd_controls, .num_controls = ARRAY_SIZE(wm8804_snd_controls), -From 2624db940287a364ccab772c498a0c098a5fadba Mon Sep 17 00:00:00 2001 +From f5995e9c2cc2d801d5b05e3f4be0bdafb184943a Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 040/154] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 040/216] Add IQaudIO Sound Card support for Raspberry Pi --- arch/arm/mach-bcm2708/bcm2708.c | 22 ++++++++ @@ -115600,10 +115616,10 @@ index 0000000..8d0e2ae +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From 809f7a7f459b05073bbb47de741894d302abb8ce Mon Sep 17 00:00:00 2001 +From 5d1809ba161ed01404974ad13403d23a008bd181 Mon Sep 17 00:00:00 2001 From: Howard Mitchell Date: Mon, 2 Mar 2015 17:28:02 +0000 -Subject: [PATCH 041/154] Set a limit of 0dB on Digital Volume Control +Subject: [PATCH 041/216] Set a limit of 0dB on Digital Volume Control The main volume control in the PCM512x DAC has a range up to +24dB. This is dangerously loud and can potentially cause massive @@ -115633,10 +115649,10 @@ index 8d0e2ae..aff7377 100644 return 0; } -From 918b734bf69d761efb0f66be2d19093b0156b408 Mon Sep 17 00:00:00 2001 +From 8dbd2bddafe5d604e9f03a702d5ae50c0dd791e6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 042/154] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 042/216] vmstat: Workaround for issue where dirty page count goes negative See: @@ -115663,10 +115679,10 @@ index 82e7db7..f87d16d 100644 static inline void __inc_zone_page_state(struct page *page, -From 6c9eeae1a0d49e5209b3040ba0b3ebc8f22ec96d Mon Sep 17 00:00:00 2001 +From 15bf30debd62320326c6a474f69eabbf3b43029e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 18:55:53 +0100 -Subject: [PATCH 043/154] BCM2708: armctrl: Add IRQ Device Tree support +Subject: [PATCH 043/216] BCM2708: armctrl: Add IRQ Device Tree support Add Device Tree IRQ support for BCM2708. Usage is the same as for irq-bcm2835. @@ -115808,10 +115824,10 @@ index 96fa9b9..74bacb3 100644 return 0; } -From d41a10ba93b35b80f449a8ca942a8e7e21046651 Mon Sep 17 00:00:00 2001 +From e85c6248222486f0aca8f09ea4bf7ad463b15487 Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 044/154] BCM2708: use pinctrl-bcm2835 +Subject: [PATCH 044/216] BCM2708: use pinctrl-bcm2835 Use pinctrl-bcm2835 instead of the pinctrl-bcm2708 and bcm2708_gpio combination. @@ -115864,10 +115880,10 @@ index 9aa8a3f..9d1149e 100644 .can_sleep = false, }; -From 16b8124e21e7dcd729a59ed38824e1b915fe8ea9 Mon Sep 17 00:00:00 2001 +From d00f2dcc5c02b51e10e6516e12570db41509ffe5 Mon Sep 17 00:00:00 2001 From: notro Date: Sun, 27 Jul 2014 20:12:58 +0200 -Subject: [PATCH 045/154] spi: bcm2708: add device tree support +Subject: [PATCH 045/216] spi: bcm2708: add device tree support Add DT support to driver and add to .dtsi file. Setup pins and spidev in .dts file. @@ -115992,10 +116008,10 @@ index 349d21f..041b5e2 100644 .probe = bcm2708_spi_probe, .remove = bcm2708_spi_remove, -From c04316c256e9e516650611dd4a9c980db0eae29c Mon Sep 17 00:00:00 2001 +From 13cf0c2ef8f80ef3e128343e2d07cd3d31eb9860 Mon Sep 17 00:00:00 2001 From: notro Date: Tue, 29 Jul 2014 11:04:49 +0200 -Subject: [PATCH 046/154] i2c: bcm2708: add device tree support +Subject: [PATCH 046/216] i2c: bcm2708: add device tree support Add DT support to driver and add to .dtsi file. Setup pins in .dts file. @@ -116138,10 +116154,10 @@ index 7d385a3..526129b 100644 .probe = bcm2708_i2c_probe, .remove = bcm2708_i2c_remove, -From 7708377b701a832e1e5ceb7b1ffdf07d144935e3 Mon Sep 17 00:00:00 2001 +From b36757e9c2eb66112c0cebce20ac608f1f94cbe4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 047/154] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 047/216] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -116177,10 +116193,10 @@ index bfbe1be..a738b25 100644 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From 9d7ac0e308c904869352d6a7961217d99c4e1313 Mon Sep 17 00:00:00 2001 +From 72f91c3f7d8b2944ccadbe7d3d57128c1fc08a8b Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 24 Jul 2014 21:24:03 +0100 -Subject: [PATCH 048/154] usb: core: make overcurrent messages more prominent +Subject: [PATCH 048/216] usb: core: make overcurrent messages more prominent Hub overcurrent messages are more serious than "debug". Increase loglevel. --- @@ -116188,7 +116204,7 @@ Hub overcurrent messages are more serious than "debug". Increase loglevel. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index d7c3d5a..6ca08fa 100644 +index 3b71516..8324c14 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -4922,7 +4922,7 @@ static void port_event(struct usb_hub *hub, int port1) @@ -116201,10 +116217,10 @@ index d7c3d5a..6ca08fa 100644 USB_PORT_FEAT_C_OVER_CURRENT); msleep(100); /* Cool down */ -From d2a00394bb184cc1933e5676bea8df542270361a Mon Sep 17 00:00:00 2001 +From cf880d700f626df4e4910b8dedea887720bf6018 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 7 Aug 2014 02:03:50 +0100 -Subject: [PATCH 049/154] Revert "ARM: dma: Use dma_pfn_offset for dma address +Subject: [PATCH 049/216] Revert "ARM: dma: Use dma_pfn_offset for dma address translation" This reverts commit 6ce0d20016925d031f1e24d64302e4c976d7cec6. @@ -116213,7 +116229,7 @@ This reverts commit 6ce0d20016925d031f1e24d64302e4c976d7cec6. 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h -index b52101d..f5572d9 100644 +index b52101d3..f5572d9 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -58,37 +58,21 @@ static inline int dma_set_mask(struct device *dev, u64 mask) @@ -116256,10 +116272,10 @@ index b52101d..f5572d9 100644 } -From 2b376efb3a813405d83208fd8e2edc63af06fc2d Mon Sep 17 00:00:00 2001 +From 3492b141fbae950fd9614cb643257658e5d89329 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 050/154] Added support for HiFiBerry DAC+ +Subject: [PATCH 050/216] Added support for HiFiBerry DAC+ The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses a different codec chip (PCM5122), therefore a new driver is necessary. @@ -116470,10 +116486,10 @@ index 0000000..c63387b +MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); +MODULE_LICENSE("GPL v2"); -From a7e71af10914924d8399d3fbc47159add5cbc3bf Mon Sep 17 00:00:00 2001 +From 3663a863bd1a077dfe48177181118e464a1d6f08 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 051/154] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 051/216] Added driver for HiFiBerry Amp amplifier add-on board The driver contains a low-level hardware driver for the TAS5713 and the drivers for the Raspberry Pi I2S subsystem. @@ -117303,10 +117319,10 @@ index 0000000..8f019e0 + +#endif /* _TAS5713_H */ -From 903043678721b196027ed1b8e0e1003b13a2f635 Mon Sep 17 00:00:00 2001 +From 5cd70cb7da74d3817f6037213f1a79ff31254d89 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Apr 2015 19:14:18 +0100 -Subject: [PATCH 052/154] bcm2708: Allow option card devices to be configured +Subject: [PATCH 052/216] bcm2708: Allow option card devices to be configured via DT If the kernel is built with Device Tree support, and if a DT blob @@ -117331,10 +117347,10 @@ index 03fa1cb..c816526 100644 static struct platform_driver bcm2835_i2s_driver = { .probe = bcm2835_i2s_probe, -From 1af7b4b7930de1c4d478bf2bd2c1805b3cb239bc Mon Sep 17 00:00:00 2001 +From b2ee40fa3d362faf4071abda9f1e273b6e80ec78 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 18:45:39 +0100 -Subject: [PATCH 053/154] Adding Device Tree support for some RPi audio cards +Subject: [PATCH 053/216] Adding Device Tree support for some RPi audio cards --- arch/arm/boot/dts/hifiberry-dac-overlay.dts | 34 +++++++++++++++++++++ @@ -117765,10 +117781,10 @@ index 126f1e9..7c6598e 100644 }; -From fa54f49c2322b1e80b7156c75b5eac370ccbc144 Mon Sep 17 00:00:00 2001 +From ea3aad745389e9631e71c1b175e37d6874ee980b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 054/154] fdt: Add support for the CONFIG_CMDLINE_EXTEND option +Subject: [PATCH 054/216] fdt: Add support for the CONFIG_CMDLINE_EXTEND option --- drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- @@ -117823,10 +117839,10 @@ index 3a896c9..0320a6f 100644 pr_debug("Command line is: %s\n", (char*)data); -From 66958bd53eb066f3472cf7f8ace313dbca4137b5 Mon Sep 17 00:00:00 2001 +From a9a57c353bdccbc5cd60d995c53d6146addf78fc Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 16 Dec 2014 10:23:48 +0000 -Subject: [PATCH 055/154] DT: Add overrides to enable i2c0, i2c1, spi and i2s +Subject: [PATCH 055/216] DT: Add overrides to enable i2c0, i2c1, spi and i2s --- arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 10 ++++++++++ @@ -117870,10 +117886,10 @@ index d8c6d15..167b22b 100644 + }; +}; -From c4afc4f5951ab82593f87be4245e70b364ee623e Mon Sep 17 00:00:00 2001 +From 4bdc71b8c2f9444a8ec6fe833cb92ba4fd4130f7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 18 Dec 2014 16:48:32 +0000 -Subject: [PATCH 056/154] lirc-rpi: Add device tree support, and a suitable +Subject: [PATCH 056/216] lirc-rpi: Add device tree support, and a suitable overlay The overlay supports DT parameters that match the old module @@ -118167,10 +118183,10 @@ index 8aa452d..24563ec 100644 if (result < 0) goto exit_rpi; -From d93c40a747bc024aec7d9fcddb35e6c20e71ee79 Mon Sep 17 00:00:00 2001 +From fb3c953810dfcbba431ad3c70eb5751d014db152 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 6 Jan 2015 12:06:55 +0000 -Subject: [PATCH 057/154] Fix the activity LED in DT mode +Subject: [PATCH 057/216] Fix the activity LED in DT mode Add a "leds" node to the base DTBs, and a subnode for the activity LED. You can change the LED function like this: @@ -118302,10 +118318,10 @@ index 0a916a4..d879316 100644 clocks { -From f12459c4b2fb1b9fe43ca17b18e796a1038aa5f5 Mon Sep 17 00:00:00 2001 +From 1c9f91aafc02bd624edc56899972cb13f48f921d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 15 Jan 2015 10:39:06 +0000 -Subject: [PATCH 058/154] Adding w1-gpio device tree overlays +Subject: [PATCH 058/216] Adding w1-gpio device tree overlays N.B. Requires firmware supporting multi-target overrides @@ -118415,10 +118431,10 @@ index 0000000..b3e97c2 + }; +}; -From f24e351f438ea544a9ab6ec86c3c2152f4490559 Mon Sep 17 00:00:00 2001 +From 740e2da8a9fa6f84e95707ee0a10b4a4cfeaed4a Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Fri, 23 Jan 2015 16:41:17 +0100 -Subject: [PATCH 059/154] TAS5713: return error if initialisation fails +Subject: [PATCH 059/216] TAS5713: return error if initialisation fails Existing TAS5713 driver logs errors during initialisation, but does not return an error code. Therefore even if initialisation fails, the driver will still be @@ -118485,10 +118501,10 @@ index a24c1da..9b27138 100644 return 0; } -From c70c2040d0a4e4e0c14e7d0d348479d8e9819028 Mon Sep 17 00:00:00 2001 +From 9615583a44fc9449d77a247d0207b35eab1db982 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 23 Jan 2015 14:48:55 +0000 -Subject: [PATCH 060/154] scripts/dtc: Update to upstream version with overlay +Subject: [PATCH 060/216] scripts/dtc: Update to upstream version with overlay patches --- @@ -123701,17 +123717,17 @@ index 54d4e904..d644002 100644 -#define DTC_VERSION "DTC 1.4.0-dirty" +#define DTC_VERSION "DTC 1.4.1-g36c70742" -From 0b07678de56962ea6065e426ac90cf04d32bb5e4 Mon Sep 17 00:00:00 2001 +From 453099dc662c02d1308039ab2dabb176e052eabf Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 23 Jan 2015 15:18:03 +0000 -Subject: [PATCH 061/154] BCM2708_DT: Build the overlays as well +Subject: [PATCH 061/216] BCM2708_DT: Build the overlays as well --- arch/arm/boot/dts/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index c86833d..0784306 100644 +index 25fbf52..63d902c 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -12,6 +12,15 @@ ifeq ($(CONFIG_BCM2709_DT),y) @@ -123731,10 +123747,10 @@ index c86833d..0784306 100644 alphascale-asm9260-devkit.dtb # Keep at91 dtb files sorted alphabetically for each SoC -From 04543b4caada4daf9b9e0423014320a000ae71ea Mon Sep 17 00:00:00 2001 +From b39dde193e6242ec53938122e553e3af4cd528ed Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Sun, 25 Jan 2015 19:41:06 +0100 -Subject: [PATCH 062/154] Add device tree overlay for HiFiBerry Amp/Amp+ +Subject: [PATCH 062/216] Add device tree overlay for HiFiBerry Amp/Amp+ This patch add the missing device tree file for the HiFiBerry Amp and Amp+ boards. --- @@ -123744,7 +123760,7 @@ This patch add the missing device tree file for the HiFiBerry Amp and Amp+ board create mode 100644 arch/arm/boot/dts/hifiberry-amp-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 0784306..8e48eb3 100644 +index 63d902c..63d89df 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -15,6 +15,7 @@ endif @@ -123801,10 +123817,10 @@ index 0000000..2c81448 + }; +}; -From 231e60fed4d703d27ae821a85739cb4f296c1706 Mon Sep 17 00:00:00 2001 +From da11da093a2c65a9faa481e0688b0f242476ee78 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 26 Jan 2015 09:18:24 +0000 -Subject: [PATCH 063/154] Add pps-gpio DT overlay +Subject: [PATCH 063/216] Add pps-gpio DT overlay Parameters: gpiopin= // Default 18 @@ -123815,7 +123831,7 @@ Parameters: create mode 100644 arch/arm/boot/dts/pps-gpio-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 8e48eb3..f542d0b 100644 +index 63d89df..18637de 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -19,6 +19,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb @@ -123867,10 +123883,10 @@ index 0000000..40bf0e1 + }; +}; -From fc55e032ddb72eae5a11c32240a383592a0dc00a Mon Sep 17 00:00:00 2001 +From 4cddfa6e3758e34eaeeb8457e0f012965436bc1c Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Wed, 29 Oct 2014 23:30:30 -0700 -Subject: [PATCH 064/154] Added support to reserve/enable a GPIO pin to be used +Subject: [PATCH 064/216] Added support to reserve/enable a GPIO pin to be used from pps-gpio module (LinuxPPS). Enable PPS modules in default config for RPi. @@ -123943,7 +123959,7 @@ index 66bc839..cc3e56c 100644 +module_param(pps_gpio_pin, int, 0644); +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index fe467e2..f141103 100644 +index c4bd0a4..914c970 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -37,6 +37,7 @@ @@ -123999,17 +124015,17 @@ index fe467e2..f141103 100644 #if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) w1_gpio_pdata.pin = w1_gpio_pin; w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup; -@@ -1261,3 +1286,5 @@ module_param(disk_led_active_low, uint, 0644); +@@ -1267,3 +1292,5 @@ module_param(disk_led_active_low, uint, 0644); module_param(reboot_part, uint, 0644); module_param(w1_gpio_pin, uint, 0644); module_param(w1_gpio_pullup, uint, 0644); +module_param(pps_gpio_pin, int, 0644); +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); -From b85ff8bd837ac1e0cc8bbd17a9eb9ec3d909d8ae Mon Sep 17 00:00:00 2001 +From 2ff35a0e682880dbae67c842805ea848285b373f Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 3 Sep 2014 14:44:22 +0100 -Subject: [PATCH 065/154] I2C: Only register the I2C device for the current +Subject: [PATCH 065/216] I2C: Only register the I2C device for the current board revision --- @@ -124054,7 +124070,7 @@ index cc3e56c..c8aea5b 100644 +module_param(vc_i2c_override, bool, 0644); +MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral."); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index f141103..396c1e7 100644 +index 914c970..259d552 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -97,6 +97,7 @@ static unsigned reboot_part = 0; @@ -124083,17 +124099,17 @@ index f141103..396c1e7 100644 bcm_register_device(&bcm2835_hwmon_device); bcm_register_device(&bcm2835_thermal_device); -@@ -1288,3 +1296,5 @@ module_param(w1_gpio_pin, uint, 0644); +@@ -1294,3 +1302,5 @@ module_param(w1_gpio_pin, uint, 0644); module_param(w1_gpio_pullup, uint, 0644); module_param(pps_gpio_pin, int, 0644); MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); +module_param(vc_i2c_override, bool, 0644); +MODULE_PARM_DESC(vc_i2c_override, "Allow the use of VC's I2C peripheral."); -From 67b07b343f34129919acae4c56eb3114ffed92f4 Mon Sep 17 00:00:00 2001 +From 32bee38e1fca47be55a48205e850c16901127982 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 28 Jan 2015 16:22:04 +0000 -Subject: [PATCH 066/154] BCM2708_DT: Add pcf8523-rtc overlay +Subject: [PATCH 066/216] BCM2708_DT: Add pcf8523-rtc overlay --- arch/arm/boot/dts/Makefile | 1 + @@ -124102,7 +124118,7 @@ Subject: [PATCH 066/154] BCM2708_DT: Add pcf8523-rtc overlay create mode 100644 arch/arm/boot/dts/pcf8523-rtc-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index f542d0b..efd1c04 100644 +index 18637de..c909f7b 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -19,6 +19,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb @@ -124142,10 +124158,10 @@ index 0000000..0071f62 + }; +}; -From 8b09a2b295e9e9ad120a87f3f2722d41edaecfec Mon Sep 17 00:00:00 2001 +From 7358633426ec4c3897c26cb1575a0ab7309e4f73 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Sat, 31 Jan 2015 16:07:56 +0100 -Subject: [PATCH 067/154] Add a parameter to turn off SPDIF output if no audio +Subject: [PATCH 067/216] Add a parameter to turn off SPDIF output if no audio is playing This patch adds the paramater auto_shutdown_output to the kernel module. @@ -124217,10 +124233,10 @@ index 74a8c73..a245995 100644 static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { -From d1b18954b288e865312efad2cd25c0dc4724b2a0 Mon Sep 17 00:00:00 2001 +From fdcfdf08df6289445d33e8acaf68faa5f5b4923b Mon Sep 17 00:00:00 2001 From: Joerg Hohensohn Date: Sun, 1 Feb 2015 22:08:03 +0100 -Subject: [PATCH 068/154] bugfix for 32kHz sample rate, was missing +Subject: [PATCH 068/216] bugfix for 32kHz sample rate, was missing --- sound/soc/bcm/hifiberry_digi.c | 1 + @@ -124239,10 +124255,10 @@ index a245995..a294a1b 100644 case 48000: case 88200: -From 79e41e4a631f1f62a6593a49b37adbf61cb0c69b Mon Sep 17 00:00:00 2001 +From 601bc9883a6bf209e736d2b1cc5991176ed1abf3 Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 069/154] Update ds1307 driver for device-tree support +Subject: [PATCH 069/216] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -124269,10 +124285,10 @@ index 4ffabb3..c6789a7 100644 .driver = { .name = "rtc-ds1307", -From c29e2b5781f6e54152dfdbc07a205e7b17ce16b9 Mon Sep 17 00:00:00 2001 +From c6e4ebd2dec4446f061cab8fa0a860e0fe7fd30a Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:26:03 -0700 -Subject: [PATCH 070/154] Add device-tree overlay for ds1307 +Subject: [PATCH 070/216] Add device-tree overlay for ds1307 Signed-off-by: Ryan Coe --- @@ -124282,7 +124298,7 @@ Signed-off-by: Ryan Coe create mode 100644 arch/arm/boot/dts/ds1307-rtc-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index efd1c04..d45424c 100644 +index c909f7b..7755a84 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -12,6 +12,7 @@ ifeq ($(CONFIG_BCM2709_DT),y) @@ -124322,10 +124338,10 @@ index 0000000..7d27044 + }; +}; -From 21a00874bde5439caf8dae1f60fbe4794f1b2ee2 Mon Sep 17 00:00:00 2001 +From 7abd2997600af8ee74045e490c6db3a41f716636 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 071/154] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 071/216] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -124652,15 +124668,15 @@ index 0000000..2ca2b98 +MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); +MODULE_LICENSE("GPL"); -From ec616ff69fa39ef7b7b232a27a339e6ec0b0b50e Mon Sep 17 00:00:00 2001 +From be825a324f0b4e90f3fc396b0ed17442c5cb771d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 20 Jun 2014 17:19:27 +0100 -Subject: [PATCH 072/154] bcm2709: Simplify and strip down IRQ handler +Subject: [PATCH 072/216] bcm2709: Simplify and strip down IRQ handler --- arch/arm/include/asm/entry-macro-multi.S | 2 + - arch/arm/mach-bcm2709/include/mach/entry-macro.S | 169 +++++++++++------------ - 2 files changed, 85 insertions(+), 86 deletions(-) + arch/arm/mach-bcm2709/include/mach/entry-macro.S | 173 +++++++++++------------ + 2 files changed, 87 insertions(+), 88 deletions(-) diff --git a/arch/arm/include/asm/entry-macro-multi.S b/arch/arm/include/asm/entry-macro-multi.S index 469a2b3..9c0a7eb 100644 @@ -124682,7 +124698,7 @@ index 469a2b3..9c0a7eb 100644 .macro arch_irq_handler, symbol_name .align 5 diff --git a/arch/arm/mach-bcm2709/include/mach/entry-macro.S b/arch/arm/mach-bcm2709/include/mach/entry-macro.S -index d08591b..101d9f1 100644 +index d08591b..08d184c 100644 --- a/arch/arm/mach-bcm2709/include/mach/entry-macro.S +++ b/arch/arm/mach-bcm2709/include/mach/entry-macro.S @@ -22,102 +22,99 @@ @@ -124713,6 +124729,10 @@ index d08591b..101d9f1 100644 + ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source + add \irqstat, \irqstat, \base, lsl #2 + ldr \tmp, [\irqstat] ++#ifdef CONFIG_SMP ++ /* test for mailbox0 (IPI) interrupt */ ++ tst \tmp, #0x10 ++ beq 1030f - /* get core's local interrupt controller */ - ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source @@ -124723,22 +124743,6 @@ index d08591b..101d9f1 100644 - /* ignore mailbox interrupts */ - bics \tmp, #0xf0 - beq 1005f -+ /* test for mailbox0 (IPI) interrupt */ -+ tst \tmp, #0x10 -+ beq 1030f - -- @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1)) -- @ N.B. CLZ is an ARM5 instruction. -- mov \irqnr, #(ARM_IRQ_LOCAL_BASE + 31) -- sub \irqstat, \tmp, #1 -- eor \irqstat, \irqstat, \tmp -- clz \tmp, \irqstat -- sub \irqnr, \tmp -- b 1020f --1005: -- /* get core number */ -- mrc p15, 0, \tmp, c0, c0, 5 -- ubfx \tmp, \tmp, #0, #2 + /* get core's mailbox interrupt control */ + ldr \irqstat, = __io_address(ARM_LOCAL_MAILBOX0_CLR0) @ mbox_clr + add \irqstat, \irqstat, \base, lsl #4 @@ -124752,25 +124756,24 @@ index d08591b..101d9f1 100644 + mov r1, sp + adr lr, BSYM(1b) + b do_IPI - -- cmp \tmp, #1 -- beq 1020f -- cmp \tmp, #2 -- beq 1020f -- cmp \tmp, #3 -- beq 1020f ++#endif +1030: + /* check gpu interrupt */ + tst \tmp, #0x100 + beq 1040f -- /* get masked status */ -- ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)] -- mov \irqnr, #(ARM_IRQ0_BASE + 31) -- and \tmp, \irqstat, #0x300 @ save bits 8 and 9 -- /* clear bits 8 and 9, and test */ -- bics \irqstat, \irqstat, #0x300 -- bne 1010f +- @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1)) +- @ N.B. CLZ is an ARM5 instruction. +- mov \irqnr, #(ARM_IRQ_LOCAL_BASE + 31) +- sub \irqstat, \tmp, #1 +- eor \irqstat, \irqstat, \tmp +- clz \tmp, \irqstat +- sub \irqnr, \tmp +- b 1020f +-1005: +- /* get core number */ +- mrc p15, 0, \tmp, c0, c0, 5 +- ubfx \tmp, \tmp, #0, #2 + ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE) + /* get masked status */ + ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)] @@ -124780,6 +124783,21 @@ index d08591b..101d9f1 100644 + bics \irqstat, \irqstat, #0x300 + bne 1010f +- cmp \tmp, #1 +- beq 1020f +- cmp \tmp, #2 +- beq 1020f +- cmp \tmp, #3 +- beq 1020f +- +- /* get masked status */ +- ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)] +- mov \irqnr, #(ARM_IRQ0_BASE + 31) +- and \tmp, \irqstat, #0x300 @ save bits 8 and 9 +- /* clear bits 8 and 9, and test */ +- bics \irqstat, \irqstat, #0x300 +- bne 1010f +- - tst \tmp, #0x100 - ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)] - movne \irqnr, #(ARM_IRQ1_BASE + 31) @@ -124872,10 +124890,10 @@ index d08591b..101d9f1 100644 +1: get_irqnr_and_base r0, r2, r6, lr + .endm -From 5bb524a3e375d3d4220a88184293d82667e8b57e Mon Sep 17 00:00:00 2001 +From 219ae1b83de018ba2a3e3d909c0cbfce14579c14 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Tue, 3 Feb 2015 07:15:19 +0100 -Subject: [PATCH 073/154] HiFiBerry Amp: fix device-tree problems +Subject: [PATCH 073/216] HiFiBerry Amp: fix device-tree problems Some code to load the driver based on device-tree-overlays was missing. This is added by this patch. --- @@ -124929,10 +124947,10 @@ index 1e87ee06..5903915 100644 .probe = snd_rpi_hifiberry_amp_probe, .remove = snd_rpi_hifiberry_amp_remove, -From 913d3a3c763a571ca99f9ea81c0ef0c663bac578 Mon Sep 17 00:00:00 2001 +From 81042a79740e7b0c61fcbfa97e76c3d97c40b630 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 3 Feb 2015 11:41:38 +0000 -Subject: [PATCH 074/154] BCM270x_DT: Add i2c0_baudrate and i2c1_baudrate +Subject: [PATCH 074/216] BCM270x_DT: Add i2c0_baudrate and i2c1_baudrate parameters --- @@ -124981,10 +124999,10 @@ index 46f4908..75c222f 100644 act_led_gpio = <&act_led>,"gpios:4"; act_led_activelow = <&act_led>,"gpios:8"; -From 9ca7fc789a28057c51d699266c2e6b57db7861cc Mon Sep 17 00:00:00 2001 +From 4ff8b4c54db8215c8daa7a1d70c623b642143f16 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 4 Feb 2015 10:02:24 +0000 -Subject: [PATCH 075/154] pinctrl-bcm2835: bcm2835_gpio_direction_output must +Subject: [PATCH 075/216] pinctrl-bcm2835: bcm2835_gpio_direction_output must set the value --- @@ -125012,10 +125030,10 @@ index 9d1149e..d9c727b 100644 static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) -From 7ea41787ab061ab5957c4e6e4cc1351816ee9bb1 Mon Sep 17 00:00:00 2001 +From 1184251f953b0cd578ee44fa36d67f7f9091e6a5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 4 Feb 2015 12:59:36 +0000 -Subject: [PATCH 076/154] w1-gpio: Sort out the pullup/parasitic power tangle +Subject: [PATCH 076/216] w1-gpio: Sort out the pullup/parasitic power tangle --- arch/arm/boot/dts/w1-gpio-overlay.dts | 4 +++- @@ -125188,10 +125206,10 @@ index d58594a..feae942 100644 unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; -From 0ef85a9dc0dc08fe3e69b02e4f87ee8a38b01723 Mon Sep 17 00:00:00 2001 +From a0d0e3ba49f5daa0ece5234cdf688fb490ee15a7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 5 Feb 2015 16:01:44 +0000 -Subject: [PATCH 077/154] i2c_bcm2708: Fix clock reference counting +Subject: [PATCH 077/216] i2c_bcm2708: Fix clock reference counting --- drivers/i2c/busses/i2c-bcm2708.c | 12 ++++++++++-- @@ -125239,10 +125257,10 @@ index 526129b..fda59ba 100644 kfree(bi); -From 6c1a859165c378643f946f6c89eaf246655f5f8f Mon Sep 17 00:00:00 2001 +From dffb6179317e46f3f2d60c62b6b4c6c1008990ef Mon Sep 17 00:00:00 2001 From: Byron Bradley Date: Fri, 6 Feb 2015 14:19:41 +0000 -Subject: [PATCH 078/154] Add device-tree overlay for pcf2127 +Subject: [PATCH 078/216] Add device-tree overlay for pcf2127 Signed-off-by: Byron Bradley --- @@ -125252,7 +125270,7 @@ Signed-off-by: Byron Bradley create mode 100644 arch/arm/boot/dts/pcf2127-rtc-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index d45424c..ca55980 100644 +index 7755a84..6cb743a 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -20,6 +20,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb @@ -125292,10 +125310,10 @@ index 0000000..01fc81d + }; +}; -From 604eef02f110e3e44c54bf61fb9fbbe2e130eec9 Mon Sep 17 00:00:00 2001 +From 6547e99ab9f5be7bc839f36becfc18e6dd879d0d Mon Sep 17 00:00:00 2001 From: android Date: Mon, 25 Aug 2014 13:18:21 +0100 -Subject: [PATCH 079/154] BCM2708_VCIO : Add automatic creation of device node +Subject: [PATCH 079/216] BCM2708_VCIO : Add automatic creation of device node --- arch/arm/mach-bcm2708/vcio.c | 12 +++++++++++- @@ -125377,10 +125395,10 @@ index 5e43e85..700bff4 100644 } -From e42746b1c99904a99a28cd326d5616087ea4f87a Mon Sep 17 00:00:00 2001 +From 05b37dedc10f2da009b868c101623c742eda1c3f Mon Sep 17 00:00:00 2001 From: jeanleflambeur Date: Sun, 1 Feb 2015 12:35:38 +0100 -Subject: [PATCH 080/154] Fix grabbing lock from atomic context in i2c driver +Subject: [PATCH 080/216] Fix grabbing lock from atomic context in i2c driver 2 main changes: - check for timeouts in the bcm2708_bsc_setup function as indicated by this comment: @@ -125599,10 +125617,10 @@ index fda59ba..81e9374 100644 dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", pdev->id, (unsigned long)regs->start, irq, baudrate); -From 1d773d31a54a7e2b7771986035e1a2d8d0e610e6 Mon Sep 17 00:00:00 2001 +From 2e3d8378c9031150eda4fd030b14d6c4ea762786 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 12 Feb 2015 11:17:53 +0000 -Subject: [PATCH 081/154] Fix LED "input" trigger implementation for 3.19 +Subject: [PATCH 081/216] Fix LED "input" trigger implementation for 3.19 --- drivers/leds/leds-gpio.c | 10 +++++++++- @@ -125689,10 +125707,10 @@ index f70f84f..f3fcaa1 100644 /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ -From 1054dcb8e6e64ebea0195b960b5cd154f0209b44 Mon Sep 17 00:00:00 2001 +From 9bdca5da4acd1e4893a10183c0202b2b1293b9cd Mon Sep 17 00:00:00 2001 From: Rainer Herbers Date: Sun, 15 Feb 2015 13:44:14 +0100 -Subject: [PATCH 082/154] Create bmp085_i2c-sensor-overlay.dts and update +Subject: [PATCH 082/216] Create bmp085_i2c-sensor-overlay.dts and update Makefile --- @@ -125702,7 +125720,7 @@ Subject: [PATCH 082/154] Create bmp085_i2c-sensor-overlay.dts and update create mode 100644 arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index ca55980..6839ece 100644 +index 6cb743a..7946143 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -12,6 +12,7 @@ ifeq ($(CONFIG_BCM2709_DT),y) @@ -125743,10 +125761,10 @@ index 0000000..b830bf2 + }; +}; -From 6f6691ec5aeefa93782d70690f69bf9ffdd1b644 Mon Sep 17 00:00:00 2001 +From 92765161f74e60edf1eb2c752f2cd3ea9d531d14 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 083/154] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 083/216] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -125892,10 +125910,10 @@ index d9c727b..ae68710 100644 }, }; -From f84f3792f87b50bfff0e15e1a78c39386bbf5b5d Mon Sep 17 00:00:00 2001 +From d1f5e57c873c1acf3be524693888af970a08f4fb Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 084/154] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 084/216] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -125922,10 +125940,10 @@ index ae68710..87b7a4a 100644 pc->irq_data[i].irqgroup = i; -From 97ee5645351880dce63ec9a15477b278ca21d0d8 Mon Sep 17 00:00:00 2001 +From a10a9f8313c8fff626c82bf63608f3f00188c5db Mon Sep 17 00:00:00 2001 From: Dave Martin Date: Fri, 27 Feb 2015 15:51:37 +0000 -Subject: [PATCH 085/154] serial/amba-pl011: Activate TX IRQ passively +Subject: [PATCH 085/216] serial/amba-pl011: Activate TX IRQ passively The current PL011 driver transmits a dummy character when the UART is opened, to assert the TX IRQ for the first time @@ -126269,10 +126287,10 @@ index 16ca535..c243729 100644 /* Ensure interrupts from this UART are masked and cleared */ -From 103c9b4d22e0e0ef5cecd80284b379253192f14b Mon Sep 17 00:00:00 2001 +From 75d9fae636d84117aa46cf0c2dcc556d02d67aca Mon Sep 17 00:00:00 2001 From: Dave Martin Date: Wed, 1 Apr 2015 14:08:31 +0100 -Subject: [PATCH 086/154] serial/amba-pl011: Refactor and simplify TX FIFO +Subject: [PATCH 086/216] serial/amba-pl011: Refactor and simplify TX FIFO handling Commit 734745c serial/amba-pl011: Activate TX IRQ passively @@ -126513,10 +126531,10 @@ index c243729..e32f4d7 100644 /* Ensure interrupts from this UART are masked and cleared */ -From 04fa1b67ccabb1b4f0a1270cbbbcb915d7b088bb Mon Sep 17 00:00:00 2001 +From 29cd864c0ec9d9d593e569ee5d4fcb463d36cb35 Mon Sep 17 00:00:00 2001 From: Jon Burgess Date: Tue, 17 Feb 2015 13:22:17 +0000 -Subject: [PATCH 087/154] Create generic i2c-rtc overlay for supporting ds1307, +Subject: [PATCH 087/216] Create generic i2c-rtc overlay for supporting ds1307, ds3231, pcf2127 and pcf8523. Signed-off-by: Jon Burgess @@ -126527,7 +126545,7 @@ Signed-off-by: Jon Burgess create mode 100644 arch/arm/boot/dts/i2c-rtc-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 6839ece..bc13a9a 100644 +index 7946143..6753fcb 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -14,6 +14,7 @@ endif @@ -126588,10 +126606,10 @@ index 0000000..5d5abb1 + }; +}; -From c667acb84fa9818d76bdd1f4260887f93f656735 Mon Sep 17 00:00:00 2001 +From 600d5e0e89ecc723b7ffb29209b058d0275502e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Feb 2015 21:24:05 +0100 -Subject: [PATCH 088/154] dts: overlay: add support for rpi-display +Subject: [PATCH 088/216] dts: overlay: add support for rpi-display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -126606,7 +126624,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/rpi-display-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index bc13a9a..3b2da65 100644 +index 6753fcb..de47748 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -25,6 +25,7 @@ dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb @@ -126705,10 +126723,10 @@ index 0000000..0578810 + }; +}; -From 85f41ebf84581d2e545c75be7022319bcc30539d Mon Sep 17 00:00:00 2001 +From 525949ace298ff41d93fc2025ac768654e745642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Feb 2015 21:36:27 +0100 -Subject: [PATCH 089/154] dts: overlay: add support for HY28A display +Subject: [PATCH 089/216] dts: overlay: add support for HY28A display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -126724,7 +126742,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/hy28a-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 3b2da65..1e1be41 100644 +index de47748..8d7e535 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -19,6 +19,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb @@ -126829,10 +126847,10 @@ index 0000000..3cd3083 + }; +}; -From 3319258136b59fb0316583e4c8e8ab7663ae1676 Mon Sep 17 00:00:00 2001 +From 131c6ba7b078b8536755c8cae2e31c09053b5804 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Feb 2015 21:38:00 +0100 -Subject: [PATCH 090/154] dts: overlay: add support for HY28B display +Subject: [PATCH 090/216] dts: overlay: add support for HY28B display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -126848,7 +126866,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/hy28b-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 1e1be41..7321acb 100644 +index 8d7e535..ec26431b1 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -20,6 +20,7 @@ dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb @@ -127008,10 +127026,10 @@ index 0000000..f774c4a + }; +}; -From 712e74ab3536054a09a73f67dd9f7cc8aa92a79f Mon Sep 17 00:00:00 2001 +From 33ce6c6c093580873f0f54b8633f44479d31786b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Feb 2015 21:38:47 +0100 -Subject: [PATCH 091/154] dts: overlay: add support for PiScreen display +Subject: [PATCH 091/216] dts: overlay: add support for PiScreen display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127026,7 +127044,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/piscreen-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 7321acb..68ee5dd 100644 +index ec26431b1..107448d 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -26,6 +26,7 @@ dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb @@ -127138,10 +127156,10 @@ index 0000000..8cd6a95 + }; +}; -From 7d5e61de5fa320467e13bee90a2291362ba0520e Mon Sep 17 00:00:00 2001 +From 5ef8657c77133ceed5a8ddf80fed6d3002ac9dca Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 092/154] enc28j60: Add device tree compatible string and an +Subject: [PATCH 092/216] enc28j60: Add device tree compatible string and an overlay --- @@ -127152,7 +127170,7 @@ Subject: [PATCH 092/154] enc28j60: Add device tree compatible string and an create mode 100755 arch/arm/boot/dts/enc28j60-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 68ee5dd..a91c55d 100644 +index 107448d..81afe85 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -14,6 +14,7 @@ endif @@ -127225,10 +127243,10 @@ index b1b5f66..c6b6e1a 100644 .probe = enc28j60_probe, .remove = enc28j60_remove, -From 1f2eb975fb1c953feee4d76c5f7c90db92599530 Mon Sep 17 00:00:00 2001 +From 04e8bf899200ef72d464ce9ee362d4377fbd7d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 27 Feb 2015 18:17:25 +0100 -Subject: [PATCH 093/154] dts: overlay: add support for Adafruit PiTFT +Subject: [PATCH 093/216] dts: overlay: add support for Adafruit PiTFT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127243,7 +127261,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/pitft28-resistive-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index a91c55d..707d373 100644 +index 81afe85..07c6eeb 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -28,6 +28,7 @@ dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb @@ -127376,10 +127394,10 @@ index 0000000..d506eae + }; +}; -From db632c485213fe893ecde8ca944cdaaf13ccc655 Mon Sep 17 00:00:00 2001 +From 917597bfd056d8d37b02a21e7ea4e56023a3e630 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Mon, 2 Mar 2015 09:37:02 +0000 -Subject: [PATCH 094/154] enable compiling spi-bcm2835 and add overlay to allow +Subject: [PATCH 094/216] enable compiling spi-bcm2835 and add overlay to allow us to load the driver --- @@ -127389,7 +127407,7 @@ Subject: [PATCH 094/154] enable compiling spi-bcm2835 and add overlay to allow create mode 100644 arch/arm/boot/dts/spi-bcm2835-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 707d373..3988c44 100644 +index 07c6eeb..e83179f 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -33,6 +33,7 @@ dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb @@ -127425,10 +127443,10 @@ index 0000000..fc1e39b + }; +}; -From 962f055d35c983953dac08caa79a80823206f90c Mon Sep 17 00:00:00 2001 +From 58f834d50fb0e6eb0f1a8c48bdb3551866addc62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 7 Mar 2015 20:39:30 +0100 -Subject: [PATCH 095/154] dts: overlay: add support for MZ61581 display +Subject: [PATCH 095/216] dts: overlay: add support for MZ61581 display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127443,7 +127461,7 @@ Signed-off-by: Noralf Trønnes create mode 100644 arch/arm/boot/dts/mz61581-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 3988c44..371d34a 100644 +index e83179f..f99eccf 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -25,6 +25,7 @@ dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb @@ -127570,10 +127588,10 @@ index 0000000..c06fe12 + }; +}; -From e242a6168a50206acb34628b1deff3278ae78505 Mon Sep 17 00:00:00 2001 +From 080c66dfc13694a3c6123d6732d6255361e49733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 7 Mar 2015 20:40:07 +0100 -Subject: [PATCH 096/154] dts: overlay: piscreen: set speed to 24MHz +Subject: [PATCH 096/216] dts: overlay: piscreen: set speed to 24MHz MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127600,10 +127618,10 @@ index 8cd6a95..b7fd7ea 100644 bgr; fps = <30>; -From 3cd0c5268c5741ee7b6e6d479718ba6566359b27 Mon Sep 17 00:00:00 2001 +From c34aef0866b8605b64dd7b7c1bf4c1db77933089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 7 Mar 2015 20:40:43 +0100 -Subject: [PATCH 097/154] dts: overlay: rpi-display: pullup irq gpio +Subject: [PATCH 097/216] dts: overlay: rpi-display: pullup irq gpio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127629,10 +127647,10 @@ index 0578810..a8fa974 100644 }; }; -From f65dc605f7653a0d8e84a1bab1e55360eee58d56 Mon Sep 17 00:00:00 2001 +From 7268b2f16833d36f6568add569f15325b398497b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 24 Mar 2015 14:48:30 +0100 -Subject: [PATCH 098/154] BCM270x_DT: add bcm2835-dma entry +Subject: [PATCH 098/216] BCM270x_DT: add bcm2835-dma entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127696,7 +127714,7 @@ index c8aea5b..6a08e95 100644 #ifdef CONFIG_BCM2708_GPIO bcm_register_device_dt(&bcm2708_gpio_device); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 396c1e7..de60e37 100644 +index 259d552..3c1c1dc 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -879,7 +879,7 @@ void __init bcm2709_init(void) @@ -127709,10 +127727,10 @@ index 396c1e7..de60e37 100644 #ifdef CONFIG_BCM2708_GPIO bcm_register_device_dt(&bcm2708_gpio_device); -From 8bf4bde8c8342e8d2b8a42b8ed6710add71871a3 Mon Sep 17 00:00:00 2001 +From ccc2b25ac7ffe4252a482901541a1894c86bb4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 24 Mar 2015 14:50:19 +0100 -Subject: [PATCH 099/154] bcm270x: add mmc-bcm2835 clock +Subject: [PATCH 099/216] bcm270x: add mmc-bcm2835 clock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127739,7 +127757,7 @@ index 6a08e95..b5f22e2 100644 bcm2708_register_clkdev(clk, "bcm2708_i2c.0"); bcm2708_register_clkdev(clk, "bcm2708_i2c.1"); diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index de60e37..5e70eab 100644 +index 3c1c1dc..e10667d 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -243,6 +243,7 @@ void __init bcm2709_init_clocks(void) @@ -127751,10 +127769,10 @@ index de60e37..5e70eab 100644 bcm2709_register_clkdev(clk, "bcm2708_i2c.0"); bcm2709_register_clkdev(clk, "bcm2708_i2c.1"); -From 5bd50eacb5ecebe294147362270426bee48ce1d5 Mon Sep 17 00:00:00 2001 +From 7520bcefca288277ace88e3df254045eee89c189 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 24 Mar 2015 15:12:35 +0100 -Subject: [PATCH 100/154] BCM270x_DT: add bcm2835-mmc entry +Subject: [PATCH 100/216] BCM270x_DT: add bcm2835-mmc entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -127909,7 +127927,7 @@ index b5f22e2..16ba248 100644 bcm2708_init_led(); for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 5e70eab..56d16a4 100644 +index e10667d..dcad008 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -909,7 +909,7 @@ void __init bcm2709_init(void) @@ -127922,10 +127940,10 @@ index 5e70eab..56d16a4 100644 bcm2709_init_led(); for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) -From c4e46a88eb70a37844ef0fe3209794835210af22 Mon Sep 17 00:00:00 2001 +From 7504524f3f951bf8c40c5decf231ea6538d1380b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Mar 2015 11:45:44 +0000 -Subject: [PATCH 101/154] BCM270x_DT: Refactor bcm2708.dtsi and bcm2709.dtsi +Subject: [PATCH 101/216] BCM270x_DT: Refactor bcm2708.dtsi and bcm2709.dtsi Extract the common elements, creating bcm2708_common.dtsi --- @@ -128346,10 +128364,10 @@ index bd6605d..5e0b935 100644 compatible = "arm,armv7-timer"; clock-frequency = <19200000>; -From cfb7979048f721c2731e8efa948154472365c415 Mon Sep 17 00:00:00 2001 +From 5d44aea95dbfd69851ffeb426ccf419f5894e70e Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 102/154] Add driver for rpi-proto +Subject: [PATCH 102/216] Add driver for rpi-proto Forward port of 3.10.x driver from https://github.com/koalo We are using a custom board and would like to use rpi 3.18.x @@ -128372,7 +128390,7 @@ Signed-off-by: Waldemar Brodkorb create mode 100644 sound/soc/bcm/rpi-proto.c diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 371d34a..eda0009 100644 +index f99eccf..daf51d2 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -24,6 +24,7 @@ dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb @@ -128624,10 +128642,10 @@ index 0000000..c6e45a0 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From c4d32dd8e87695a74125b0596d7b892e4a56335f Mon Sep 17 00:00:00 2001 +From b1c2c58f341642e8bcc337b592f19d5543ae51ad Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Thu, 2 Apr 2015 12:22:55 +0100 -Subject: [PATCH 103/154] Add Device Tree support for RPi-DAC. +Subject: [PATCH 103/216] Add Device Tree support for RPi-DAC. --- arch/arm/boot/dts/Makefile | 1 + @@ -128638,7 +128656,7 @@ Subject: [PATCH 103/154] Add Device Tree support for RPi-DAC. create mode 100644 arch/arm/boot/dts/rpi-dac-overlay.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index eda0009..2b8c692a 100644 +index daf51d2..980b78e0 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -24,6 +24,7 @@ dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb @@ -128757,24 +128775,24 @@ index b4eaa44..afe1b41 100644 }; -From b62355897570f675cbdce1f8fec722df790cd3b9 Mon Sep 17 00:00:00 2001 +From c3bd8511bef07e4a3ebf9e78fc1ed0889aaf1d62 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 104/154] config: Add default configs +Subject: [PATCH 104/216] config: Add default configs --- - arch/arm/configs/bcm2709_defconfig | 1192 ++++++++++++++++++++++++++++++++++++ - arch/arm/configs/bcmrpi_defconfig | 1187 +++++++++++++++++++++++++++++++++++ - 2 files changed, 2379 insertions(+) + arch/arm/configs/bcm2709_defconfig | 1191 ++++++++++++++++++++++++++++++++++++ + arch/arm/configs/bcmrpi_defconfig | 1186 +++++++++++++++++++++++++++++++++++ + 2 files changed, 2377 insertions(+) create mode 100644 arch/arm/configs/bcm2709_defconfig create mode 100644 arch/arm/configs/bcmrpi_defconfig diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig new file mode 100644 -index 0000000..23079b4 +index 0000000..7cec5f8 --- /dev/null +++ b/arch/arm/configs/bcm2709_defconfig -@@ -0,0 +1,1192 @@ +@@ -0,0 +1,1191 @@ +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +CONFIG_PHYS_OFFSET=0 +CONFIG_LOCALVERSION="-v7" @@ -129154,7 +129172,6 @@ index 0000000..23079b4 +CONFIG_BT_MRVL_SDIO=m +CONFIG_BT_ATH3K=m +CONFIG_BT_WILINK=m -+CONFIG_CFG80211_WEXT=y +CONFIG_MAC80211=m +CONFIG_MAC80211_MESH=y +CONFIG_WIMAX=m @@ -129969,10 +129986,10 @@ index 0000000..23079b4 +CONFIG_LIBCRC32C=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig new file mode 100644 -index 0000000..919e0b7 +index 0000000..e77173b --- /dev/null +++ b/arch/arm/configs/bcmrpi_defconfig -@@ -0,0 +1,1187 @@ +@@ -0,0 +1,1186 @@ +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +CONFIG_PHYS_OFFSET=0 +# CONFIG_LOCALVERSION_AUTO is not set @@ -130345,7 +130362,6 @@ index 0000000..919e0b7 +CONFIG_BT_MRVL_SDIO=m +CONFIG_BT_ATH3K=m +CONFIG_BT_WILINK=m -+CONFIG_CFG80211_WEXT=y +CONFIG_MAC80211=m +CONFIG_MAC80211_MESH=y +CONFIG_WIMAX=m @@ -131161,10 +131177,10 @@ index 0000000..919e0b7 +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From 9d99e3183e2eb323e971f91365fa2d202cd8c7b2 Mon Sep 17 00:00:00 2001 +From 196c354f9d8f85f9e56bd2ce11113883f98bccaa Mon Sep 17 00:00:00 2001 From: Jakub Kicinski Date: Mon, 2 Mar 2015 16:34:37 +0100 -Subject: [PATCH 105/154] bcm2708: fix uart1 parameters +Subject: [PATCH 105/216] bcm2708: fix uart1 parameters System clock is 250MHz, but the device uses a non-standard oversampling rate (8 instead of 16) hence the clock rate @@ -131199,189 +131215,10 @@ index 16ba248..b848e4a 100644 {}, }; -From f36bd72cd2b1a780caca8b621d212a1337ffeffe Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 13 Apr 2015 23:34:50 +0100 -Subject: [PATCH 106/154] bcm2835-mmc: Add range of debug options for slowing - things down - ---- - drivers/mmc/host/bcm2835-mmc.c | 92 ++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 84 insertions(+), 8 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 28b00d3..776476e 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -71,6 +71,8 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) - - -+static unsigned mmc_debug; -+ - struct bcm2835_host { - spinlock_t lock; - -@@ -131,20 +133,94 @@ struct bcm2835_host { - }; - - -+static inline u32 bcm2835_mmc_axi_outstanding_reads(void) -+{ -+#ifdef CONFIG_ARCH_BCM2709 -+ u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT)); -+#else -+ u32 r = 0; -+#endif -+ return (r >> 0) & 0x3ff; -+} -+ -+static inline u32 bcm2835_mmc_axi_outstanding_writes(void) -+{ -+#ifdef CONFIG_ARCH_BCM2709 -+ u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT)); -+#else -+ u32 r = 0; -+#endif -+ return (r >> 16) & 0x3ff; -+} -+ - static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) - { -+ u32 delay; -+ if (mmc_debug & (1<<0)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<1)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); -+ - writel(val, host->ioaddr + reg); - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); -+ -+ delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -+ if (delay) -+ udelay(delay); -+ -+ if (mmc_debug & (1<<2)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<3)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); - } - - static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) - { -+ u32 delay; -+ if (mmc_debug & (1<<4)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<5)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); -+ - writel(val, host->ioaddr + reg); -+ -+ delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -+ if (delay) -+ udelay(delay); -+ -+ if (mmc_debug & (1<<6)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<7)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); - } - - static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) - { -- return readl(host->ioaddr + reg); -+ u32 ret; -+ if (mmc_debug & (1<<8)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<9)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); -+ -+ ret = readl(host->ioaddr + reg); -+ -+ if (mmc_debug & (1<<10)) -+ while (bcm2835_mmc_axi_outstanding_reads() > 1) -+ cpu_relax(); -+ if (mmc_debug & (1<<11)) -+ while (bcm2835_mmc_axi_outstanding_writes() > 0) -+ cpu_relax(); -+ return ret; - } - - static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int reg) -@@ -1263,9 +1339,7 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - { - struct mmc_host *mmc = host->mmc; - struct device *dev = mmc->parent; --#ifndef FORCE_PIO - struct dma_slave_config cfg; --#endif - int ret; - - bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -@@ -1289,10 +1363,11 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - spin_lock_init(&host->lock); - --#ifdef FORCE_PIO -+dev_info(dev, "mmc_debug:%x\n", mmc_debug); -+if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - host->have_dma = false; --#else -+} else { - if (IS_ERR_OR_NULL(host->dma_chan_tx) || - IS_ERR_OR_NULL(host->dma_chan_rx)) { - dev_err(dev, "%s: Unable to initialise DMA channels. Falling back to PIO\n", -@@ -1316,7 +1391,7 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - cfg.dst_addr = 0; - ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); - } --#endif -+} - mmc->max_segs = 128; - mmc->max_req_size = 524288; - mmc->max_seg_size = mmc->max_req_size; -@@ -1386,7 +1461,7 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) - - host->phys_addr = iomem->start + BCM2835_VCMMU_SHIFT; - --#ifndef FORCE_PIO -+if (!(mmc_debug & (1<<12))) { - if (node) { - host->dma_chan_tx = of_dma_request_slave_channel(node, "tx"); - host->dma_chan_rx = of_dma_request_slave_channel(node, "rx"); -@@ -1399,7 +1474,7 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) - host->dma_chan_tx = dma_request_channel(mask, NULL, NULL); - host->dma_chan_rx = dma_request_channel(mask, NULL, NULL); - } --#endif -+} - clk = devm_clk_get(dev, NULL); - if (IS_ERR(clk)) { - dev_err(dev, "could not get clk\n"); -@@ -1500,6 +1575,7 @@ static struct platform_driver bcm2835_mmc_driver = { - }; - module_platform_driver(bcm2835_mmc_driver); - -+module_param(mmc_debug, uint, 0644); - MODULE_ALIAS("platform:mmc-bcm2835"); - MODULE_DESCRIPTION("BCM2835 SDHCI driver"); - MODULE_LICENSE("GPL v2"); - -From c81f2f73fe75be1e7116b6a973ee358f88299fc4 Mon Sep 17 00:00:00 2001 +From 8243fc28ee2c92452173c695fdb7990e3758fdc3 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Fri, 20 Mar 2015 15:26:11 +0100 -Subject: [PATCH 107/154] spi: bcm2835: fix all checkpath --strict messages +Subject: [PATCH 106/216] spi: bcm2835: fix all checkpath --strict messages The following errors/warnings issued by checkpatch.pl --strict have been fixed: drivers/spi/spi-bcm2835.c:182: CHECK: Alignment should match open parenthesis @@ -131467,10 +131304,10 @@ index 419a782..779d3a8 100644 dev_err(&pdev->dev, "could not request IRQ: %d\n", err); goto out_clk_disable; -From 9520a8428a85248b6c09c2fc596f805b26dbfb01 Mon Sep 17 00:00:00 2001 +From 54e38f321ea8bb1990d6f496c0710532224a35ad Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Mon, 23 Mar 2015 15:11:53 +0100 -Subject: [PATCH 108/154] spi: bcm2835: fill/drain SPI-fifo as much as possible +Subject: [PATCH 107/216] spi: bcm2835: fill/drain SPI-fifo as much as possible during interrupt Implement the recommendation from the BCM2835 data-sheet @@ -131611,10 +131448,10 @@ index 779d3a8..960dcce 100644 udelay(tfr->delay_usecs); -From ef109c1aa550a46350eb49f2962105b36f9eb08a Mon Sep 17 00:00:00 2001 +From 52469b2a3843dbd5aad2109a73e1b41371f83be3 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Thu, 19 Mar 2015 09:01:52 +0000 -Subject: [PATCH 109/154] spi: bcm2835: clock divider can be a multiple of 2 +Subject: [PATCH 108/216] spi: bcm2835: clock divider can be a multiple of 2 The official documentation is wrong in this respect. Has been tested empirically for dividers 2-1024 @@ -131642,10 +131479,10 @@ index 960dcce..8de1925 100644 if (cdiv >= 65536) cdiv = 0; /* 0 is the slowest we can go */ -From dfc9858b6b0ecce21436e94e2f69b1dd0f762ee7 Mon Sep 17 00:00:00 2001 +From b3622510de92a35d73778905be9ab4ad4235bd66 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Thu, 19 Mar 2015 09:01:53 +0000 -Subject: [PATCH 110/154] spi: bcm2835: enable support of 3-wire mode +Subject: [PATCH 109/216] spi: bcm2835: enable support of 3-wire mode Signed-off-by: Martin Sperl Signed-off-by: Mark Brown @@ -131678,10 +131515,10 @@ index 8de1925..3f93718 100644 cs |= BCM2835_SPI_CS_CPOL; if (spi->mode & SPI_CPHA) -From 941e9c41fb0d684fecf9814a4a67e9367a0317f9 Mon Sep 17 00:00:00 2001 +From c71501bcc7b07a82119e2f7b27309a62f90aa02a Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Thu, 26 Mar 2015 11:08:36 +0100 -Subject: [PATCH 111/154] spi: bcm2835: move to the transfer_one driver model +Subject: [PATCH 110/216] spi: bcm2835: move to the transfer_one driver model This also allows for GPIO-CS to get used removing the limitation of 2/3 SPI devises on the SPI bus. @@ -132042,10 +131879,10 @@ index 3f93718..31d80eb0 100644 BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX); -From a6eb700e27e979e9e1f48e07980da7338cd9254b Mon Sep 17 00:00:00 2001 +From cf51ed163d8109aa02dfc267633ed4c0a4a81f08 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Sun, 29 Mar 2015 16:03:23 +0200 -Subject: [PATCH 112/154] spi: bcm2835: fix code formatting issue +Subject: [PATCH 111/216] spi: bcm2835: fix code formatting issue Signed-off-by: Martin Sperl Tested-by: Martin Sperl @@ -132069,10 +131906,10 @@ index 31d80eb0..4aa80fd 100644 } -From 37f9415e2b665c56f8c9025c1cf982544af01560 Mon Sep 17 00:00:00 2001 +From 8f0e96a797cebd49ab5054b3c150386a5f840855 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Sun, 29 Mar 2015 16:03:25 +0200 -Subject: [PATCH 113/154] spi: bcm2835: fill FIFO before enabling interrupts to +Subject: [PATCH 112/216] spi: bcm2835: fill FIFO before enabling interrupts to reduce interrupts/message To reduce the number of interrupts/message we fill the FIFO before @@ -132118,10 +131955,10 @@ index 4aa80fd..321dbe2 100644 * Enable the HW block. This will immediately trigger a DONE (TX * empty) interrupt, upon which we will fill the TX FIFO with the -From 53bdf6040181dd14e4cbe133f564b8bf97187722 Mon Sep 17 00:00:00 2001 +From 31a827ccaeac10f8a5ac4ee4dc4fcdda68470eb7 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Mon, 6 Apr 2015 17:16:31 +0000 -Subject: [PATCH 114/154] spi: bcm2835: transform native-cs to gpio-cs on first +Subject: [PATCH 113/216] spi: bcm2835: transform native-cs to gpio-cs on first spi_setup Transforms the bcm-2835 native SPI-chip select to their gpio-cs equivalent. @@ -132214,10 +132051,10 @@ index 321dbe2..033b93f 100644 static int bcm2835_spi_probe(struct platform_device *pdev) -From e45ccf9253f127943bb6c87ad94c6b07a32bf7ea Mon Sep 17 00:00:00 2001 +From 776aadc5da23cf97862d5eb535d8d9b8a038552f Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Mon, 6 Apr 2015 17:16:30 +0000 -Subject: [PATCH 115/154] spi: bcm2835: enabling polling mode for transfers +Subject: [PATCH 114/216] spi: bcm2835: enabling polling mode for transfers shorter than 30us In cases of short transfer times the CPU is spending lots of time @@ -132400,10 +132237,10 @@ index 033b93f..44ee1f3 100644 static void bcm2835_spi_handle_err(struct spi_master *master, -From 49bbfbdf10a9f004fb6a50b858eea8f38f739c0f Mon Sep 17 00:00:00 2001 +From 0a92a30733013eae878dc15c597dfa718f2865f5 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Thu, 16 Apr 2015 21:18:47 +0100 -Subject: [PATCH 116/154] spi: bcm2835: change timeout of polling driver to 1s +Subject: [PATCH 115/216] spi: bcm2835: change timeout of polling driver to 1s The way that the timeout code is written in the polling function the timeout does also trigger when interrupted or rescheduled while @@ -132440,10 +132277,10 @@ index 44ee1f3..1a915e5 100644 while (bs->rx_len) { /* read from fifo as much as possible */ -From 6b23b3c1fd226b23b58c29a55bcbe43b7b88b0d4 Mon Sep 17 00:00:00 2001 +From a53606a32ae4bdadc08985d0a67a6924c09633f1 Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 117/154] smsx95xx: fix crimes against truesize +Subject: [PATCH 116/216] smsx95xx: fix crimes against truesize smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. @@ -132478,10 +132315,10 @@ index e29a323..aff63dc usbnet_skb_return(dev, ax_skb); } -From e2a06a85f9b686d7355a76e723f87e415ec1f804 Mon Sep 17 00:00:00 2001 +From a6f41e34aeb0834ce943e48ee5f6655716dd53c4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 118/154] smsc95xx: Disable turbo mode by default +Subject: [PATCH 117/216] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- @@ -132501,10 +132338,10 @@ index aff63dc..08a8a8c 100755 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); -From 5e29e90fd355af610012b11333016d4bf5516de8 Mon Sep 17 00:00:00 2001 +From d8512fe40402051a7fb3ec7e7ad25f38d0abab65 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 18 Mar 2015 18:06:52 +0100 -Subject: [PATCH 119/154] HiFiBerry Digi: set SPDIF status bits for sample rate +Subject: [PATCH 118/216] HiFiBerry Digi: set SPDIF status bits for sample rate The HiFiBerry Digi driver did not signal the sample rate in the SPDIF status bits. While this is optional, some DACs and receivers do not accept this signal. This patch @@ -132574,10 +132411,10 @@ index a294a1b..80732b8 100644 } -From 5aac453ca203bb564797bd8d8b2a3cfaccd07447 Mon Sep 17 00:00:00 2001 +From 496a822ba4493536df3181be27d4b2d2906d4fde Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 18 Apr 2015 17:20:14 +0100 -Subject: [PATCH 120/154] bcm2708-dmaengine: Add debug options +Subject: [PATCH 119/216] bcm2708-dmaengine: Add debug options --- drivers/dma/bcm2708-dmaengine.c | 8 +++++++- @@ -132624,234 +132461,10 @@ index 6150b8f..8182b16 100644 MODULE_DESCRIPTION("BCM2835 DMA engine driver"); MODULE_AUTHOR("Florian Meier "); -From 497dbba490e4a04b7db0dfe6a553c54a5ab14113 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sat, 18 Apr 2015 17:21:12 +0100 -Subject: [PATCH 121/154] bcm2835-mmc: Add option to disable - MMC_QUIRK_BLK_NO_CMD23 - ---- - drivers/mmc/core/quirks.c | 2 ++ - drivers/mmc/host/bcm2835-mmc.c | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index f472082..8c90f3f 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -98,6 +98,8 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -+ extern unsigned mmc_debug; -+ if (!(mmc_debug & (1<<13))) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; - } - EXPORT_SYMBOL(mmc_fixup_device); -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 776476e..9b7f490 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -71,7 +71,7 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) - - --static unsigned mmc_debug; -+/*static */unsigned mmc_debug; - - struct bcm2835_host { - spinlock_t lock; - -From d2a4b3ddb4faa2251db5f42012b26beccffcf79e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 22 Apr 2015 20:31:12 +0100 -Subject: [PATCH 123/154] bcm2835-mmc: Add option to disable some delays - ---- - drivers/mmc/host/bcm2835-mmc.c | 34 ++++++++++++++++++---------------- - 1 file changed, 18 insertions(+), 16 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 9b7f490..7010204 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -72,6 +72,7 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - - - /*static */unsigned mmc_debug; -+/*static */unsigned mmc_debug2; - - struct bcm2835_host { - spinlock_t lock; -@@ -153,7 +154,7 @@ static inline u32 bcm2835_mmc_axi_outstanding_writes(void) - return (r >> 16) & 0x3ff; - } - --static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) -+static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) - { - u32 delay; - if (mmc_debug & (1<<0)) -@@ -167,7 +168,7 @@ static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int re - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); - - delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -- if (delay) -+ if (delay && !((1<shadow = newval; - else -- bcm2835_mmc_writel(host, newval, reg & ~3); -+ bcm2835_mmc_writel(host, newval, reg & ~3, 0); - - } - -@@ -247,7 +248,7 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg - u32 mask = 0xff << byte_shift; - u32 newval = (oldval & ~mask) | (val << byte_shift); - -- bcm2835_mmc_writel(host, newval, reg & ~3); -+ bcm2835_mmc_writel(host, newval, reg & ~3, 1); - } - - -@@ -279,7 +280,7 @@ static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) - ier &= ~clear; - /* change which requests generate IRQs - makes no difference to - the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ -- bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE); -+ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); - } - - -@@ -373,8 +374,8 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | - SDHCI_INT_RESPONSE; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); - - if (soft) { - /* force clock reconfiguration */ -@@ -596,8 +597,8 @@ static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) - else - host->ier = (host->ier & ~dma_irqs) | pio_irqs; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); - } - - -@@ -679,7 +680,7 @@ static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, - mode |= SDHCI_TRNS_AUTO_CMD12; - else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { - mode |= SDHCI_TRNS_AUTO_CMD23; -- bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2); -+ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); - } - } - -@@ -742,7 +743,7 @@ void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd - - bcm2835_mmc_prepare_data(host, cmd); - -- bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT); -+ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); - - bcm2835_mmc_set_transfer_mode(host, cmd); - -@@ -899,8 +900,8 @@ static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int en - else - host->ier &= ~SDHCI_INT_CARD_INT; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); - mmiowb(); - } - } -@@ -1047,7 +1048,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) - /* Clear selected interrupts. */ - mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | - SDHCI_INT_BUS_POWER); -- bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS); -+ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); - - - if (intmask & SDHCI_INT_CMD_MASK) -@@ -1077,7 +1078,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) - - if (intmask) { - unexpected |= intmask; -- bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS); -+ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); - } - - if (result == IRQ_NONE) -@@ -1363,7 +1364,7 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - spin_lock_init(&host->lock); - --dev_info(dev, "mmc_debug:%x\n", mmc_debug); -+dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); - if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - host->have_dma = false; -@@ -1576,6 +1577,7 @@ static struct platform_driver bcm2835_mmc_driver = { - module_platform_driver(bcm2835_mmc_driver); - - module_param(mmc_debug, uint, 0644); -+module_param(mmc_debug2, uint, 0644); - MODULE_ALIAS("platform:mmc-bcm2835"); - MODULE_DESCRIPTION("BCM2835 SDHCI driver"); - MODULE_LICENSE("GPL v2"); - -From 488911bc7cc59fa99f2d9f33d9c8bad421d8684a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 28 Apr 2015 19:29:54 +0100 -Subject: [PATCH 124/154] bcm2835-mmc: Default to disabling - MMC_QUIRK_BLK_NO_CMD23 - ---- - drivers/mmc/core/quirks.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index 8c90f3f..bc3bbad 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -71,6 +71,7 @@ static const struct mmc_fixup mmc_fixup_methods[] = { - - void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - { -+ extern unsigned mmc_debug; - const struct mmc_fixup *f; - u64 rev = cid_rev_card(card); - -@@ -98,8 +99,7 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -- extern unsigned mmc_debug; -- if (!(mmc_debug & (1<<13))) -+ if (mmc_debug & (1<<13)) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; - } - EXPORT_SYMBOL(mmc_fixup_device); - -From ff0caccc6072241e140c819873b102840a8a7135 Mon Sep 17 00:00:00 2001 +From 4dc3a781a0d5718153bc38b1f1294523d44b8f66 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 125/154] Add blk_pos parameter to mmc multi_io_quirk callback +Subject: [PATCH 120/216] Add blk_pos parameter to mmc multi_io_quirk callback --- drivers/mmc/card/block.c | 1 + @@ -132862,10 +132475,10 @@ Subject: [PATCH 125/154] Add blk_pos parameter to mmc multi_io_quirk callback 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c -index c69afb5..95a12fd 100644 +index ed2e71a..ce854a9 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c -@@ -1401,6 +1401,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, +@@ -1413,6 +1413,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, brq->data.blocks = card->host->ops->multi_io_quirk(card, (rq_data_dir(req) == READ) ? MMC_DATA_READ : MMC_DATA_WRITE, @@ -132904,7 +132517,7 @@ index 6906a90..1fb7577 100644 /* * In Renesas controllers, when performing a diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c -index a31c357..b04edb5 100644 +index dba7e1c..0c87f4f 100644 --- a/drivers/mmc/host/tmio_mmc_pio.c +++ b/drivers/mmc/host/tmio_mmc_pio.c @@ -1001,7 +1001,9 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) @@ -132934,27 +132547,27 @@ index c3b84a2..c1c3868f 100644 struct mmc_card; -From da9969b245bc29e30fd1eba1398d7303f9674374 Mon Sep 17 00:00:00 2001 +From 12b12cf1a7a825c46dcefa06bdde683cac053189 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 126/154] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 121/216] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. --- arch/arm/boot/dts/Makefile | 1 + - arch/arm/boot/dts/sdhost-overlay.dts | 64 ++ + arch/arm/boot/dts/sdhost-overlay.dts | 73 ++ arch/arm/configs/bcm2709_defconfig | 1 + arch/arm/configs/bcmrpi_defconfig | 1 + drivers/mmc/host/Kconfig | 10 + drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-sdhost.c | 1694 ++++++++++++++++++++++++++++++++++ + drivers/mmc/host/bcm2835-sdhost.c | 1685 ++++++++++++++++++++++++++++++++++ 7 files changed, 1772 insertions(+) create mode 100644 arch/arm/boot/dts/sdhost-overlay.dts create mode 100644 drivers/mmc/host/bcm2835-sdhost.c diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile -index 2b8c692a..5effb3c 100644 +index 980b78e0..9cb5a2d 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -34,6 +34,7 @@ dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb @@ -132967,10 +132580,10 @@ index 2b8c692a..5effb3c 100644 dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb diff --git a/arch/arm/boot/dts/sdhost-overlay.dts b/arch/arm/boot/dts/sdhost-overlay.dts new file mode 100644 -index 0000000..234914f1 +index 0000000..33db96e --- /dev/null +++ b/arch/arm/boot/dts/sdhost-overlay.dts -@@ -0,0 +1,64 @@ +@@ -0,0 +1,73 @@ +/dts-v1/; +/plugin/; + @@ -132991,7 +132604,7 @@ index 0000000..234914f1 + dmas = <&dma 13>, + <&dma 13>; + dma-names = "tx", "rx"; -+ brcm,delay_after_stop = <0>; ++ brcm,delay-after-stop = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_pins>; + status = "okay"; @@ -133031,8 +132644,17 @@ index 0000000..234914f1 + }; + }; + ++ fragment@3 { ++ target-path = "/__overrides__"; ++ __overlay__ { ++ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; ++ }; ++ }; ++ + __overrides__ { -+ delay_after_stop = <&sdhost>,"brcm,delay_after_stop:0"; ++ delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; ++ force_pio = <&sdhost>,"brcm,force-pio?"; ++ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; + }; +}; diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig @@ -133094,10 +132716,10 @@ index 9d41de9..8a7e43e 100644 obj-$(CONFIG_MMC_AU1X) += au1xmmc.o diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c new file mode 100644 -index 0000000..cf5471f +index 0000000..0c311b5 --- /dev/null +++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -0,0 +1,1694 @@ +@@ -0,0 +1,1685 @@ +/* + * BCM2835 SD host driver. + * @@ -133215,7 +132837,7 @@ index 0000000..cf5471f +#ifdef CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER +#define PIO_DMA_BARRIER CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER +#else -+#define PIO_DMA_BARRIER 00 ++#define PIO_DMA_BARRIER 0 +#endif + +#define MIN_FREQ 400000 @@ -133276,6 +132898,7 @@ index 0000000..cf5471f + struct dma_chan *dma_chan_rx; /* DMA channel for reads */ + struct dma_chan *dma_chan_tx; /* DMA channel for writes */ + ++ bool allow_dma; + bool have_dma; + bool use_dma; + /*end of DMA part*/ @@ -133721,7 +133344,8 @@ index 0000000..cf5471f + bcm2835_sdhost_set_transfer_irqs(host); + + bcm2835_sdhost_write(host, data->blksz, SDHBCT); -+ bcm2835_sdhost_write(host, data->blocks, SDHBLC); ++ if (host->use_dma) ++ bcm2835_sdhost_write(host, data->blocks, SDHBLC); + + BUG_ON(!host->data); +} @@ -134335,53 +133959,41 @@ index 0000000..cf5471f + + 623->400KHz/27.8MHz + reset value (507)->491159/50MHz ++ ++ BUT, the 3-bit clock divisor in data mode is too small if the ++ core clock is higher than 250MHz, so instead use the SLOW_CARD ++ configuration bit to force the use of the ident clock divisor ++ at all times. + */ + + host->mmc->actual_clock = 0; + -+ if (clock <= 400000) { -+ /* It's an ident clock - don't worry about the lower bits */ -+ host->slow_card = true; -+ if (clock < 100000) { -+ /* Can't stop the clock, but make it as slow as possible -+ * to show willing -+ */ -+ host->cdiv = SDCDIV_MAX_CDIV; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ return; -+ } -+ div = host->max_clk / clock; -+ if ((host->max_clk / div) > 400000) -+ div++; -+ div -= 2; -+ -+ if (div > SDCDIV_MAX_CDIV) -+ div = SDCDIV_MAX_CDIV; -+ -+ host->mmc->actual_clock = host->max_clk / (div + 2); -+ } else { -+ /* It's a data clock - choose the lower bits, and make -+ the upper bits vaguely sensible */ -+ host->slow_card = false; -+ -+ for (div = 0x0; div < 0x7; div++) { -+ if ((host->max_clk / (div + 2)) <= clock) -+ break; -+ } -+ -+ host->mmc->actual_clock = host->max_clk / (div + 2); -+ -+ div |= (((host->max_clk / 400000) - 2) & ~0x7); -+ if ((host->max_clk / (div + 2)) > 400000) -+ div += 0x8; ++ if (clock < 100000) { ++ /* Can't stop the clock, but make it as slow as possible ++ * to show willing ++ */ ++ host->cdiv = SDCDIV_MAX_CDIV; ++ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); ++ return; + } + ++ div = host->max_clk / clock; ++ if (div < 2) ++ div = 2; ++ if ((host->max_clk / div) > clock) ++ div++; ++ div -= 2; ++ ++ if (div > SDCDIV_MAX_CDIV) ++ div = SDCDIV_MAX_CDIV; ++ ++ host->mmc->actual_clock = host->max_clk / (div + 2); ++ + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + -+ pr_debug(DRIVER_NAME ": cdiv=%x (actual clock %d, data clock %d)\n", -+ host->cdiv, host->mmc->actual_clock, -+ host->max_clk / ((div & 0x7) + 2)); ++ pr_debug(DRIVER_NAME ": clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", ++ clock, host->max_clk, host->cdiv, host->mmc->actual_clock); +} + +static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) @@ -134447,7 +134059,6 @@ index 0000000..cf5471f + + spin_lock_irqsave(&host->lock, flags); + -+ pr_debug("host->clock = %d\n", host->clock); + if (!ios->clock || ios->clock != host->clock) { + bcm2835_sdhost_set_clock(host, ios->clock); + host->clock = ios->clock; @@ -134460,9 +134071,8 @@ index 0000000..cf5471f + + host->hcfg |= SDHCFG_WIDE_INT_BUS; + -+ host->hcfg &= ~SDHCFG_SLOW_CARD; -+ if (host->slow_card || !ALLOW_FAST) -+ host->hcfg |= SDHCFG_SLOW_CARD; ++ /* Disable clever clock switching, to cope with fast core clocks */ ++ host->hcfg |= SDHCFG_SLOW_CARD; + + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + @@ -134490,7 +134100,7 @@ index 0000000..cf5471f +} + + -+static struct mmc_host_ops bcm2835_ops = { ++static struct mmc_host_ops bcm2835_sdhost_ops = { + .request = bcm2835_sdhost_request, + .set_ios = bcm2835_sdhost_set_ios, + .enable_sdio_irq = bcm2835_sdhost_enable_sdio_irq, @@ -134554,8 +134164,6 @@ index 0000000..cf5471f + + bcm2835_sdhost_reset(host); + -+ mmc->ops = &bcm2835_ops; -+ mmc->f_max = host->max_clk; + mmc->f_max = host->max_clk; + mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV; + @@ -134565,14 +134173,14 @@ index 0000000..cf5471f + mmc->max_busy_timeout = (1 << 27) / host->timeout_clk; +#endif + /* host controller capabilities */ -+ mmc->caps = /*XXX MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | ++ mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | + MMC_CAP_NEEDS_POLL | + (ALLOW_CMD23 * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + -+ if (ALLOW_DMA) { ++ if (host->allow_dma) { + if (!host->dma_chan_tx || !host->dma_chan_rx || + IS_ERR(host->dma_chan_tx) || IS_ERR(host->dma_chan_rx)) { + pr_err("%s: Unable to initialise DMA channels. Falling back to PIO\n", DRIVER_NAME); @@ -134659,7 +134267,7 @@ index 0000000..cf5471f + if (!mmc) + return -ENOMEM; + -+ mmc->ops = &bcm2835_ops; ++ mmc->ops = &bcm2835_sdhost_ops; + host = mmc_priv(mmc); + host->mmc = mmc; + host->timeout = msecs_to_jiffies(1000); @@ -134678,12 +134286,23 @@ index 0000000..cf5471f + (unsigned long)iomem->start, + (unsigned long)host->phys_addr); + -+ if (ALLOW_DMA) { ++ host->allow_dma = ALLOW_DMA; ++ ++ if (node) { ++ /* Read any custom properties */ ++ of_property_read_u32(node, ++ "brcm,delay-after-stop", ++ &host->delay_after_stop); ++ host->allow_dma = ALLOW_DMA && ++ !of_property_read_bool(node, "brcm,force-pio"); ++ } ++ ++ if (host->allow_dma) { + if (node) { + host->dma_chan_tx = -+ of_dma_request_slave_channel(node, "tx"); ++ dma_request_slave_channel(dev, "tx"); + host->dma_chan_rx = -+ of_dma_request_slave_channel(node, "rx"); ++ dma_request_slave_channel(dev, "rx"); + } else { + dma_cap_mask_t mask; + @@ -134697,12 +134316,6 @@ index 0000000..cf5471f + } + } + -+ if (node) { -+ /* Read any custom properties */ -+ of_property_read_u32(node, -+ "brcm,delay_after_stop", -+ &host->delay_after_stop); -+ } + clk = devm_clk_get(dev, NULL); + if (IS_ERR(clk)) { + dev_err(dev, "could not get clk\n"); @@ -134793,10 +134406,10 @@ index 0000000..cf5471f +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From d0ad183e75bf9660c672a66864c30f35e39c2285 Mon Sep 17 00:00:00 2001 +From 4504d17456cfc2f8b8b987d8709adcf759c8ea2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 28 Apr 2015 19:24:30 +0200 -Subject: [PATCH 127/154] BCM270x: Add memory and irq resources to dmaengine +Subject: [PATCH 122/216] BCM270x: Add memory and irq resources to dmaengine device and DT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -134934,7 +134547,7 @@ index b848e4a..703215d 100644 #if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 56d16a4..0179f25f 100644 +index dcad008..97116c3 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -56,7 +56,6 @@ @@ -135025,10 +134638,10 @@ index 56d16a4..0179f25f 100644 #if defined(CONFIG_W1_MASTER_GPIO) || defined(CONFIG_W1_MASTER_GPIO_MODULE) -From c738deeab4bb66c4e8d546c5ead7e6489adef231 Mon Sep 17 00:00:00 2001 +From 4111e2c08fdfcfaa72b531689e2b9bc2b8c29453 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 28 Apr 2015 19:25:43 +0200 -Subject: [PATCH 128/154] dmaengine: bcm2708: Merge with arch dma.c driver and +Subject: [PATCH 123/216] dmaengine: bcm2708: Merge with arch dma.c driver and disable dma.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -135859,10 +135472,10 @@ index 0000000..2310e34 + +#endif /* _PLAT_BCM2708_DMA_H */ -From 0e5fbba02ca988fa8955301d3a2fe4859edf297f Mon Sep 17 00:00:00 2001 +From 2b9f3386a080d00da4e6335272fe3b94cc51cfef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 28 Apr 2015 19:26:59 +0200 -Subject: [PATCH 129/154] BCM270x: dma: Remove driver +Subject: [PATCH 124/216] BCM270x: dma: Remove driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136708,10 +136321,10 @@ index a5e58d1..0000000 - -MODULE_PARM_DESC(dmachans, "Bitmap of DMA channels available to the ARM"); -From 757e5f795ceb0d9c52dcda952e021d2a233e3064 Mon Sep 17 00:00:00 2001 +From d2647dd924553835bc9b8f6ec0dce6cc25662d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 28 Apr 2015 19:54:17 +0200 -Subject: [PATCH 130/154] BCM270x: Remove dmaman device +Subject: [PATCH 125/216] BCM270x: Remove dmaman device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136760,7 +136373,7 @@ index 703215d..486e090 100644 bcm_register_device(&bcm2708_vcio_device); #ifdef CONFIG_BCM2708_GPIO diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 0179f25f..dcd3b47 100644 +index 97116c3..44bfc50 100644 --- a/arch/arm/mach-bcm2709/bcm2709.c +++ b/arch/arm/mach-bcm2709/bcm2709.c @@ -257,21 +257,6 @@ static struct amba_device *amba_devs[] __initdata = { @@ -136794,10 +136407,10 @@ index 0179f25f..dcd3b47 100644 bcm_register_device(&bcm2708_vcio_device); #ifdef CONFIG_BCM2708_GPIO -From 4e2b210eeb03a1ff3cd5913626735d101a546ffd Mon Sep 17 00:00:00 2001 +From 149df0acaf7510d53047e19054e3b13607f60afd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:24:02 +0200 -Subject: [PATCH 131/154] bcm2835: bcm2835_defconfig +Subject: [PATCH 126/216] bcm2835: bcm2835_defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136885,10 +136498,10 @@ index 31cb073..245aede 100644 CONFIG_EXT2_FS=y CONFIG_EXT2_FS_XATTR=y -From a7be6fff3d6583b745414afa57543e2478b72c65 Mon Sep 17 00:00:00 2001 +From 40cd8a80edbedd6bef0da2bcd55e777f80ef30ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:24:46 +0200 -Subject: [PATCH 132/154] mmc: bcm2835-mmc: Make available on ARCH_BCM2835 +Subject: [PATCH 127/216] mmc: bcm2835-mmc: Make available on ARCH_BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136914,10 +136527,10 @@ index 1666c6c..41d6e47 100644 This selects the MMC Interface on BCM2835. -From 5f6edf81dfb2f425b3a961c56cf811c9410a1cc6 Mon Sep 17 00:00:00 2001 +From 6c0c225509561cc261c594db00d429f2c032ebfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:28:22 +0200 -Subject: [PATCH 133/154] bcm2835: bcm2835_defconfig enable MMC_BCM2835 +Subject: [PATCH 128/216] bcm2835: bcm2835_defconfig enable MMC_BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -136952,10 +136565,10 @@ index 245aede..cf2e7a6 100644 # CONFIG_IOMMU_SUPPORT is not set CONFIG_EXT2_FS=y -From 2e7d6a25e832b1fa62e790c318385d2d0af3aa1c Mon Sep 17 00:00:00 2001 +From 8bff84b0504771b895a12dcc5975b26345a3f9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 29 Apr 2015 17:29:04 +0200 -Subject: [PATCH 134/154] bcm2835: Change to use bcm2835-mmc in Device Tree +Subject: [PATCH 129/216] bcm2835: Change to use bcm2835-mmc in Device Tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -137013,732 +136626,10 @@ index 3342cb1..f2dec21 100644 clk_i2c: clock@1 { -From 67fd2c5af2cdfa7a1659258e0f4f7ec8269a0dd6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Wed, 29 Apr 2015 16:42:21 +0100 -Subject: [PATCH 135/154] vchiq: Allocation does not need to be atomic - ---- - drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 7e7b09f..d7ebdfc 100644 ---- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -99,7 +99,7 @@ vchiq_platform_init(VCHIQ_STATE_T *state) - frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); - - g_slot_mem = dma_alloc_coherent(NULL, g_slot_mem_size + frag_mem_size, -- &g_slot_phys, GFP_ATOMIC); -+ &g_slot_phys, GFP_KERNEL); - - if (!g_slot_mem) { - vchiq_log_error(vchiq_arm_log_level, - -From aa6b3e63fae5d01a11706503841c141478d46536 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 1 May 2015 17:46:16 +0100 -Subject: [PATCH 136/154] bcm2835-mmc: Add option to disable delays on some - writeb calls - ---- - drivers/mmc/host/bcm2835-mmc.c | 29 +++++++++++++++++++++-------- - 1 file changed, 21 insertions(+), 8 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 7010204..8fb4cf8 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -240,7 +240,7 @@ static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int re - - } - --static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg) -+static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg, int from) - { - u32 oldval = bcm2835_mmc_readl(host, reg & ~3); - u32 byte_num = reg & 3; -@@ -248,7 +248,16 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg - u32 mask = 0xff << byte_shift; - u32 newval = (oldval & ~mask) | (val << byte_shift); - -- bcm2835_mmc_writel(host, newval, reg & ~3, 1); -+ if ((reg & ~3) == 0x28) // SDHCI_HOST_CONTROL, SDHCI_POWER_CONTROL, SDHCI_BLOCK_GAP_CONTROL, SDHCI_WAKE_UP_CONTROL -+ { -+ WARN_ON(oldval & ((1<<16)|(1<<17))); -+ } -+ else if ((reg & ~3) == 0x2C) // SDHCI_CLOCK_CONTROL, SDHCI_TIMEOUT_CONTROL, SDHCI_SOFTWARE_RESET -+ { -+ WARN_ON(oldval & ((1<<24)|(1<<25)|(1<<26))); -+ } -+ -+ bcm2835_mmc_writel(host, newval, reg & ~3, from + 10); - } - - -@@ -333,7 +342,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - { - unsigned long timeout; - -- bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET); -+ bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET, 0); - - if (mask & SDHCI_RESET_ALL) - host->clock = 0; -@@ -347,7 +356,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - pr_err("%s: Reset 0x%x never completed.\n", - mmc_hostname(host->mmc), (int)mask); - bcm2835_mmc_dumpregs(host); -- return; -+ goto exit; - } - timeout--; - mdelay(1); -@@ -357,6 +366,9 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - host->max_delay = 100-timeout; - pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); - } -+exit: -+ if ((mmc_debug & (1<<15))) -+ bcm2835_mmc_writeb(host, TIMEOUT_VAL, SDHCI_TIMEOUT_CONTROL, 1); - } - - static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); -@@ -609,9 +621,10 @@ static void bcm2835_mmc_prepare_data(struct bcm2835_host *host, struct mmc_comma - - WARN_ON(host->data); - -+ if (!(mmc_debug & (1<<14))) - if (data || (cmd->flags & MMC_RSP_BUSY)) { - count = TIMEOUT_VAL; -- bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL); -+ bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL, 1); - } - - if (!data) -@@ -1237,7 +1250,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - if (host->pwr != SDHCI_POWER_330) { - host->pwr = SDHCI_POWER_330; -- bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL); -+ bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL, 2); - } - - ctrl = bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL); -@@ -1252,7 +1265,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - ctrl &= ~SDHCI_CTRL_HISPD; /* NO_HISPD_BIT */ - - -- bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL, 3); - /* - * We only need to set Driver Strength if the - * preset value enable is not set. -@@ -1273,7 +1286,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - /* Re-enable SD Clock */ - bcm2835_mmc_set_clock(host, host->clock); -- bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL, 4); - - mmiowb(); - - -From 39315a8ea76cfb3aae6853aedd409e89886d8fd4 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 1 May 2015 17:46:56 +0100 -Subject: [PATCH 137/154] bcm2835-mmc: warn on accesses without spinlock - ---- - drivers/mmc/host/bcm2835-mmc.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 8fb4cf8..7315e58 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -164,6 +164,7 @@ static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int re - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -+ WARN_ON(!spin_is_locked(&host->lock)); - writel(val, host->ioaddr + reg); - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); - -@@ -189,6 +190,7 @@ static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -+ WARN_ON(!spin_is_locked(&host->lock)); - writel(val, host->ioaddr + reg); - - delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -@@ -213,6 +215,7 @@ static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -+ WARN_ON(!spin_is_locked(&host->lock)); - ret = readl(host->ioaddr + reg); - - if (mmc_debug & (1<<10)) -@@ -586,11 +589,14 @@ static void bcm2835_mmc_transfer_dma(struct bcm2835_host *host) - dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); - } - if (desc) { -+ unsigned long flags; -+ spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_unsignal_irqs(host, SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL); - host->tx_desc = desc; - desc->callback = bcm2835_mmc_dma_complete; - desc->callback_param = host; -+ spin_unlock_irqrestore(&host->lock, flags); - dmaengine_submit(desc); - dma_async_issue_pending(dma_chan); - } -@@ -1349,7 +1355,7 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param) - - - --int bcm2835_mmc_add_host(struct bcm2835_host *host) -+static int bcm2835_mmc_add_host(struct bcm2835_host *host) - { - struct mmc_host *mmc = host->mmc; - struct device *dev = mmc->parent; -@@ -1375,8 +1381,6 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - host->flags = SDHCI_AUTO_CMD23; - -- spin_lock_init(&host->lock); -- - dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); - if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - -From 547b7363c0a41772fa3b8eb4b34f7cf343a2e9a2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 1 May 2015 18:35:38 +0100 -Subject: [PATCH 138/154] bcm2835-mmc: Add locks when accessing sdhost - registers - ---- - drivers/mmc/host/bcm2835-mmc.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 7315e58..2d00e0f 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -344,7 +344,11 @@ static void bcm2835_mmc_dumpregs(struct bcm2835_host *host) - static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - { - unsigned long timeout; -+ unsigned long flags; -+ -+ BUG_ON(spin_is_locked(&host->lock)); - -+ spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET, 0); - - if (mask & SDHCI_RESET_ALL) -@@ -362,7 +366,9 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - goto exit; - } - timeout--; -+ spin_unlock_irqrestore(&host->lock, flags); - mdelay(1); -+ spin_lock_irqsave(&host->lock, flags); - } - - if (100-timeout > 10 && 100-timeout > host->max_delay) { -@@ -372,12 +378,14 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - exit: - if ((mmc_debug & (1<<15))) - bcm2835_mmc_writeb(host, TIMEOUT_VAL, SDHCI_TIMEOUT_CONTROL, 1); -+ spin_unlock_irqrestore(&host->lock, flags); - } - - static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); - - static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - { -+ unsigned long flags; - if (soft) - bcm2835_mmc_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA); - else -@@ -389,8 +397,10 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | - SDHCI_INT_RESPONSE; - -+ spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); - bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); -+ spin_unlock_irqrestore(&host->lock, flags); - - if (soft) { - /* force clock reconfiguration */ -@@ -1339,8 +1349,10 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param) - (mrq->data && (mrq->data->error || - (mrq->data->stop && mrq->data->stop->error))))) { - -+ spin_unlock_irqrestore(&host->lock, flags); - bcm2835_mmc_reset(host, SDHCI_RESET_CMD); - bcm2835_mmc_reset(host, SDHCI_RESET_DATA); -+ spin_lock_irqsave(&host->lock, flags); - } - - host->mrq = NULL; - -From fdc5e42967bafe096808671f3955d110bbb65764 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 1 May 2015 17:35:50 +0100 -Subject: [PATCH 139/154] squash: sdhost support for faster core clocks, and - force-pio mode - ---- - arch/arm/boot/dts/sdhost-overlay.dts | 13 ++++- - drivers/mmc/host/bcm2835-sdhost.c | 101 ++++++++++++++++------------------- - 2 files changed, 57 insertions(+), 57 deletions(-) - -diff --git a/arch/arm/boot/dts/sdhost-overlay.dts b/arch/arm/boot/dts/sdhost-overlay.dts -index 234914f1..33db96e 100644 ---- a/arch/arm/boot/dts/sdhost-overlay.dts -+++ b/arch/arm/boot/dts/sdhost-overlay.dts -@@ -18,7 +18,7 @@ - dmas = <&dma 13>, - <&dma 13>; - dma-names = "tx", "rx"; -- brcm,delay_after_stop = <0>; -+ brcm,delay-after-stop = <0>; - pinctrl-names = "default"; - pinctrl-0 = <&sdhost_pins>; - status = "okay"; -@@ -58,7 +58,16 @@ - }; - }; - -+ fragment@3 { -+ target-path = "/__overrides__"; -+ __overlay__ { -+ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; -+ }; -+ }; -+ - __overrides__ { -- delay_after_stop = <&sdhost>,"brcm,delay_after_stop:0"; -+ delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; -+ force_pio = <&sdhost>,"brcm,force-pio?"; -+ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; - }; - }; -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index cf5471f..98bbd96 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -115,7 +115,7 @@ - #ifdef CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER - #define PIO_DMA_BARRIER CONFIG_MMC_BCM2835_SDHOST_PIO_DMA_BARRIER - #else --#define PIO_DMA_BARRIER 00 -+#define PIO_DMA_BARRIER 0 - #endif - - #define MIN_FREQ 400000 -@@ -176,6 +176,7 @@ struct bcm2835_host { - struct dma_chan *dma_chan_rx; /* DMA channel for reads */ - struct dma_chan *dma_chan_tx; /* DMA channel for writes */ - -+ bool allow_dma; - bool have_dma; - bool use_dma; - /*end of DMA part*/ -@@ -621,7 +622,8 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co - bcm2835_sdhost_set_transfer_irqs(host); - - bcm2835_sdhost_write(host, data->blksz, SDHBCT); -- bcm2835_sdhost_write(host, data->blocks, SDHBLC); -+ if (host->use_dma) -+ bcm2835_sdhost_write(host, data->blocks, SDHBLC); - - BUG_ON(!host->data); - } -@@ -1235,53 +1237,41 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) - - 623->400KHz/27.8MHz - reset value (507)->491159/50MHz -+ -+ BUT, the 3-bit clock divisor in data mode is too small if the -+ core clock is higher than 250MHz, so instead use the SLOW_CARD -+ configuration bit to force the use of the ident clock divisor -+ at all times. - */ - - host->mmc->actual_clock = 0; - -- if (clock <= 400000) { -- /* It's an ident clock - don't worry about the lower bits */ -- host->slow_card = true; -- if (clock < 100000) { -- /* Can't stop the clock, but make it as slow as possible -- * to show willing -- */ -- host->cdiv = SDCDIV_MAX_CDIV; -- bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -- return; -- } -- div = host->max_clk / clock; -- if ((host->max_clk / div) > 400000) -- div++; -- div -= 2; -- -- if (div > SDCDIV_MAX_CDIV) -- div = SDCDIV_MAX_CDIV; -- -- host->mmc->actual_clock = host->max_clk / (div + 2); -- } else { -- /* It's a data clock - choose the lower bits, and make -- the upper bits vaguely sensible */ -- host->slow_card = false; -+ if (clock < 100000) { -+ /* Can't stop the clock, but make it as slow as possible -+ * to show willing -+ */ -+ host->cdiv = SDCDIV_MAX_CDIV; -+ bcm2835_sdhost_write(host, host->cdiv, SDCDIV); -+ return; -+ } - -- for (div = 0x0; div < 0x7; div++) { -- if ((host->max_clk / (div + 2)) <= clock) -- break; -- } -+ div = host->max_clk / clock; -+ if (div < 2) -+ div = 2; -+ if ((host->max_clk / div) > clock) -+ div++; -+ div -= 2; - -- host->mmc->actual_clock = host->max_clk / (div + 2); -+ if (div > SDCDIV_MAX_CDIV) -+ div = SDCDIV_MAX_CDIV; - -- div |= (((host->max_clk / 400000) - 2) & ~0x7); -- if ((host->max_clk / (div + 2)) > 400000) -- div += 0x8; -- } -+ host->mmc->actual_clock = host->max_clk / (div + 2); - - host->cdiv = div; - bcm2835_sdhost_write(host, host->cdiv, SDCDIV); - -- pr_debug(DRIVER_NAME ": cdiv=%x (actual clock %d, data clock %d)\n", -- host->cdiv, host->mmc->actual_clock, -- host->max_clk / ((div & 0x7) + 2)); -+ pr_debug(DRIVER_NAME ": clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", -+ clock, host->max_clk, host->cdiv, host->mmc->actual_clock); - } - - static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) -@@ -1347,7 +1337,6 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - spin_lock_irqsave(&host->lock, flags); - -- pr_debug("host->clock = %d\n", host->clock); - if (!ios->clock || ios->clock != host->clock) { - bcm2835_sdhost_set_clock(host, ios->clock); - host->clock = ios->clock; -@@ -1360,9 +1349,8 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - host->hcfg |= SDHCFG_WIDE_INT_BUS; - -- host->hcfg &= ~SDHCFG_SLOW_CARD; -- if (host->slow_card || !ALLOW_FAST) -- host->hcfg |= SDHCFG_SLOW_CARD; -+ /* Disable clever clock switching, to cope with fast core clocks */ -+ host->hcfg |= SDHCFG_SLOW_CARD; - - bcm2835_sdhost_write(host, host->hcfg, SDHCFG); - -@@ -1390,7 +1378,7 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, - } - - --static struct mmc_host_ops bcm2835_ops = { -+static struct mmc_host_ops bcm2835_sdhost_ops = { - .request = bcm2835_sdhost_request, - .set_ios = bcm2835_sdhost_set_ios, - .enable_sdio_irq = bcm2835_sdhost_enable_sdio_irq, -@@ -1454,8 +1442,6 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - - bcm2835_sdhost_reset(host); - -- mmc->ops = &bcm2835_ops; -- mmc->f_max = host->max_clk; - mmc->f_max = host->max_clk; - mmc->f_min = host->max_clk / SDCDIV_MAX_CDIV; - -@@ -1465,14 +1451,14 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) - mmc->max_busy_timeout = (1 << 27) / host->timeout_clk; - #endif - /* host controller capabilities */ -- mmc->caps = /*XXX MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | -+ mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | - MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | - MMC_CAP_NEEDS_POLL | - (ALLOW_CMD23 * MMC_CAP_CMD23); - - spin_lock_init(&host->lock); - -- if (ALLOW_DMA) { -+ if (host->allow_dma) { - if (!host->dma_chan_tx || !host->dma_chan_rx || - IS_ERR(host->dma_chan_tx) || IS_ERR(host->dma_chan_rx)) { - pr_err("%s: Unable to initialise DMA channels. Falling back to PIO\n", DRIVER_NAME); -@@ -1559,7 +1545,7 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - if (!mmc) - return -ENOMEM; - -- mmc->ops = &bcm2835_ops; -+ mmc->ops = &bcm2835_sdhost_ops; - host = mmc_priv(mmc); - host->mmc = mmc; - host->timeout = msecs_to_jiffies(1000); -@@ -1578,7 +1564,18 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - (unsigned long)iomem->start, - (unsigned long)host->phys_addr); - -- if (ALLOW_DMA) { -+ host->allow_dma = ALLOW_DMA; -+ -+ if (node) { -+ /* Read any custom properties */ -+ of_property_read_u32(node, -+ "brcm,delay-after-stop", -+ &host->delay_after_stop); -+ host->allow_dma = ALLOW_DMA && -+ !of_property_read_bool(node, "brcm,force-pio"); -+ } -+ -+ if (host->allow_dma) { - if (node) { - host->dma_chan_tx = - of_dma_request_slave_channel(node, "tx"); -@@ -1597,12 +1594,6 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - } - } - -- if (node) { -- /* Read any custom properties */ -- of_property_read_u32(node, -- "brcm,delay_after_stop", -- &host->delay_after_stop); -- } - clk = devm_clk_get(dev, NULL); - if (IS_ERR(clk)) { - dev_err(dev, "could not get clk\n"); - -From 503ce7c5d43ec5fa137fbcc4b764542e5c524b93 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 5 May 2015 10:39:39 +0100 -Subject: [PATCH 140/154] bcm2835-mmc/sdhost: of_dma_request_slave_channel - isn't exported... - -of_dma_request_slave_channel isn't an exported function, so can't be -used from within a module. Replace with dma_request_slave_channel, -which calls the of_ variant but IS exported. - -See: https://github.com/raspberrypi/linux/issues/952 - -Signed-off-by: Phil Elwell ---- - drivers/mmc/host/bcm2835-mmc.c | 4 ++-- - drivers/mmc/host/bcm2835-sdhost.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 2d00e0f..8edae29 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -1493,8 +1493,8 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) - - if (!(mmc_debug & (1<<12))) { - if (node) { -- host->dma_chan_tx = of_dma_request_slave_channel(node, "tx"); -- host->dma_chan_rx = of_dma_request_slave_channel(node, "rx"); -+ host->dma_chan_tx = dma_request_slave_channel(dev, "tx"); -+ host->dma_chan_rx = dma_request_slave_channel(dev, "rx"); - } else { - dma_cap_mask_t mask; - -diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c -index 98bbd96..0c311b5 100644 ---- a/drivers/mmc/host/bcm2835-sdhost.c -+++ b/drivers/mmc/host/bcm2835-sdhost.c -@@ -1578,9 +1578,9 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) - if (host->allow_dma) { - if (node) { - host->dma_chan_tx = -- of_dma_request_slave_channel(node, "tx"); -+ dma_request_slave_channel(dev, "tx"); - host->dma_chan_rx = -- of_dma_request_slave_channel(node, "rx"); -+ dma_request_slave_channel(dev, "rx"); - } else { - dma_cap_mask_t mask; - - -From a80e690cd5f73b47a29d930983e663063d447541 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 14:44:41 +0100 -Subject: [PATCH 141/154] squash: bcm2709: Allow to build without SMP - ---- - arch/arm/mach-bcm2709/bcm2709.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index dcd3b47..439a2d6 100644 ---- a/arch/arm/mach-bcm2709/bcm2709.c -+++ b/arch/arm/mach-bcm2709/bcm2709.c -@@ -1197,6 +1197,7 @@ static void __init board_reserve(void) - } - - -+#ifdef CONFIG_SMP - #include - - #include -@@ -1299,6 +1300,7 @@ struct smp_operations bcm2709_smp_ops __initdata = { - .smp_secondary_init = bcm2709_secondary_init, - .smp_boot_secondary = bcm2709_boot_secondary, - }; -+#endif - - static const char * const bcm2709_compat[] = { - "brcm,bcm2709", -@@ -1308,7 +1310,9 @@ static const char * const bcm2709_compat[] = { - - MACHINE_START(BCM2709, "BCM2709") - /* Maintainer: Broadcom Europe Ltd. */ -+#ifdef CONFIG_SMP - .smp = smp_ops(bcm2709_smp_ops), -+#endif - .map_io = bcm2709_map_io, - .init_irq = bcm2709_init_irq, - .init_time = bcm2709_timer_init, -@@ -1321,7 +1325,9 @@ MACHINE_END - - MACHINE_START(BCM2708, "BCM2709") - /* Maintainer: Broadcom Europe Ltd. */ -+#ifdef CONFIG_SMP - .smp = smp_ops(bcm2709_smp_ops), -+#endif - .map_io = bcm2709_map_io, - .init_irq = bcm2709_init_irq, - .init_time = bcm2709_timer_init, - -From 12149d45facaf1a03592b41a7f4ed0ef64898258 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 14:45:00 +0100 -Subject: [PATCH 142/154] squash: entry_macro: Allow to build without SMP - ---- - arch/arm/mach-bcm2709/include/mach/entry-macro.S | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/arm/mach-bcm2709/include/mach/entry-macro.S b/arch/arm/mach-bcm2709/include/mach/entry-macro.S -index 101d9f1..08d184c 100644 ---- a/arch/arm/mach-bcm2709/include/mach/entry-macro.S -+++ b/arch/arm/mach-bcm2709/include/mach/entry-macro.S -@@ -35,7 +35,7 @@ - ldr \irqstat, = __io_address(ARM_LOCAL_IRQ_PENDING0) @ local interrupt source - add \irqstat, \irqstat, \base, lsl #2 - ldr \tmp, [\irqstat] -- -+#ifdef CONFIG_SMP - /* test for mailbox0 (IPI) interrupt */ - tst \tmp, #0x10 - beq 1030f -@@ -53,7 +53,7 @@ - mov r1, sp - adr lr, BSYM(1b) - b do_IPI -- -+#endif - 1030: - /* check gpu interrupt */ - tst \tmp, #0x100 - -From ef2659470ba228678f2d46b4767b456d08ff6bef Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 14:45:12 +0100 -Subject: [PATCH 143/154] squash: dwc_otg: Allow to build without SMP - ---- - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -index 276ad0c7..7e0c726 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -@@ -78,7 +78,7 @@ void notrace _fiq_print(enum fiq_debug_level dbg_lvl, volatile struct fiq_state - * fiq_fsm_spin_lock() - ARMv6+ bare bones spinlock - * Must be called with local interrupts and FIQ disabled. - */ --#ifdef CONFIG_ARCH_BCM2709 -+#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) - inline void fiq_fsm_spin_lock(fiq_lock_t *lock) - { - unsigned long tmp; -@@ -111,7 +111,7 @@ inline void fiq_fsm_spin_lock(fiq_lock_t *lock) { } - /** - * fiq_fsm_spin_unlock() - ARMv6+ bare bones spinunlock - */ --#ifdef CONFIG_ARCH_BCM2709 -+#if defined(CONFIG_ARCH_BCM2709) && defined(CONFIG_SMP) - inline void fiq_fsm_spin_unlock(fiq_lock_t *lock) - { - smp_mb(); - -From 121d87c832937a71df50e83be0bfd7da9016e9b3 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 14:56:45 +0100 -Subject: [PATCH 144/154] squash: bcm2709: Fix build with SYSTEM_TIMER defined - ---- - arch/arm/mach-bcm2709/bcm2709.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c -index 439a2d6..44bfc50 100644 ---- a/arch/arm/mach-bcm2709/bcm2709.c -+++ b/arch/arm/mach-bcm2709/bcm2709.c -@@ -1103,7 +1103,7 @@ static void __init bcm2709_timer_init(void) - /* - * Make irqs happen for the system timer - */ -- setup_irq(IRQ_TIMER3, &bcm2708_timer_irq); -+ setup_irq(IRQ_TIMER3, &bcm2709_timer_irq); - - sched_clock_register(bcm2709_read_sched_clock, 32, STC_FREQ_HZ); - -@@ -1117,7 +1117,7 @@ static void __init bcm2709_timer_init(void) - timer0_clockevent.cpumask = cpumask_of(0); - clockevents_register_device(&timer0_clockevent); - -- register_current_timer_delay(&bcm2708_delay_timer); -+ register_current_timer_delay(&bcm2709_delay_timer); - } - - #else - -From cb9d41ece08a5675207633802d3a71b7b8c0897c Mon Sep 17 00:00:00 2001 +From 89df9a42f6e60b3c54c4b49b1fafff7ef201ac72 Mon Sep 17 00:00:00 2001 From: Christopher Freeman Date: Wed, 4 Mar 2015 01:16:58 -0800 -Subject: [PATCH 145/154] dmaengine: increment privatecnt when using +Subject: [PATCH 130/216] dmaengine: increment privatecnt when using dma_get_any_slave_channel Channels allocated via dma_get_any_slave_channel were not increasing @@ -137775,676 +136666,10 @@ index ac336a9..bb2b914 100644 } -From a7865cec5171ab86807a1c9e27d003149574fa1e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:00:01 +0100 -Subject: [PATCH 147/154] Revert "bcm2835-mmc: Add locks when accessing sdhost - registers" - -This reverts commit 547b7363c0a41772fa3b8eb4b34f7cf343a2e9a2. ---- - drivers/mmc/host/bcm2835-mmc.c | 12 ------------ - 1 file changed, 12 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 8edae29..3345612 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -344,11 +344,7 @@ static void bcm2835_mmc_dumpregs(struct bcm2835_host *host) - static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - { - unsigned long timeout; -- unsigned long flags; -- -- BUG_ON(spin_is_locked(&host->lock)); - -- spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET, 0); - - if (mask & SDHCI_RESET_ALL) -@@ -366,9 +362,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - goto exit; - } - timeout--; -- spin_unlock_irqrestore(&host->lock, flags); - mdelay(1); -- spin_lock_irqsave(&host->lock, flags); - } - - if (100-timeout > 10 && 100-timeout > host->max_delay) { -@@ -378,14 +372,12 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - exit: - if ((mmc_debug & (1<<15))) - bcm2835_mmc_writeb(host, TIMEOUT_VAL, SDHCI_TIMEOUT_CONTROL, 1); -- spin_unlock_irqrestore(&host->lock, flags); - } - - static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); - - static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - { -- unsigned long flags; - if (soft) - bcm2835_mmc_reset(host, SDHCI_RESET_CMD|SDHCI_RESET_DATA); - else -@@ -397,10 +389,8 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | - SDHCI_INT_RESPONSE; - -- spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); - bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); -- spin_unlock_irqrestore(&host->lock, flags); - - if (soft) { - /* force clock reconfiguration */ -@@ -1349,10 +1339,8 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param) - (mrq->data && (mrq->data->error || - (mrq->data->stop && mrq->data->stop->error))))) { - -- spin_unlock_irqrestore(&host->lock, flags); - bcm2835_mmc_reset(host, SDHCI_RESET_CMD); - bcm2835_mmc_reset(host, SDHCI_RESET_DATA); -- spin_lock_irqsave(&host->lock, flags); - } - - host->mrq = NULL; - -From 73f24007e994cb3df4c5726b875a49e8fa1093ab Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:00:10 +0100 -Subject: [PATCH 148/154] Revert "bcm2835-mmc: warn on accesses without - spinlock" - -This reverts commit 39315a8ea76cfb3aae6853aedd409e89886d8fd4. ---- - drivers/mmc/host/bcm2835-mmc.c | 10 +++------- - 1 file changed, 3 insertions(+), 7 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 3345612..81e75d7 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -164,7 +164,6 @@ static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int re - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -- WARN_ON(!spin_is_locked(&host->lock)); - writel(val, host->ioaddr + reg); - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); - -@@ -190,7 +189,6 @@ static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -- WARN_ON(!spin_is_locked(&host->lock)); - writel(val, host->ioaddr + reg); - - delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -@@ -215,7 +213,6 @@ static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) - while (bcm2835_mmc_axi_outstanding_writes() > 0) - cpu_relax(); - -- WARN_ON(!spin_is_locked(&host->lock)); - ret = readl(host->ioaddr + reg); - - if (mmc_debug & (1<<10)) -@@ -589,14 +586,11 @@ static void bcm2835_mmc_transfer_dma(struct bcm2835_host *host) - dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); - } - if (desc) { -- unsigned long flags; -- spin_lock_irqsave(&host->lock, flags); - bcm2835_mmc_unsignal_irqs(host, SDHCI_INT_DATA_AVAIL | - SDHCI_INT_SPACE_AVAIL); - host->tx_desc = desc; - desc->callback = bcm2835_mmc_dma_complete; - desc->callback_param = host; -- spin_unlock_irqrestore(&host->lock, flags); - dmaengine_submit(desc); - dma_async_issue_pending(dma_chan); - } -@@ -1355,7 +1349,7 @@ static void bcm2835_mmc_tasklet_finish(unsigned long param) - - - --static int bcm2835_mmc_add_host(struct bcm2835_host *host) -+int bcm2835_mmc_add_host(struct bcm2835_host *host) - { - struct mmc_host *mmc = host->mmc; - struct device *dev = mmc->parent; -@@ -1381,6 +1375,8 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host) - - host->flags = SDHCI_AUTO_CMD23; - -+ spin_lock_init(&host->lock); -+ - dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); - if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - -From 95ae72d689b237f84ffc55c5d03d727fd004186b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:00:19 +0100 -Subject: [PATCH 149/154] Revert "bcm2835-mmc: Add option to disable delays on - some writeb calls" - -This reverts commit aa6b3e63fae5d01a11706503841c141478d46536. ---- - drivers/mmc/host/bcm2835-mmc.c | 29 ++++++++--------------------- - 1 file changed, 8 insertions(+), 21 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 81e75d7..a72304a 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -240,7 +240,7 @@ static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int re - - } - --static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg, int from) -+static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg) - { - u32 oldval = bcm2835_mmc_readl(host, reg & ~3); - u32 byte_num = reg & 3; -@@ -248,16 +248,7 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg - u32 mask = 0xff << byte_shift; - u32 newval = (oldval & ~mask) | (val << byte_shift); - -- if ((reg & ~3) == 0x28) // SDHCI_HOST_CONTROL, SDHCI_POWER_CONTROL, SDHCI_BLOCK_GAP_CONTROL, SDHCI_WAKE_UP_CONTROL -- { -- WARN_ON(oldval & ((1<<16)|(1<<17))); -- } -- else if ((reg & ~3) == 0x2C) // SDHCI_CLOCK_CONTROL, SDHCI_TIMEOUT_CONTROL, SDHCI_SOFTWARE_RESET -- { -- WARN_ON(oldval & ((1<<24)|(1<<25)|(1<<26))); -- } -- -- bcm2835_mmc_writel(host, newval, reg & ~3, from + 10); -+ bcm2835_mmc_writel(host, newval, reg & ~3, 1); - } - - -@@ -342,7 +333,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - { - unsigned long timeout; - -- bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET, 0); -+ bcm2835_mmc_writeb(host, mask, SDHCI_SOFTWARE_RESET); - - if (mask & SDHCI_RESET_ALL) - host->clock = 0; -@@ -356,7 +347,7 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - pr_err("%s: Reset 0x%x never completed.\n", - mmc_hostname(host->mmc), (int)mask); - bcm2835_mmc_dumpregs(host); -- goto exit; -+ return; - } - timeout--; - mdelay(1); -@@ -366,9 +357,6 @@ static void bcm2835_mmc_reset(struct bcm2835_host *host, u8 mask) - host->max_delay = 100-timeout; - pr_warning("Warning: MMC controller hung for %d ms\n", host->max_delay); - } --exit: -- if ((mmc_debug & (1<<15))) -- bcm2835_mmc_writeb(host, TIMEOUT_VAL, SDHCI_TIMEOUT_CONTROL, 1); - } - - static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios); -@@ -621,10 +609,9 @@ static void bcm2835_mmc_prepare_data(struct bcm2835_host *host, struct mmc_comma - - WARN_ON(host->data); - -- if (!(mmc_debug & (1<<14))) - if (data || (cmd->flags & MMC_RSP_BUSY)) { - count = TIMEOUT_VAL; -- bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL, 1); -+ bcm2835_mmc_writeb(host, count, SDHCI_TIMEOUT_CONTROL); - } - - if (!data) -@@ -1250,7 +1237,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - if (host->pwr != SDHCI_POWER_330) { - host->pwr = SDHCI_POWER_330; -- bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL, 2); -+ bcm2835_mmc_writeb(host, SDHCI_POWER_330 | SDHCI_POWER_ON, SDHCI_POWER_CONTROL); - } - - ctrl = bcm2835_mmc_readb(host, SDHCI_HOST_CONTROL); -@@ -1265,7 +1252,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - ctrl &= ~SDHCI_CTRL_HISPD; /* NO_HISPD_BIT */ - - -- bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL, 3); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); - /* - * We only need to set Driver Strength if the - * preset value enable is not set. -@@ -1286,7 +1273,7 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) - - /* Re-enable SD Clock */ - bcm2835_mmc_set_clock(host, host->clock); -- bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL, 4); -+ bcm2835_mmc_writeb(host, ctrl, SDHCI_HOST_CONTROL); - - mmiowb(); - - -From a52246c79aa9d148e6b554d33fb6365d10397540 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:00:28 +0100 -Subject: [PATCH 150/154] Revert "bcm2835-mmc: Add option to disable some - delays" - -This reverts commit d2a4b3ddb4faa2251db5f42012b26beccffcf79e. ---- - drivers/mmc/host/bcm2835-mmc.c | 34 ++++++++++++++++------------------ - 1 file changed, 16 insertions(+), 18 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index a72304a..8ff54d6 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -72,7 +72,6 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - - - /*static */unsigned mmc_debug; --/*static */unsigned mmc_debug2; - - struct bcm2835_host { - spinlock_t lock; -@@ -154,7 +153,7 @@ static inline u32 bcm2835_mmc_axi_outstanding_writes(void) - return (r >> 16) & 0x3ff; - } - --static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) -+static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) - { - u32 delay; - if (mmc_debug & (1<<0)) -@@ -168,7 +167,7 @@ static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int re - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); - - delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -- if (delay && !((1<shadow = newval; - else -- bcm2835_mmc_writel(host, newval, reg & ~3, 0); -+ bcm2835_mmc_writel(host, newval, reg & ~3); - - } - -@@ -248,7 +247,7 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg - u32 mask = 0xff << byte_shift; - u32 newval = (oldval & ~mask) | (val << byte_shift); - -- bcm2835_mmc_writel(host, newval, reg & ~3, 1); -+ bcm2835_mmc_writel(host, newval, reg & ~3); - } - - -@@ -280,7 +279,7 @@ static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) - ier &= ~clear; - /* change which requests generate IRQs - makes no difference to - the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ -- bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); -+ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE); - } - - -@@ -374,8 +373,8 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) - SDHCI_INT_TIMEOUT | SDHCI_INT_DATA_END | - SDHCI_INT_RESPONSE; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); - - if (soft) { - /* force clock reconfiguration */ -@@ -597,8 +596,8 @@ static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) - else - host->ier = (host->ier & ~dma_irqs) | pio_irqs; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); - } - - -@@ -680,7 +679,7 @@ static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, - mode |= SDHCI_TRNS_AUTO_CMD12; - else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { - mode |= SDHCI_TRNS_AUTO_CMD23; -- bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); -+ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2); - } - } - -@@ -743,7 +742,7 @@ void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd - - bcm2835_mmc_prepare_data(host, cmd); - -- bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); -+ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT); - - bcm2835_mmc_set_transfer_mode(host, cmd); - -@@ -900,8 +899,8 @@ static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int en - else - host->ier &= ~SDHCI_INT_CARD_INT; - -- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); -- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); -+ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); - mmiowb(); - } - } -@@ -1048,7 +1047,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) - /* Clear selected interrupts. */ - mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | - SDHCI_INT_BUS_POWER); -- bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); -+ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS); - - - if (intmask & SDHCI_INT_CMD_MASK) -@@ -1078,7 +1077,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) - - if (intmask) { - unexpected |= intmask; -- bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); -+ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS); - } - - if (result == IRQ_NONE) -@@ -1364,7 +1363,7 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - spin_lock_init(&host->lock); - --dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); -+dev_info(dev, "mmc_debug:%x\n", mmc_debug); - if (mmc_debug & (1<<12)) { - dev_info(dev, "Forcing PIO mode\n"); - host->have_dma = false; -@@ -1577,7 +1576,6 @@ static struct platform_driver bcm2835_mmc_driver = { - module_platform_driver(bcm2835_mmc_driver); - - module_param(mmc_debug, uint, 0644); --module_param(mmc_debug2, uint, 0644); - MODULE_ALIAS("platform:mmc-bcm2835"); - MODULE_DESCRIPTION("BCM2835 SDHCI driver"); - MODULE_LICENSE("GPL v2"); - -From 3fefacdc8e061a0929ad3a6342d717a4a1805bb7 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:01:39 +0100 -Subject: [PATCH 151/154] Revert "bcm2835-mmc: Default to disabling - MMC_QUIRK_BLK_NO_CMD23" - -This reverts commit 488911bc7cc59fa99f2d9f33d9c8bad421d8684a. ---- - drivers/mmc/core/quirks.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index bc3bbad..8c90f3f 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -71,7 +71,6 @@ static const struct mmc_fixup mmc_fixup_methods[] = { - - void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - { -- extern unsigned mmc_debug; - const struct mmc_fixup *f; - u64 rev = cid_rev_card(card); - -@@ -99,7 +98,8 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -- if (mmc_debug & (1<<13)) -+ extern unsigned mmc_debug; -+ if (!(mmc_debug & (1<<13))) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; - } - EXPORT_SYMBOL(mmc_fixup_device); - -From 4c0553ea01d701c23aa54168a85c34b5928ccd31 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:01:44 +0100 -Subject: [PATCH 152/154] Revert "bcm2835-mmc: Add option to disable - MMC_QUIRK_BLK_NO_CMD23" - -This reverts commit 497dbba490e4a04b7db0dfe6a553c54a5ab14113. ---- - drivers/mmc/core/quirks.c | 2 -- - drivers/mmc/host/bcm2835-mmc.c | 2 +- - 2 files changed, 1 insertion(+), 3 deletions(-) - -diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c -index 8c90f3f..f472082 100644 ---- a/drivers/mmc/core/quirks.c -+++ b/drivers/mmc/core/quirks.c -@@ -98,8 +98,6 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) - /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. - * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). - */ -- extern unsigned mmc_debug; -- if (!(mmc_debug & (1<<13))) - card->quirks |= MMC_QUIRK_BLK_NO_CMD23; - } - EXPORT_SYMBOL(mmc_fixup_device); -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 8ff54d6..96197da 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -71,7 +71,7 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) - - --/*static */unsigned mmc_debug; -+static unsigned mmc_debug; - - struct bcm2835_host { - spinlock_t lock; - -From b8a19a3a5279b15170aee2c67a13380413402f72 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 5 May 2015 23:03:28 +0100 -Subject: [PATCH 153/154] Revert "bcm2835-mmc: Add range of debug options for - slowing things down" - -This reverts commit f36bd72cd2b1a780caca8b621d212a1337ffeffe. ---- - drivers/mmc/host/bcm2835-mmc.c | 92 ++++-------------------------------------- - 1 file changed, 8 insertions(+), 84 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 96197da..eef0d351 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -71,8 +71,6 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) - #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) - - --static unsigned mmc_debug; -- - struct bcm2835_host { - spinlock_t lock; - -@@ -133,94 +131,20 @@ struct bcm2835_host { - }; - - --static inline u32 bcm2835_mmc_axi_outstanding_reads(void) --{ --#ifdef CONFIG_ARCH_BCM2709 -- u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT)); --#else -- u32 r = 0; --#endif -- return (r >> 0) & 0x3ff; --} -- --static inline u32 bcm2835_mmc_axi_outstanding_writes(void) --{ --#ifdef CONFIG_ARCH_BCM2709 -- u32 r = readl(__io_address(ARM_LOCAL_AXI_COUNT)); --#else -- u32 r = 0; --#endif -- return (r >> 16) & 0x3ff; --} -- - static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) - { -- u32 delay; -- if (mmc_debug & (1<<0)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<1)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); -- - writel(val, host->ioaddr + reg); - udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); -- -- delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); -- if (delay) -- udelay(delay); -- -- if (mmc_debug & (1<<2)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<3)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); - } - - static inline void mmc_raw_writel(struct bcm2835_host *host, u32 val, int reg) - { -- u32 delay; -- if (mmc_debug & (1<<4)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<5)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); -- - writel(val, host->ioaddr + reg); -- -- delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); -- if (delay) -- udelay(delay); -- -- if (mmc_debug & (1<<6)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<7)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); - } - - static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) - { -- u32 ret; -- if (mmc_debug & (1<<8)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<9)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); -- -- ret = readl(host->ioaddr + reg); -- -- if (mmc_debug & (1<<10)) -- while (bcm2835_mmc_axi_outstanding_reads() > 1) -- cpu_relax(); -- if (mmc_debug & (1<<11)) -- while (bcm2835_mmc_axi_outstanding_writes() > 0) -- cpu_relax(); -- return ret; -+ return readl(host->ioaddr + reg); - } - - static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int reg) -@@ -1339,7 +1263,9 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - { - struct mmc_host *mmc = host->mmc; - struct device *dev = mmc->parent; -+#ifndef FORCE_PIO - struct dma_slave_config cfg; -+#endif - int ret; - - bcm2835_mmc_reset(host, SDHCI_RESET_ALL); -@@ -1363,11 +1289,10 @@ int bcm2835_mmc_add_host(struct bcm2835_host *host) - - spin_lock_init(&host->lock); - --dev_info(dev, "mmc_debug:%x\n", mmc_debug); --if (mmc_debug & (1<<12)) { -+#ifdef FORCE_PIO - dev_info(dev, "Forcing PIO mode\n"); - host->have_dma = false; --} else { -+#else - if (IS_ERR_OR_NULL(host->dma_chan_tx) || - IS_ERR_OR_NULL(host->dma_chan_rx)) { - dev_err(dev, "%s: Unable to initialise DMA channels. Falling back to PIO\n", -@@ -1391,7 +1316,7 @@ if (mmc_debug & (1<<12)) { - cfg.dst_addr = 0; - ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); - } --} -+#endif - mmc->max_segs = 128; - mmc->max_req_size = 524288; - mmc->max_seg_size = mmc->max_req_size; -@@ -1461,7 +1386,7 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) - - host->phys_addr = iomem->start + BCM2835_VCMMU_SHIFT; - --if (!(mmc_debug & (1<<12))) { -+#ifndef FORCE_PIO - if (node) { - host->dma_chan_tx = dma_request_slave_channel(dev, "tx"); - host->dma_chan_rx = dma_request_slave_channel(dev, "rx"); -@@ -1474,7 +1399,7 @@ if (!(mmc_debug & (1<<12))) { - host->dma_chan_tx = dma_request_channel(mask, NULL, NULL); - host->dma_chan_rx = dma_request_channel(mask, NULL, NULL); - } --} -+#endif - clk = devm_clk_get(dev, NULL); - if (IS_ERR(clk)) { - dev_err(dev, "could not get clk\n"); -@@ -1575,7 +1500,6 @@ static struct platform_driver bcm2835_mmc_driver = { - }; - module_platform_driver(bcm2835_mmc_driver); - --module_param(mmc_debug, uint, 0644); - MODULE_ALIAS("platform:mmc-bcm2835"); - MODULE_DESCRIPTION("BCM2835 SDHCI driver"); - MODULE_LICENSE("GPL v2"); - -From fe2ea3e054df3bcbb5eb2a41f2760cc418ef7f70 Mon Sep 17 00:00:00 2001 +From 0ecdaeb739edb714add6d8ae452d12d2ce821573 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 1 May 2015 17:46:56 +0100 -Subject: [PATCH 154/154] bcm2835-mmc: Add locks when accessing sdhost +Subject: [PATCH 131/216] bcm2835-mmc: Add locks when accessing sdhost registers --- @@ -138565,3 +136790,19964 @@ index eef0d351..1c34f476 100644 #ifdef FORCE_PIO dev_info(dev, "Forcing PIO mode\n"); host->have_dma = false; + +From d7580af2f81793fd3312608de95a9009123d8710 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 13 Apr 2015 23:34:50 +0100 +Subject: [PATCH 132/216] bcm2835-mmc: Add range of debug options for slowing + things down + +bcm2835-mmc: Add option to disable some delays + +bcm2835-mmc: Add option to disable MMC_QUIRK_BLK_NO_CMD23 + +bcm2835-mmc: Default to disabling MMC_QUIRK_BLK_NO_CMD23 +--- + drivers/mmc/core/quirks.c | 2 ++ + drivers/mmc/host/bcm2835-mmc.c | 44 ++++++++++++++++++++++++++++-------------- + 2 files changed, 32 insertions(+), 14 deletions(-) + +diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c +index f472082..bc3bbad 100644 +--- a/drivers/mmc/core/quirks.c ++++ b/drivers/mmc/core/quirks.c +@@ -71,6 +71,7 @@ static const struct mmc_fixup mmc_fixup_methods[] = { + + void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + { ++ extern unsigned mmc_debug; + const struct mmc_fixup *f; + u64 rev = cid_rev_card(card); + +@@ -98,6 +99,7 @@ void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + /* SDHCI on BCM2708 - bug causes a certain sequence of CMD23 operations to fail. + * Disable this flag for all cards (fall-back to CMD25/CMD18 multi-block transfers). + */ ++ if (mmc_debug & (1<<13)) + card->quirks |= MMC_QUIRK_BLK_NO_CMD23; + } + EXPORT_SYMBOL(mmc_fixup_device); +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +index 1c34f476..68314d5 100644 +--- a/drivers/mmc/host/bcm2835-mmc.c ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -71,6 +71,9 @@ pr_debug(DRIVER_NAME " [%s()]: " f, __func__, ## x) + #define BCM2835_VCMMU_SHIFT (0x7E000000 - BCM2708_PERI_BASE) + + ++unsigned mmc_debug; ++unsigned mmc_debug2; ++ + struct bcm2835_host { + spinlock_t lock; + +@@ -131,17 +134,27 @@ struct bcm2835_host { + }; + + +-static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg) ++static inline void bcm2835_mmc_writel(struct bcm2835_host *host, u32 val, int reg, int from) + { ++ unsigned delay; + lockdep_assert_held_once(&host->lock); + writel(val, host->ioaddr + reg); + udelay(BCM2835_SDHCI_WRITE_DELAY(max(host->clock, MIN_FREQ))); ++ ++ delay = ((mmc_debug >> 16) & 0xf) << ((mmc_debug >> 20) & 0xf); ++ if (delay && !((1<lock); + writel(val, host->ioaddr + reg); ++ ++ delay = ((mmc_debug >> 24) & 0xf) << ((mmc_debug >> 28) & 0xf); ++ if (delay) ++ udelay(delay); + } + + static inline u32 bcm2835_mmc_readl(struct bcm2835_host *host, int reg) +@@ -162,7 +175,7 @@ static inline void bcm2835_mmc_writew(struct bcm2835_host *host, u16 val, int re + if (reg == SDHCI_TRANSFER_MODE) + host->shadow = newval; + else +- bcm2835_mmc_writel(host, newval, reg & ~3); ++ bcm2835_mmc_writel(host, newval, reg & ~3, 0); + + } + +@@ -174,7 +187,7 @@ static inline void bcm2835_mmc_writeb(struct bcm2835_host *host, u8 val, int reg + u32 mask = 0xff << byte_shift; + u32 newval = (oldval & ~mask) | (val << byte_shift); + +- bcm2835_mmc_writel(host, newval, reg & ~3); ++ bcm2835_mmc_writel(host, newval, reg & ~3, 1); + } + + +@@ -206,7 +219,7 @@ static void bcm2835_mmc_unsignal_irqs(struct bcm2835_host *host, u32 clear) + ier &= ~clear; + /* change which requests generate IRQs - makes no difference to + the content of SDHCI_INT_STATUS, or the need to acknowledge IRQs */ +- bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE); ++ bcm2835_mmc_writel(host, ier, SDHCI_SIGNAL_ENABLE, 2); + } + + +@@ -307,8 +320,8 @@ static void bcm2835_mmc_init(struct bcm2835_host *host, int soft) + SDHCI_INT_RESPONSE; + + spin_lock_irqsave(&host->lock, flags); +- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); +- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 3); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 3); + spin_unlock_irqrestore(&host->lock, flags); + + if (soft) { +@@ -534,8 +547,8 @@ static void bcm2835_mmc_set_transfer_irqs(struct bcm2835_host *host) + else + host->ier = (host->ier & ~dma_irqs) | pio_irqs; + +- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); +- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 4); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 4); + } + + +@@ -617,7 +630,7 @@ static void bcm2835_mmc_set_transfer_mode(struct bcm2835_host *host, + mode |= SDHCI_TRNS_AUTO_CMD12; + else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) { + mode |= SDHCI_TRNS_AUTO_CMD23; +- bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2); ++ bcm2835_mmc_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2, 5); + } + } + +@@ -680,7 +693,7 @@ void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd + + bcm2835_mmc_prepare_data(host, cmd); + +- bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT); ++ bcm2835_mmc_writel(host, cmd->arg, SDHCI_ARGUMENT, 6); + + bcm2835_mmc_set_transfer_mode(host, cmd); + +@@ -837,8 +850,8 @@ static void bcm2835_mmc_enable_sdio_irq_nolock(struct bcm2835_host *host, int en + else + host->ier &= ~SDHCI_INT_CARD_INT; + +- bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE); +- bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_INT_ENABLE, 7); ++ bcm2835_mmc_writel(host, host->ier, SDHCI_SIGNAL_ENABLE, 7); + mmiowb(); + } + } +@@ -985,7 +998,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) + /* Clear selected interrupts. */ + mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK | + SDHCI_INT_BUS_POWER); +- bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS); ++ bcm2835_mmc_writel(host, mask, SDHCI_INT_STATUS, 8); + + + if (intmask & SDHCI_INT_CMD_MASK) +@@ -1015,7 +1028,7 @@ static irqreturn_t bcm2835_mmc_irq(int irq, void *dev_id) + + if (intmask) { + unexpected |= intmask; +- bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS); ++ bcm2835_mmc_writel(host, intmask, SDHCI_INT_STATUS, 9); + } + + if (result == IRQ_NONE) +@@ -1303,6 +1316,7 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host) + + host->flags = SDHCI_AUTO_CMD23; + ++ dev_info(dev, "mmc_debug:%x mmc_debug2:%x\n", mmc_debug, mmc_debug2); + #ifdef FORCE_PIO + dev_info(dev, "Forcing PIO mode\n"); + host->have_dma = false; +@@ -1514,6 +1528,8 @@ static struct platform_driver bcm2835_mmc_driver = { + }; + module_platform_driver(bcm2835_mmc_driver); + ++module_param(mmc_debug, uint, 0644); ++module_param(mmc_debug2, uint, 0644); + MODULE_ALIAS("platform:mmc-bcm2835"); + MODULE_DESCRIPTION("BCM2835 SDHCI driver"); + MODULE_LICENSE("GPL v2"); + +From e34578092803603a960a2a7bcccde5d0c8240b9a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 19:08:54 +0200 +Subject: [PATCH 133/216] BCM270x: Correct vcio device memory resource and add + irq resource +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The vcio driver hardcodes these resources, so this is the first +step in correcting this. Spell out the device name so we don't +have to include mach/vcio.h, since this header file will eventually +go away when the driver is later moved to drivers/mailbox. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/bcm2708.c | 17 ++++++++++------- + arch/arm/mach-bcm2708/include/mach/platform.h | 1 + + arch/arm/mach-bcm2709/bcm2709.c | 17 ++++++++++------- + arch/arm/mach-bcm2709/include/mach/platform.h | 1 + + 4 files changed, 22 insertions(+), 14 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 486e090..51f8efa 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -55,7 +55,6 @@ + #include + + #include +-#include + #include + + #include +@@ -414,17 +413,21 @@ static struct platform_device bcm2708_usb_device = { + }; + + static struct resource bcm2708_vcio_resources[] = { +- [0] = { /* mailbox/semaphore/doorbell access */ +- .start = MCORE_BASE, +- .end = MCORE_BASE + SZ_4K - 1, +- .flags = IORESOURCE_MEM, +- }, ++ { ++ .start = ARMCTRL_0_MAIL0_BASE, ++ .end = ARMCTRL_0_MAIL0_BASE + SZ_64 - 1, ++ .flags = IORESOURCE_MEM, ++ }, { ++ .start = IRQ_ARM_MAILBOX, ++ .end = IRQ_ARM_MAILBOX, ++ .flags = IORESOURCE_IRQ, ++ }, + }; + + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = BCM_VCIO_DRIVER_NAME, ++ .name = "bcm2708_vcio", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +diff --git a/arch/arm/mach-bcm2708/include/mach/platform.h b/arch/arm/mach-bcm2708/include/mach/platform.h +index 2e7e1bb..bef3e5a 100644 +--- a/arch/arm/mach-bcm2708/include/mach/platform.h ++++ b/arch/arm/mach-bcm2708/include/mach/platform.h +@@ -81,6 +81,7 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + + /* +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 44bfc50..8ed88b4 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -56,7 +56,6 @@ + #include + + #include +-#include + #include + + #include +@@ -433,17 +432,21 @@ static struct platform_device bcm2708_usb_device = { + }; + + static struct resource bcm2708_vcio_resources[] = { +- [0] = { /* mailbox/semaphore/doorbell access */ +- .start = MCORE_BASE, +- .end = MCORE_BASE + SZ_4K - 1, +- .flags = IORESOURCE_MEM, +- }, ++ { ++ .start = ARMCTRL_0_MAIL0_BASE, ++ .end = ARMCTRL_0_MAIL0_BASE + SZ_64 - 1, ++ .flags = IORESOURCE_MEM, ++ }, { ++ .start = IRQ_ARM_MAILBOX, ++ .end = IRQ_ARM_MAILBOX, ++ .flags = IORESOURCE_IRQ, ++ }, + }; + + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = BCM_VCIO_DRIVER_NAME, ++ .name = "bcm2708_vcio", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +diff --git a/arch/arm/mach-bcm2709/include/mach/platform.h b/arch/arm/mach-bcm2709/include/mach/platform.h +index 7157f38..5574bb5 100644 +--- a/arch/arm/mach-bcm2709/include/mach/platform.h ++++ b/arch/arm/mach-bcm2709/include/mach/platform.h +@@ -81,6 +81,7 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + + /* + +From 4b03fd4291b9ed1cd100b359967f1b1fdc39984a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 2 May 2015 09:55:53 +0200 +Subject: [PATCH 134/216] video: fbdev: bcm2708_fb: Don't panic on error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +No need to panic the kernel if the video driver fails. +Just print a message and return an error. + +Signed-off-by: Noralf Trønnes +--- + drivers/video/fbdev/bcm2708_fb.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +index 9179291..52e655a 100644 +--- a/drivers/video/fbdev/bcm2708_fb.c ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -325,8 +325,8 @@ static int bcm2708_fb_set_par(struct fb_info *info) + /* the console may currently be locked */ + console_trylock(); + console_unlock(); +- +- BUG(); /* what can we do here */ ++ pr_err("bcm2708_fb_set_par: Failed to set screen_base\n"); ++ return -EIO; + } + } + print_debug +@@ -677,7 +677,9 @@ static int bcm2708_fb_register(struct bcm2708_fb *fb) + */ + + fb_set_var(&fb->fb, &fb->fb.var); +- bcm2708_fb_set_par(&fb->fb); ++ ret = bcm2708_fb_set_par(&fb->fb); ++ if (ret) ++ return ret; + + print_debug("BCM2708FB: registering framebuffer (%dx%d@%d) (%d)\n", fbwidth, + fbheight, fbdepth, fbswap); + +From 1965f1d8dcc748e1f9ba3ff28c8fb5191e081a4d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 20:49:04 +0200 +Subject: [PATCH 135/216] BCM2708: vcio: Fix checkpatch issues +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +checkpatch.pl errors and warnings: +Many whitespace related issues in some form or another. +Consider using instead of . +braces {} are not necessary for single statement blocks. +Use pr_* instead of printk. +Do not initialise statics to 0 or NULL. +Avoid CamelCase. +sizeof size should be sizeof(size). +break is not useful after a goto or return. +struct file_operations should normally be const +Possible unnecessary 'out of memory' message +Comparison to NULL could be written "!res" +quoted string split across lines. + +This has not been adressed: +WARNING: consider using a completion + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/include/mach/vcio.h | 12 ++- + arch/arm/mach-bcm2708/vcio.c | 123 ++++++++++++++---------------- + 2 files changed, 62 insertions(+), 73 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/include/mach/vcio.h b/arch/arm/mach-bcm2708/include/mach/vcio.h +index 8e11d67e..58188b74 100644 +--- a/arch/arm/mach-bcm2708/include/mach/vcio.h ++++ b/arch/arm/mach-bcm2708/include/mach/vcio.h +@@ -12,10 +12,6 @@ + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef _MACH_BCM2708_VCIO_H + #define _MACH_BCM2708_VCIO_H +@@ -34,12 +30,14 @@ + #define MBOX_CHAN_COUNT 9 + + enum { +- VCMSG_PROCESS_REQUEST = 0x00000000 ++ VCMSG_PROCESS_REQUEST = 0x00000000 + }; ++ + enum { +- VCMSG_REQUEST_SUCCESSFUL = 0x80000000, +- VCMSG_REQUEST_FAILED = 0x80000001 ++ VCMSG_REQUEST_SUCCESSFUL = 0x80000000, ++ VCMSG_REQUEST_FAILED = 0x80000001 + }; ++ + /* Mailbox property tags */ + enum { + VCMSG_PROPERTY_END = 0x00000000, +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 700bff4..5e9e777 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -37,8 +37,7 @@ + #include + #include + +-#include +- ++#include + + #define DRIVER_NAME BCM_VCIO_DRIVER_NAME + +@@ -61,7 +60,9 @@ + #define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) + + #define MBOX_MAGIC 0xd0d0c0de +-static struct class *vcio_class = NULL; ++ ++static struct class *vcio_class; ++ + struct vc_mailbox { + struct device *dev; /* parent device */ + void __iomem *status; +@@ -102,9 +103,9 @@ static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) + { + int rc; + +- if (mbox->magic != MBOX_MAGIC) ++ if (mbox->magic != MBOX_MAGIC) { + rc = -EINVAL; +- else { ++ } else { + /* wait for the mailbox FIFO to have some space in it */ + while (0 != (readl(mbox->status) & ARM_MS_FULL)) + cpu_relax(); +@@ -119,9 +120,9 @@ static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) + { + int rc; + +- if (mbox->magic != MBOX_MAGIC) ++ if (mbox->magic != MBOX_MAGIC) { + rc = -EINVAL; +- else { ++ } else { + down(&mbox->sema[chan]); + *data28 = MBOX_DATA28(mbox->msg[chan]); + mbox->msg[chan] = 0; +@@ -133,17 +134,18 @@ static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) + static irqreturn_t mbox_irq(int irq, void *dev_id) + { + /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *) dev_id; ++ struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; + int status = readl(mbox->status); + int ret = IRQ_NONE; + + while (!(status & ARM_MS_EMPTY)) { + uint32_t msg = readl(mbox->read); + int chan = MBOX_CHAN(msg); ++ + if (chan < MBOX_CHAN_COUNT) { + if (mbox->msg[chan]) { + /* Overflow */ +- printk(KERN_ERR DRIVER_NAME ++ pr_err(DRIVER_NAME + ": mbox chan %d overflow - drop %08x\n", + chan, msg); + } else { +@@ -151,7 +153,7 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + up(&mbox->sema[chan]); + } + } else { +- printk(KERN_ERR DRIVER_NAME ++ pr_err(DRIVER_NAME + ": invalid channel selector (msg %08x)\n", msg); + } + ret = IRQ_HANDLED; +@@ -174,9 +176,9 @@ static struct device *mbox_dev; /* we assume there's only one! */ + + static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) + { ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); + int rc; + +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); + device_lock(dev); + rc = mbox_write(mailbox, chan, data28); + device_unlock(dev); +@@ -186,9 +188,9 @@ static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) + + static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) + { ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); + int rc; + +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); + device_lock(dev); + rc = mbox_read(mailbox, chan, data28); + device_unlock(dev); +@@ -221,41 +223,36 @@ static void dev_mbox_register(const char *dev_name, struct device *dev) + + static int mbox_copy_from_user(void *dst, const void *src, int size) + { +- if ( (uint32_t)src < TASK_SIZE) +- { ++ if ((uint32_t)src < TASK_SIZE) + return copy_from_user(dst, src, size); +- } +- else +- { +- memcpy( dst, src, size ); +- return 0; +- } ++ ++ memcpy(dst, src, size); ++ ++ return 0; + } + + static int mbox_copy_to_user(void *dst, const void *src, int size) + { +- if ( (uint32_t)dst < TASK_SIZE) +- { ++ if ((uint32_t)dst < TASK_SIZE) + return copy_to_user(dst, src, size); +- } +- else +- { +- memcpy( dst, src, size ); +- return 0; +- } ++ ++ memcpy(dst, src, size); ++ ++ return 0; + } + + static DEFINE_MUTEX(mailbox_lock); + extern int bcm_mailbox_property(void *data, int size) + { + uint32_t success; +- dma_addr_t mem_bus; /* the memory address accessed from videocore */ +- void *mem_kern; /* the memory address accessed from driver */ ++ dma_addr_t mem_bus; /* the memory address accessed from videocore */ ++ void *mem_kern; /* the memory address accessed from driver */ + int s = 0; + +- mutex_lock(&mailbox_lock); ++ mutex_lock(&mailbox_lock); + /* allocate some memory for the messages communicating with GPU */ +- mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, GFP_ATOMIC); ++ mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, ++ GFP_ATOMIC); + if (mem_kern) { + /* create the message */ + mbox_copy_from_user(mem_kern, data, size); +@@ -263,9 +260,8 @@ extern int bcm_mailbox_property(void *data, int size) + /* send the message */ + wmb(); + s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); +- if (s == 0) { ++ if (s == 0) + s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); +- } + if (s == 0) { + /* copy the response */ + rmb(); +@@ -276,9 +272,9 @@ extern int bcm_mailbox_property(void *data, int size) + s = -ENOMEM; + } + if (s != 0) +- printk(KERN_ERR DRIVER_NAME ": %s failed (%d)\n", __func__, s); ++ pr_err(DRIVER_NAME ": %s failed (%d)\n", __func__, s); + +- mutex_unlock(&mailbox_lock); ++ mutex_unlock(&mailbox_lock); + return s; + } + EXPORT_SYMBOL_GPL(bcm_mailbox_property); +@@ -291,7 +287,7 @@ EXPORT_SYMBOL_GPL(bcm_mailbox_property); + * Is the device open right now? Used to prevent + * concurent access into the same device + */ +-static int Device_Open = 0; ++static bool device_is_open; + + /* + * This is called whenever a process attempts to open the device file +@@ -301,10 +297,10 @@ static int device_open(struct inode *inode, struct file *file) + /* + * We don't want to talk to two processes at the same time + */ +- if (Device_Open) ++ if (device_is_open) + return -EBUSY; + +- Device_Open++; ++ device_is_open = true; + /* + * Initialize the message + */ +@@ -317,7 +313,7 @@ static int device_release(struct inode *inode, struct file *file) + /* + * We're now ready for our next caller + */ +- Device_Open--; ++ device_is_open = false; + + module_put(THIS_MODULE); + return 0; +@@ -333,9 +329,8 @@ static int device_release(struct inode *inode, struct file *file) + * calling process), the ioctl call returns the output of this function. + * + */ +-static long device_ioctl(struct file *file, /* see include/linux/fs.h */ +- unsigned int ioctl_num, /* number and param for ioctl */ +- unsigned long ioctl_param) ++static long device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) + { + unsigned size; + /* +@@ -348,11 +343,10 @@ static long device_ioctl(struct file *file, /* see include/linux/fs.h */ + * to be the device's message. Get the parameter given to + * ioctl by the process. + */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof size); ++ mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); + return bcm_mailbox_property((void *)ioctl_param, size); +- break; + default: +- printk(KERN_ERR DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); ++ pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); + return -EINVAL; + } + +@@ -368,7 +362,7 @@ static long device_ioctl(struct file *file, /* see include/linux/fs.h */ + * the devices table, it can't be local to + * init_module. NULL is for unimplemented functios. + */ +-struct file_operations fops = { ++const struct file_operations fops = { + .unlocked_ioctl = device_ioctl, + .open = device_open, + .release = device_release, /* a.k.a. close */ +@@ -380,17 +374,15 @@ static int bcm_vcio_probe(struct platform_device *pdev) + struct vc_mailbox *mailbox; + + mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL); +- if (NULL == mailbox) { +- printk(KERN_ERR DRIVER_NAME ": failed to allocate " +- "mailbox memory\n"); ++ if (!mailbox) { + ret = -ENOMEM; + } else { + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (res == NULL) { +- printk(KERN_ERR DRIVER_NAME ": failed to obtain memory " +- "resource\n"); ++ if (!res) { ++ pr_err(DRIVER_NAME ++ ": failed to obtain memory resource\n"); + ret = -ENODEV; + kfree(mailbox); + } else { +@@ -402,8 +394,8 @@ static int bcm_vcio_probe(struct platform_device *pdev) + + mbox_irqaction.dev_id = mailbox; + setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction); +- printk(KERN_INFO DRIVER_NAME ": mailbox at %p\n", +- __io_address(ARM_0_MAIL0_RD)); ++ dev_info(&pdev->dev, "mailbox at %p\n", ++ __io_address(ARM_0_MAIL0_RD)); + } + } + +@@ -417,17 +409,18 @@ static int bcm_vcio_probe(struct platform_device *pdev) + * Negative values signify an error + */ + if (ret < 0) { +- printk(KERN_ERR DRIVER_NAME +- "Failed registering the character device %d\n", ret); ++ pr_err(DRIVER_NAME ++ "Failed registering the character device %d\n", ++ ret); + return ret; + } + vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME); + if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- return ret ; ++ ret = PTR_ERR(vcio_class); ++ return ret; + } + device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); ++ "vcio"); + } + return ret; + } +@@ -456,20 +449,18 @@ static int __init bcm_mbox_init(void) + { + int ret; + +- printk(KERN_INFO "mailbox: Broadcom VideoCore Mailbox driver\n"); ++ pr_info("mailbox: Broadcom VideoCore Mailbox driver\n"); + + ret = platform_driver_register(&bcm_mbox_driver); +- if (ret != 0) { +- printk(KERN_ERR DRIVER_NAME ": failed to register " +- "on platform\n"); +- } ++ if (ret) ++ pr_err(DRIVER_NAME ": failed to register on platform\n"); + + return ret; + } + + static void __exit bcm_mbox_exit(void) + { +- device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0)); ++ device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); + class_destroy(vcio_class); + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); + platform_driver_unregister(&bcm_mbox_driver); + +From f7567a97143abdc87b5dc258b3b628ba115ce0b2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:02:44 +0200 +Subject: [PATCH 136/216] BCM2708: vcio: Remove unused code and compact + comments +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The config reference SERIAL_BCM_MBOX_CONSOLE does not exist, +so remove the whole clause as it will always be false. + +Remove includes that are not needed. +Add . +Also sort include headers alphabetically, since this +is now the preferred coding style. + +Remove vc_mailbox->dev since it is not used. + +Compact some comments to one line. +Remove superfluous comments. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 68 ++++++++++---------------------------------- + 1 file changed, 15 insertions(+), 53 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 5e9e777..270f126 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -12,39 +12,24 @@ + * VideoCore processor + */ + +-#if defined(CONFIG_SERIAL_BCM_MBOX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +-#define SUPPORT_SYSRQ +-#endif +- ++#include ++#include + #include +-#include +-#include +-#include + #include +-#include ++#include + #include +-#include +-#include +-#include +-#include +-#include +-#include + #include +-#include +- + #include ++#include ++#include ++#include ++#include + + #include + #include + +-#include +- + #define DRIVER_NAME BCM_VCIO_DRIVER_NAME + +-/* ---------------------------------------------------------------------- +- * Mailbox +- * -------------------------------------------------------------------- */ +- + /* offsets from a mail box base address */ + #define MAIL_WRT 0x00 /* write - and next 4 words */ + #define MAIL_RD 0x00 /* read - and next 4 words */ +@@ -64,7 +49,6 @@ + static struct class *vcio_class; + + struct vc_mailbox { +- struct device *dev; /* parent device */ + void __iomem *status; + void __iomem *config; + void __iomem *read; +@@ -79,7 +63,6 @@ static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, + { + int i; + +- mbox_out->dev = dev; + mbox_out->status = __io_address(addr_mbox + MAIL_STA); + mbox_out->config = __io_address(addr_mbox + MAIL_CNF); + mbox_out->read = __io_address(addr_mbox + MAIL_RD); +@@ -144,7 +127,6 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + + if (chan < MBOX_CHAN_COUNT) { + if (mbox->msg[chan]) { +- /* Overflow */ + pr_err(DRIVER_NAME + ": mbox chan %d overflow - drop %08x\n", + chan, msg); +@@ -168,9 +150,7 @@ static struct irqaction mbox_irqaction = { + .handler = mbox_irq, + }; + +-/* ---------------------------------------------------------------------- +- * Mailbox Methods +- * -------------------------------------------------------------------- */ ++/* Mailbox Methods */ + + static struct device *mbox_dev; /* we assume there's only one! */ + +@@ -279,9 +259,7 @@ extern int bcm_mailbox_property(void *data, int size) + } + EXPORT_SYMBOL_GPL(bcm_mailbox_property); + +-/* ---------------------------------------------------------------------- +- * Platform Device for Mailbox +- * -------------------------------------------------------------------- */ ++/* Platform Device for Mailbox */ + + /* + * Is the device open right now? Used to prevent +@@ -289,33 +267,26 @@ EXPORT_SYMBOL_GPL(bcm_mailbox_property); + */ + static bool device_is_open; + +-/* +- * This is called whenever a process attempts to open the device file +- */ ++/* This is called whenever a process attempts to open the device file */ + static int device_open(struct inode *inode, struct file *file) + { +- /* +- * We don't want to talk to two processes at the same time +- */ ++ /* We don't want to talk to two processes at the same time */ + if (device_is_open) + return -EBUSY; + + device_is_open = true; +- /* +- * Initialize the message +- */ + try_module_get(THIS_MODULE); ++ + return 0; + } + + static int device_release(struct inode *inode, struct file *file) + { +- /* +- * We're now ready for our next caller +- */ ++ /* We're now ready for our next caller */ + device_is_open = false; + + module_put(THIS_MODULE); ++ + return 0; + } + +@@ -333,9 +304,7 @@ static long device_ioctl(struct file *file, unsigned int ioctl_num, + unsigned long ioctl_param) + { + unsigned size; +- /* +- * Switch according to the ioctl called +- */ ++ + switch (ioctl_num) { + case IOCTL_MBOX_PROPERTY: + /* +@@ -400,14 +369,7 @@ static int bcm_vcio_probe(struct platform_device *pdev) + } + + if (ret == 0) { +- /* +- * Register the character device +- */ + ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- +- /* +- * Negative values signify an error +- */ + if (ret < 0) { + pr_err(DRIVER_NAME + "Failed registering the character device %d\n", + +From 406f0f628a2f978a1da4d25dda3b5eafb94cefd0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:10:18 +0200 +Subject: [PATCH 137/216] BCM2708: vcio: Move character device teardown to + driver remove +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +chrdev is created in the probe function, but teared down in module exit. +Move chrdev teardown to happen on device removal. +Also add missing mbox_dev disabling. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 270f126..cac8dd7 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -391,8 +391,12 @@ static int bcm_vcio_remove(struct platform_device *pdev) + { + struct vc_mailbox *mailbox = platform_get_drvdata(pdev); + ++ mbox_dev = NULL; + platform_set_drvdata(pdev, NULL); + kfree(mailbox); ++ device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); ++ class_destroy(vcio_class); ++ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); + + return 0; + } +@@ -422,9 +426,6 @@ static int __init bcm_mbox_init(void) + + static void __exit bcm_mbox_exit(void) + { +- device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); + platform_driver_unregister(&bcm_mbox_driver); + } + + +From fa189cd5d18e5cda8438873181a329fc489a6649 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:20:46 +0200 +Subject: [PATCH 138/216] BCM2708: vcio: Restructure error paths +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +No need to use if/else clauses on error when return can be used directly. +Also test for errors first if possible. +This is done to enhance readability. +bcm_vcio_probe() is not touched, it will be reworked later. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 48 +++++++++++++++++++------------------------- + 1 file changed, 21 insertions(+), 27 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index cac8dd7..36e0f1e 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -84,34 +84,28 @@ static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, + + static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) + { +- int rc; ++ if (mbox->magic != MBOX_MAGIC) ++ return -EINVAL; + +- if (mbox->magic != MBOX_MAGIC) { +- rc = -EINVAL; +- } else { +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->status) & ARM_MS_FULL)) +- cpu_relax(); ++ /* wait for the mailbox FIFO to have some space in it */ ++ while (0 != (readl(mbox->status) & ARM_MS_FULL)) ++ cpu_relax(); + +- writel(MBOX_MSG(chan, data28), mbox->write); +- rc = 0; +- } +- return rc; ++ writel(MBOX_MSG(chan, data28), mbox->write); ++ ++ return 0; + } + + static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) + { +- int rc; ++ if (mbox->magic != MBOX_MAGIC) ++ return -EINVAL; + +- if (mbox->magic != MBOX_MAGIC) { +- rc = -EINVAL; +- } else { +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- rc = 0; +- } +- return rc; ++ down(&mbox->sema[chan]); ++ *data28 = MBOX_DATA28(mbox->msg[chan]); ++ mbox->msg[chan] = 0; ++ ++ return 0; + } + + static irqreturn_t mbox_irq(int irq, void *dev_id) +@@ -180,19 +174,19 @@ static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) + + extern int bcm_mailbox_write(unsigned chan, uint32_t data28) + { +- if (mbox_dev) +- return dev_mbox_write(mbox_dev, chan, data28); +- else ++ if (!mbox_dev) + return -ENODEV; ++ ++ return dev_mbox_write(mbox_dev, chan, data28); + } + EXPORT_SYMBOL_GPL(bcm_mailbox_write); + + extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) + { +- if (mbox_dev) +- return dev_mbox_read(mbox_dev, chan, data28); +- else ++ if (!mbox_dev) + return -ENODEV; ++ ++ return dev_mbox_read(mbox_dev, chan, data28); + } + EXPORT_SYMBOL_GPL(bcm_mailbox_read); + + +From ce2c991a11f0a94679423655dceed9bb80604892 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:28:31 +0200 +Subject: [PATCH 139/216] BCM2708: vcio: Move some macros from header to driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Move some macros that are only used by the driver: +MAJOR_NUM +IOCTL_MBOX_PROPERTY +DEVICE_FILE_NAME + +This one becomes superfluous: BCM_VCIO_DRIVER_NAME + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/include/mach/vcio.h | 35 ------------------------------- + arch/arm/mach-bcm2708/vcio.c | 9 ++++++-- + 2 files changed, 7 insertions(+), 37 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/include/mach/vcio.h b/arch/arm/mach-bcm2708/include/mach/vcio.h +index 58188b74..95ad121 100644 +--- a/arch/arm/mach-bcm2708/include/mach/vcio.h ++++ b/arch/arm/mach-bcm2708/include/mach/vcio.h +@@ -20,8 +20,6 @@ + * (semaphores, doorbells, mailboxes) + */ + +-#define BCM_VCIO_DRIVER_NAME "bcm2708_vcio" +- + /* Constants shared with the ARM identifying separate mailbox channels */ + #define MBOX_CHAN_POWER 0 /* for use by the power management interface */ + #define MBOX_CHAN_FB 1 /* for use by the frame buffer */ +@@ -127,37 +125,4 @@ extern int /*rc*/ bcm_mailbox_read(unsigned chan, uint32_t *data28); + extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28); + extern int /*rc*/ bcm_mailbox_property(void *data, int size); + +-#include +- +-/* +- * The major device number. We can't rely on dynamic +- * registration any more, because ioctls need to know +- * it. +- */ +-#define MAJOR_NUM 100 +- +-/* +- * Set the message of the device driver +- */ +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +-/* +- * _IOWR means that we're creating an ioctl command +- * number for passing information from a user process +- * to the kernel module and from the kernel module to user process +- * +- * The first arguments, MAJOR_NUM, is the major device +- * number we're using. +- * +- * The second argument is the number of the command +- * (there could be several with different meanings). +- * +- * The third argument is the type we want to get from +- * the process to the kernel. +- */ +- +-/* +- * The name of the device file +- */ +-#define DEVICE_FILE_NAME "vcio" +- + #endif +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 36e0f1e..75cf955 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -28,7 +29,8 @@ + #include + #include + +-#define DRIVER_NAME BCM_VCIO_DRIVER_NAME ++#define DRIVER_NAME "bcm2708_vcio" ++#define DEVICE_FILE_NAME "vcio" + + /* offsets from a mail box base address */ + #define MAIL_WRT 0x00 /* write - and next 4 words */ +@@ -46,6 +48,9 @@ + + #define MBOX_MAGIC 0xd0d0c0de + ++#define MAJOR_NUM 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) ++ + static struct class *vcio_class; + + struct vc_mailbox { +@@ -370,7 +375,7 @@ static int bcm_vcio_probe(struct platform_device *pdev) + ret); + return ret; + } +- vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME); ++ vcio_class = class_create(THIS_MODULE, DRIVER_NAME); + if (IS_ERR(vcio_class)) { + ret = PTR_ERR(vcio_class); + return ret; + +From 71c6a7270af56930e1e31ff243048c1ac12ebc1f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:40:03 +0200 +Subject: [PATCH 140/216] BCM2708: vcio: Only store the register base address +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +No need to keep pointers to the sub registers. Only +store the base address. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 37 ++++++++++++++----------------------- + 1 file changed, 14 insertions(+), 23 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index 75cf955..e67fa3e 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -33,12 +33,12 @@ + #define DEVICE_FILE_NAME "vcio" + + /* offsets from a mail box base address */ +-#define MAIL_WRT 0x00 /* write - and next 4 words */ +-#define MAIL_RD 0x00 /* read - and next 4 words */ +-#define MAIL_POL 0x10 /* read without popping the fifo */ +-#define MAIL_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL_STA 0x18 /* status */ +-#define MAIL_CNF 0x1C /* configuration */ ++#define MAIL0_RD 0x00 /* read - and next 4 words */ ++#define MAIL0_POL 0x10 /* read without popping the fifo */ ++#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ ++#define MAIL0_STA 0x18 /* status */ ++#define MAIL0_CNF 0x1C /* configuration */ ++#define MAIL1_WRT 0x20 /* write - and next 4 words */ + + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) + #define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +@@ -54,10 +54,7 @@ + static struct class *vcio_class; + + struct vc_mailbox { +- void __iomem *status; +- void __iomem *config; +- void __iomem *read; +- void __iomem *write; ++ void __iomem *regs; + uint32_t msg[MBOX_CHAN_COUNT]; + struct semaphore sema[MBOX_CHAN_COUNT]; + uint32_t magic; +@@ -68,13 +65,7 @@ static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, + { + int i; + +- mbox_out->status = __io_address(addr_mbox + MAIL_STA); +- mbox_out->config = __io_address(addr_mbox + MAIL_CNF); +- mbox_out->read = __io_address(addr_mbox + MAIL_RD); +- /* Write to the other mailbox */ +- mbox_out->write = +- __io_address((addr_mbox ^ ARM_0_MAIL0_WRT ^ ARM_0_MAIL1_WRT) + +- MAIL_WRT); ++ mbox_out->regs = __io_address(addr_mbox); + + for (i = 0; i < MBOX_CHAN_COUNT; i++) { + mbox_out->msg[i] = 0; +@@ -82,7 +73,7 @@ static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, + } + + /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->config); ++ writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); + + mbox_out->magic = MBOX_MAGIC; + } +@@ -93,10 +84,10 @@ static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) + return -EINVAL; + + /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->status) & ARM_MS_FULL)) ++ while (0 != (readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL)) + cpu_relax(); + +- writel(MBOX_MSG(chan, data28), mbox->write); ++ writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); + + return 0; + } +@@ -117,11 +108,11 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + { + /* wait for the mailbox FIFO to have some data in it */ + struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +- int status = readl(mbox->status); ++ int status = readl(mbox->regs + MAIL0_STA); + int ret = IRQ_NONE; + + while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->read); ++ uint32_t msg = readl(mbox->regs + MAIL0_RD); + int chan = MBOX_CHAN(msg); + + if (chan < MBOX_CHAN_COUNT) { +@@ -138,7 +129,7 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + ": invalid channel selector (msg %08x)\n", msg); + } + ret = IRQ_HANDLED; +- status = readl(mbox->status); ++ status = readl(mbox->regs + MAIL0_STA); + } + return ret; + } + +From 30e7622ceffd50a31b6544e3a3e05bb0743c3bc2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 21:44:39 +0200 +Subject: [PATCH 141/216] BCM2708: vcio: Do not print messages in module init +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It is not common practice to print messages from a +module init function that only register a driver. +Remove obsolete module alias. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index e67fa3e..ff50ebd 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -403,15 +403,7 @@ static struct platform_driver bcm_mbox_driver = { + + static int __init bcm_mbox_init(void) + { +- int ret; +- +- pr_info("mailbox: Broadcom VideoCore Mailbox driver\n"); +- +- ret = platform_driver_register(&bcm_mbox_driver); +- if (ret) +- pr_err(DRIVER_NAME ": failed to register on platform\n"); +- +- return ret; ++ return platform_driver_register(&bcm_mbox_driver); + } + + static void __exit bcm_mbox_exit(void) +@@ -425,4 +417,3 @@ module_exit(bcm_mbox_exit); + MODULE_AUTHOR("Gray Girling"); + MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); + MODULE_LICENSE("GPL"); +-MODULE_ALIAS("platform:bcm-mbox"); + +From 7a9128973d51200625a3d3f8ff72a4580cb9f14b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 30 Apr 2015 23:33:43 +0200 +Subject: [PATCH 142/216] BCM2708: vcio: Use device resources +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use device resources instead of hardcoding them. +Use devm_* functions where possible. +Merge dev_mbox_register() with probe function. +Add Device Tree support. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/vcio.c | 122 +++++++++++++++++++++---------------------- + 1 file changed, 61 insertions(+), 61 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +index ff50ebd..c4c2bcd 100644 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ b/arch/arm/mach-bcm2708/vcio.c +@@ -21,13 +21,10 @@ + #include + #include + #include +-#include + #include +-#include + #include + + #include +-#include + + #define DRIVER_NAME "bcm2708_vcio" + #define DEVICE_FILE_NAME "vcio" +@@ -60,13 +57,10 @@ struct vc_mailbox { + uint32_t magic; + }; + +-static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, +- uint32_t addr_mbox) ++static void mbox_init(struct vc_mailbox *mbox_out) + { + int i; + +- mbox_out->regs = __io_address(addr_mbox); +- + for (i = 0; i < MBOX_CHAN_COUNT; i++) { + mbox_out->msg[i] = 0; + sema_init(&mbox_out->sema[i], 0); +@@ -104,7 +98,7 @@ static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) + return 0; + } + +-static irqreturn_t mbox_irq(int irq, void *dev_id) ++static irqreturn_t mbox_irq_handler(int irq, void *dev_id) + { + /* wait for the mailbox FIFO to have some data in it */ + struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +@@ -134,12 +128,6 @@ static irqreturn_t mbox_irq(int irq, void *dev_id) + return ret; + } + +-static struct irqaction mbox_irqaction = { +- .name = "ARM Mailbox IRQ", +- .flags = IRQF_DISABLED | IRQF_IRQPOLL, +- .handler = mbox_irq, +-}; +- + /* Mailbox Methods */ + + static struct device *mbox_dev; /* we assume there's only one! */ +@@ -186,11 +174,6 @@ extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) + } + EXPORT_SYMBOL_GPL(bcm_mailbox_read); + +-static void dev_mbox_register(const char *dev_name, struct device *dev) +-{ +- mbox_dev = dev; +-} +- + static int mbox_copy_from_user(void *dst, const void *src, int size) + { + if ((uint32_t)src < TASK_SIZE) +@@ -329,61 +312,71 @@ const struct file_operations fops = { + + static int bcm_vcio_probe(struct platform_device *pdev) + { +- int ret = 0; ++ struct device *dev = &pdev->dev; ++ struct device *vdev; + struct vc_mailbox *mailbox; ++ struct resource *res; ++ int irq, ret; ++ ++ mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); ++ if (!mailbox) ++ return -ENOMEM; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mailbox->regs = devm_ioremap_resource(dev, res); ++ if (IS_ERR(mailbox->regs)) ++ return PTR_ERR(mailbox->regs); ++ ++ irq = platform_get_irq(pdev, 0); ++ ret = devm_request_irq(dev, irq, mbox_irq_handler, ++ IRQF_DISABLED | IRQF_IRQPOLL, ++ dev_name(dev), mailbox); ++ if (ret) { ++ dev_err(dev, "Interrupt request failed %d\n", ret); ++ return ret; ++ } + +- mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL); +- if (!mailbox) { +- ret = -ENOMEM; +- } else { +- struct resource *res; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (!res) { +- pr_err(DRIVER_NAME +- ": failed to obtain memory resource\n"); +- ret = -ENODEV; +- kfree(mailbox); +- } else { +- /* should be based on the registers from res really */ +- mbox_init(mailbox, &pdev->dev, ARM_0_MAIL0_RD); +- +- platform_set_drvdata(pdev, mailbox); +- dev_mbox_register(DRIVER_NAME, &pdev->dev); ++ ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); ++ if (ret < 0) { ++ pr_err("Character device registration failed %d\n", ret); ++ return ret; ++ } + +- mbox_irqaction.dev_id = mailbox; +- setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction); +- dev_info(&pdev->dev, "mailbox at %p\n", +- __io_address(ARM_0_MAIL0_RD)); +- } ++ vcio_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vcio_class)) { ++ ret = PTR_ERR(vcio_class); ++ pr_err("Class creation failed %d\n", ret); ++ goto err_class; + } + +- if (ret == 0) { +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- if (ret < 0) { +- pr_err(DRIVER_NAME +- "Failed registering the character device %d\n", +- ret); +- return ret; +- } +- vcio_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- return ret; +- } +- device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); ++ vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, ++ "vcio"); ++ if (IS_ERR(vdev)) { ++ ret = PTR_ERR(vdev); ++ pr_err("Device creation failed %d\n", ret); ++ goto err_dev; + } ++ ++ mbox_init(mailbox); ++ platform_set_drvdata(pdev, mailbox); ++ mbox_dev = dev; ++ ++ dev_info(dev, "mailbox at %p\n", mailbox->regs); ++ ++ return 0; ++ ++err_dev: ++ class_destroy(vcio_class); ++err_class: ++ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); ++ + return ret; + } + + static int bcm_vcio_remove(struct platform_device *pdev) + { +- struct vc_mailbox *mailbox = platform_get_drvdata(pdev); +- + mbox_dev = NULL; + platform_set_drvdata(pdev, NULL); +- kfree(mailbox); + device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); + class_destroy(vcio_class); + unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +@@ -391,6 +384,12 @@ static int bcm_vcio_remove(struct platform_device *pdev) + return 0; + } + ++static const struct of_device_id bcm_vcio_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-vcio", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); ++ + static struct platform_driver bcm_mbox_driver = { + .probe = bcm_vcio_probe, + .remove = bcm_vcio_remove, +@@ -398,6 +397,7 @@ static struct platform_driver bcm_mbox_driver = { + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, ++ .of_match_table = bcm_vcio_of_match_table, + }, + }; + + +From bb294088d80bcba531bc3d58b4a6c08b8cdcb0b0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 19:11:03 +0200 +Subject: [PATCH 143/216] mailbox: bcm2708: Add bcm2708-vcio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Copy the arch vcio.c driver to drivers/mailbox. +This is done to make it available on ARCH_BCM2835. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/Kconfig | 6 + + drivers/mailbox/Makefile | 2 + + drivers/mailbox/bcm2708-vcio.c | 426 ++++++++++++++++++++++++++ + include/linux/platform_data/mailbox-bcm2708.h | 126 ++++++++ + 4 files changed, 560 insertions(+) + create mode 100644 drivers/mailbox/bcm2708-vcio.c + create mode 100644 include/linux/platform_data/mailbox-bcm2708.h + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 84325f2..fdcb206 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -6,6 +6,12 @@ menuconfig MAILBOX + signals. Say Y if your platform supports hardware mailboxes. + + if MAILBOX ++config BCM2708_MBOX ++ bool "Broadcom BCM2708 Mailbox (vcio)" ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ help ++ Broadcom BCM2708 Mailbox (vcio) ++ + config PL320_MBOX + bool "ARM PL320 Mailbox" + depends on ARM_AMBA +diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile +index 2e79231..c2d2bed 100644 +--- a/drivers/mailbox/Makefile ++++ b/drivers/mailbox/Makefile +@@ -2,6 +2,8 @@ + + obj-$(CONFIG_MAILBOX) += mailbox.o + ++obj-$(CONFIG_BCM2708_MBOX) += bcm2708-vcio.o ++ + obj-$(CONFIG_PL320_MBOX) += pl320-ipc.o + + obj-$(CONFIG_OMAP2PLUS_MBOX) += omap-mailbox.o +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +new file mode 100644 +index 0000000..ee3e778 +--- /dev/null ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -0,0 +1,426 @@ ++/* ++ * linux/arch/arm/mach-bcm2708/vcio.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * 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. ++ * ++ * This device provides a shared mechanism for writing to the mailboxes, ++ * semaphores, doorbells etc. that are shared between the ARM and the ++ * VideoCore processor ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DRIVER_NAME "bcm2708_vcio" ++#define DEVICE_FILE_NAME "vcio" ++ ++/* offsets from a mail box base address */ ++#define MAIL0_RD 0x00 /* read - and next 4 words */ ++#define MAIL0_POL 0x10 /* read without popping the fifo */ ++#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ ++#define MAIL0_STA 0x18 /* status */ ++#define MAIL0_CNF 0x1C /* configuration */ ++#define MAIL1_WRT 0x20 /* write - and next 4 words */ ++ ++/* On MACH_BCM270x these come through (arm_control.h ) */ ++#ifndef ARM_MS_EMPTY ++#define ARM_MS_EMPTY BIT(30) ++#define ARM_MS_FULL BIT(31) ++ ++#define ARM_MC_IHAVEDATAIRQEN BIT(0) ++#endif ++ ++#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) ++#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) ++#define MBOX_CHAN(msg) ((msg) & 0xf) ++#define MBOX_DATA28(msg) ((msg) & ~0xf) ++#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) ++ ++#define MBOX_MAGIC 0xd0d0c0de ++ ++#define MAJOR_NUM 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) ++ ++static struct class *vcio_class; ++ ++struct vc_mailbox { ++ void __iomem *regs; ++ uint32_t msg[MBOX_CHAN_COUNT]; ++ struct semaphore sema[MBOX_CHAN_COUNT]; ++ uint32_t magic; ++}; ++ ++static void mbox_init(struct vc_mailbox *mbox_out) ++{ ++ int i; ++ ++ for (i = 0; i < MBOX_CHAN_COUNT; i++) { ++ mbox_out->msg[i] = 0; ++ sema_init(&mbox_out->sema[i], 0); ++ } ++ ++ /* Enable the interrupt on data reception */ ++ writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); ++ ++ mbox_out->magic = MBOX_MAGIC; ++} ++ ++static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) ++{ ++ if (mbox->magic != MBOX_MAGIC) ++ return -EINVAL; ++ ++ /* wait for the mailbox FIFO to have some space in it */ ++ while (0 != (readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL)) ++ cpu_relax(); ++ ++ writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); ++ ++ return 0; ++} ++ ++static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) ++{ ++ if (mbox->magic != MBOX_MAGIC) ++ return -EINVAL; ++ ++ down(&mbox->sema[chan]); ++ *data28 = MBOX_DATA28(mbox->msg[chan]); ++ mbox->msg[chan] = 0; ++ ++ return 0; ++} ++ ++static irqreturn_t mbox_irq_handler(int irq, void *dev_id) ++{ ++ /* wait for the mailbox FIFO to have some data in it */ ++ struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; ++ int status = readl(mbox->regs + MAIL0_STA); ++ int ret = IRQ_NONE; ++ ++ while (!(status & ARM_MS_EMPTY)) { ++ uint32_t msg = readl(mbox->regs + MAIL0_RD); ++ int chan = MBOX_CHAN(msg); ++ ++ if (chan < MBOX_CHAN_COUNT) { ++ if (mbox->msg[chan]) { ++ pr_err(DRIVER_NAME ++ ": mbox chan %d overflow - drop %08x\n", ++ chan, msg); ++ } else { ++ mbox->msg[chan] = (msg | 0xf); ++ up(&mbox->sema[chan]); ++ } ++ } else { ++ pr_err(DRIVER_NAME ++ ": invalid channel selector (msg %08x)\n", msg); ++ } ++ ret = IRQ_HANDLED; ++ status = readl(mbox->regs + MAIL0_STA); ++ } ++ return ret; ++} ++ ++/* Mailbox Methods */ ++ ++static struct device *mbox_dev; /* we assume there's only one! */ ++ ++static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) ++{ ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); ++ int rc; ++ ++ device_lock(dev); ++ rc = mbox_write(mailbox, chan, data28); ++ device_unlock(dev); ++ ++ return rc; ++} ++ ++static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) ++{ ++ struct vc_mailbox *mailbox = dev_get_drvdata(dev); ++ int rc; ++ ++ device_lock(dev); ++ rc = mbox_read(mailbox, chan, data28); ++ device_unlock(dev); ++ ++ return rc; ++} ++ ++extern int bcm_mailbox_write(unsigned chan, uint32_t data28) ++{ ++ if (!mbox_dev) ++ return -ENODEV; ++ ++ return dev_mbox_write(mbox_dev, chan, data28); ++} ++EXPORT_SYMBOL_GPL(bcm_mailbox_write); ++ ++extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) ++{ ++ if (!mbox_dev) ++ return -ENODEV; ++ ++ return dev_mbox_read(mbox_dev, chan, data28); ++} ++EXPORT_SYMBOL_GPL(bcm_mailbox_read); ++ ++static int mbox_copy_from_user(void *dst, const void *src, int size) ++{ ++ if ((uint32_t)src < TASK_SIZE) ++ return copy_from_user(dst, src, size); ++ ++ memcpy(dst, src, size); ++ ++ return 0; ++} ++ ++static int mbox_copy_to_user(void *dst, const void *src, int size) ++{ ++ if ((uint32_t)dst < TASK_SIZE) ++ return copy_to_user(dst, src, size); ++ ++ memcpy(dst, src, size); ++ ++ return 0; ++} ++ ++static DEFINE_MUTEX(mailbox_lock); ++extern int bcm_mailbox_property(void *data, int size) ++{ ++ uint32_t success; ++ dma_addr_t mem_bus; /* the memory address accessed from videocore */ ++ void *mem_kern; /* the memory address accessed from driver */ ++ int s = 0; ++ ++ mutex_lock(&mailbox_lock); ++ /* allocate some memory for the messages communicating with GPU */ ++ mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, ++ GFP_ATOMIC); ++ if (mem_kern) { ++ /* create the message */ ++ mbox_copy_from_user(mem_kern, data, size); ++ ++ /* send the message */ ++ wmb(); ++ s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); ++ if (s == 0) ++ s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); ++ if (s == 0) { ++ /* copy the response */ ++ rmb(); ++ mbox_copy_to_user(data, mem_kern, size); ++ } ++ dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); ++ } else { ++ s = -ENOMEM; ++ } ++ if (s != 0) ++ pr_err(DRIVER_NAME ": %s failed (%d)\n", __func__, s); ++ ++ mutex_unlock(&mailbox_lock); ++ return s; ++} ++EXPORT_SYMBOL_GPL(bcm_mailbox_property); ++ ++/* Platform Device for Mailbox */ ++ ++/* ++ * Is the device open right now? Used to prevent ++ * concurent access into the same device ++ */ ++static bool device_is_open; ++ ++/* This is called whenever a process attempts to open the device file */ ++static int device_open(struct inode *inode, struct file *file) ++{ ++ /* We don't want to talk to two processes at the same time */ ++ if (device_is_open) ++ return -EBUSY; ++ ++ device_is_open = true; ++ try_module_get(THIS_MODULE); ++ ++ return 0; ++} ++ ++static int device_release(struct inode *inode, struct file *file) ++{ ++ /* We're now ready for our next caller */ ++ device_is_open = false; ++ ++ module_put(THIS_MODULE); ++ ++ return 0; ++} ++ ++/* ++ * This function is called whenever a process tries to do an ioctl on our ++ * device file. We get two extra parameters (additional to the inode and file ++ * structures, which all device functions get): the number of the ioctl called ++ * and the parameter given to the ioctl function. ++ * ++ * If the ioctl is write or read/write (meaning output is returned to the ++ * calling process), the ioctl call returns the output of this function. ++ * ++ */ ++static long device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ unsigned size; ++ ++ switch (ioctl_num) { ++ case IOCTL_MBOX_PROPERTY: ++ /* ++ * Receive a pointer to a message (in user space) and set that ++ * to be the device's message. Get the parameter given to ++ * ioctl by the process. ++ */ ++ mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); ++ return bcm_mailbox_property((void *)ioctl_param, size); ++ default: ++ pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/* Module Declarations */ ++ ++/* ++ * This structure will hold the functions to be called ++ * when a process does something to the device we ++ * created. Since a pointer to this structure is kept in ++ * the devices table, it can't be local to ++ * init_module. NULL is for unimplemented functios. ++ */ ++const struct file_operations fops = { ++ .unlocked_ioctl = device_ioctl, ++ .open = device_open, ++ .release = device_release, /* a.k.a. close */ ++}; ++ ++static int bcm_vcio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device *vdev; ++ struct vc_mailbox *mailbox; ++ struct resource *res; ++ int irq, ret; ++ ++ mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); ++ if (!mailbox) ++ return -ENOMEM; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mailbox->regs = devm_ioremap_resource(dev, res); ++ if (IS_ERR(mailbox->regs)) ++ return PTR_ERR(mailbox->regs); ++ ++ irq = platform_get_irq(pdev, 0); ++ ret = devm_request_irq(dev, irq, mbox_irq_handler, ++ IRQF_DISABLED | IRQF_IRQPOLL, ++ dev_name(dev), mailbox); ++ if (ret) { ++ dev_err(dev, "Interrupt request failed %d\n", ret); ++ return ret; ++ } ++ ++ ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); ++ if (ret < 0) { ++ pr_err("Character device registration failed %d\n", ret); ++ return ret; ++ } ++ ++ vcio_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vcio_class)) { ++ ret = PTR_ERR(vcio_class); ++ pr_err("Class creation failed %d\n", ret); ++ goto err_class; ++ } ++ ++ vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, ++ "vcio"); ++ if (IS_ERR(vdev)) { ++ ret = PTR_ERR(vdev); ++ pr_err("Device creation failed %d\n", ret); ++ goto err_dev; ++ } ++ ++ mbox_init(mailbox); ++ platform_set_drvdata(pdev, mailbox); ++ mbox_dev = dev; ++ ++ dev_info(dev, "mailbox at %p\n", mailbox->regs); ++ ++ return 0; ++ ++err_dev: ++ class_destroy(vcio_class); ++err_class: ++ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); ++ ++ return ret; ++} ++ ++static int bcm_vcio_remove(struct platform_device *pdev) ++{ ++ mbox_dev = NULL; ++ platform_set_drvdata(pdev, NULL); ++ device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); ++ class_destroy(vcio_class); ++ unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm_vcio_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-vcio", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); ++ ++static struct platform_driver bcm_mbox_driver = { ++ .probe = bcm_vcio_probe, ++ .remove = bcm_vcio_remove, ++ ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm_vcio_of_match_table, ++ }, ++}; ++ ++static int __init bcm_mbox_init(void) ++{ ++ return platform_driver_register(&bcm_mbox_driver); ++} ++ ++static void __exit bcm_mbox_exit(void) ++{ ++ platform_driver_unregister(&bcm_mbox_driver); ++} ++ ++arch_initcall(bcm_mbox_init); /* Initialize early */ ++module_exit(bcm_mbox_exit); ++ ++MODULE_AUTHOR("Gray Girling"); ++MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); ++MODULE_LICENSE("GPL"); +diff --git a/include/linux/platform_data/mailbox-bcm2708.h b/include/linux/platform_data/mailbox-bcm2708.h +new file mode 100644 +index 0000000..cc284ed +--- /dev/null ++++ b/include/linux/platform_data/mailbox-bcm2708.h +@@ -0,0 +1,126 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++#ifndef _PLAT_MAILBOX_BCM2708_H ++#define _PLAT_MAILBOX_BCM2708_H ++ ++/* Routines to handle I/O via the VideoCore "ARM control" registers ++ * (semaphores, doorbells, mailboxes) ++ */ ++ ++/* Constants shared with the ARM identifying separate mailbox channels */ ++#define MBOX_CHAN_POWER 0 /* for use by the power management interface */ ++#define MBOX_CHAN_FB 1 /* for use by the frame buffer */ ++#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */ ++#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */ ++#define MBOX_CHAN_COUNT 9 ++ ++enum { ++ VCMSG_PROCESS_REQUEST = 0x00000000 ++}; ++ ++enum { ++ VCMSG_REQUEST_SUCCESSFUL = 0x80000000, ++ VCMSG_REQUEST_FAILED = 0x80000001 ++}; ++ ++/* Mailbox property tags */ ++enum { ++ VCMSG_PROPERTY_END = 0x00000000, ++ VCMSG_GET_FIRMWARE_REVISION = 0x00000001, ++ VCMSG_GET_BOARD_MODEL = 0x00010001, ++ VCMSG_GET_BOARD_REVISION = 0x00010002, ++ VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003, ++ VCMSG_GET_BOARD_SERIAL = 0x00010004, ++ VCMSG_GET_ARM_MEMORY = 0x00010005, ++ VCMSG_GET_VC_MEMORY = 0x00010006, ++ VCMSG_GET_CLOCKS = 0x00010007, ++ VCMSG_GET_COMMAND_LINE = 0x00050001, ++ VCMSG_GET_DMA_CHANNELS = 0x00060001, ++ VCMSG_GET_POWER_STATE = 0x00020001, ++ VCMSG_GET_TIMING = 0x00020002, ++ VCMSG_SET_POWER_STATE = 0x00028001, ++ VCMSG_GET_CLOCK_STATE = 0x00030001, ++ VCMSG_SET_CLOCK_STATE = 0x00038001, ++ VCMSG_GET_CLOCK_RATE = 0x00030002, ++ VCMSG_SET_CLOCK_RATE = 0x00038002, ++ VCMSG_GET_VOLTAGE = 0x00030003, ++ VCMSG_SET_VOLTAGE = 0x00038003, ++ VCMSG_GET_MAX_CLOCK = 0x00030004, ++ VCMSG_GET_MAX_VOLTAGE = 0x00030005, ++ VCMSG_GET_TEMPERATURE = 0x00030006, ++ VCMSG_GET_MIN_CLOCK = 0x00030007, ++ VCMSG_GET_MIN_VOLTAGE = 0x00030008, ++ VCMSG_GET_TURBO = 0x00030009, ++ VCMSG_GET_MAX_TEMPERATURE = 0x0003000a, ++ VCMSG_GET_STC = 0x0003000b, ++ VCMSG_SET_TURBO = 0x00038009, ++ VCMSG_SET_ALLOCATE_MEM = 0x0003000c, ++ VCMSG_SET_LOCK_MEM = 0x0003000d, ++ VCMSG_SET_UNLOCK_MEM = 0x0003000e, ++ VCMSG_SET_RELEASE_MEM = 0x0003000f, ++ VCMSG_SET_EXECUTE_CODE = 0x00030010, ++ VCMSG_SET_EXECUTE_QPU = 0x00030011, ++ VCMSG_SET_ENABLE_QPU = 0x00030012, ++ VCMSG_GET_RESOURCE_HANDLE = 0x00030014, ++ VCMSG_GET_EDID_BLOCK = 0x00030020, ++ VCMSG_GET_CUSTOMER_OTP = 0x00030021, ++ VCMSG_SET_CUSTOMER_OTP = 0x00038021, ++ VCMSG_SET_ALLOCATE_BUFFER = 0x00040001, ++ VCMSG_SET_RELEASE_BUFFER = 0x00048001, ++ VCMSG_SET_BLANK_SCREEN = 0x00040002, ++ VCMSG_TST_BLANK_SCREEN = 0x00044002, ++ VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003, ++ VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, ++ VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, ++ VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004, ++ VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, ++ VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, ++ VCMSG_GET_DEPTH = 0x00040005, ++ VCMSG_TST_DEPTH = 0x00044005, ++ VCMSG_SET_DEPTH = 0x00048005, ++ VCMSG_GET_PIXEL_ORDER = 0x00040006, ++ VCMSG_TST_PIXEL_ORDER = 0x00044006, ++ VCMSG_SET_PIXEL_ORDER = 0x00048006, ++ VCMSG_GET_ALPHA_MODE = 0x00040007, ++ VCMSG_TST_ALPHA_MODE = 0x00044007, ++ VCMSG_SET_ALPHA_MODE = 0x00048007, ++ VCMSG_GET_PITCH = 0x00040008, ++ VCMSG_TST_PITCH = 0x00044008, ++ VCMSG_SET_PITCH = 0x00048008, ++ VCMSG_GET_VIRTUAL_OFFSET = 0x00040009, ++ VCMSG_TST_VIRTUAL_OFFSET = 0x00044009, ++ VCMSG_SET_VIRTUAL_OFFSET = 0x00048009, ++ VCMSG_GET_OVERSCAN = 0x0004000a, ++ VCMSG_TST_OVERSCAN = 0x0004400a, ++ VCMSG_SET_OVERSCAN = 0x0004800a, ++ VCMSG_GET_PALETTE = 0x0004000b, ++ VCMSG_TST_PALETTE = 0x0004400b, ++ VCMSG_SET_PALETTE = 0x0004800b, ++ VCMSG_GET_LAYER = 0x0004000c, ++ VCMSG_TST_LAYER = 0x0004400c, ++ VCMSG_SET_LAYER = 0x0004800c, ++ VCMSG_GET_TRANSFORM = 0x0004000d, ++ VCMSG_TST_TRANSFORM = 0x0004400d, ++ VCMSG_SET_TRANSFORM = 0x0004800d, ++ VCMSG_TST_VSYNC = 0x0004400e, ++ VCMSG_SET_VSYNC = 0x0004800e, ++ VCMSG_SET_CURSOR_INFO = 0x00008010, ++ VCMSG_SET_CURSOR_STATE = 0x00008011, ++}; ++ ++int bcm_mailbox_read(unsigned chan, uint32_t *data28); ++int bcm_mailbox_write(unsigned chan, uint32_t data28); ++int bcm_mailbox_property(void *data, int size); ++ ++#endif + +From 1e5c7135fc145addcf195d02759a45e162f2daac Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 19:11:58 +0200 +Subject: [PATCH 144/216] BCM270x: power: Change initcall level to subsys +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Load ordering of modules are determined by the initcall used. +If it's the same initcall level, makefile ordering decides. +Now that the mailbox driver is being moved, it's no longer +placed before the power driver by the linker. +So use a later initcall level to let the mailbox driver +load first. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/power.c | 6 +++++- + arch/arm/mach-bcm2709/power.c | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/power.c b/arch/arm/mach-bcm2708/power.c +index 2696be9..0db355d 100644 +--- a/arch/arm/mach-bcm2708/power.c ++++ b/arch/arm/mach-bcm2708/power.c +@@ -189,7 +189,11 @@ static void __exit bcm_power_exit(void) + bcm_mailbox_write(MBOX_CHAN_POWER, 0); + } + +-arch_initcall(bcm_power_init); /* Initialize early */ ++/* ++ * Load after the mailbox driver is initialized (arch_initcall), ++ * but before depending drivers (module_init). ++ */ ++subsys_initcall(bcm_power_init); + module_exit(bcm_power_exit); + + MODULE_AUTHOR("Phil Elwell"); +diff --git a/arch/arm/mach-bcm2709/power.c b/arch/arm/mach-bcm2709/power.c +index 3421057..88c1e28 100644 +--- a/arch/arm/mach-bcm2709/power.c ++++ b/arch/arm/mach-bcm2709/power.c +@@ -187,7 +187,11 @@ static void __exit bcm_power_exit(void) + bcm_mailbox_write(MBOX_CHAN_POWER, 0); + } + +-arch_initcall(bcm_power_init); /* Initialize early */ ++/* ++ * Load after the mailbox driver is initialized (arch_initcall), ++ * but before depending drivers (module_init). ++ */ ++subsys_initcall(bcm_power_init); + module_exit(bcm_power_exit); + + MODULE_AUTHOR("Phil Elwell"); + +From 41e80f86dc78015856087cccd8e4f9a251042f9d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 2 May 2015 09:34:26 +0200 +Subject: [PATCH 145/216] BCM270x: Use bcm2708-vcio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use bcm2708-vcio instead of the arch version. +Change affected drivers to use linux/platform_data/mailbox-bcm2708.h + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2709_defconfig | 2 ++ + arch/arm/configs/bcmrpi_defconfig | 2 ++ + arch/arm/mach-bcm2708/Makefile | 2 +- + arch/arm/mach-bcm2708/power.c | 2 +- + arch/arm/mach-bcm2708/vc_mem.c | 2 +- + arch/arm/mach-bcm2709/Makefile | 2 +- + arch/arm/mach-bcm2709/power.c | 2 +- + arch/arm/mach-bcm2709/vc_mem.c | 2 +- + arch/arm/mach-bcm2709/vc_support.c | 2 +- + drivers/cpufreq/bcm2835-cpufreq.c | 2 +- + drivers/hwmon/bcm2835-hwmon.c | 2 +- + drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 2 +- + drivers/thermal/bcm2835-thermal.c | 2 +- + drivers/video/fbdev/bcm2708_fb.c | 2 +- + 14 files changed, 16 insertions(+), 12 deletions(-) + mode change 100755 => 100644 arch/arm/mach-bcm2709/vc_support.c + mode change 100755 => 100644 drivers/cpufreq/bcm2835-cpufreq.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 367a04a..ff87581 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -1052,6 +1052,8 @@ CONFIG_FB_TFT_UPD161704=m + CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2708_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index db287f3..e339979 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -1045,6 +1045,8 @@ CONFIG_FB_TFT_UPD161704=m + CONFIG_FB_TFT_WATTEROTT=m + CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m ++CONFIG_MAILBOX=y ++CONFIG_BCM2708_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile +index 454408c..c1e7d41 100644 +--- a/arch/arm/mach-bcm2708/Makefile ++++ b/arch/arm/mach-bcm2708/Makefile +@@ -2,6 +2,6 @@ + # Makefile for the linux kernel. + # + +-obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o vcio.o power.o ++obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o power.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2708/power.c b/arch/arm/mach-bcm2708/power.c +index 0db355d..796837f 100644 +--- a/arch/arm/mach-bcm2708/power.c ++++ b/arch/arm/mach-bcm2708/power.c +@@ -14,8 +14,8 @@ + #include + #include + #include ++#include + #include +-#include + #include + + #define DRIVER_NAME "bcm2708_power" +diff --git a/arch/arm/mach-bcm2708/vc_mem.c b/arch/arm/mach-bcm2708/vc_mem.c +index 2982af7..226b737 100644 +--- a/arch/arm/mach-bcm2708/vc_mem.c ++++ b/arch/arm/mach-bcm2708/vc_mem.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #ifdef CONFIG_ARCH_KONA + #include +@@ -31,7 +32,6 @@ + #endif + + #include "mach/vc_mem.h" +-#include + + #define DRIVER_NAME "vc-mem" + +diff --git a/arch/arm/mach-bcm2709/Makefile b/arch/arm/mach-bcm2709/Makefile +index f07c38b..77b8429 100644 +--- a/arch/arm/mach-bcm2709/Makefile ++++ b/arch/arm/mach-bcm2709/Makefile +@@ -2,6 +2,6 @@ + # Makefile for the linux kernel. + # + +-obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o vcio.o power.o ++obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o power.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2709/power.c b/arch/arm/mach-bcm2709/power.c +index 88c1e28..960e472 100644 +--- a/arch/arm/mach-bcm2709/power.c ++++ b/arch/arm/mach-bcm2709/power.c +@@ -14,8 +14,8 @@ + #include + #include + #include ++#include + #include +-#include + #include + + #define DRIVER_NAME "bcm2708_power" +diff --git a/arch/arm/mach-bcm2709/vc_mem.c b/arch/arm/mach-bcm2709/vc_mem.c +index ac578db..d2adfd1 100644 +--- a/arch/arm/mach-bcm2709/vc_mem.c ++++ b/arch/arm/mach-bcm2709/vc_mem.c +@@ -22,6 +22,7 @@ + #include + #include + #include ++#include + + #ifdef CONFIG_ARCH_KONA + #include +@@ -31,7 +32,6 @@ + #endif + + #include "mach/vc_mem.h" +-#include + + #define DRIVER_NAME "vc-mem" + +diff --git a/arch/arm/mach-bcm2709/vc_support.c b/arch/arm/mach-bcm2709/vc_support.c +old mode 100755 +new mode 100644 +index 0bc41c4..c4dc7d6 +--- a/arch/arm/mach-bcm2709/vc_support.c ++++ b/arch/arm/mach-bcm2709/vc_support.c +@@ -6,7 +6,7 @@ + */ + + #include +-#include ++#include + + #ifdef ECLIPSE_IGNORE + +diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c +old mode 100755 +new mode 100644 +index 447ca09..6735da9 +--- a/drivers/cpufreq/bcm2835-cpufreq.c ++++ b/drivers/cpufreq/bcm2835-cpufreq.c +@@ -26,7 +26,7 @@ + #include + #include + #include +-#include ++#include + + /* ---------- DEFINES ---------- */ + /*#define CPUFREQ_DEBUG_ENABLE*/ /* enable debugging */ +diff --git a/drivers/hwmon/bcm2835-hwmon.c b/drivers/hwmon/bcm2835-hwmon.c +index 5bbed45..d14502c 100644 +--- a/drivers/hwmon/bcm2835-hwmon.c ++++ b/drivers/hwmon/bcm2835-hwmon.c +@@ -17,9 +17,9 @@ + #include + #include + #include ++#include + #include + #include +-#include + #include + #include + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 8ec88bb..70e5086 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -40,13 +40,13 @@ + #include + #include + #include ++#include + #include + #include + + #include + + #include +-#include + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) + +diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c +index 85fceb5..0c556d1 100644 +--- a/drivers/thermal/bcm2835-thermal.c ++++ b/drivers/thermal/bcm2835-thermal.c +@@ -15,10 +15,10 @@ + #include + #include + #include ++#include + #include + #include + #include +-#include + #include + + +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +index 52e655a..345c15e 100644 +--- a/drivers/video/fbdev/bcm2708_fb.c ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -32,7 +33,6 @@ + + #include + #include +-#include + + #include + #include + +From 5bb0a0c80fc46ae0edea87f97244f28fb167dfe0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 2 May 2015 09:35:07 +0200 +Subject: [PATCH 146/216] BCM270x: Remove arch driver vcio.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Remove the arch vcio.c driver and header file. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/include/mach/vcio.h | 128 -------- + arch/arm/mach-bcm2708/vcio.c | 419 -------------------------- + arch/arm/mach-bcm2709/include/mach/vcio.h | 165 ---------- + arch/arm/mach-bcm2709/vcio.c | 484 ------------------------------ + 4 files changed, 1196 deletions(-) + delete mode 100644 arch/arm/mach-bcm2708/include/mach/vcio.h + delete mode 100644 arch/arm/mach-bcm2708/vcio.c + delete mode 100644 arch/arm/mach-bcm2709/include/mach/vcio.h + delete mode 100644 arch/arm/mach-bcm2709/vcio.c + +diff --git a/arch/arm/mach-bcm2708/include/mach/vcio.h b/arch/arm/mach-bcm2708/include/mach/vcio.h +deleted file mode 100644 +index 95ad121..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/vcio.h ++++ /dev/null +@@ -1,128 +0,0 @@ +-/* +- * arch/arm/mach-bcm2708/include/mach/vcio.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- */ +-#ifndef _MACH_BCM2708_VCIO_H +-#define _MACH_BCM2708_VCIO_H +- +-/* Routines to handle I/O via the VideoCore "ARM control" registers +- * (semaphores, doorbells, mailboxes) +- */ +- +-/* Constants shared with the ARM identifying separate mailbox channels */ +-#define MBOX_CHAN_POWER 0 /* for use by the power management interface */ +-#define MBOX_CHAN_FB 1 /* for use by the frame buffer */ +-#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */ +-#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */ +-#define MBOX_CHAN_COUNT 9 +- +-enum { +- VCMSG_PROCESS_REQUEST = 0x00000000 +-}; +- +-enum { +- VCMSG_REQUEST_SUCCESSFUL = 0x80000000, +- VCMSG_REQUEST_FAILED = 0x80000001 +-}; +- +-/* Mailbox property tags */ +-enum { +- VCMSG_PROPERTY_END = 0x00000000, +- VCMSG_GET_FIRMWARE_REVISION = 0x00000001, +- VCMSG_GET_BOARD_MODEL = 0x00010001, +- VCMSG_GET_BOARD_REVISION = 0x00010002, +- VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003, +- VCMSG_GET_BOARD_SERIAL = 0x00010004, +- VCMSG_GET_ARM_MEMORY = 0x00010005, +- VCMSG_GET_VC_MEMORY = 0x00010006, +- VCMSG_GET_CLOCKS = 0x00010007, +- VCMSG_GET_COMMAND_LINE = 0x00050001, +- VCMSG_GET_DMA_CHANNELS = 0x00060001, +- VCMSG_GET_POWER_STATE = 0x00020001, +- VCMSG_GET_TIMING = 0x00020002, +- VCMSG_SET_POWER_STATE = 0x00028001, +- VCMSG_GET_CLOCK_STATE = 0x00030001, +- VCMSG_SET_CLOCK_STATE = 0x00038001, +- VCMSG_GET_CLOCK_RATE = 0x00030002, +- VCMSG_SET_CLOCK_RATE = 0x00038002, +- VCMSG_GET_VOLTAGE = 0x00030003, +- VCMSG_SET_VOLTAGE = 0x00038003, +- VCMSG_GET_MAX_CLOCK = 0x00030004, +- VCMSG_GET_MAX_VOLTAGE = 0x00030005, +- VCMSG_GET_TEMPERATURE = 0x00030006, +- VCMSG_GET_MIN_CLOCK = 0x00030007, +- VCMSG_GET_MIN_VOLTAGE = 0x00030008, +- VCMSG_GET_TURBO = 0x00030009, +- VCMSG_GET_MAX_TEMPERATURE = 0x0003000a, +- VCMSG_GET_STC = 0x0003000b, +- VCMSG_SET_TURBO = 0x00038009, +- VCMSG_SET_ALLOCATE_MEM = 0x0003000c, +- VCMSG_SET_LOCK_MEM = 0x0003000d, +- VCMSG_SET_UNLOCK_MEM = 0x0003000e, +- VCMSG_SET_RELEASE_MEM = 0x0003000f, +- VCMSG_SET_EXECUTE_CODE = 0x00030010, +- VCMSG_SET_EXECUTE_QPU = 0x00030011, +- VCMSG_SET_ENABLE_QPU = 0x00030012, +- VCMSG_GET_RESOURCE_HANDLE = 0x00030014, +- VCMSG_GET_EDID_BLOCK = 0x00030020, +- VCMSG_GET_CUSTOMER_OTP = 0x00030021, +- VCMSG_SET_CUSTOMER_OTP = 0x00038021, +- VCMSG_SET_ALLOCATE_BUFFER = 0x00040001, +- VCMSG_SET_RELEASE_BUFFER = 0x00048001, +- VCMSG_SET_BLANK_SCREEN = 0x00040002, +- VCMSG_TST_BLANK_SCREEN = 0x00044002, +- VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003, +- VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, +- VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, +- VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004, +- VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +- VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, +- VCMSG_GET_DEPTH = 0x00040005, +- VCMSG_TST_DEPTH = 0x00044005, +- VCMSG_SET_DEPTH = 0x00048005, +- VCMSG_GET_PIXEL_ORDER = 0x00040006, +- VCMSG_TST_PIXEL_ORDER = 0x00044006, +- VCMSG_SET_PIXEL_ORDER = 0x00048006, +- VCMSG_GET_ALPHA_MODE = 0x00040007, +- VCMSG_TST_ALPHA_MODE = 0x00044007, +- VCMSG_SET_ALPHA_MODE = 0x00048007, +- VCMSG_GET_PITCH = 0x00040008, +- VCMSG_TST_PITCH = 0x00044008, +- VCMSG_SET_PITCH = 0x00048008, +- VCMSG_GET_VIRTUAL_OFFSET = 0x00040009, +- VCMSG_TST_VIRTUAL_OFFSET = 0x00044009, +- VCMSG_SET_VIRTUAL_OFFSET = 0x00048009, +- VCMSG_GET_OVERSCAN = 0x0004000a, +- VCMSG_TST_OVERSCAN = 0x0004400a, +- VCMSG_SET_OVERSCAN = 0x0004800a, +- VCMSG_GET_PALETTE = 0x0004000b, +- VCMSG_TST_PALETTE = 0x0004400b, +- VCMSG_SET_PALETTE = 0x0004800b, +- VCMSG_GET_LAYER = 0x0004000c, +- VCMSG_TST_LAYER = 0x0004400c, +- VCMSG_SET_LAYER = 0x0004800c, +- VCMSG_GET_TRANSFORM = 0x0004000d, +- VCMSG_TST_TRANSFORM = 0x0004400d, +- VCMSG_SET_TRANSFORM = 0x0004800d, +- VCMSG_TST_VSYNC = 0x0004400e, +- VCMSG_SET_VSYNC = 0x0004800e, +- VCMSG_SET_CURSOR_INFO = 0x00008010, +- VCMSG_SET_CURSOR_STATE = 0x00008011, +-}; +- +-extern int /*rc*/ bcm_mailbox_read(unsigned chan, uint32_t *data28); +-extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28); +-extern int /*rc*/ bcm_mailbox_property(void *data, int size); +- +-#endif +diff --git a/arch/arm/mach-bcm2708/vcio.c b/arch/arm/mach-bcm2708/vcio.c +deleted file mode 100644 +index c4c2bcd..0000000 +--- a/arch/arm/mach-bcm2708/vcio.c ++++ /dev/null +@@ -1,419 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/vcio.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for writing to the mailboxes, +- * semaphores, doorbells etc. that are shared between the ARM and the +- * VideoCore processor +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#define DRIVER_NAME "bcm2708_vcio" +-#define DEVICE_FILE_NAME "vcio" +- +-/* offsets from a mail box base address */ +-#define MAIL0_RD 0x00 /* read - and next 4 words */ +-#define MAIL0_POL 0x10 /* read without popping the fifo */ +-#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL0_STA 0x18 /* status */ +-#define MAIL0_CNF 0x1C /* configuration */ +-#define MAIL1_WRT 0x20 /* write - and next 4 words */ +- +-#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +-#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +-#define MBOX_CHAN(msg) ((msg) & 0xf) +-#define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) +- +-#define MBOX_MAGIC 0xd0d0c0de +- +-#define MAJOR_NUM 100 +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +- +-static struct class *vcio_class; +- +-struct vc_mailbox { +- void __iomem *regs; +- uint32_t msg[MBOX_CHAN_COUNT]; +- struct semaphore sema[MBOX_CHAN_COUNT]; +- uint32_t magic; +-}; +- +-static void mbox_init(struct vc_mailbox *mbox_out) +-{ +- int i; +- +- for (i = 0; i < MBOX_CHAN_COUNT; i++) { +- mbox_out->msg[i] = 0; +- sema_init(&mbox_out->sema[i], 0); +- } +- +- /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); +- +- mbox_out->magic = MBOX_MAGIC; +-} +- +-static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL)) +- cpu_relax(); +- +- writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); +- +- return 0; +-} +- +-static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- +- return 0; +-} +- +-static irqreturn_t mbox_irq_handler(int irq, void *dev_id) +-{ +- /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +- int status = readl(mbox->regs + MAIL0_STA); +- int ret = IRQ_NONE; +- +- while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->regs + MAIL0_RD); +- int chan = MBOX_CHAN(msg); +- +- if (chan < MBOX_CHAN_COUNT) { +- if (mbox->msg[chan]) { +- pr_err(DRIVER_NAME +- ": mbox chan %d overflow - drop %08x\n", +- chan, msg); +- } else { +- mbox->msg[chan] = (msg | 0xf); +- up(&mbox->sema[chan]); +- } +- } else { +- pr_err(DRIVER_NAME +- ": invalid channel selector (msg %08x)\n", msg); +- } +- ret = IRQ_HANDLED; +- status = readl(mbox->regs + MAIL0_STA); +- } +- return ret; +-} +- +-/* Mailbox Methods */ +- +-static struct device *mbox_dev; /* we assume there's only one! */ +- +-static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_write(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_read(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-extern int bcm_mailbox_write(unsigned chan, uint32_t data28) +-{ +- if (!mbox_dev) +- return -ENODEV; +- +- return dev_mbox_write(mbox_dev, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_write); +- +-extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) +-{ +- if (!mbox_dev) +- return -ENODEV; +- +- return dev_mbox_read(mbox_dev, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); +- +-static int mbox_copy_from_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)src < TASK_SIZE) +- return copy_from_user(dst, src, size); +- +- memcpy(dst, src, size); +- +- return 0; +-} +- +-static int mbox_copy_to_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)dst < TASK_SIZE) +- return copy_to_user(dst, src, size); +- +- memcpy(dst, src, size); +- +- return 0; +-} +- +-static DEFINE_MUTEX(mailbox_lock); +-extern int bcm_mailbox_property(void *data, int size) +-{ +- uint32_t success; +- dma_addr_t mem_bus; /* the memory address accessed from videocore */ +- void *mem_kern; /* the memory address accessed from driver */ +- int s = 0; +- +- mutex_lock(&mailbox_lock); +- /* allocate some memory for the messages communicating with GPU */ +- mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, +- GFP_ATOMIC); +- if (mem_kern) { +- /* create the message */ +- mbox_copy_from_user(mem_kern, data, size); +- +- /* send the message */ +- wmb(); +- s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); +- if (s == 0) +- s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); +- if (s == 0) { +- /* copy the response */ +- rmb(); +- mbox_copy_to_user(data, mem_kern, size); +- } +- dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); +- } else { +- s = -ENOMEM; +- } +- if (s != 0) +- pr_err(DRIVER_NAME ": %s failed (%d)\n", __func__, s); +- +- mutex_unlock(&mailbox_lock); +- return s; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_property); +- +-/* Platform Device for Mailbox */ +- +-/* +- * Is the device open right now? Used to prevent +- * concurent access into the same device +- */ +-static bool device_is_open; +- +-/* This is called whenever a process attempts to open the device file */ +-static int device_open(struct inode *inode, struct file *file) +-{ +- /* We don't want to talk to two processes at the same time */ +- if (device_is_open) +- return -EBUSY; +- +- device_is_open = true; +- try_module_get(THIS_MODULE); +- +- return 0; +-} +- +-static int device_release(struct inode *inode, struct file *file) +-{ +- /* We're now ready for our next caller */ +- device_is_open = false; +- +- module_put(THIS_MODULE); +- +- return 0; +-} +- +-/* +- * This function is called whenever a process tries to do an ioctl on our +- * device file. We get two extra parameters (additional to the inode and file +- * structures, which all device functions get): the number of the ioctl called +- * and the parameter given to the ioctl function. +- * +- * If the ioctl is write or read/write (meaning output is returned to the +- * calling process), the ioctl call returns the output of this function. +- * +- */ +-static long device_ioctl(struct file *file, unsigned int ioctl_num, +- unsigned long ioctl_param) +-{ +- unsigned size; +- +- switch (ioctl_num) { +- case IOCTL_MBOX_PROPERTY: +- /* +- * Receive a pointer to a message (in user space) and set that +- * to be the device's message. Get the parameter given to +- * ioctl by the process. +- */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); +- return bcm_mailbox_property((void *)ioctl_param, size); +- default: +- pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); +- return -EINVAL; +- } +- +- return 0; +-} +- +-/* Module Declarations */ +- +-/* +- * This structure will hold the functions to be called +- * when a process does something to the device we +- * created. Since a pointer to this structure is kept in +- * the devices table, it can't be local to +- * init_module. NULL is for unimplemented functios. +- */ +-const struct file_operations fops = { +- .unlocked_ioctl = device_ioctl, +- .open = device_open, +- .release = device_release, /* a.k.a. close */ +-}; +- +-static int bcm_vcio_probe(struct platform_device *pdev) +-{ +- struct device *dev = &pdev->dev; +- struct device *vdev; +- struct vc_mailbox *mailbox; +- struct resource *res; +- int irq, ret; +- +- mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); +- if (!mailbox) +- return -ENOMEM; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- mailbox->regs = devm_ioremap_resource(dev, res); +- if (IS_ERR(mailbox->regs)) +- return PTR_ERR(mailbox->regs); +- +- irq = platform_get_irq(pdev, 0); +- ret = devm_request_irq(dev, irq, mbox_irq_handler, +- IRQF_DISABLED | IRQF_IRQPOLL, +- dev_name(dev), mailbox); +- if (ret) { +- dev_err(dev, "Interrupt request failed %d\n", ret); +- return ret; +- } +- +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- if (ret < 0) { +- pr_err("Character device registration failed %d\n", ret); +- return ret; +- } +- +- vcio_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- pr_err("Class creation failed %d\n", ret); +- goto err_class; +- } +- +- vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); +- if (IS_ERR(vdev)) { +- ret = PTR_ERR(vdev); +- pr_err("Device creation failed %d\n", ret); +- goto err_dev; +- } +- +- mbox_init(mailbox); +- platform_set_drvdata(pdev, mailbox); +- mbox_dev = dev; +- +- dev_info(dev, "mailbox at %p\n", mailbox->regs); +- +- return 0; +- +-err_dev: +- class_destroy(vcio_class); +-err_class: +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return ret; +-} +- +-static int bcm_vcio_remove(struct platform_device *pdev) +-{ +- mbox_dev = NULL; +- platform_set_drvdata(pdev, NULL); +- device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return 0; +-} +- +-static const struct of_device_id bcm_vcio_of_match_table[] = { +- { .compatible = "brcm,bcm2708-vcio", }, +- {}, +-}; +-MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); +- +-static struct platform_driver bcm_mbox_driver = { +- .probe = bcm_vcio_probe, +- .remove = bcm_vcio_remove, +- +- .driver = { +- .name = DRIVER_NAME, +- .owner = THIS_MODULE, +- .of_match_table = bcm_vcio_of_match_table, +- }, +-}; +- +-static int __init bcm_mbox_init(void) +-{ +- return platform_driver_register(&bcm_mbox_driver); +-} +- +-static void __exit bcm_mbox_exit(void) +-{ +- platform_driver_unregister(&bcm_mbox_driver); +-} +- +-arch_initcall(bcm_mbox_init); /* Initialize early */ +-module_exit(bcm_mbox_exit); +- +-MODULE_AUTHOR("Gray Girling"); +-MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); +-MODULE_LICENSE("GPL"); +diff --git a/arch/arm/mach-bcm2709/include/mach/vcio.h b/arch/arm/mach-bcm2709/include/mach/vcio.h +deleted file mode 100644 +index 8e11d67e..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/vcio.h ++++ /dev/null +@@ -1,165 +0,0 @@ +-/* +- * arch/arm/mach-bcm2708/include/mach/vcio.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +-#ifndef _MACH_BCM2708_VCIO_H +-#define _MACH_BCM2708_VCIO_H +- +-/* Routines to handle I/O via the VideoCore "ARM control" registers +- * (semaphores, doorbells, mailboxes) +- */ +- +-#define BCM_VCIO_DRIVER_NAME "bcm2708_vcio" +- +-/* Constants shared with the ARM identifying separate mailbox channels */ +-#define MBOX_CHAN_POWER 0 /* for use by the power management interface */ +-#define MBOX_CHAN_FB 1 /* for use by the frame buffer */ +-#define MBOX_CHAN_VCHIQ 3 /* for use by the VCHIQ interface */ +-#define MBOX_CHAN_PROPERTY 8 /* for use by the property channel */ +-#define MBOX_CHAN_COUNT 9 +- +-enum { +- VCMSG_PROCESS_REQUEST = 0x00000000 +-}; +-enum { +- VCMSG_REQUEST_SUCCESSFUL = 0x80000000, +- VCMSG_REQUEST_FAILED = 0x80000001 +-}; +-/* Mailbox property tags */ +-enum { +- VCMSG_PROPERTY_END = 0x00000000, +- VCMSG_GET_FIRMWARE_REVISION = 0x00000001, +- VCMSG_GET_BOARD_MODEL = 0x00010001, +- VCMSG_GET_BOARD_REVISION = 0x00010002, +- VCMSG_GET_BOARD_MAC_ADDRESS = 0x00010003, +- VCMSG_GET_BOARD_SERIAL = 0x00010004, +- VCMSG_GET_ARM_MEMORY = 0x00010005, +- VCMSG_GET_VC_MEMORY = 0x00010006, +- VCMSG_GET_CLOCKS = 0x00010007, +- VCMSG_GET_COMMAND_LINE = 0x00050001, +- VCMSG_GET_DMA_CHANNELS = 0x00060001, +- VCMSG_GET_POWER_STATE = 0x00020001, +- VCMSG_GET_TIMING = 0x00020002, +- VCMSG_SET_POWER_STATE = 0x00028001, +- VCMSG_GET_CLOCK_STATE = 0x00030001, +- VCMSG_SET_CLOCK_STATE = 0x00038001, +- VCMSG_GET_CLOCK_RATE = 0x00030002, +- VCMSG_SET_CLOCK_RATE = 0x00038002, +- VCMSG_GET_VOLTAGE = 0x00030003, +- VCMSG_SET_VOLTAGE = 0x00038003, +- VCMSG_GET_MAX_CLOCK = 0x00030004, +- VCMSG_GET_MAX_VOLTAGE = 0x00030005, +- VCMSG_GET_TEMPERATURE = 0x00030006, +- VCMSG_GET_MIN_CLOCK = 0x00030007, +- VCMSG_GET_MIN_VOLTAGE = 0x00030008, +- VCMSG_GET_TURBO = 0x00030009, +- VCMSG_GET_MAX_TEMPERATURE = 0x0003000a, +- VCMSG_GET_STC = 0x0003000b, +- VCMSG_SET_TURBO = 0x00038009, +- VCMSG_SET_ALLOCATE_MEM = 0x0003000c, +- VCMSG_SET_LOCK_MEM = 0x0003000d, +- VCMSG_SET_UNLOCK_MEM = 0x0003000e, +- VCMSG_SET_RELEASE_MEM = 0x0003000f, +- VCMSG_SET_EXECUTE_CODE = 0x00030010, +- VCMSG_SET_EXECUTE_QPU = 0x00030011, +- VCMSG_SET_ENABLE_QPU = 0x00030012, +- VCMSG_GET_RESOURCE_HANDLE = 0x00030014, +- VCMSG_GET_EDID_BLOCK = 0x00030020, +- VCMSG_GET_CUSTOMER_OTP = 0x00030021, +- VCMSG_SET_CUSTOMER_OTP = 0x00038021, +- VCMSG_SET_ALLOCATE_BUFFER = 0x00040001, +- VCMSG_SET_RELEASE_BUFFER = 0x00048001, +- VCMSG_SET_BLANK_SCREEN = 0x00040002, +- VCMSG_TST_BLANK_SCREEN = 0x00044002, +- VCMSG_GET_PHYSICAL_WIDTH_HEIGHT = 0x00040003, +- VCMSG_TST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, +- VCMSG_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, +- VCMSG_GET_VIRTUAL_WIDTH_HEIGHT = 0x00040004, +- VCMSG_TST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +- VCMSG_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, +- VCMSG_GET_DEPTH = 0x00040005, +- VCMSG_TST_DEPTH = 0x00044005, +- VCMSG_SET_DEPTH = 0x00048005, +- VCMSG_GET_PIXEL_ORDER = 0x00040006, +- VCMSG_TST_PIXEL_ORDER = 0x00044006, +- VCMSG_SET_PIXEL_ORDER = 0x00048006, +- VCMSG_GET_ALPHA_MODE = 0x00040007, +- VCMSG_TST_ALPHA_MODE = 0x00044007, +- VCMSG_SET_ALPHA_MODE = 0x00048007, +- VCMSG_GET_PITCH = 0x00040008, +- VCMSG_TST_PITCH = 0x00044008, +- VCMSG_SET_PITCH = 0x00048008, +- VCMSG_GET_VIRTUAL_OFFSET = 0x00040009, +- VCMSG_TST_VIRTUAL_OFFSET = 0x00044009, +- VCMSG_SET_VIRTUAL_OFFSET = 0x00048009, +- VCMSG_GET_OVERSCAN = 0x0004000a, +- VCMSG_TST_OVERSCAN = 0x0004400a, +- VCMSG_SET_OVERSCAN = 0x0004800a, +- VCMSG_GET_PALETTE = 0x0004000b, +- VCMSG_TST_PALETTE = 0x0004400b, +- VCMSG_SET_PALETTE = 0x0004800b, +- VCMSG_GET_LAYER = 0x0004000c, +- VCMSG_TST_LAYER = 0x0004400c, +- VCMSG_SET_LAYER = 0x0004800c, +- VCMSG_GET_TRANSFORM = 0x0004000d, +- VCMSG_TST_TRANSFORM = 0x0004400d, +- VCMSG_SET_TRANSFORM = 0x0004800d, +- VCMSG_TST_VSYNC = 0x0004400e, +- VCMSG_SET_VSYNC = 0x0004800e, +- VCMSG_SET_CURSOR_INFO = 0x00008010, +- VCMSG_SET_CURSOR_STATE = 0x00008011, +-}; +- +-extern int /*rc*/ bcm_mailbox_read(unsigned chan, uint32_t *data28); +-extern int /*rc*/ bcm_mailbox_write(unsigned chan, uint32_t data28); +-extern int /*rc*/ bcm_mailbox_property(void *data, int size); +- +-#include +- +-/* +- * The major device number. We can't rely on dynamic +- * registration any more, because ioctls need to know +- * it. +- */ +-#define MAJOR_NUM 100 +- +-/* +- * Set the message of the device driver +- */ +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +-/* +- * _IOWR means that we're creating an ioctl command +- * number for passing information from a user process +- * to the kernel module and from the kernel module to user process +- * +- * The first arguments, MAJOR_NUM, is the major device +- * number we're using. +- * +- * The second argument is the number of the command +- * (there could be several with different meanings). +- * +- * The third argument is the type we want to get from +- * the process to the kernel. +- */ +- +-/* +- * The name of the device file +- */ +-#define DEVICE_FILE_NAME "vcio" +- +-#endif +diff --git a/arch/arm/mach-bcm2709/vcio.c b/arch/arm/mach-bcm2709/vcio.c +deleted file mode 100644 +index 700bff4..0000000 +--- a/arch/arm/mach-bcm2709/vcio.c ++++ /dev/null +@@ -1,484 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/vcio.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for writing to the mailboxes, +- * semaphores, doorbells etc. that are shared between the ARM and the +- * VideoCore processor +- */ +- +-#if defined(CONFIG_SERIAL_BCM_MBOX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +-#define SUPPORT_SYSRQ +-#endif +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include +-#include +- +-#include +- +- +-#define DRIVER_NAME BCM_VCIO_DRIVER_NAME +- +-/* ---------------------------------------------------------------------- +- * Mailbox +- * -------------------------------------------------------------------- */ +- +-/* offsets from a mail box base address */ +-#define MAIL_WRT 0x00 /* write - and next 4 words */ +-#define MAIL_RD 0x00 /* read - and next 4 words */ +-#define MAIL_POL 0x10 /* read without popping the fifo */ +-#define MAIL_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL_STA 0x18 /* status */ +-#define MAIL_CNF 0x1C /* configuration */ +- +-#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +-#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +-#define MBOX_CHAN(msg) ((msg) & 0xf) +-#define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) +- +-#define MBOX_MAGIC 0xd0d0c0de +-static struct class *vcio_class = NULL; +-struct vc_mailbox { +- struct device *dev; /* parent device */ +- void __iomem *status; +- void __iomem *config; +- void __iomem *read; +- void __iomem *write; +- uint32_t msg[MBOX_CHAN_COUNT]; +- struct semaphore sema[MBOX_CHAN_COUNT]; +- uint32_t magic; +-}; +- +-static void mbox_init(struct vc_mailbox *mbox_out, struct device *dev, +- uint32_t addr_mbox) +-{ +- int i; +- +- mbox_out->dev = dev; +- mbox_out->status = __io_address(addr_mbox + MAIL_STA); +- mbox_out->config = __io_address(addr_mbox + MAIL_CNF); +- mbox_out->read = __io_address(addr_mbox + MAIL_RD); +- /* Write to the other mailbox */ +- mbox_out->write = +- __io_address((addr_mbox ^ ARM_0_MAIL0_WRT ^ ARM_0_MAIL1_WRT) + +- MAIL_WRT); +- +- for (i = 0; i < MBOX_CHAN_COUNT; i++) { +- mbox_out->msg[i] = 0; +- sema_init(&mbox_out->sema[i], 0); +- } +- +- /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->config); +- +- mbox_out->magic = MBOX_MAGIC; +-} +- +-static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) +-{ +- int rc; +- +- if (mbox->magic != MBOX_MAGIC) +- rc = -EINVAL; +- else { +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->status) & ARM_MS_FULL)) +- cpu_relax(); +- +- writel(MBOX_MSG(chan, data28), mbox->write); +- rc = 0; +- } +- return rc; +-} +- +-static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) +-{ +- int rc; +- +- if (mbox->magic != MBOX_MAGIC) +- rc = -EINVAL; +- else { +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- rc = 0; +- } +- return rc; +-} +- +-static irqreturn_t mbox_irq(int irq, void *dev_id) +-{ +- /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *) dev_id; +- int status = readl(mbox->status); +- int ret = IRQ_NONE; +- +- while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->read); +- int chan = MBOX_CHAN(msg); +- if (chan < MBOX_CHAN_COUNT) { +- if (mbox->msg[chan]) { +- /* Overflow */ +- printk(KERN_ERR DRIVER_NAME +- ": mbox chan %d overflow - drop %08x\n", +- chan, msg); +- } else { +- mbox->msg[chan] = (msg | 0xf); +- up(&mbox->sema[chan]); +- } +- } else { +- printk(KERN_ERR DRIVER_NAME +- ": invalid channel selector (msg %08x)\n", msg); +- } +- ret = IRQ_HANDLED; +- status = readl(mbox->status); +- } +- return ret; +-} +- +-static struct irqaction mbox_irqaction = { +- .name = "ARM Mailbox IRQ", +- .flags = IRQF_DISABLED | IRQF_IRQPOLL, +- .handler = mbox_irq, +-}; +- +-/* ---------------------------------------------------------------------- +- * Mailbox Methods +- * -------------------------------------------------------------------- */ +- +-static struct device *mbox_dev; /* we assume there's only one! */ +- +-static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) +-{ +- int rc; +- +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- device_lock(dev); +- rc = mbox_write(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) +-{ +- int rc; +- +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- device_lock(dev); +- rc = mbox_read(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-extern int bcm_mailbox_write(unsigned chan, uint32_t data28) +-{ +- if (mbox_dev) +- return dev_mbox_write(mbox_dev, chan, data28); +- else +- return -ENODEV; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_write); +- +-extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) +-{ +- if (mbox_dev) +- return dev_mbox_read(mbox_dev, chan, data28); +- else +- return -ENODEV; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); +- +-static void dev_mbox_register(const char *dev_name, struct device *dev) +-{ +- mbox_dev = dev; +-} +- +-static int mbox_copy_from_user(void *dst, const void *src, int size) +-{ +- if ( (uint32_t)src < TASK_SIZE) +- { +- return copy_from_user(dst, src, size); +- } +- else +- { +- memcpy( dst, src, size ); +- return 0; +- } +-} +- +-static int mbox_copy_to_user(void *dst, const void *src, int size) +-{ +- if ( (uint32_t)dst < TASK_SIZE) +- { +- return copy_to_user(dst, src, size); +- } +- else +- { +- memcpy( dst, src, size ); +- return 0; +- } +-} +- +-static DEFINE_MUTEX(mailbox_lock); +-extern int bcm_mailbox_property(void *data, int size) +-{ +- uint32_t success; +- dma_addr_t mem_bus; /* the memory address accessed from videocore */ +- void *mem_kern; /* the memory address accessed from driver */ +- int s = 0; +- +- mutex_lock(&mailbox_lock); +- /* allocate some memory for the messages communicating with GPU */ +- mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, GFP_ATOMIC); +- if (mem_kern) { +- /* create the message */ +- mbox_copy_from_user(mem_kern, data, size); +- +- /* send the message */ +- wmb(); +- s = bcm_mailbox_write(MBOX_CHAN_PROPERTY, (uint32_t)mem_bus); +- if (s == 0) { +- s = bcm_mailbox_read(MBOX_CHAN_PROPERTY, &success); +- } +- if (s == 0) { +- /* copy the response */ +- rmb(); +- mbox_copy_to_user(data, mem_kern, size); +- } +- dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); +- } else { +- s = -ENOMEM; +- } +- if (s != 0) +- printk(KERN_ERR DRIVER_NAME ": %s failed (%d)\n", __func__, s); +- +- mutex_unlock(&mailbox_lock); +- return s; +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_property); +- +-/* ---------------------------------------------------------------------- +- * Platform Device for Mailbox +- * -------------------------------------------------------------------- */ +- +-/* +- * Is the device open right now? Used to prevent +- * concurent access into the same device +- */ +-static int Device_Open = 0; +- +-/* +- * This is called whenever a process attempts to open the device file +- */ +-static int device_open(struct inode *inode, struct file *file) +-{ +- /* +- * We don't want to talk to two processes at the same time +- */ +- if (Device_Open) +- return -EBUSY; +- +- Device_Open++; +- /* +- * Initialize the message +- */ +- try_module_get(THIS_MODULE); +- return 0; +-} +- +-static int device_release(struct inode *inode, struct file *file) +-{ +- /* +- * We're now ready for our next caller +- */ +- Device_Open--; +- +- module_put(THIS_MODULE); +- return 0; +-} +- +-/* +- * This function is called whenever a process tries to do an ioctl on our +- * device file. We get two extra parameters (additional to the inode and file +- * structures, which all device functions get): the number of the ioctl called +- * and the parameter given to the ioctl function. +- * +- * If the ioctl is write or read/write (meaning output is returned to the +- * calling process), the ioctl call returns the output of this function. +- * +- */ +-static long device_ioctl(struct file *file, /* see include/linux/fs.h */ +- unsigned int ioctl_num, /* number and param for ioctl */ +- unsigned long ioctl_param) +-{ +- unsigned size; +- /* +- * Switch according to the ioctl called +- */ +- switch (ioctl_num) { +- case IOCTL_MBOX_PROPERTY: +- /* +- * Receive a pointer to a message (in user space) and set that +- * to be the device's message. Get the parameter given to +- * ioctl by the process. +- */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof size); +- return bcm_mailbox_property((void *)ioctl_param, size); +- break; +- default: +- printk(KERN_ERR DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); +- return -EINVAL; +- } +- +- return 0; +-} +- +-/* Module Declarations */ +- +-/* +- * This structure will hold the functions to be called +- * when a process does something to the device we +- * created. Since a pointer to this structure is kept in +- * the devices table, it can't be local to +- * init_module. NULL is for unimplemented functios. +- */ +-struct file_operations fops = { +- .unlocked_ioctl = device_ioctl, +- .open = device_open, +- .release = device_release, /* a.k.a. close */ +-}; +- +-static int bcm_vcio_probe(struct platform_device *pdev) +-{ +- int ret = 0; +- struct vc_mailbox *mailbox; +- +- mailbox = kzalloc(sizeof(*mailbox), GFP_KERNEL); +- if (NULL == mailbox) { +- printk(KERN_ERR DRIVER_NAME ": failed to allocate " +- "mailbox memory\n"); +- ret = -ENOMEM; +- } else { +- struct resource *res; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- if (res == NULL) { +- printk(KERN_ERR DRIVER_NAME ": failed to obtain memory " +- "resource\n"); +- ret = -ENODEV; +- kfree(mailbox); +- } else { +- /* should be based on the registers from res really */ +- mbox_init(mailbox, &pdev->dev, ARM_0_MAIL0_RD); +- +- platform_set_drvdata(pdev, mailbox); +- dev_mbox_register(DRIVER_NAME, &pdev->dev); +- +- mbox_irqaction.dev_id = mailbox; +- setup_irq(IRQ_ARM_MAILBOX, &mbox_irqaction); +- printk(KERN_INFO DRIVER_NAME ": mailbox at %p\n", +- __io_address(ARM_0_MAIL0_RD)); +- } +- } +- +- if (ret == 0) { +- /* +- * Register the character device +- */ +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- +- /* +- * Negative values signify an error +- */ +- if (ret < 0) { +- printk(KERN_ERR DRIVER_NAME +- "Failed registering the character device %d\n", ret); +- return ret; +- } +- vcio_class = class_create(THIS_MODULE, BCM_VCIO_DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- return ret ; +- } +- device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); +- } +- return ret; +-} +- +-static int bcm_vcio_remove(struct platform_device *pdev) +-{ +- struct vc_mailbox *mailbox = platform_get_drvdata(pdev); +- +- platform_set_drvdata(pdev, NULL); +- kfree(mailbox); +- +- return 0; +-} +- +-static struct platform_driver bcm_mbox_driver = { +- .probe = bcm_vcio_probe, +- .remove = bcm_vcio_remove, +- +- .driver = { +- .name = DRIVER_NAME, +- .owner = THIS_MODULE, +- }, +-}; +- +-static int __init bcm_mbox_init(void) +-{ +- int ret; +- +- printk(KERN_INFO "mailbox: Broadcom VideoCore Mailbox driver\n"); +- +- ret = platform_driver_register(&bcm_mbox_driver); +- if (ret != 0) { +- printk(KERN_ERR DRIVER_NAME ": failed to register " +- "on platform\n"); +- } +- +- return ret; +-} +- +-static void __exit bcm_mbox_exit(void) +-{ +- device_destroy(vcio_class,MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- platform_driver_unregister(&bcm_mbox_driver); +-} +- +-arch_initcall(bcm_mbox_init); /* Initialize early */ +-module_exit(bcm_mbox_exit); +- +-MODULE_AUTHOR("Gray Girling"); +-MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); +-MODULE_LICENSE("GPL"); +-MODULE_ALIAS("platform:bcm-mbox"); + +From ca452e4734877d6b36d1a836d473b81f3d561c3f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 23:00:15 +0200 +Subject: [PATCH 147/216] BCM270x_DT: Add mailbox bcm2708-vcio +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add bcm2708-vcio to Device Tree and don't add the +platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 6 ++++++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + 3 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 065a424..1c8c1af 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -36,6 +36,12 @@ + #interrupt-cells = <2>; + }; + ++ mailbox: mailbox@7e00b800 { ++ compatible = "brcm,bcm2708-vcio"; ++ reg = <0x7e00b880 0x40>; ++ interrupts = <0 1>; ++ }; ++ + gpio: gpio { + compatible = "brcm,bcm2835-gpio"; + reg = <0x7e200000 0xb4>; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 51f8efa..7cc47c1 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -908,7 +908,7 @@ void __init bcm2708_init(void) + bcm2708_dt_init(); + + bcm_register_device_dt(&bcm2708_dmaengine_device); +- bcm_register_device(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_vcio_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); + #endif +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 8ed88b4..2c0a664 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -929,7 +929,7 @@ void __init bcm2709_init(void) + bcm2709_dt_init(); + + bcm_register_device_dt(&bcm2708_dmaengine_device); +- bcm_register_device(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_vcio_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); + #endif + +From 8cb40db6e93540a4cf0d45ee23eb9b0441050543 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 23:00:45 +0200 +Subject: [PATCH 148/216] bcm2835: bcm2835_defconfig enable BCM2708_MBOX +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Enable the mailbox driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2835_defconfig | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index cf2e7a6..26b4c75 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -99,6 +99,8 @@ CONFIG_LEDS_TRIGGER_CAMERA=y + CONFIG_DMADEVICES=y + CONFIG_DMA_BCM2708=y + CONFIG_STAGING=y ++CONFIG_MAILBOX=y ++CONFIG_BCM2708_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXT2_FS=y + CONFIG_EXT2_FS_XATTR=y + +From c03f517d41d6da89f70794d6bf20974e81ac72f1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 1 May 2015 23:02:46 +0200 +Subject: [PATCH 149/216] bcm2835: Add mailbox bcm2708-vcio to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add mailbox to Device Tree. There are no kernel users yet, +but it's available to userspace. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index f2dec21..06cba29 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -60,6 +60,12 @@ + reg = <0x7e104000 0x10>; + }; + ++ mailbox: mailbox@7e00b800 { ++ compatible = "brcm,bcm2708-vcio"; ++ reg = <0x7e00b880 0x40>; ++ interrupts = <0 1>; ++ }; ++ + gpio: gpio@7e200000 { + compatible = "brcm,bcm2835-gpio"; + reg = <0x7e200000 0xb4>; + +From 2010049aa53c210156598c979fd38dc893baa049 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 12 May 2015 11:48:18 +0200 +Subject: [PATCH 150/216] mailbox: bcm2708-vcio: Allocation does not need to be + atomic +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +No need to do atomic allocation in a context that can sleep. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/bcm2708-vcio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +index ee3e778..74a7fcb 100644 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -212,7 +212,7 @@ extern int bcm_mailbox_property(void *data, int size) + mutex_lock(&mailbox_lock); + /* allocate some memory for the messages communicating with GPU */ + mem_kern = dma_alloc_coherent(NULL, PAGE_ALIGN(size), &mem_bus, +- GFP_ATOMIC); ++ GFP_KERNEL); + if (mem_kern) { + /* create the message */ + mbox_copy_from_user(mem_kern, data, size); + +From f86559819816a393e05426b6dac30d84582fa13d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 12 May 2015 13:45:32 +0200 +Subject: [PATCH 151/216] mailbox: bcm2708-vcio: Check the correct status + register before writing +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With the VC reader blocked and the ARM writing, MAIL0_STA reads +empty permanently while MAIL1_STA goes from empty (0x40000000) +to non-empty (0x00000001-0x00000007) to full (0x80000008). + +Suggested-by: Phil Elwell +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/bcm2708-vcio.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +index 74a7fcb..19ecfe8 100644 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -35,6 +35,7 @@ + #define MAIL0_STA 0x18 /* status */ + #define MAIL0_CNF 0x1C /* configuration */ + #define MAIL1_WRT 0x20 /* write - and next 4 words */ ++#define MAIL1_STA 0x38 /* status */ + + /* On MACH_BCM270x these come through (arm_control.h ) */ + #ifndef ARM_MS_EMPTY +@@ -85,7 +86,7 @@ static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) + return -EINVAL; + + /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL)) ++ while (0 != (readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL)) + cpu_relax(); + + writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); + +From 94bbfc4066df94c006edec5a48fe4df6547a1b01 Mon Sep 17 00:00:00 2001 +From: Gordon Hollingworth +Date: Tue, 12 May 2015 14:47:56 +0100 +Subject: [PATCH 152/216] rpi-ft5406: Add touchscreen driver for pi LCD display + +--- + drivers/input/touchscreen/Kconfig | 7 + + drivers/input/touchscreen/Makefile | 1 + + drivers/input/touchscreen/rpi-ft5406.c | 258 ++++++++++++++++++++++++++ + include/linux/platform_data/mailbox-bcm2708.h | 1 + + 4 files changed, 267 insertions(+) + create mode 100644 drivers/input/touchscreen/rpi-ft5406.c + +diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig +index 6261fd6..e7e9416 100644 +--- a/drivers/input/touchscreen/Kconfig ++++ b/drivers/input/touchscreen/Kconfig +@@ -557,6 +557,13 @@ config TOUCHSCREEN_EDT_FT5X06 + To compile this driver as a module, choose M here: the + module will be called edt-ft5x06. + ++config TOUCHSCREEN_RPI_FT5406 ++ tristate "Raspberry Pi FT5406 driver" ++ depends on ARCH_BCM2708 || ARCH_BCM2709 ++ help ++ Say Y here to enable the Raspberry Pi memory based FT5406 device ++ ++ + config TOUCHSCREEN_MIGOR + tristate "Renesas MIGO-R touchscreen" + depends on SH_MIGOR && I2C +diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile +index 0242fea..e0268f0 100644 +--- a/drivers/input/touchscreen/Makefile ++++ b/drivers/input/touchscreen/Makefile +@@ -28,6 +28,7 @@ obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o + obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o + obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o + obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o ++obj-$(CONFIG_TOUCHSCREEN_RPI_FT5406) += rpi-ft5406.o + obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o + obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o + obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +new file mode 100644 +index 0000000..f55151b +--- /dev/null ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -0,0 +1,258 @@ ++/* ++ * Driver for memory based ft5406 touchscreen ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * ++ * 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 ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MAXIMUM_SUPPORTED_POINTS 10 ++struct ft5406_regs { ++ uint8_t device_mode; ++ uint8_t gesture_id; ++ uint8_t num_points; ++ struct ft5406_touch { ++ uint8_t xh; ++ uint8_t xl; ++ uint8_t yh; ++ uint8_t yl; ++ uint8_t res1; ++ uint8_t res2; ++ } point[MAXIMUM_SUPPORTED_POINTS]; ++}; ++ ++#define SCREEN_WIDTH 800 ++#define SCREEN_HEIGHT 480 ++ ++struct ft5406 { ++ struct platform_device * pdev; ++ struct input_dev * input_dev; ++ void __iomem * ts_base; ++ struct ft5406_regs * regs; ++ struct task_struct * thread; ++}; ++ ++ ++/* tag part of the message */ ++struct vc_msg_tag { ++ uint32_t tag_id; /* the message id */ ++ uint32_t buffer_size; /* size of the buffer (which in this case is always 8 bytes) */ ++ uint32_t data_size; /* amount of data being sent or received */ ++ uint32_t val; /* data buffer */ ++}; ++ ++/* message structure to be sent to videocore */ ++struct vc_msg { ++ uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ ++ uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ ++ struct vc_msg_tag tag; /* the tag structure above to make */ ++ uint32_t end_tag; /* an end identifier, should be set to NULL */ ++}; ++ ++/* Thread to poll for touchscreen events ++ * ++ * This thread polls the memory based register copy of the ft5406 registers ++ * using the number of points register to know whether the copy has been ++ * updated (we write 99 to the memory copy, the GPU will write between ++ * 0 - 10 points) ++ */ ++static int ft5406_thread(void *arg) ++{ ++ struct ft5406 *ts = (struct ft5406 *) arg; ++ struct ft5406_regs regs; ++ int known_ids = 0; ++ ++ while(!kthread_should_stop()) ++ { ++ // 60fps polling ++ msleep(17); ++ memcpy_fromio(®s, ts->regs, sizeof(*ts->regs)); ++ writel(99, &ts->regs->num_points); ++ // Do not output if theres no new information (num_points is 99) ++ // or we have no touch points and don't need to release any ++ if(!(regs.num_points == 99 || (regs.num_points == 0 && known_ids == 0))) ++ { ++ int i; ++ int modified_ids = 0, released_ids; ++ for(i = 0; i < regs.num_points; i++) ++ { ++ int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; ++ int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; ++ int touchid = (regs.point[i].yh >> 4) & 0xf; ++ ++ modified_ids |= 1 << touchid; ++ ++ if(!((1 << touchid) & known_ids)) ++ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); ++ ++ input_mt_slot(ts->input_dev, touchid); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); ++ ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); ++ ++ } ++ ++ released_ids = known_ids & ~modified_ids; ++ for(i = 0; released_ids && i < MAXIMUM_SUPPORTED_POINTS; i++) ++ { ++ if(released_ids & (1<pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); ++ input_mt_slot(ts->input_dev, i); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); ++ modified_ids &= ~(1 << i); ++ } ++ } ++ known_ids = modified_ids; ++ ++ input_mt_report_pointer_emulation(ts->input_dev, true); ++ input_sync(ts->input_dev); ++ } ++ ++ } ++ ++ return 0; ++} ++ ++static int ft5406_probe(struct platform_device *pdev) ++{ ++ int ret; ++ struct input_dev * input_dev = input_allocate_device(); ++ struct vc_msg request; ++ struct ft5406 * ts; ++ ++ dev_info(&pdev->dev, "Probing device\n"); ++ ++ ts = kzalloc(sizeof(struct ft5406), GFP_KERNEL); ++ ++ if (!ts || !input_dev) { ++ ret = -ENOMEM; ++ dev_err(&pdev->dev, "Failed to allocate memory\n"); ++ return ret; ++ } ++ ts->input_dev = input_dev; ++ platform_set_drvdata(pdev, ts); ++ ts->pdev = pdev; ++ ++ input_dev->name = "FT5406 memory based driver"; ++ ++ __set_bit(EV_KEY, input_dev->evbit); ++ __set_bit(EV_SYN, input_dev->evbit); ++ __set_bit(EV_ABS, input_dev->evbit); ++ ++ input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, ++ SCREEN_WIDTH, 0, 0); ++ input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, ++ SCREEN_HEIGHT, 0, 0); ++ ++ input_mt_init_slots(input_dev, MAXIMUM_SUPPORTED_POINTS, INPUT_MT_DIRECT); ++ ++ input_set_drvdata(input_dev, ts); ++ ++ ret = input_register_device(input_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "could not register input device, %d\n", ++ ret); ++ return ret; ++ } ++ ++ memset(&request, 0, sizeof request); ++ ++ request.msg_size = sizeof request; ++ request.request_code = VCMSG_PROCESS_REQUEST; ++ request.tag.tag_id = VCMSG_GET_TOUCHBUF; ++ request.tag.buffer_size = 4; ++ request.tag.data_size = 4; ++ ++ bcm_mailbox_property(&request, sizeof(request)); ++ ++ if(request.request_code == VCMSG_REQUEST_SUCCESSFUL) ++ { ++ dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", request.tag.val); ++ } ++ else ++ { ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ return -1; ++ } ++ ++ // mmap the physical memory ++ request.tag.val &= ~0xc0000000; ++ ts->ts_base = ioremap(request.tag.val, sizeof(*ts->regs)); ++ if(ts->ts_base == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to map physical address\n"); ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ return -1; ++ } ++ ++ ts->regs = (struct ft5406_regs *) ts->ts_base; ++ ++ // create thread to poll the touch events ++ ts->thread = kthread_run(ft5406_thread, ts, "ft5406"); ++ if(ts->thread == NULL) ++ { ++ dev_err(&pdev->dev, "Failed to create kernel thread"); ++ iounmap(ts->ts_base); ++ input_unregister_device(input_dev); ++ kzfree(ts); ++ } ++ ++ return 0; ++} ++ ++static int ft5406_remove(struct platform_device *pdev) ++{ ++ struct ft5406 *ts = (struct ft5406 *) platform_get_drvdata(pdev); ++ ++ dev_info(&pdev->dev, "Removing rpi-ft5406\n"); ++ ++ kthread_stop(ts->thread); ++ iounmap(ts->ts_base); ++ input_unregister_device(ts->input_dev); ++ kzfree(ts); ++ ++ return 0; ++} ++ ++static const struct of_device_id ft5406_match[] = { ++ { .compatible = "rpi,rpi-ft5406", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, ft5406_match); ++ ++static struct platform_driver ft5406_driver = { ++ .driver = { ++ .name = "rpi-ft5406", ++ .owner = THIS_MODULE, ++ .of_match_table = ft5406_match, ++ }, ++ .probe = ft5406_probe, ++ .remove = ft5406_remove, ++}; ++ ++module_platform_driver(ft5406_driver); ++ ++MODULE_AUTHOR("Gordon Hollingworth"); ++MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); ++MODULE_LICENSE("GPL"); +diff --git a/include/linux/platform_data/mailbox-bcm2708.h b/include/linux/platform_data/mailbox-bcm2708.h +index cc284ed..d3ea839 100644 +--- a/include/linux/platform_data/mailbox-bcm2708.h ++++ b/include/linux/platform_data/mailbox-bcm2708.h +@@ -115,6 +115,7 @@ enum { + VCMSG_SET_TRANSFORM = 0x0004800d, + VCMSG_TST_VSYNC = 0x0004400e, + VCMSG_SET_VSYNC = 0x0004800e, ++ VCMSG_GET_TOUCHBUF = 0x0004000f, + VCMSG_SET_CURSOR_INFO = 0x00008010, + VCMSG_SET_CURSOR_STATE = 0x00008011, + }; + +From 7a6f093876247b186c1465ef0f45132b0c804af2 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 7 May 2015 09:22:23 +0100 +Subject: [PATCH 153/216] bcm2835-sdhost: Error handling fix, and code + clarification + +--- + drivers/mmc/host/bcm2835-sdhost.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 0c311b5..542ae12 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -1041,13 +1041,14 @@ static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) + host->cmd->error = -EILSEQ; + + /* Use the block interrupt for writes after the first block */ +- if (!(host->data->flags & MMC_DATA_READ)) { ++ if (host->data->flags & MMC_DATA_WRITE) { + host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); + host->hcfg |= SDHCFG_BLOCK_IRPT_EN; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + if (host->data->error) + bcm2835_sdhost_finish_data(host); +- bcm2835_sdhost_transfer_pio(host); ++ else ++ bcm2835_sdhost_transfer_pio(host); + } else { + if (!host->data->error) { + bcm2835_sdhost_transfer_pio(host); +@@ -1132,12 +1133,12 @@ static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) + bcm2835_sdhost_dumpregs(host); + } + +- if (loops) +- early |= handled; +- + if (!handled) + break; + ++ if (loops) ++ early |= handled; ++ + result = IRQ_HANDLED; + + /* Clear all interrupts and notifications */ + +From d502512774e7121bd6787008f5956daefa3ac138 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 14 May 2015 11:48:40 +0100 +Subject: [PATCH 154/216] bcm2835-sdhost: Adding overclocking option + +Allow a different clock speed to be substitued for a requested 50MHz. +This option is exposed using the "overclock_50" DT parameter. +Note that the sdhost interface is restricted to integer divisions of +core_freq, and the highest sensible option for a core_freq of 250MHz +is 84 (250/3 = 83.3MHz), the next being 125 (250/2) which is much too +high. + +Use at your own risk. +--- + arch/arm/boot/dts/sdhost-overlay.dts | 6 ++++-- + drivers/mmc/host/bcm2835-sdhost.c | 17 +++++++++++++++-- + 2 files changed, 19 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/boot/dts/sdhost-overlay.dts b/arch/arm/boot/dts/sdhost-overlay.dts +index 33db96e..b2653e9 100644 +--- a/arch/arm/boot/dts/sdhost-overlay.dts ++++ b/arch/arm/boot/dts/sdhost-overlay.dts +@@ -13,14 +13,15 @@ + sdhost: sdhost@7e202000 { + compatible = "brcm,bcm2835-sdhost"; + reg = <0x7e202000 0x100>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; + interrupts = <2 24>; + clocks = <&clk_sdhost>; + dmas = <&dma 13>, + <&dma 13>; + dma-names = "tx", "rx"; + brcm,delay-after-stop = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&sdhost_pins>; ++ brcm,overclock-50 = <0>; + status = "okay"; + }; + +@@ -67,6 +68,7 @@ + + __overrides__ { + delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; ++ overclock_50 = <&sdhost>,"brcm,overclock-50:0"; + force_pio = <&sdhost>,"brcm,force-pio?"; + sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; + }; +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 542ae12..2a9eb9f 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -184,6 +184,7 @@ struct bcm2835_host { + int max_delay; /* maximum length of time spent waiting */ + struct timeval stop_time; /* when the last stop was issued */ + u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ ++ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + }; + + +@@ -1223,6 +1224,10 @@ static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id) + void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + { + int div = 0; /* Initialized for compiler warning */ ++ unsigned int input_clock = clock; ++ ++ if (host->overclock_50 && (clock == 50000000)) ++ clock = host->overclock_50 * 1000000; + + /* The SDCDIV register has 11 bits, and holds (div - 2). + But in data mode the max is 50MHz wihout a minimum, and only the +@@ -1266,13 +1271,18 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + if (div > SDCDIV_MAX_CDIV) + div = SDCDIV_MAX_CDIV; + +- host->mmc->actual_clock = host->max_clk / (div + 2); ++ clock = host->max_clk / (div + 2); ++ host->mmc->actual_clock = clock; ++ ++ if (clock > input_clock) ++ pr_warn("%s: Overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); + + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + + pr_debug(DRIVER_NAME ": clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", +- clock, host->max_clk, host->cdiv, host->mmc->actual_clock); ++ input_clock, host->max_clk, host->cdiv, host->mmc->actual_clock); + } + + static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq) +@@ -1572,6 +1582,9 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + of_property_read_u32(node, + "brcm,delay-after-stop", + &host->delay_after_stop); ++ of_property_read_u32(node, ++ "brcm,overclock-50", ++ &host->overclock_50); + host->allow_dma = ALLOW_DMA && + !of_property_read_bool(node, "brcm,force-pio"); + } + +From ae7169ee054f60e3db61f1a5bb6eb1f52913886a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 14 May 2015 11:55:57 +0100 +Subject: [PATCH 155/216] bcm2835-mmc: Adding overclocking option + +Allow a different clock speed to be substitued for a requested 50MHz. +This option is exposed using the "overclock_50" DT parameter. +Note that the mmc interface is restricted to EVEN integer divisions of +250MHz, and the highest sensible option is 63 (250/4 = 62.5), the +next being 125 (250/2) which is much too high. + +Use at your own risk. +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/mmc-overlay.dts | 19 +++++++++++++++++++ + drivers/mmc/host/bcm2835-mmc.c | 25 ++++++++++++++++++++++--- + 3 files changed, 42 insertions(+), 3 deletions(-) + create mode 100644 arch/arm/boot/dts/mmc-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 9cb5a2d..a21afc5 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -27,6 +27,7 @@ dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += pcf2127-rtc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += pcf8523-rtc-overlay.dtb +diff --git a/arch/arm/boot/dts/mmc-overlay.dts b/arch/arm/boot/dts/mmc-overlay.dts +new file mode 100644 +index 0000000..0a37cf4 +--- /dev/null ++++ b/arch/arm/boot/dts/mmc-overlay.dts +@@ -0,0 +1,19 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&mmc>; ++ ++ __overlay__ { ++ brcm,overclock-50 = <0>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&mmc>,"brcm,overclock-50:0"; ++ force_pio = <&mmc>,"brcm,force-pio?"; ++ }; ++}; +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +index 68314d5..c7c2ca1 100644 +--- a/drivers/mmc/host/bcm2835-mmc.c ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -131,6 +131,8 @@ struct bcm2835_host { + #define SDHCI_AUTO_CMD12 (1<<6) /* Auto CMD12 support */ + #define SDHCI_AUTO_CMD23 (1<<7) /* Auto CMD23 support */ + #define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ ++ ++ u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + }; + + +@@ -1086,7 +1088,10 @@ void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) + int real_div = div, clk_mul = 1; + u16 clk = 0; + unsigned long timeout; ++ unsigned int input_clock = clock; + ++ if (host->overclock_50 && (clock == 50000000)) ++ clock = host->overclock_50 * 1000000; + + host->mmc->actual_clock = 0; + +@@ -1110,7 +1115,12 @@ void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) + div >>= 1; + + if (real_div) +- host->mmc->actual_clock = (host->max_clk * clk_mul) / real_div; ++ clock = (host->max_clk * clk_mul) / real_div; ++ host->mmc->actual_clock = clock; ++ ++ if (clock > input_clock) ++ pr_warn("%s: Overclocking to %dHz\n", ++ mmc_hostname(host->mmc), clock); + + clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; + clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN) +@@ -1177,6 +1187,9 @@ static void bcm2835_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + u8 ctrl; + u16 clk, ctrl_2; + ++ pr_debug("bcm2835_mmc_set_ios: clock %d, pwr %d, bus_width %d, timing %d, vdd %d, drv_type %d\n", ++ ios->clock, ios->power_mode, ios->bus_width, ++ ios->timing, ios->signal_voltage, ios->drv_type); + + spin_lock_irqsave(&host->lock, flags); + +@@ -1444,10 +1457,16 @@ static int bcm2835_mmc_probe(struct platform_device *pdev) + goto err; + } + +- if (node) ++ if (node) { + mmc_of_parse(mmc); +- else ++ ++ /* Read any custom properties */ ++ of_property_read_u32(node, ++ "brcm,overclock-50", ++ &host->overclock_50); ++ } else { + mmc->caps |= MMC_CAP_4_BIT_DATA; ++ } + + ret = bcm2835_mmc_add_host(host); + if (ret) + +From 4b4b9568bc6fbfc222d59a28b2727ae5c725a92a Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Fri, 15 May 2015 14:21:32 +0200 +Subject: [PATCH 156/216] dmaengine: bcm2708: set residue_granularity field + +bcm2708-dmaengine supports residue reporting at burst level +but didn't report this via the residue_granularity field. + +Without this field set properly we get playback issues with I2S cards. +--- + drivers/dma/bcm2708-dmaengine.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c +index 937fd60..987ed53 100644 +--- a/drivers/dma/bcm2708-dmaengine.c ++++ b/drivers/dma/bcm2708-dmaengine.c +@@ -1112,6 +1112,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); ++ od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; + od->ddev.dev = &pdev->dev; + INIT_LIST_HEAD(&od->ddev.channels); + spin_lock_init(&od->lock); +@@ -1180,6 +1181,7 @@ static int bcm2835_dma_probe(struct platform_device *pdev) + od->ddev.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); + od->ddev.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); ++ od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; + od->ddev.dev = &pdev->dev; + INIT_LIST_HEAD(&od->ddev.channels); + spin_lock_init(&od->lock); + +From 1ddcc631437e913995361718209077d8247c10b0 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 12 May 2015 17:26:35 +0100 +Subject: [PATCH 157/216] BCM2708_DT: Adding starter Compute Module DTS files + +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 7 +++++++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 30 ++++++++++++++++++++++++++++++ + 3 files changed, 38 insertions(+) + create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dts + create mode 100755 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index a21afc5..f3558df 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -3,6 +3,7 @@ ifeq ($(CONFIG_OF),y) + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb + dtb-$(CONFIG_BCM2709_DT) += bcm2709-rpi-2-b.dtb + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b-plus.dtb ++dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-cm.dtb + + # Raspberry Pi + ifeq ($(CONFIG_BCM2708_DT),y) +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +new file mode 100755 +index 0000000..45f8244 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -0,0 +1,7 @@ ++/dts-v1/; ++ ++/include/ "bcm2708-rpi-cm.dtsi" ++ ++/ { ++ model = "Raspberry Pi Compute Module"; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +new file mode 100755 +index 0000000..d0a6fb8 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -0,0 +1,30 @@ ++/include/ "bcm2708.dtsi" ++ ++/ { ++ aliases { ++ soc = &soc; ++ gpio = &gpio; ++ intc = &intc; ++ leds = &leds; ++ sound = &sound; ++ }; ++ ++ sound: sound { ++ }; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; ++ ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ }; ++}; + +From 210157c8363fc0ac4c99273d3ed8f54ed9929b0f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 May 2015 11:57:29 +0100 +Subject: [PATCH 158/216] bcm2835-sdhost: Round up the overclock, so 62 works + for 62.5Mhz + +Also only warn once for each overclock setting. +--- + drivers/mmc/host/bcm2835-sdhost.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 2a9eb9f..eef8a24 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -185,6 +185,7 @@ struct bcm2835_host { + struct timeval stop_time; /* when the last stop was issued */ + u32 delay_after_stop; /* minimum time between stop and subsequent data transfer */ + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ ++ u32 max_overclock; /* Highest reported */ + }; + + +@@ -1227,7 +1228,7 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + unsigned int input_clock = clock; + + if (host->overclock_50 && (clock == 50000000)) +- clock = host->overclock_50 * 1000000; ++ clock = host->overclock_50 * 1000000 + 999999; + + /* The SDCDIV register has 11 bits, and holds (div - 2). + But in data mode the max is 50MHz wihout a minimum, and only the +@@ -1274,9 +1275,11 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + clock = host->max_clk / (div + 2); + host->mmc->actual_clock = clock; + +- if (clock > input_clock) ++ if ((clock > input_clock) && (clock > host->max_overclock)) { + pr_warn("%s: Overclocking to %dHz\n", + mmc_hostname(host->mmc), clock); ++ host->max_overclock = clock; ++ } + + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + +From a946e70fd45a1f24f99816f72f5bbb0a7de0c1f3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 May 2015 12:29:42 +0100 +Subject: [PATCH 159/216] bcm2835-mmc: Round up the overclock, so 62 works for + 62.5Mhz + +Also only warn once for each overclock setting. +--- + drivers/mmc/host/bcm2835-mmc.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +index c7c2ca1..b7c4883 100644 +--- a/drivers/mmc/host/bcm2835-mmc.c ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -133,6 +133,7 @@ struct bcm2835_host { + #define SDHCI_SDIO_IRQ_ENABLED (1<<9) /* SDIO irq enabled */ + + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ ++ u32 max_overclock; /* Highest reported */ + }; + + +@@ -1091,7 +1092,7 @@ void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) + unsigned int input_clock = clock; + + if (host->overclock_50 && (clock == 50000000)) +- clock = host->overclock_50 * 1000000; ++ clock = host->overclock_50 * 1000000 + 999999; + + host->mmc->actual_clock = 0; + +@@ -1118,9 +1119,11 @@ void bcm2835_mmc_set_clock(struct bcm2835_host *host, unsigned int clock) + clock = (host->max_clk * clk_mul) / real_div; + host->mmc->actual_clock = clock; + +- if (clock > input_clock) ++ if ((clock > input_clock) && (clock > host->max_overclock)) { + pr_warn("%s: Overclocking to %dHz\n", + mmc_hostname(host->mmc), clock); ++ host->max_overclock = clock; ++ } + + clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT; + clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN) + +From f80dd3188715edaa5c23e3d99793170aa7dbd877 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 May 2015 13:05:27 +0100 +Subject: [PATCH 160/216] BCM2708_DT: Add missing CM aliases + +--- + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index d0a6fb8..8340c1e 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -3,6 +3,10 @@ + / { + aliases { + soc = &soc; ++ spi0 = &spi0; ++ i2c0 = &i2c0; ++ i2c1 = &i2c1; ++ i2s = &i2s; + gpio = &gpio; + intc = &intc; + leds = &leds; + +From 90c3a2ff9838fdf619c6f391c27ce2fe02f083cf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 15 May 2015 20:20:09 +0200 +Subject: [PATCH 161/216] usb: dwc_otg: Don't use dma_to_virt() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 6ce0d20 changes dma_to_virt() which breaks this driver. +Open code the old dma_to_virt() implementation to work around this. + +Limit the use of __bus_to_virt() to cases where transfer_buffer_length +is set and transfer_buffer is not set. This is done to increase the +chance that this driver will also work on ARCH_BCM2835. + +transfer_buffer should not be NULL if the length is set, but the +comment in the code indicates that there are situations where this +might happen. drivers/usb/isp1760/isp1760-hcd.c also has a similar +comment pointing to a possible: 'usb storage / SCSI bug'. + +Signed-off-by: Noralf Trønnes +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +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 1d28459..6aad9c4 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c +@@ -766,16 +766,17 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd, + !(usb_pipein(urb->pipe)))); + + buf = urb->transfer_buffer; +- if (hcd->self.uses_dma) { ++ if (hcd->self.uses_dma && !buf && urb->transfer_buffer_length) { + /* + * Calculate virtual address from physical address, + * because some class driver may not fill transfer_buffer. + * In Buffer DMA mode virual address is used, + * when handling non DWORD aligned buffers. + */ +- //buf = phys_to_virt(urb->transfer_dma); +- // DMA addresses are bus addresses not physical addresses! +- buf = dma_to_virt(&urb->dev->dev, urb->transfer_dma); ++ buf = (void *)__bus_to_virt((unsigned long)urb->transfer_dma); ++ dev_warn_once(&urb->dev->dev, ++ "USB transfer_buffer was NULL, will use __bus_to_virt(%pad)=%p\n", ++ &urb->transfer_dma, buf); + } + + if (!(urb->transfer_flags & URB_NO_INTERRUPT)) + +From 785584eaa255550270eb4496bdc31f241561b26c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 15 May 2015 20:20:26 +0200 +Subject: [PATCH 162/216] fixup: restore dma-mapping.h +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +dwc_otg has been fixed, so no need to revert 6ce0d20: +ARM: dma: Use dma_pfn_offset for dma address translation + +The pfn_to_dma/dma_to_pfn changes that came with that commit +is needed to use the 'dma-ranges' DT property on ARCH_BCM2835. +dma-ranges is needed by bcm2708_fb and vchiq on ARCH_BCM2835. +If not the mailbox call fails to hand over the correct +bus address to videocore. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/include/asm/dma-mapping.h | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h +index f5572d9..b52101d3 100644 +--- a/arch/arm/include/asm/dma-mapping.h ++++ b/arch/arm/include/asm/dma-mapping.h +@@ -58,21 +58,37 @@ static inline int dma_set_mask(struct device *dev, u64 mask) + #ifndef __arch_pfn_to_dma + static inline dma_addr_t pfn_to_dma(struct device *dev, unsigned long pfn) + { ++ if (dev) ++ pfn -= dev->dma_pfn_offset; + return (dma_addr_t)__pfn_to_bus(pfn); + } + + static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr) + { +- return __bus_to_pfn(addr); ++ unsigned long pfn = __bus_to_pfn(addr); ++ ++ if (dev) ++ pfn += dev->dma_pfn_offset; ++ ++ return pfn; + } + + static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) + { ++ if (dev) { ++ unsigned long pfn = dma_to_pfn(dev, addr); ++ ++ return phys_to_virt(__pfn_to_phys(pfn)); ++ } ++ + return (void *)__bus_to_virt((unsigned long)addr); + } + + static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) + { ++ if (dev) ++ return pfn_to_dma(dev, virt_to_pfn(addr)); ++ + return (dma_addr_t)__virt_to_bus((unsigned long)(addr)); + } + + +From 1b1de68277ff97f836021328e6ac6fbb24494c73 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:18:28 +0200 +Subject: [PATCH 163/216] fbdev: bcm2708_fb: Add ARCH_BCM2835 support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree support. +Pass the device to dma_alloc_coherent() in order to get the +correct bus address on ARCH_BCM2835. +Use the new DMA legacy API header file. +Including is not necessary. + +Signed-off-by: Noralf Trønnes +--- + drivers/video/fbdev/bcm2708_fb.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/drivers/video/fbdev/bcm2708_fb.c b/drivers/video/fbdev/bcm2708_fb.c +index 345c15e..f6ac7da 100644 +--- a/drivers/video/fbdev/bcm2708_fb.c ++++ b/drivers/video/fbdev/bcm2708_fb.c +@@ -24,16 +24,13 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include + #include +- +-#include +-#include +- + #include + #include + #include +@@ -628,7 +625,7 @@ static int bcm2708_fb_register(struct bcm2708_fb *fb) + void *mem; + + mem = +- dma_alloc_coherent(NULL, PAGE_ALIGN(sizeof(*fb->info)), &dma, ++ dma_alloc_coherent(&fb->dev->dev, PAGE_ALIGN(sizeof(*fb->info)), &dma, + GFP_KERNEL); + + if (NULL == mem) { +@@ -783,12 +780,19 @@ static int bcm2708_fb_remove(struct platform_device *dev) + return 0; + } + ++static const struct of_device_id bcm2708_fb_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-fb", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2708_fb_of_match_table); ++ + static struct platform_driver bcm2708_fb_driver = { + .probe = bcm2708_fb_probe, + .remove = bcm2708_fb_remove, + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, ++ .of_match_table = bcm2708_fb_of_match_table, + }, + }; + + +From e6d3d3d4102639777a7261d9eb6f195176fc50bb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:20:00 +0200 +Subject: [PATCH 164/216] BCM270x: Remove header file mach/dma.h +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This header file can be removed since there are no more users. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/include/mach/dma.h | 2 -- + arch/arm/mach-bcm2709/include/mach/dma.h | 2 -- + 2 files changed, 4 deletions(-) + delete mode 100644 arch/arm/mach-bcm2708/include/mach/dma.h + delete mode 100644 arch/arm/mach-bcm2709/include/mach/dma.h + +diff --git a/arch/arm/mach-bcm2708/include/mach/dma.h b/arch/arm/mach-bcm2708/include/mach/dma.h +deleted file mode 100644 +index d826705..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/dma.h ++++ /dev/null +@@ -1,2 +0,0 @@ +-/* This file can be removed when all the drivers have been updated */ +-#include +diff --git a/arch/arm/mach-bcm2709/include/mach/dma.h b/arch/arm/mach-bcm2709/include/mach/dma.h +deleted file mode 100644 +index d826705..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/dma.h ++++ /dev/null +@@ -1,2 +0,0 @@ +-/* This file can be removed when all the drivers have been updated */ +-#include + +From 11e908510cac293a92b124f36476ae7fe4c581ec Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:21:31 +0200 +Subject: [PATCH 165/216] BCM270x_DT: Add bcm2708-fb device +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add bcm2708-fb to Device Tree and don't add the +platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++++ + arch/arm/boot/dts/bcm2708_common.dtsi | 5 +++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + 6 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index f25563a..9a8fed0 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -49,6 +49,10 @@ + bus-width = <4>; + }; + ++&fb { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 17b4b8c..cf67ec9 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -49,6 +49,10 @@ + bus-width = <4>; + }; + ++&fb { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 1c8c1af..c5ed34b 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -109,6 +109,11 @@ + leds: leds { + compatible = "gpio-leds"; + }; ++ ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ status = "disabled"; ++ }; + }; + + clocks { +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index c73249b..1c865de 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -49,6 +49,10 @@ + bus-width = <4>; + }; + ++&fb { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 7cc47c1..cde2124 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -928,7 +928,7 @@ void __init bcm2708_init(void) + bcm_register_device_dt(&w1_device); + #endif + bcm_register_device(&bcm2708_systemtimer_device); +- bcm_register_device(&bcm2708_fb_device); ++ bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device(&bcm2708_usb_device); + bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 2c0a664..95db41ff 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -951,7 +951,7 @@ void __init bcm2709_init(void) + #ifdef SYSTEM_TIMER + bcm_register_device(&bcm2708_systemtimer_device); + #endif +- bcm_register_device(&bcm2708_fb_device); ++ bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device(&bcm2708_usb_device); + bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + +From 0abe9b6fa045617f9fb0f8afe64b69072821d241 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 5 May 2015 13:10:11 -0700 +Subject: [PATCH 166/216] ARM: bcm2835: Use 0x4 prefix for DMA bus addresses to + SDRAM. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +There exists a tiny MMU, configurable only by the VC (running the +closed firmware), which maps from the ARM's physical addresses to bus +addresses. These bus addresses determine the caching behavior in the +VC's L1/L2 (note: separate from the ARM's L1/L2) according to the top +2 bits. The bits in the bus address mean: + +From the VideoCore processor: +0x0... L1 and L2 cache allocating and coherent +0x4... L1 non-allocating, but coherent. L2 allocating and coherent +0x8... L1 non-allocating, but coherent. L2 non-allocating, but coherent +0xc... SDRAM alias. Cache is bypassed. Not L1 or L2 allocating or coherent + +From the GPU peripherals (note: all peripherals bypass the L1 +cache. The ARM will see this view once through the VC MMU): +0x0... Do not use +0x4... L1 non-allocating, and incoherent. L2 allocating and coherent. +0x8... L1 non-allocating, and incoherent. L2 non-allocating, but coherent +0xc... SDRAM alias. Cache is bypassed. Not L1 or L2 allocating or coherent + +The 2835 firmware always configures the MMU to turn ARM physical +addresses with 0x0 top bits to 0x4, meaning present in L2 but +incoherent with L1. However, any bus addresses we were generating in +the kernel to be passed to a device had 0x0 bits. That would be a +reserved (possibly totally incoherent) value if sent to a GPU +peripheral like USB, or L1 allocating if sent to the VC (like a +firmware property request). By setting dma-ranges, all of the devices +below it get a dev->dma_pfn_offset, so that dma_alloc_coherent() and +friends return addresses with 0x4 bits and avoid cache incoherency. + +This matches the behavior in the downstream 2708 kernel (see +BUS_OFFSET in arch/arm/mach-bcm2708/include/mach/memory.h). + +Signed-off-by: Eric Anholt +Tested-by: Noralf Trønnes +Acked-by: Stephen Warren +Cc: popcornmix@gmail.com +--- + arch/arm/boot/dts/bcm2835.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 06cba29..f91db90 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -14,6 +14,7 @@ + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x7e000000 0x20000000 0x02000000>; ++ dma-ranges = <0x40000000 0x00000000 0x20000000>; + + timer@7e003000 { + compatible = "brcm,bcm2835-system-timer"; + +From fabd2cdba17ab122a41957bced0c06e993b559a8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:24:13 +0200 +Subject: [PATCH 167/216] bcm2835: Add bcm2708-fb to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add framebuffer device to Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 4 ++++ + arch/arm/boot/dts/bcm2835.dtsi | 5 +++++ + 2 files changed, 9 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index 9f4ed2f..f2ce803 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -49,3 +49,7 @@ + status = "okay"; + bus-width = <4>; + }; ++ ++&fb { ++ status = "okay"; ++}; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index f91db90..f3ab9b3 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -159,6 +159,11 @@ + arm-pmu { + compatible = "arm,arm1176-pmu"; + }; ++ ++ fb: fb { ++ compatible = "brcm,bcm2708-fb"; ++ status = "disabled"; ++ }; + }; + + clocks { + +From 81530cfc1eb8c2069f7083fa2cc56b3b7470eb29 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 18 May 2015 17:24:35 +0200 +Subject: [PATCH 168/216] bcm2835: bcm2835_defconfig use FB_BCM2708 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Enable the bcm2708 framebuffer driver. +Disable the simple framebuffer driver, which matches the +device handed over by u-boot. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2835_defconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 26b4c75..1af6069 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -72,7 +72,7 @@ CONFIG_SPI_BCM2835=y + CONFIG_GPIO_SYSFS=y + # CONFIG_HWMON is not set + CONFIG_FB=y +-CONFIG_FB_SIMPLE=y ++CONFIG_FB_BCM2708=y + CONFIG_FRAMEBUFFER_CONSOLE=y + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y + CONFIG_USB=y + +From 9e0da80c0836b21773e84b699f2e94e50680b485 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 19 May 2015 11:41:11 +0100 +Subject: [PATCH 169/216] BCM2708_DT: Enable mmc and fb in the CM dtsi + +--- + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 8340c1e..815a3a4 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -25,6 +25,15 @@ + }; + }; + ++&mmc { ++ status = "okay"; ++ bus-width = <4>; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ + / { + __overrides__ { + act_led_gpio = <&act_led>,"gpios:4"; + +From c95de8db34841f61ef2cb38afb8b84973bd9aa6c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 19 May 2015 13:31:50 +0200 +Subject: [PATCH 170/216] BCM270x: Add vchiq device to platform file and Device + Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Prepare to turn the vchiq module into a driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 6 ++++++ + arch/arm/mach-bcm2708/bcm2708.c | 26 ++++++++++++++++++++++++++ + arch/arm/mach-bcm2708/include/mach/platform.h | 1 + + arch/arm/mach-bcm2709/bcm2709.c | 26 ++++++++++++++++++++++++++ + arch/arm/mach-bcm2709/include/mach/platform.h | 1 + + 5 files changed, 60 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index c5ed34b..2d9bcd8 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -114,6 +114,12 @@ + compatible = "brcm,bcm2708-fb"; + status = "disabled"; + }; ++ ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ }; + }; + + clocks { +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index cde2124..81cc988 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -437,6 +437,31 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static struct resource bcm2708_vchiq_resources[] = { ++ { ++ .start = ARMCTRL_0_BELL_BASE, ++ .end = ARMCTRL_0_BELL_BASE + 16, ++ .flags = IORESOURCE_MEM, ++ }, { ++ .start = IRQ_ARM_DOORBELL_0, ++ .end = IRQ_ARM_DOORBELL_0, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 vchiq_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_vchiq_device = { ++ .name = "bcm2835_vchiq", ++ .id = -1, ++ .resource = bcm2708_vchiq_resources, ++ .num_resources = ARRAY_SIZE(bcm2708_vchiq_resources), ++ .dev = { ++ .dma_mask = &vchiq_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + #ifdef CONFIG_BCM2708_GPIO + #define BCM_GPIO_DRIVER_NAME "bcm2708_gpio" + +@@ -909,6 +934,7 @@ void __init bcm2708_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); + #endif +diff --git a/arch/arm/mach-bcm2708/include/mach/platform.h b/arch/arm/mach-bcm2708/include/mach/platform.h +index bef3e5a..69674e9 100644 +--- a/arch/arm/mach-bcm2708/include/mach/platform.h ++++ b/arch/arm/mach-bcm2708/include/mach/platform.h +@@ -81,6 +81,7 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_BELL_BASE (ARMCTRL_0_SBM_BASE + 0x40) /* User 0 (ARM)'s Doorbell */ + #define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 95db41ff..528bf6e 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -456,6 +456,31 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static struct resource bcm2708_vchiq_resources[] = { ++ { ++ .start = ARMCTRL_0_BELL_BASE, ++ .end = ARMCTRL_0_BELL_BASE + 16, ++ .flags = IORESOURCE_MEM, ++ }, { ++ .start = IRQ_ARM_DOORBELL_0, ++ .end = IRQ_ARM_DOORBELL_0, ++ .flags = IORESOURCE_IRQ, ++ }, ++}; ++ ++static u64 vchiq_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_vchiq_device = { ++ .name = "bcm2835_vchiq", ++ .id = -1, ++ .resource = bcm2708_vchiq_resources, ++ .num_resources = ARRAY_SIZE(bcm2708_vchiq_resources), ++ .dev = { ++ .dma_mask = &vchiq_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + #ifdef CONFIG_BCM2708_GPIO + #define BCM_GPIO_DRIVER_NAME "bcm2708_gpio" + +@@ -930,6 +955,7 @@ void __init bcm2709_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); + #endif +diff --git a/arch/arm/mach-bcm2709/include/mach/platform.h b/arch/arm/mach-bcm2709/include/mach/platform.h +index 5574bb5..be99733 100644 +--- a/arch/arm/mach-bcm2709/include/mach/platform.h ++++ b/arch/arm/mach-bcm2709/include/mach/platform.h +@@ -81,6 +81,7 @@ + #define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */ + #define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */ + #define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */ ++#define ARMCTRL_0_BELL_BASE (ARMCTRL_0_SBM_BASE + 0x40) /* User 0 (ARM)'s Doorbell */ + #define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */ + + + +From b723b4395acda96c805d6cd382d5732efa6e449c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 19 May 2015 13:32:34 +0200 +Subject: [PATCH 171/216] bcm2708: vchiq: Add Device Tree support +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Turn vchiq into a driver and stop hardcoding resources. +Use devm_* functions in probe path to simplify cleanup. +A global variable is used to hold the register address. This is done +to keep this patch as small as possible. +Also make available on ARCH_BCM2835. +Based on work by Lubomir Rintel. + +Signed-off-by: Noralf Trønnes +--- + drivers/misc/vc04_services/Kconfig | 2 +- + .../interface/vchiq_arm/vchiq_2835_arm.c | 124 +++++++++------------ + .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 44 ++++---- + .../vc04_services/interface/vchiq_arm/vchiq_arm.h | 7 +- + 4 files changed, 79 insertions(+), 98 deletions(-) + +diff --git a/drivers/misc/vc04_services/Kconfig b/drivers/misc/vc04_services/Kconfig +index b94e6cd..b4198c2 100644 +--- a/drivers/misc/vc04_services/Kconfig ++++ b/drivers/misc/vc04_services/Kconfig +@@ -1,6 +1,6 @@ + config BCM2708_VCHIQ + tristate "Videocore VCHIQ" +- depends on MACH_BCM2708 || MACH_BCM2709 ++ depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 + default y + help + Kernel to VideoCore communication interface for the +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 70e5086..660aad2 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -35,22 +35,17 @@ + #include + #include + #include +-#include + #include + #include + #include + #include + #include ++#include + #include + #include + +-#include +- +-#include +- + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) + +-#define VCHIQ_DOORBELL_IRQ IRQ_ARM_DOORBELL_0 + #define VCHIQ_ARM_ADDRESS(x) ((void *)__virt_to_bus((unsigned)x)) + + #include "vchiq_arm.h" +@@ -60,14 +55,15 @@ + + #define MAX_FRAGMENTS (VCHIQ_NUM_CURRENT_BULKS * 2) + ++#define BELL0 0x00 ++#define BELL2 0x08 ++ + typedef struct vchiq_2835_state_struct { + int inited; + VCHIQ_ARM_STATE_T arm_state; + } VCHIQ_2835_ARM_STATE_T; + +-static char *g_slot_mem; +-static int g_slot_mem_size; +-dma_addr_t g_slot_phys; ++static void __iomem *g_regs; + static FRAGMENTS_T *g_fragments_base; + static FRAGMENTS_T *g_free_fragments; + struct semaphore g_free_fragments_sema; +@@ -86,43 +82,40 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + static void + free_pagelist(PAGELIST_T *pagelist, int actual); + +-int __init +-vchiq_platform_init(VCHIQ_STATE_T *state) ++int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + { ++ struct device *dev = &pdev->dev; + VCHIQ_SLOT_ZERO_T *vchiq_slot_zero; +- int frag_mem_size; +- int err; +- int i; ++ struct resource *res; ++ void *slot_mem; ++ dma_addr_t slot_phys; ++ int slot_mem_size, frag_mem_size; ++ int err, irq, i; + + /* Allocate space for the channels in coherent memory */ +- g_slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); ++ slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); + frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); + +- g_slot_mem = dma_alloc_coherent(NULL, g_slot_mem_size + frag_mem_size, +- &g_slot_phys, GFP_KERNEL); +- +- if (!g_slot_mem) { +- vchiq_log_error(vchiq_arm_log_level, +- "Unable to allocate channel memory"); +- err = -ENOMEM; +- goto failed_alloc; ++ slot_mem = dmam_alloc_coherent(dev, slot_mem_size + frag_mem_size, ++ &slot_phys, GFP_KERNEL); ++ if (!slot_mem) { ++ dev_err(dev, "could not allocate DMA memory\n"); ++ return -ENOMEM; + } + +- WARN_ON(((int)g_slot_mem & (PAGE_SIZE - 1)) != 0); ++ WARN_ON(((int)slot_mem & (PAGE_SIZE - 1)) != 0); + +- vchiq_slot_zero = vchiq_init_slots(g_slot_mem, g_slot_mem_size); +- if (!vchiq_slot_zero) { +- err = -EINVAL; +- goto failed_init_slots; +- } ++ vchiq_slot_zero = vchiq_init_slots(slot_mem, slot_mem_size); ++ if (!vchiq_slot_zero) ++ return -EINVAL; + + vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX] = +- (int)g_slot_phys + g_slot_mem_size; ++ (int)slot_phys + slot_mem_size; + vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX] = + MAX_FRAGMENTS; + +- g_fragments_base = (FRAGMENTS_T *)(g_slot_mem + g_slot_mem_size); +- g_slot_mem_size += frag_mem_size; ++ g_fragments_base = (FRAGMENTS_T *)(slot_mem + slot_mem_size); ++ slot_mem_size += frag_mem_size; + + g_free_fragments = g_fragments_base; + for (i = 0; i < (MAX_FRAGMENTS - 1); i++) { +@@ -132,54 +125,46 @@ vchiq_platform_init(VCHIQ_STATE_T *state) + *(FRAGMENTS_T **)&g_fragments_base[i] = NULL; + sema_init(&g_free_fragments_sema, MAX_FRAGMENTS); + +- if (vchiq_init_state(state, vchiq_slot_zero, 0/*slave*/) != +- VCHIQ_SUCCESS) { +- err = -EINVAL; +- goto failed_vchiq_init; ++ if (vchiq_init_state(state, vchiq_slot_zero, 0) != VCHIQ_SUCCESS) ++ return -EINVAL; ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ g_regs = devm_ioremap_resource(&pdev->dev, res); ++ if (IS_ERR(g_regs)) ++ return PTR_ERR(g_regs); ++ ++ irq = platform_get_irq(pdev, 0); ++ if (irq <= 0) { ++ dev_err(dev, "failed to get IRQ\n"); ++ return irq; + } + +- err = request_irq(VCHIQ_DOORBELL_IRQ, vchiq_doorbell_irq, +- IRQF_IRQPOLL, "VCHIQ doorbell", +- state); +- if (err < 0) { +- vchiq_log_error(vchiq_arm_log_level, "%s: failed to register " +- "irq=%d err=%d", __func__, +- VCHIQ_DOORBELL_IRQ, err); +- goto failed_request_irq; ++ err = devm_request_irq(dev, irq, vchiq_doorbell_irq, IRQF_IRQPOLL, ++ "VCHIQ doorbell", state); ++ if (err) { ++ dev_err(dev, "failed to register irq=%d\n", irq); ++ return err; + } + + /* Send the base address of the slots to VideoCore */ + + dsb(); /* Ensure all writes have completed */ + +- bcm_mailbox_write(MBOX_CHAN_VCHIQ, (unsigned int)g_slot_phys); ++ err = bcm_mailbox_write(MBOX_CHAN_VCHIQ, (unsigned int)slot_phys); ++ if (err) { ++ dev_err(dev, "mailbox write failed\n"); ++ return err; ++ } + + vchiq_log_info(vchiq_arm_log_level, +- "vchiq_init - done (slots %x, phys %x)", +- (unsigned int)vchiq_slot_zero, g_slot_phys); ++ "vchiq_init - done (slots %x, phys %pad)", ++ (unsigned int)vchiq_slot_zero, &slot_phys); + +- vchiq_call_connected_callbacks(); ++ vchiq_call_connected_callbacks(); + + return 0; +- +-failed_request_irq: +-failed_vchiq_init: +-failed_init_slots: +- dma_free_coherent(NULL, g_slot_mem_size, g_slot_mem, g_slot_phys); +- +-failed_alloc: +- return err; +-} +- +-void __exit +-vchiq_platform_exit(VCHIQ_STATE_T *state) +-{ +- free_irq(VCHIQ_DOORBELL_IRQ, state); +- dma_free_coherent(NULL, g_slot_mem_size, +- g_slot_mem, g_slot_phys); + } + +- + VCHIQ_STATUS_T + vchiq_platform_init_state(VCHIQ_STATE_T *state) + { +@@ -213,11 +198,8 @@ remote_event_signal(REMOTE_EVENT_T *event) + + dsb(); /* data barrier operation */ + +- if (event->armed) { +- /* trigger vc interrupt */ +- +- writel(0, __io_address(ARM_0_BELL2)); +- } ++ if (event->armed) ++ writel(0, g_regs + BELL2); /* trigger vc interrupt */ + } + + int +@@ -341,7 +323,7 @@ vchiq_doorbell_irq(int irq, void *dev_id) + unsigned int status; + + /* Read (and clear) the doorbell */ +- status = readl(__io_address(ARM_0_BELL0)); ++ status = readl(g_regs + BELL0); + + if (status & 0x4) { /* Was the doorbell rung? */ + remote_event_pollall(state); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +index 0ad9656..31e2cba 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.c +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + + #include "vchiq_core.h" + #include "vchiq_ioctl.h" +@@ -2790,15 +2791,7 @@ void vchiq_platform_conn_state_changed(VCHIQ_STATE_T *state, + } + } + +- +-/**************************************************************************** +-* +-* vchiq_init - called when the module is loaded. +-* +-***************************************************************************/ +- +-static int __init +-vchiq_init(void) ++static int vchiq_probe(struct platform_device *pdev) + { + int err; + void *ptr_err; +@@ -2835,7 +2828,7 @@ vchiq_init(void) + if (IS_ERR(ptr_err)) + goto failed_device_create; + +- err = vchiq_platform_init(&g_state); ++ err = vchiq_platform_init(pdev, &g_state); + if (err != 0) + goto failed_platform_init; + +@@ -2862,23 +2855,32 @@ vchiq_init(void) + return err; + } + +-/**************************************************************************** +-* +-* vchiq_exit - called when the module is unloaded. +-* +-***************************************************************************/ +- +-static void __exit +-vchiq_exit(void) ++static int vchiq_remove(struct platform_device *pdev) + { +- vchiq_platform_exit(&g_state); + device_destroy(vchiq_class, vchiq_devid); + class_destroy(vchiq_class); + cdev_del(&vchiq_cdev); + unregister_chrdev_region(vchiq_devid, 1); ++ ++ return 0; + } + +-module_init(vchiq_init); +-module_exit(vchiq_exit); ++static const struct of_device_id vchiq_of_match[] = { ++ { .compatible = "brcm,bcm2835-vchiq", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, vchiq_of_match); ++ ++static struct platform_driver vchiq_driver = { ++ .driver = { ++ .name = "bcm2835_vchiq", ++ .owner = THIS_MODULE, ++ .of_match_table = vchiq_of_match, ++ }, ++ .probe = vchiq_probe, ++ .remove = vchiq_remove, ++}; ++module_platform_driver(vchiq_driver); ++ + MODULE_LICENSE("GPL"); + MODULE_AUTHOR("Broadcom Corporation"); +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +index d1e2741..9740e1a 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_arm.h +@@ -36,6 +36,7 @@ + #define VCHIQ_ARM_H + + #include ++#include + #include + #include + #include "vchiq_core.h" +@@ -128,11 +129,7 @@ typedef struct vchiq_arm_state_struct { + extern int vchiq_arm_log_level; + extern int vchiq_susp_log_level; + +-extern int __init +-vchiq_platform_init(VCHIQ_STATE_T *state); +- +-extern void __exit +-vchiq_platform_exit(VCHIQ_STATE_T *state); ++int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state); + + extern VCHIQ_STATE_T * + vchiq_get_state(void); + +From a368d9389c5c346a4e5b6ee63a5b28c45184aa20 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 19 May 2015 13:32:50 +0200 +Subject: [PATCH 172/216] bcm2835: Add bcm2835-vchiq to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add vchiq to Device Tree. There are no kernel users yet, +but it's available to userspace (vcgencmd). + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index f3ab9b3..72d0354 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -164,6 +164,12 @@ + compatible = "brcm,bcm2708-fb"; + status = "disabled"; + }; ++ ++ vchiq: vchiq { ++ compatible = "brcm,bcm2835-vchiq"; ++ reg = <0x7e00b840 0xf>; ++ interrupts = <0 2>; ++ }; + }; + + clocks { + +From 0bf6760b3d81238fcfac05e88f66252192c5745d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 20 May 2015 09:29:46 +0100 +Subject: [PATCH 173/216] i2c-bcm2708: When using DT, leave the GPIO setup to + pinctrl + +--- + drivers/i2c/busses/i2c-bcm2708.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c +index 81e9374..8773203 100644 +--- a/drivers/i2c/busses/i2c-bcm2708.c ++++ b/drivers/i2c/busses/i2c-bcm2708.c +@@ -382,7 +382,8 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + goto out_clk_put; + } + +- bcm2708_i2c_init_pinmode(pdev->id); ++ if (!pdev->dev.of_node) ++ bcm2708_i2c_init_pinmode(pdev->id); + + bi = kzalloc(sizeof(*bi), GFP_KERNEL); + if (!bi) + +From aa0aca81361683205b07ecc895256795ea771528 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 21 May 2015 11:36:31 +0100 +Subject: [PATCH 174/216] vchiq: Change logging level for inbound data + +--- + drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +index 835688b..2c98da4 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_core.c +@@ -1782,7 +1782,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) + service->remoteport); + break; + case VCHIQ_MSG_DATA: +- vchiq_log_trace(vchiq_core_log_level, ++ vchiq_log_info(vchiq_core_log_level, + "%d: prs DATA@%x,%x (%d->%d)", + state->id, (unsigned int)header, size, + remoteport, localport); + +From 32477cf579fd64092395855bfacf907c7da8e3d8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 21 May 2015 13:24:35 +0200 +Subject: [PATCH 175/216] BCM270x: Add onboard sound device to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree support to alsa driver. +Add device to Device Tree. +Don't add platform devices when booting in DT mode. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 4 ++ + arch/arm/boot/dts/bcm2708_common.dtsi | 7 +++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + sound/arm/Kconfig | 3 +- + sound/arm/bcm2835.c | 91 ++++++++++++++++++++++++++++++++ + 9 files changed, 118 insertions(+), 3 deletions(-) + mode change 100755 => 100644 arch/arm/boot/dts/bcm2708-rpi-cm.dtsi + mode change 100755 => 100644 sound/arm/bcm2835.c + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 9a8fed0..6323c5b 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -53,6 +53,10 @@ + status = "okay"; + }; + ++&audio { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index cf67ec9..e1fe6a4 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -53,6 +53,10 @@ + status = "okay"; + }; + ++&audio { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +old mode 100755 +new mode 100644 +index 815a3a4..1c2cfcf +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -34,6 +34,10 @@ + status = "okay"; + }; + ++&audio { ++ status = "okay"; ++}; ++ + / { + __overrides__ { + act_led_gpio = <&act_led>,"gpios:4"; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 2d9bcd8..4bf6960 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -3,6 +3,13 @@ + / { + interrupt-parent = <&intc>; + ++ /* Onboard audio */ ++ audio: audio { ++ compatible = "brcm,bcm2835-audio"; ++ brcm,pwm-channels = <8>; ++ status = "disabled"; ++ }; ++ + soc: soc { + compatible = "simple-bus"; + #address-cells = <1>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 1c865de..921add1 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -53,6 +53,10 @@ + status = "okay"; + }; + ++&audio { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 81cc988..e451187 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -964,7 +964,7 @@ void __init bcm2708_init(void) + #endif + bcm2708_init_led(); + for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) +- bcm_register_device(&bcm2708_alsa_devices[i]); ++ bcm_register_device_dt(&bcm2708_alsa_devices[i]); + + bcm_register_device_dt(&bcm2708_spi_device); + +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 528bf6e..06c2c74 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -987,7 +987,7 @@ void __init bcm2709_init(void) + #endif + bcm2709_init_led(); + for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) +- bcm_register_device(&bcm2708_alsa_devices[i]); ++ bcm_register_device_dt(&bcm2708_alsa_devices[i]); + + bcm_register_device_dt(&bcm2708_spi_device); + +diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig +index ada7ba2..fcbe9d7 100644 +--- a/sound/arm/Kconfig ++++ b/sound/arm/Kconfig +@@ -41,7 +41,8 @@ config SND_PXA2XX_AC97 + + config SND_BCM2835 + tristate "BCM2835 ALSA driver" +- depends on (ARCH_BCM2708 || ARCH_BCM2709) && BCM2708_VCHIQ && SND ++ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) \ ++ && BCM2708_VCHIQ && SND + select SND_PCM + help + Say Y or M if you want to support BCM2835 Alsa pcm card driver +diff --git a/sound/arm/bcm2835.c b/sound/arm/bcm2835.c +old mode 100755 +new mode 100644 +index 7ed5079..6b545e7 +--- a/sound/arm/bcm2835.c ++++ b/sound/arm/bcm2835.c +@@ -17,6 +17,7 @@ + #include + #include + #include ++#include + + #include "bcm2835.h" + +@@ -81,6 +82,86 @@ static int snd_bcm2835_create(struct snd_card *card, + return 0; + } + ++static int snd_bcm2835_alsa_probe_dt(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ bcm2835_chip_t *chip; ++ struct snd_card *card; ++ u32 numchans; ++ int err, i; ++ ++ err = of_property_read_u32(dev->of_node, "brcm,pwm-channels", ++ &numchans); ++ if (err) { ++ dev_err(dev, "Failed to get DT property 'brcm,pwm-channels'"); ++ return err; ++ } ++ ++ if (numchans == 0 || numchans > MAX_SUBSTREAMS) { ++ numchans = MAX_SUBSTREAMS; ++ dev_warn(dev, "Illegal 'brcm,pwm-channels' value, will use %u\n", ++ numchans); ++ } ++ ++ err = snd_card_new(NULL, -1, NULL, THIS_MODULE, 0, &card); ++ if (err) { ++ dev_err(dev, "Failed to create soundcard structure\n"); ++ return err; ++ } ++ ++ snd_card_set_dev(card, dev); ++ strcpy(card->driver, "bcm2835"); ++ strcpy(card->shortname, "bcm2835 ALSA"); ++ sprintf(card->longname, "%s", card->shortname); ++ ++ err = snd_bcm2835_create(card, pdev, &chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create bcm2835 chip\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_pcm(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 pcm device\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_spdif_pcm(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 spdif pcm device\n"); ++ goto err_free; ++ } ++ ++ err = snd_bcm2835_new_ctl(chip); ++ if (err < 0) { ++ dev_err(dev, "Failed to create new bcm2835 ctl\n"); ++ goto err_free; ++ } ++ ++ for (i = 0; i < numchans; i++) { ++ chip->avail_substreams |= (1 << i); ++ chip->pdev[i] = pdev; ++ } ++ ++ err = snd_card_register(card); ++ if (err) { ++ dev_err(dev, "Failed to register bcm2835 ALSA card \n"); ++ goto err_free; ++ } ++ ++ g_card = card; ++ g_chip = chip; ++ platform_set_drvdata(pdev, card); ++ audio_info("bcm2835 ALSA card created with %u channels\n", numchans); ++ ++ return 0; ++ ++err_free: ++ snd_card_free(card); ++ ++ return err; ++} ++ + static int snd_bcm2835_alsa_probe(struct platform_device *pdev) + { + static int dev; +@@ -88,6 +169,9 @@ static int snd_bcm2835_alsa_probe(struct platform_device *pdev) + struct snd_card *card; + int err; + ++ if (pdev->dev.of_node) ++ return snd_bcm2835_alsa_probe_dt(pdev); ++ + if (dev >= MAX_SUBSTREAMS) + return -ENODEV; + +@@ -224,6 +308,12 @@ static int snd_bcm2835_alsa_resume(struct platform_device *pdev) + + #endif + ++static const struct of_device_id snd_bcm2835_of_match_table[] = { ++ { .compatible = "brcm,bcm2835-audio", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_bcm2835_of_match_table); ++ + static struct platform_driver bcm2835_alsa0_driver = { + .probe = snd_bcm2835_alsa_probe, + .remove = snd_bcm2835_alsa_remove, +@@ -234,6 +324,7 @@ static struct platform_driver bcm2835_alsa0_driver = { + .driver = { + .name = "bcm2835_AUD0", + .owner = THIS_MODULE, ++ .of_match_table = snd_bcm2835_of_match_table, + }, + }; + + +From a8d9f167700bc9fd113a303b4944272519fc40f0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 21 May 2015 13:25:32 +0200 +Subject: [PATCH 176/216] bcm2835: Add bcm2835-audio to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add onboard sound device to Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index f2ce803..f23835e 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -14,6 +14,12 @@ + linux,default-trigger = "heartbeat"; + }; + }; ++ ++ /* Onboard audio */ ++ audio: audio { ++ compatible = "brcm,bcm2835-audio"; ++ brcm,pwm-channels = <8>; ++ }; + }; + + &gpio { + +From ead779a26fcab730a6d4be4c7b48c62b22afd8a5 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 18 May 2015 16:59:02 +0100 +Subject: [PATCH 177/216] config: Add CONFIG_CIFS_UPCALL + +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index ff87581..6fdd9bb 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -1118,6 +1118,7 @@ CONFIG_NFSD_V3_ACL=y + CONFIG_NFSD_V4=y + CONFIG_CIFS=m + CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y + CONFIG_CIFS_XATTR=y + CONFIG_CIFS_POSIX=y + CONFIG_9P_FS=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index e339979..93b3de1 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -1111,6 +1111,7 @@ CONFIG_NFSD_V3_ACL=y + CONFIG_NFSD_V4=y + CONFIG_CIFS=m + CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y + CONFIG_CIFS_XATTR=y + CONFIG_CIFS_POSIX=y + CONFIG_9P_FS=m + +From 2728618d457e238f4f95d96ad9303a1d816109a9 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 18 May 2015 16:59:13 +0100 +Subject: [PATCH 178/216] config: Add CONFIG_FB_SSD1307=m + +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 6fdd9bb..9daaeb7 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -769,6 +769,7 @@ CONFIG_VIDEO_OV7640=m + CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y ++CONFIG_FB_SSD1307=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 93b3de1..dc27aeb 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -762,6 +762,7 @@ CONFIG_VIDEO_OV7640=m + CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y ++CONFIG_FB_SSD1307=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y + +From 25b5c8e286f3a2b1779c63754b8993107bb416b0 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 13 Oct 2014 11:47:53 +0100 +Subject: [PATCH 179/216] Improve __copy_to_user and __copy_from_user + performance + +Provide a __copy_from_user that uses memcpy. On BCM2708, use +optimised memcpy/memmove/memcmp/memset implementations. +--- + arch/arm/include/asm/string.h | 5 + + arch/arm/include/asm/uaccess.h | 1 + + arch/arm/lib/Makefile | 15 +- + arch/arm/lib/arm-mem.h | 159 ++++++++++++ + arch/arm/lib/copy_from_user.S | 4 +- + arch/arm/lib/exports_rpi.c | 37 +++ + arch/arm/lib/memcmp_rpi.S | 285 +++++++++++++++++++++ + arch/arm/lib/memcpy_rpi.S | 59 +++++ + arch/arm/lib/memcpymove.h | 506 +++++++++++++++++++++++++++++++++++++ + arch/arm/lib/memmove_rpi.S | 61 +++++ + arch/arm/lib/memset_rpi.S | 121 +++++++++ + arch/arm/lib/uaccess_with_memcpy.c | 112 +++++++- + 12 files changed, 1359 insertions(+), 6 deletions(-) + create mode 100644 arch/arm/lib/arm-mem.h + create mode 100644 arch/arm/lib/exports_rpi.c + create mode 100644 arch/arm/lib/memcmp_rpi.S + create mode 100644 arch/arm/lib/memcpy_rpi.S + create mode 100644 arch/arm/lib/memcpymove.h + create mode 100644 arch/arm/lib/memmove_rpi.S + create mode 100644 arch/arm/lib/memset_rpi.S + +diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h +index cf4f3aa..9fe7780 100644 +--- a/arch/arm/include/asm/string.h ++++ b/arch/arm/include/asm/string.h +@@ -24,6 +24,11 @@ extern void * memchr(const void *, int, __kernel_size_t); + #define __HAVE_ARCH_MEMSET + extern void * memset(void *, int, __kernel_size_t); + ++#ifdef CONFIG_MACH_BCM2708 ++#define __HAVE_ARCH_MEMCMP ++extern int memcmp(const void *, const void *, size_t); ++#endif ++ + extern void __memzero(void *ptr, __kernel_size_t n); + + #define memset(p,v,n) \ +diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h +index ce0786e..b85b93d 100644 +--- a/arch/arm/include/asm/uaccess.h ++++ b/arch/arm/include/asm/uaccess.h +@@ -475,6 +475,7 @@ do { \ + + #ifdef CONFIG_MMU + extern unsigned long __must_check __copy_from_user(void *to, const void __user *from, unsigned long n); ++extern unsigned long __must_check __copy_from_user_std(void *to, const void __user *from, unsigned long n); + extern unsigned long __must_check __copy_to_user(void __user *to, const void *from, unsigned long n); + extern unsigned long __must_check __copy_to_user_std(void __user *to, const void *from, unsigned long n); + extern unsigned long __must_check __clear_user(void __user *addr, unsigned long n); +diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile +index d8a7807..9c7dc5b 100644 +--- a/arch/arm/lib/Makefile ++++ b/arch/arm/lib/Makefile +@@ -6,9 +6,8 @@ + + lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ +- delay.o delay-loop.o findbit.o memchr.o memcpy.o \ +- memmove.o memset.o memzero.o setbit.o \ +- strchr.o strrchr.o \ ++ delay.o delay-loop.o findbit.o memchr.o memzero.o \ ++ setbit.o strchr.o strrchr.o \ + testchangebit.o testclearbit.o testsetbit.o \ + ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \ + ucmpdi2.o lib1funcs.o div64.o \ +@@ -18,6 +17,16 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ + mmu-y := clear_user.o copy_page.o getuser.o putuser.o \ + copy_from_user.o copy_to_user.o + ++# Choose optimised implementations for Raspberry Pi ++ifeq ($(CONFIG_MACH_BCM2708),y) ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_FROM_USER_THRESHOLD=1600 ++ CFLAGS_uaccess_with_memcpy.o += -DCOPY_TO_USER_THRESHOLD=672 ++ obj-$(CONFIG_MODULES) += exports_rpi.o ++ lib-y += memcpy_rpi.o memmove_rpi.o memset_rpi.o memcmp_rpi.o ++else ++ lib-y += memcpy.o memmove.o memset.o ++endif ++ + # using lib_ here won't override already available weak symbols + obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o + +diff --git a/arch/arm/lib/arm-mem.h b/arch/arm/lib/arm-mem.h +new file mode 100644 +index 0000000..5d4bda1 +--- /dev/null ++++ b/arch/arm/lib/arm-mem.h +@@ -0,0 +1,159 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++.macro myfunc fname ++ .func fname ++ .global fname ++fname: ++.endm ++ ++.macro preload_leading_step1 backwards, ptr, base ++/* If the destination is already 16-byte aligned, then we need to preload ++ * between 0 and prefetch_distance (inclusive) cache lines ahead so there ++ * are no gaps when the inner loop starts. ++ */ ++ .if backwards ++ sub ptr, base, #1 ++ bic ptr, ptr, #31 ++ .else ++ bic ptr, base, #31 ++ .endif ++ .set OFFSET, 0 ++ .rept prefetch_distance+1 ++ pld [ptr, #OFFSET] ++ .if backwards ++ .set OFFSET, OFFSET-32 ++ .else ++ .set OFFSET, OFFSET+32 ++ .endif ++ .endr ++.endm ++ ++.macro preload_leading_step2 backwards, ptr, base, leading_bytes, tmp ++/* However, if the destination is not 16-byte aligned, we may need to ++ * preload one more cache line than that. The question we need to ask is: ++ * are the leading bytes more than the amount by which the source ++ * pointer will be rounded down for preloading, and if so, by how many ++ * cache lines? ++ */ ++ .if backwards ++/* Here we compare against how many bytes we are into the ++ * cache line, counting down from the highest such address. ++ * Effectively, we want to calculate ++ * leading_bytes = dst&15 ++ * cacheline_offset = 31-((src-leading_bytes-1)&31) ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0, or rearranging: ++ * leading_bytes + (src-leading_bytes-1)&31 <= 31 ++ */ ++ mov tmp, base, lsl #32-5 ++ sbc tmp, tmp, leading_bytes, lsl #32-5 ++ adds tmp, tmp, leading_bytes, lsl #32-5 ++ bcc 61f ++ pld [ptr, #-32*(prefetch_distance+1)] ++ .else ++/* Effectively, we want to calculate ++ * leading_bytes = (-dst)&15 ++ * cacheline_offset = (src+leading_bytes)&31 ++ * extra_needed = leading_bytes - cacheline_offset ++ * and test if extra_needed is <= 0. ++ */ ++ mov tmp, base, lsl #32-5 ++ add tmp, tmp, leading_bytes, lsl #32-5 ++ rsbs tmp, tmp, leading_bytes, lsl #32-5 ++ bls 61f ++ pld [ptr, #32*(prefetch_distance+1)] ++ .endif ++61: ++.endm ++ ++.macro preload_trailing backwards, base, remain, tmp ++ /* We need either 0, 1 or 2 extra preloads */ ++ .if backwards ++ rsb tmp, base, #0 ++ mov tmp, tmp, lsl #32-5 ++ .else ++ mov tmp, base, lsl #32-5 ++ .endif ++ adds tmp, tmp, remain, lsl #32-5 ++ adceqs tmp, tmp, #0 ++ /* The instruction above has two effects: ensures Z is only ++ * set if C was clear (so Z indicates that both shifted quantities ++ * were 0), and clears C if Z was set (so C indicates that the sum ++ * of the shifted quantities was greater and not equal to 32) */ ++ beq 82f ++ .if backwards ++ sub tmp, base, #1 ++ bic tmp, tmp, #31 ++ .else ++ bic tmp, base, #31 ++ .endif ++ bcc 81f ++ .if backwards ++ pld [tmp, #-32*(prefetch_distance+1)] ++81: ++ pld [tmp, #-32*prefetch_distance] ++ .else ++ pld [tmp, #32*(prefetch_distance+2)] ++81: ++ pld [tmp, #32*(prefetch_distance+1)] ++ .endif ++82: ++.endm ++ ++.macro preload_all backwards, narrow_case, shift, base, remain, tmp0, tmp1 ++ .if backwards ++ sub tmp0, base, #1 ++ bic tmp0, tmp0, #31 ++ pld [tmp0] ++ sub tmp1, base, remain, lsl #shift ++ .else ++ bic tmp0, base, #31 ++ pld [tmp0] ++ add tmp1, base, remain, lsl #shift ++ sub tmp1, tmp1, #1 ++ .endif ++ bic tmp1, tmp1, #31 ++ cmp tmp1, tmp0 ++ beq 92f ++ .if narrow_case ++ /* In this case, all the data fits in either 1 or 2 cache lines */ ++ pld [tmp1] ++ .else ++91: ++ .if backwards ++ sub tmp0, tmp0, #32 ++ .else ++ add tmp0, tmp0, #32 ++ .endif ++ cmp tmp0, tmp1 ++ pld [tmp0] ++ bne 91b ++ .endif ++92: ++.endm +diff --git a/arch/arm/lib/copy_from_user.S b/arch/arm/lib/copy_from_user.S +index 7a235b9..8aff879 100644 +--- a/arch/arm/lib/copy_from_user.S ++++ b/arch/arm/lib/copy_from_user.S +@@ -89,11 +89,13 @@ + + .text + +-ENTRY(__copy_from_user) ++ENTRY(__copy_from_user_std) ++WEAK(__copy_from_user) + + #include "copy_template.S" + + ENDPROC(__copy_from_user) ++ENDPROC(__copy_from_user_std) + + .pushsection .fixup,"ax" + .align 0 +diff --git a/arch/arm/lib/exports_rpi.c b/arch/arm/lib/exports_rpi.c +new file mode 100644 +index 0000000..1f82604 +--- /dev/null ++++ b/arch/arm/lib/exports_rpi.c +@@ -0,0 +1,37 @@ ++/** ++ * Copyright (c) 2014, Raspberry Pi (Trading) Ltd. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions ++ * are met: ++ * 1. Redistributions of source code must retain the above copyright ++ * notice, this list of conditions, and the following disclaimer, ++ * without modification. ++ * 2. Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * 3. The names of the above-listed copyright holders may not be used ++ * to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * ALTERNATIVELY, this software may be distributed under the terms of the ++ * GNU General Public License ("GPL") version 2, as published by the Free ++ * Software Foundation. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS ++ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, ++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, ++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR ++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ++ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING ++ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#include ++#include ++ ++EXPORT_SYMBOL(memcmp); +diff --git a/arch/arm/lib/memcmp_rpi.S b/arch/arm/lib/memcmp_rpi.S +new file mode 100644 +index 0000000..bf6e4ed +--- /dev/null ++++ b/arch/arm/lib/memcmp_rpi.S +@@ -0,0 +1,285 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include ++#include "arm-mem.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++.macro memcmp_process_head unaligned ++ .if unaligned ++ ldr DAT0, [S_1], #4 ++ ldr DAT1, [S_1], #4 ++ ldr DAT2, [S_1], #4 ++ ldr DAT3, [S_1], #4 ++ .else ++ ldmia S_1!, {DAT0, DAT1, DAT2, DAT3} ++ .endif ++ ldmia S_2!, {DAT4, DAT5, DAT6, DAT7} ++.endm ++ ++.macro memcmp_process_tail ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ cmpeq DAT3, DAT7 ++ bne 200f ++.endm ++ ++.macro memcmp_leading_31bytes ++ movs DAT0, OFF, lsl #31 ++ ldrmib DAT0, [S_1], #1 ++ ldrcsh DAT1, [S_1], #2 ++ ldrmib DAT4, [S_2], #1 ++ ldrcsh DAT5, [S_2], #2 ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ submi N, N, #1 ++ subcs N, N, #2 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++ movs DAT0, OFF, lsl #29 ++ ldrmi DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ ldrcs DAT2, [S_1], #4 ++ ldrmi DAT4, [S_2], #4 ++ ldmcsia S_2!, {DAT5, DAT6} ++ movpl DAT0, #0 ++ movcc DAT1, #0 ++ movcc DAT2, #0 ++ movpl DAT4, #0 ++ movcc DAT5, #0 ++ movcc DAT6, #0 ++ submi N, N, #4 ++ subcs N, N, #8 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ tst OFF, #16 ++ beq 105f ++ memcmp_process_head 1 ++ sub N, N, #16 ++ memcmp_process_tail ++105: ++.endm ++ ++.macro memcmp_trailing_15bytes unaligned ++ movs N, N, lsl #29 ++ .if unaligned ++ ldrcs DAT0, [S_1], #4 ++ ldrcs DAT1, [S_1], #4 ++ .else ++ ldmcsia S_1!, {DAT0, DAT1} ++ .endif ++ ldrmi DAT2, [S_1], #4 ++ ldmcsia S_2!, {DAT4, DAT5} ++ ldrmi DAT6, [S_2], #4 ++ movcc DAT0, #0 ++ movcc DAT1, #0 ++ movpl DAT2, #0 ++ movcc DAT4, #0 ++ movcc DAT5, #0 ++ movpl DAT6, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ cmpeq DAT2, DAT6 ++ bne 200f ++ movs N, N, lsl #2 ++ ldrcsh DAT0, [S_1], #2 ++ ldrmib DAT1, [S_1] ++ ldrcsh DAT4, [S_2], #2 ++ ldrmib DAT5, [S_2] ++ movcc DAT0, #0 ++ movpl DAT1, #0 ++ movcc DAT4, #0 ++ movpl DAT5, #0 ++ cmp DAT0, DAT4 ++ cmpeq DAT1, DAT5 ++ bne 200f ++.endm ++ ++.macro memcmp_long_inner_loop unaligned ++110: ++ memcmp_process_head unaligned ++ pld [S_2, #prefetch_distance*32 + 16] ++ memcmp_process_tail ++ memcmp_process_head unaligned ++ pld [S_1, OFF] ++ memcmp_process_tail ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, ++ * deal with final preloads */ ++ preload_trailing 0, S_1, N, DAT0 ++ preload_trailing 0, S_2, N, DAT0 ++ add N, N, #(prefetch_distance+2)*32 - 16 ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm ++ ++.macro memcmp_short_inner_loop unaligned ++ subs N, N, #16 /* simplifies inner loop termination */ ++ blo 122f ++120: ++ memcmp_process_head unaligned ++ memcmp_process_tail ++ subs N, N, #16 ++ bhs 120b ++122: /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcmp_trailing_15bytes unaligned ++199: /* Reached end without detecting a difference */ ++ mov a1, #0 ++ setend le ++ pop {DAT1-DAT6, pc} ++.endm ++ ++/* ++ * int memcmp(const void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to buffer 1 ++ * a2 = pointer to buffer 2 ++ * a3 = number of bytes to compare (as unsigned chars) ++ * On exit: ++ * a1 = >0/=0/<0 if s1 >/=/< s2 ++ */ ++ ++.set prefetch_distance, 2 ++ ++ENTRY(memcmp) ++ S_1 .req a1 ++ S_2 .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req ip ++ OFF .req lr ++ ++ push {DAT1-DAT6, lr} ++ setend be /* lowest-addressed bytes are most significant */ ++ ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 170f ++ ++ /* Long case */ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 0, DAT0, S_1 ++ preload_leading_step1 0, DAT1, S_2 ++ tst S_2, #31 ++ beq 154f ++ rsb OFF, S_2, #0 /* no need to AND with 15 here */ ++ preload_leading_step2 0, DAT0, S_1, OFF, DAT2 ++ preload_leading_step2 0, DAT1, S_2, OFF, DAT2 ++ memcmp_leading_31bytes ++154: /* Second source now cacheline (32-byte) aligned; we have at ++ * least one prefetch to go. */ ++ /* Prefetch offset is best selected such that it lies in the ++ * first 8 of each 32 bytes - but it's just as easy to aim for ++ * the first one */ ++ and OFF, S_1, #31 ++ rsb OFF, OFF, #32*prefetch_distance ++ tst S_1, #3 ++ bne 140f ++ memcmp_long_inner_loop 0 ++140: memcmp_long_inner_loop 1 ++ ++170: /* Short case */ ++ teq N, #0 ++ beq 199f ++ preload_all 0, 0, 0, S_1, N, DAT0, DAT1 ++ preload_all 0, 0, 0, S_2, N, DAT0, DAT1 ++ tst S_2, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ ldrb DAT0, [S_1], #1 ++ ldrb DAT4, [S_2], #1 ++ cmp DAT0, DAT4 ++ bne 200f ++ tst S_2, #3 ++ bne 172b ++174: /* Second source now 4-byte aligned; we have 0 or more bytes to go */ ++ tst S_1, #3 ++ bne 140f ++ memcmp_short_inner_loop 0 ++140: memcmp_short_inner_loop 1 ++ ++200: /* Difference found: determine sign. */ ++ movhi a1, #1 ++ movlo a1, #-1 ++ setend le ++ pop {DAT1-DAT6, pc} ++ ++ .unreq S_1 ++ .unreq S_2 ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq OFF ++ENDPROC(memcmp) +diff --git a/arch/arm/lib/memcpy_rpi.S b/arch/arm/lib/memcpy_rpi.S +new file mode 100644 +index 0000000..15ff2bd +--- /dev/null ++++ b/arch/arm/lib/memcpy_rpi.S +@@ -0,0 +1,59 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include ++#include "arm-mem.h" ++#include "memcpymove.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memcpy(void * restrict s1, const void * restrict s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ ++ ++.set prefetch_distance, 3 ++ ++ENTRY(memcpy) ++ memcpy 0 ++ENDPROC(memcpy) +diff --git a/arch/arm/lib/memcpymove.h b/arch/arm/lib/memcpymove.h +new file mode 100644 +index 0000000..d8be584 +--- /dev/null ++++ b/arch/arm/lib/memcpymove.h +@@ -0,0 +1,506 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++.macro unaligned_words backwards, align, use_pld, words, r0, r1, r2, r3, r4, r5, r6, r7, r8 ++ .if words == 1 ++ .if backwards ++ mov r1, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r1, r1, r0, lsr #align*8 ++ str r1, [D, #-4]! ++ .else ++ mov r0, r1, lsr #align*8 ++ ldr r1, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ str r0, [D], #4 ++ .endif ++ .elseif words == 2 ++ .if backwards ++ ldr r1, [S, #-4]! ++ mov r2, r0, lsl #32-align*8 ++ ldr r0, [S, #-4]! ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2} ++ .else ++ ldr r1, [S, #4]! ++ mov r0, r2, lsr #align*8 ++ ldr r2, [S, #4]! ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ stmia D!, {r0, r1} ++ .endif ++ .elseif words == 4 ++ .if backwards ++ ldmdb S!, {r2, r3} ++ mov r4, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1} ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2} ++ mov r0, r4, lsr #align*8 ++ ldmib S!, {r3, r4} ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ .endif ++ .elseif words == 8 ++ .if backwards ++ ldmdb S!, {r4, r5, r6, r7} ++ mov r8, r0, lsl #32-align*8 ++ ldmdb S!, {r0, r1, r2, r3} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r8, r8, r7, lsr #align*8 ++ mov r7, r7, lsl #32-align*8 ++ orr r7, r7, r6, lsr #align*8 ++ mov r6, r6, lsl #32-align*8 ++ orr r6, r6, r5, lsr #align*8 ++ mov r5, r5, lsl #32-align*8 ++ orr r5, r5, r4, lsr #align*8 ++ mov r4, r4, lsl #32-align*8 ++ orr r4, r4, r3, lsr #align*8 ++ mov r3, r3, lsl #32-align*8 ++ orr r3, r3, r2, lsr #align*8 ++ mov r2, r2, lsl #32-align*8 ++ orr r2, r2, r1, lsr #align*8 ++ mov r1, r1, lsl #32-align*8 ++ orr r1, r1, r0, lsr #align*8 ++ stmdb D!, {r5, r6, r7, r8} ++ stmdb D!, {r1, r2, r3, r4} ++ .else ++ ldmib S!, {r1, r2, r3, r4} ++ mov r0, r8, lsr #align*8 ++ ldmib S!, {r5, r6, r7, r8} ++ .if use_pld ++ pld [S, OFF] ++ .endif ++ orr r0, r0, r1, lsl #32-align*8 ++ mov r1, r1, lsr #align*8 ++ orr r1, r1, r2, lsl #32-align*8 ++ mov r2, r2, lsr #align*8 ++ orr r2, r2, r3, lsl #32-align*8 ++ mov r3, r3, lsr #align*8 ++ orr r3, r3, r4, lsl #32-align*8 ++ mov r4, r4, lsr #align*8 ++ orr r4, r4, r5, lsl #32-align*8 ++ mov r5, r5, lsr #align*8 ++ orr r5, r5, r6, lsl #32-align*8 ++ mov r6, r6, lsr #align*8 ++ orr r6, r6, r7, lsl #32-align*8 ++ mov r7, r7, lsr #align*8 ++ orr r7, r7, r8, lsl #32-align*8 ++ stmia D!, {r0, r1, r2, r3} ++ stmia D!, {r4, r5, r6, r7} ++ .endif ++ .endif ++.endm ++ ++.macro memcpy_leading_15bytes backwards, align ++ movs DAT1, DAT2, lsl #31 ++ sub N, N, DAT2 ++ .if backwards ++ ldrmib DAT0, [S, #-1]! ++ ldrcsh DAT1, [S, #-2]! ++ strmib DAT0, [D, #-1]! ++ strcsh DAT1, [D, #-2]! ++ .else ++ ldrmib DAT0, [S], #1 ++ ldrcsh DAT1, [S], #2 ++ strmib DAT0, [D], #1 ++ strcsh DAT1, [D], #2 ++ .endif ++ movs DAT1, DAT2, lsl #29 ++ .if backwards ++ ldrmi DAT0, [S, #-4]! ++ .if align == 0 ++ ldmcsdb S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT2, [S, #-4]! ++ ldrcs DAT1, [S, #-4]! ++ .endif ++ strmi DAT0, [D, #-4]! ++ stmcsdb D!, {DAT1, DAT2} ++ .else ++ ldrmi DAT0, [S], #4 ++ .if align == 0 ++ ldmcsia S!, {DAT1, DAT2} ++ .else ++ ldrcs DAT1, [S], #4 ++ ldrcs DAT2, [S], #4 ++ .endif ++ strmi DAT0, [D], #4 ++ stmcsia D!, {DAT1, DAT2} ++ .endif ++.endm ++ ++.macro memcpy_trailing_15bytes backwards, align ++ movs N, N, lsl #29 ++ .if backwards ++ .if align == 0 ++ ldmcsdb S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT1, [S, #-4]! ++ ldrcs DAT0, [S, #-4]! ++ .endif ++ ldrmi DAT2, [S, #-4]! ++ stmcsdb D!, {DAT0, DAT1} ++ strmi DAT2, [D, #-4]! ++ .else ++ .if align == 0 ++ ldmcsia S!, {DAT0, DAT1} ++ .else ++ ldrcs DAT0, [S], #4 ++ ldrcs DAT1, [S], #4 ++ .endif ++ ldrmi DAT2, [S], #4 ++ stmcsia D!, {DAT0, DAT1} ++ strmi DAT2, [D], #4 ++ .endif ++ movs N, N, lsl #2 ++ .if backwards ++ ldrcsh DAT0, [S, #-2]! ++ ldrmib DAT1, [S, #-1] ++ strcsh DAT0, [D, #-2]! ++ strmib DAT1, [D, #-1] ++ .else ++ ldrcsh DAT0, [S], #2 ++ ldrmib DAT1, [S] ++ strcsh DAT0, [D], #2 ++ strmib DAT1, [D] ++ .endif ++.endm ++ ++.macro memcpy_long_inner_loop backwards, align ++ .if align != 0 ++ .if backwards ++ ldr DAT0, [S, #-align]! ++ .else ++ ldr LAST, [S, #-align]! ++ .endif ++ .endif ++110: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ pld [S, OFF] ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 1, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 110b ++ /* Just before the final (prefetch_distance+1) 32-byte blocks, deal with final preloads */ ++ preload_trailing backwards, S, N, OFF ++ add N, N, #(prefetch_distance+2)*32 - 32 ++120: ++ .if align == 0 ++ .if backwards ++ ldmdb S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT4, DAT5, DAT6, LAST} ++ stmdb D!, {DAT0, DAT1, DAT2, DAT3} ++ .else ++ ldmia S!, {DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, LAST} ++ stmia D!, {DAT0, DAT1, DAT2, DAT3} ++ stmia D!, {DAT4, DAT5, DAT6, LAST} ++ .endif ++ .else ++ unaligned_words backwards, align, 0, 8, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7, LAST ++ .endif ++ subs N, N, #32 ++ bhs 120b ++ tst N, #16 ++ .if align == 0 ++ .if backwards ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ .else ++ beq 130f ++ unaligned_words backwards, align, 0, 4, DAT0, DAT1, DAT2, DAT3, LAST ++130: ++ .endif ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ .if align != 0 ++ add S, S, #align ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {DAT3, DAT4, DAT5, DAT6, DAT7} ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy_medium_inner_loop backwards, align ++120: ++ .if backwards ++ .if align == 0 ++ ldmdb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr LAST, [S, #-4]! ++ ldr DAT2, [S, #-4]! ++ ldr DAT1, [S, #-4]! ++ ldr DAT0, [S, #-4]! ++ .endif ++ stmdb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldr DAT0, [S], #4 ++ ldr DAT1, [S], #4 ++ ldr DAT2, [S], #4 ++ ldr LAST, [S], #4 ++ .endif ++ stmia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ subs N, N, #16 ++ bhs 120b ++ /* Trailing words and bytes */ ++ tst N, #15 ++ beq 199f ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy_short_inner_loop backwards, align ++ tst N, #16 ++ .if backwards ++ .if align == 0 ++ ldmnedb S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne LAST, [S, #-4]! ++ ldrne DAT2, [S, #-4]! ++ ldrne DAT1, [S, #-4]! ++ ldrne DAT0, [S, #-4]! ++ .endif ++ stmnedb D!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ .if align == 0 ++ ldmneia S!, {DAT0, DAT1, DAT2, LAST} ++ .else ++ ldrne DAT0, [S], #4 ++ ldrne DAT1, [S], #4 ++ ldrne DAT2, [S], #4 ++ ldrne LAST, [S], #4 ++ .endif ++ stmneia D!, {DAT0, DAT1, DAT2, LAST} ++ .endif ++ memcpy_trailing_15bytes backwards, align ++199: ++ pop {D, DAT1, DAT2, pc} ++.endm ++ ++.macro memcpy backwards ++ D .req a1 ++ S .req a2 ++ N .req a3 ++ DAT0 .req a4 ++ DAT1 .req v1 ++ DAT2 .req v2 ++ DAT3 .req v3 ++ DAT4 .req v4 ++ DAT5 .req v5 ++ DAT6 .req v6 ++ DAT7 .req sl ++ LAST .req ip ++ OFF .req lr ++ ++ .cfi_startproc ++ ++ push {D, DAT1, DAT2, lr} ++ ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_undefined S ++ .cfi_undefined N ++ .cfi_undefined DAT0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_undefined LAST ++ .cfi_rel_offset lr, 12 ++ ++ .if backwards ++ add D, D, N ++ add S, S, N ++ .endif ++ ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ /* To preload ahead as we go, we need at least (prefetch_distance+2) 32-byte blocks */ ++ cmp N, #(prefetch_distance+3)*32 - 1 ++ blo 160f ++ ++ /* Long case */ ++ push {DAT3, DAT4, DAT5, DAT6, DAT7} ++ ++ .cfi_def_cfa_offset 36 ++ .cfi_rel_offset D, 20 ++ .cfi_rel_offset DAT1, 24 ++ .cfi_rel_offset DAT2, 28 ++ .cfi_rel_offset DAT3, 0 ++ .cfi_rel_offset DAT4, 4 ++ .cfi_rel_offset DAT5, 8 ++ .cfi_rel_offset DAT6, 12 ++ .cfi_rel_offset DAT7, 16 ++ .cfi_rel_offset lr, 32 ++ ++ /* Adjust N so that the decrement instruction can also test for ++ * inner loop termination. We want it to stop when there are ++ * (prefetch_distance+1) complete blocks to go. */ ++ sub N, N, #(prefetch_distance+2)*32 ++ preload_leading_step1 backwards, DAT0, S ++ .if backwards ++ /* Bug in GAS: it accepts, but mis-assembles the instruction ++ * ands DAT2, D, #60, 2 ++ * which sets DAT2 to the number of leading bytes until destination is aligned and also clears C (sets borrow) ++ */ ++ .word 0xE210513C ++ beq 154f ++ .else ++ ands DAT2, D, #15 ++ beq 154f ++ rsb DAT2, DAT2, #16 /* number of leading bytes until destination aligned */ ++ .endif ++ preload_leading_step2 backwards, DAT0, S, DAT2, OFF ++ memcpy_leading_15bytes backwards, 1 ++154: /* Destination now 16-byte aligned; we have at least one prefetch as well as at least one 16-byte output block */ ++ /* Prefetch offset is best selected such that it lies in the first 8 of each 32 bytes - but it's just as easy to aim for the first one */ ++ .if backwards ++ rsb OFF, S, #3 ++ and OFF, OFF, #28 ++ sub OFF, OFF, #32*(prefetch_distance+1) ++ .else ++ and OFF, S, #28 ++ rsb OFF, OFF, #32*prefetch_distance ++ .endif ++ movs DAT0, S, lsl #31 ++ bhi 157f ++ bcs 156f ++ bmi 155f ++ memcpy_long_inner_loop backwards, 0 ++155: memcpy_long_inner_loop backwards, 1 ++156: memcpy_long_inner_loop backwards, 2 ++157: memcpy_long_inner_loop backwards, 3 ++ ++ .cfi_def_cfa_offset 16 ++ .cfi_rel_offset D, 0 ++ .cfi_rel_offset DAT1, 4 ++ .cfi_rel_offset DAT2, 8 ++ .cfi_same_value DAT3 ++ .cfi_same_value DAT4 ++ .cfi_same_value DAT5 ++ .cfi_same_value DAT6 ++ .cfi_same_value DAT7 ++ .cfi_rel_offset lr, 12 ++ ++160: /* Medium case */ ++ preload_all backwards, 0, 0, S, N, DAT2, OFF ++ sub N, N, #16 /* simplifies inner loop termination */ ++ .if backwards ++ ands DAT2, D, #15 ++ beq 164f ++ .else ++ ands DAT2, D, #15 ++ beq 164f ++ rsb DAT2, DAT2, #16 ++ .endif ++ memcpy_leading_15bytes backwards, align ++164: /* Destination now 16-byte aligned; we have at least one 16-byte output block */ ++ tst S, #3 ++ bne 140f ++ memcpy_medium_inner_loop backwards, 0 ++140: memcpy_medium_inner_loop backwards, 1 ++ ++170: /* Short case, less than 31 bytes, so no guarantee of at least one 16-byte block */ ++ teq N, #0 ++ beq 199f ++ preload_all backwards, 1, 0, S, N, DAT2, LAST ++ tst D, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199f ++ .if backwards ++ ldrb DAT0, [S, #-1]! ++ strb DAT0, [D, #-1]! ++ .else ++ ldrb DAT0, [S], #1 ++ strb DAT0, [D], #1 ++ .endif ++ tst D, #3 ++ bne 172b ++174: /* Destination now 4-byte aligned; we have 0 or more output bytes to go */ ++ tst S, #3 ++ bne 140f ++ memcpy_short_inner_loop backwards, 0 ++140: memcpy_short_inner_loop backwards, 1 ++ ++ .cfi_endproc ++ ++ .unreq D ++ .unreq S ++ .unreq N ++ .unreq DAT0 ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ .unreq DAT4 ++ .unreq DAT5 ++ .unreq DAT6 ++ .unreq DAT7 ++ .unreq LAST ++ .unreq OFF ++.endm +diff --git a/arch/arm/lib/memmove_rpi.S b/arch/arm/lib/memmove_rpi.S +new file mode 100644 +index 0000000..8b0760c +--- /dev/null ++++ b/arch/arm/lib/memmove_rpi.S +@@ -0,0 +1,61 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include ++#include "arm-mem.h" ++#include "memcpymove.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memmove(void *s1, const void *s2, size_t n); ++ * On entry: ++ * a1 = pointer to destination ++ * a2 = pointer to source ++ * a3 = number of bytes to copy ++ * On exit: ++ * a1 preserved ++ */ ++ ++.set prefetch_distance, 3 ++ ++ENTRY(memmove) ++ cmp a2, a1 ++ bpl memcpy /* pl works even over -1 - 0 and 0x7fffffff - 0x80000000 boundaries */ ++ memcpy 1 ++ENDPROC(memmove) +diff --git a/arch/arm/lib/memset_rpi.S b/arch/arm/lib/memset_rpi.S +new file mode 100644 +index 0000000..2cde883 +--- /dev/null ++++ b/arch/arm/lib/memset_rpi.S +@@ -0,0 +1,121 @@ ++/* ++Copyright (c) 2013, Raspberry Pi Foundation ++Copyright (c) 2013, RISC OS Open Ltd ++All rights reserved. ++ ++Redistribution and use in source and binary forms, with or without ++modification, are permitted provided that the following conditions are met: ++ * Redistributions of source code must retain the above copyright ++ notice, this list of conditions and the following disclaimer. ++ * Redistributions in binary form must reproduce the above copyright ++ notice, this list of conditions and the following disclaimer in the ++ documentation and/or other materials provided with the distribution. ++ * Neither the name of the copyright holder nor the ++ names of its contributors may be used to endorse or promote products ++ derived from this software without specific prior written permission. ++ ++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ++ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ++DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY ++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ++*/ ++ ++#include ++#include "arm-mem.h" ++ ++/* Prevent the stack from becoming executable */ ++#if defined(__linux__) && defined(__ELF__) ++.section .note.GNU-stack,"",%progbits ++#endif ++ ++ .text ++ .arch armv6 ++ .object_arch armv4 ++ .arm ++ .altmacro ++ .p2align 2 ++ ++/* ++ * void *memset(void *s, int c, size_t n); ++ * On entry: ++ * a1 = pointer to buffer to fill ++ * a2 = byte pattern to fill with (caller-narrowed) ++ * a3 = number of bytes to fill ++ * On exit: ++ * a1 preserved ++ */ ++ENTRY(memset) ++ S .req a1 ++ DAT0 .req a2 ++ N .req a3 ++ DAT1 .req a4 ++ DAT2 .req ip ++ DAT3 .req lr ++ ++ orr DAT0, DAT0, lsl #8 ++ push {S, lr} ++ orr DAT0, DAT0, lsl #16 ++ mov DAT1, DAT0 ++ ++ /* See if we're guaranteed to have at least one 16-byte aligned 16-byte write */ ++ cmp N, #31 ++ blo 170f ++ ++161: sub N, N, #16 /* simplifies inner loop termination */ ++ /* Leading words and bytes */ ++ tst S, #15 ++ beq 164f ++ rsb DAT3, S, #0 /* bits 0-3 = number of leading bytes until aligned */ ++ movs DAT2, DAT3, lsl #31 ++ submi N, N, #1 ++ strmib DAT0, [S], #1 ++ subcs N, N, #2 ++ strcsh DAT0, [S], #2 ++ movs DAT2, DAT3, lsl #29 ++ submi N, N, #4 ++ strmi DAT0, [S], #4 ++ subcs N, N, #8 ++ stmcsia S!, {DAT0, DAT1} ++164: /* Delayed set up of DAT2 and DAT3 so we could use them as scratch registers above */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ /* Now the inner loop of 16-byte stores */ ++165: stmia S!, {DAT0, DAT1, DAT2, DAT3} ++ subs N, N, #16 ++ bhs 165b ++166: /* Trailing words and bytes */ ++ movs N, N, lsl #29 ++ stmcsia S!, {DAT0, DAT1} ++ strmi DAT0, [S], #4 ++ movs N, N, lsl #2 ++ strcsh DAT0, [S], #2 ++ strmib DAT0, [S] ++199: pop {S, pc} ++ ++170: /* Short case */ ++ mov DAT2, DAT0 ++ mov DAT3, DAT0 ++ tst S, #3 ++ beq 174f ++172: subs N, N, #1 ++ blo 199b ++ strb DAT0, [S], #1 ++ tst S, #3 ++ bne 172b ++174: tst N, #16 ++ stmneia S!, {DAT0, DAT1, DAT2, DAT3} ++ b 166b ++ ++ .unreq S ++ .unreq DAT0 ++ .unreq N ++ .unreq DAT1 ++ .unreq DAT2 ++ .unreq DAT3 ++ENDPROC(memset) +diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c +index 3e58d71..0622891 100644 +--- a/arch/arm/lib/uaccess_with_memcpy.c ++++ b/arch/arm/lib/uaccess_with_memcpy.c +@@ -22,6 +22,14 @@ + #include + #include + ++#ifndef COPY_FROM_USER_THRESHOLD ++#define COPY_FROM_USER_THRESHOLD 64 ++#endif ++ ++#ifndef COPY_TO_USER_THRESHOLD ++#define COPY_TO_USER_THRESHOLD 64 ++#endif ++ + static int + pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + { +@@ -85,7 +93,44 @@ pin_page_for_write(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) + return 1; + } + +-static unsigned long noinline ++static int ++pin_page_for_read(const void __user *_addr, pte_t **ptep, spinlock_t **ptlp) ++{ ++ unsigned long addr = (unsigned long)_addr; ++ pgd_t *pgd; ++ pmd_t *pmd; ++ pte_t *pte; ++ pud_t *pud; ++ spinlock_t *ptl; ++ ++ pgd = pgd_offset(current->mm, addr); ++ if (unlikely(pgd_none(*pgd) || pgd_bad(*pgd))) ++ { ++ return 0; ++ } ++ pud = pud_offset(pgd, addr); ++ if (unlikely(pud_none(*pud) || pud_bad(*pud))) ++ { ++ return 0; ++ } ++ ++ pmd = pmd_offset(pud, addr); ++ if (unlikely(pmd_none(*pmd) || pmd_bad(*pmd))) ++ return 0; ++ ++ pte = pte_offset_map_lock(current->mm, pmd, addr, &ptl); ++ if (unlikely(!pte_present(*pte) || !pte_young(*pte))) { ++ pte_unmap_unlock(pte, ptl); ++ return 0; ++ } ++ ++ *ptep = pte; ++ *ptlp = ptl; ++ ++ return 1; ++} ++ ++unsigned long noinline + __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) + { + int atomic; +@@ -135,6 +180,54 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) + return n; + } + ++unsigned long noinline ++__copy_from_user_memcpy(void *to, const void __user *from, unsigned long n) ++{ ++ int atomic; ++ ++ if (unlikely(segment_eq(get_fs(), KERNEL_DS))) { ++ memcpy(to, (const void *)from, n); ++ return 0; ++ } ++ ++ /* the mmap semaphore is taken only if not in an atomic context */ ++ atomic = in_atomic(); ++ ++ if (!atomic) ++ down_read(¤t->mm->mmap_sem); ++ while (n) { ++ pte_t *pte; ++ spinlock_t *ptl; ++ int tocopy; ++ ++ while (!pin_page_for_read(from, &pte, &ptl)) { ++ char temp; ++ if (!atomic) ++ up_read(¤t->mm->mmap_sem); ++ if (__get_user(temp, (char __user *)from)) ++ goto out; ++ if (!atomic) ++ down_read(¤t->mm->mmap_sem); ++ } ++ ++ tocopy = (~(unsigned long)from & ~PAGE_MASK) + 1; ++ if (tocopy > n) ++ tocopy = n; ++ ++ memcpy(to, (const void *)from, tocopy); ++ to += tocopy; ++ from += tocopy; ++ n -= tocopy; ++ ++ pte_unmap_unlock(pte, ptl); ++ } ++ if (!atomic) ++ up_read(¤t->mm->mmap_sem); ++ ++out: ++ return n; ++} ++ + unsigned long + __copy_to_user(void __user *to, const void *from, unsigned long n) + { +@@ -145,10 +238,25 @@ __copy_to_user(void __user *to, const void *from, unsigned long n) + * With frame pointer disabled, tail call optimization kicks in + * as well making this test almost invisible. + */ +- if (n < 64) ++ if (n < COPY_TO_USER_THRESHOLD) + return __copy_to_user_std(to, from, n); + return __copy_to_user_memcpy(to, from, n); + } ++ ++unsigned long ++__copy_from_user(void *to, const void __user *from, unsigned long n) ++{ ++ /* ++ * This test is stubbed out of the main function above to keep ++ * the overhead for small copies low by avoiding a large ++ * register dump on the stack just to reload them right away. ++ * With frame pointer disabled, tail call optimization kicks in ++ * as well making this test almost invisible. ++ */ ++ if (n < COPY_FROM_USER_THRESHOLD) ++ return __copy_from_user_std(to, from, n); ++ return __copy_from_user_memcpy(to, from, n); ++} + + static unsigned long noinline + __clear_user_memset(void __user *addr, unsigned long n) + +From ee5567b6efdbf9cbdf4cacaabc7623c5f6d45064 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 19 May 2015 18:49:06 +0100 +Subject: [PATCH 180/216] vcsm: Add ioctl for custom cache flushing + +--- + arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h | 15 +++++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 49 ++++++++++++++++++++++ + 2 files changed, 64 insertions(+) + +diff --git a/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h b/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h +index 42d0eb0..334f36d 100644 +--- a/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h ++++ b/arch/arm/mach-bcm2708/include/mach/vmcs_sm_ioctl.h +@@ -61,6 +61,8 @@ enum vmcs_sm_cmd_e { + VMCS_SM_CMD_HOST_WALK_PID_ALLOC, + VMCS_SM_CMD_HOST_WALK_PID_MAP, + ++ VMCS_SM_CMD_CLEAN_INVALID, ++ + VMCS_SM_CMD_LAST /* Do no delete */ + }; + +@@ -163,6 +165,16 @@ struct vmcs_sm_ioctl_cache { + unsigned int size; + }; + ++struct vmcs_sm_ioctl_clean_invalid { ++ /* user -> kernel */ ++ struct { ++ unsigned int cmd; ++ unsigned int handle; ++ unsigned int addr; ++ unsigned int size; ++ } s[8]; ++}; ++ + /* IOCTL numbers */ + #define VMCS_SM_IOCTL_MEM_ALLOC\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ +@@ -191,6 +203,9 @@ struct vmcs_sm_ioctl_cache { + #define VMCS_SM_IOCTL_MEM_INVALID\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_INVALID,\ + struct vmcs_sm_ioctl_cache) ++#define VMCS_SM_IOCTL_MEM_CLEAN_INVALID\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID,\ ++ struct vmcs_sm_ioctl_clean_invalid) + + #define VMCS_SM_IOCTL_SIZE_USR_HDL\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index da1c523..39a8971 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2732,6 +2732,55 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + break; + ++ /* Flush/Invalidate the cache for a given mapping. */ ++ case VMCS_SM_CMD_CLEAN_INVALID: ++ { ++ int i; ++ struct vmcs_sm_ioctl_clean_invalid ioparam; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ for (i=0; ires_cached) { ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ ++ /* L1/L2 cache flush */ ++ down_read(¤t->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range(base, end); ++ up_read(¤t->mm->mmap_sem); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; ++ } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ } ++ break; ++ } ++ } ++ } ++ break; ++ + default: + { + ret = -EINVAL; + +From 6f9e2f739661f49e2375be580025549b367444b2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 17 Mar 2015 16:07:48 +0100 +Subject: [PATCH 181/216] dts: overlay: add generic support for ads7846 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add generic support for the ADS7846 touch controller. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/ads7846-overlay.dts | 83 +++++++++++++++++++++++++++++++++++ + 2 files changed, 84 insertions(+) + create mode 100644 arch/arm/boot/dts/ads7846-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index f3558df..0e77296 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -13,6 +13,7 @@ ifeq ($(CONFIG_BCM2709_DT),y) + RPI_DT_OVERLAYS=y + endif + ++dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += ds1307-rtc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb +diff --git a/arch/arm/boot/dts/ads7846-overlay.dts b/arch/arm/boot/dts/ads7846-overlay.dts +new file mode 100644 +index 0000000..6a92cd1 +--- /dev/null ++++ b/arch/arm/boot/dts/ads7846-overlay.dts +@@ -0,0 +1,83 @@ ++/* ++ * Generic Device Tree overlay for the ADS7846 touch controller ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ ads7846_pins: ads7846_pins { ++ brcm,pins = <255>; /* illegal default value */ ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ads7846: ads7846@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ads7846_pins>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <255 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 255 0>; ++ ++ /* driver defaults */ ++ ti,x-min = /bits/ 16 <0>; ++ ti,y-min = /bits/ 16 <0>; ++ ti,x-max = /bits/ 16 <0x0FFF>; ++ ti,y-max = /bits/ 16 <0x0FFF>; ++ ti,pressure-min = /bits/ 16 <0>; ++ ti,pressure-max = /bits/ 16 <0xFFFF>; ++ ti,x-plate-ohms = /bits/ 16 <400>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ cs = <&ads7846>,"reg:0"; ++ speed = <&ads7846>,"spi-max-frequency:0"; ++ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ ++ <&ads7846>,"interrupts:0", ++ <&ads7846>,"pendown-gpio:4"; ++ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; ++ swapxy = <&ads7846>,"ti,swap-xy?"; ++ xmin = <&ads7846>,"ti,x-min;0"; ++ ymin = <&ads7846>,"ti,y-min;0"; ++ xmax = <&ads7846>,"ti,x-max;0"; ++ ymax = <&ads7846>,"ti,y-max;0"; ++ pmin = <&ads7846>,"ti,pressure-min;0"; ++ pmax = <&ads7846>,"ti,pressure-max;0"; ++ xohms = <&ads7846>,"ti,x-plate-ohms;0"; ++ }; ++}; + +From beda21eb0afb05805e46419c37f1127bf35fa775 Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Sun, 24 May 2015 19:12:01 +0200 +Subject: [PATCH 182/216] bcm270x: add dtparam for audio node + +The audio node is enabled by default and can be disabled +with dtparam=audio=off in config.txt +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 ++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 2 ++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 6323c5b..609d004 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -126,5 +126,7 @@ + pwr_led_gpio = <&pwr_led>,"gpios:4"; + pwr_led_activelow = <&pwr_led>,"gpios:8"; + pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index e1fe6a4..e601194 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -116,5 +116,7 @@ + act_led_gpio = <&act_led>,"gpios:4"; + act_led_activelow = <&act_led>,"gpios:8"; + act_led_trigger = <&act_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 921add1..fe282e4 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -126,5 +126,7 @@ + pwr_led_gpio = <&pwr_led>,"gpios:4"; + pwr_led_activelow = <&pwr_led>,"gpios:8"; + pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; ++ ++ audio = <&audio>,"status"; + }; + }; + +From c40ce86818e2ccd1521b5072cfa0bc102893ca7a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 27 May 2015 17:22:15 +0100 +Subject: [PATCH 183/216] bcm2835-audio: Create the platform device if the DT + node is disabled + +For backwards compatibility, allow the built-in ALSA driver to be enabled +either by loading the module from /etc/modules or by enabling the "/audio" +node in DT. +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ---- + arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ---- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ---- + arch/arm/mach-bcm2708/bcm2708.c | 10 ++++++++-- + arch/arm/mach-bcm2709/bcm2709.c | 10 ++++++++-- + 5 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 609d004..75df21c 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -53,10 +53,6 @@ + status = "okay"; + }; + +-&audio { +- status = "okay"; +-}; +- + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index e601194..df12b7d 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -53,10 +53,6 @@ + status = "okay"; + }; + +-&audio { +- status = "okay"; +-}; +- + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index fe282e4..78bc756 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -53,10 +53,6 @@ + status = "okay"; + }; + +-&audio { +- status = "okay"; +-}; +- + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index e451187..06438df 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -963,8 +963,14 @@ void __init bcm2708_init(void) + bcm_register_device_dt(&bcm2835_emmc_device); + #endif + bcm2708_init_led(); +- for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) +- bcm_register_device_dt(&bcm2708_alsa_devices[i]); ++ ++ /* Only create the platform devices for the ALSA driver in the ++ absence of an enabled "audio" DT node */ ++ if (!use_dt || ++ !of_device_is_available(of_find_node_by_path("/audio"))) { ++ for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) ++ bcm_register_device(&bcm2708_alsa_devices[i]); ++ } + + bcm_register_device_dt(&bcm2708_spi_device); + +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 06c2c74..ce06b7d 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -986,8 +986,14 @@ void __init bcm2709_init(void) + bcm_register_device_dt(&bcm2835_emmc_device); + #endif + bcm2709_init_led(); +- for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) +- bcm_register_device_dt(&bcm2708_alsa_devices[i]); ++ ++ /* Only create the platform devices for the ALSA driver in the ++ absence of an enabled "audio" DT node */ ++ if (!use_dt || ++ !of_device_is_available(of_find_node_by_path("/audio"))) { ++ for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) ++ bcm_register_device(&bcm2708_alsa_devices[i]); ++ } + + bcm_register_device_dt(&bcm2708_spi_device); + + +From 9f10489e52092f350c72745c2ac3d0afbbf4cd44 Mon Sep 17 00:00:00 2001 +From: Martin Sperl +Date: Wed, 27 May 2015 14:39:55 +0000 +Subject: [PATCH 184/216] device-tree: spi: make spi-bcm2835 the default spi + driver and prepare for dma + +* make spi-bcm2835 the default driver for spi +* add a fallback spi-bcm2708 overlay +* add dma entries to device tree for future updates +* add default cs-gpios entry showing how to extend the number of chip-selects. + +Signed-off-by: Martin Sperl +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm2708_common.dtsi | 10 +++++++++- + arch/arm/boot/dts/spi-bcm2708-overlay.dts | 18 ++++++++++++++++++ + 3 files changed, 28 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/boot/dts/spi-bcm2708-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 0e77296..9124dfb 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -41,6 +41,7 @@ dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb + + dtb-$(CONFIG_MACH_ASM9260) += \ + alphascale-asm9260-devkit.dtb +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 4bf6960..3f8af85 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -84,13 +84,21 @@ + }; + + spi0: spi@7e204000 { +- compatible = "brcm,bcm2708-spi"; ++ compatible = "brcm,bcm2835-spi"; + reg = <0x7e204000 0x1000>; + interrupts = <2 22>; + clocks = <&clk_spi>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; ++ /* the dma channels */ ++ dmas = <&dma 6>, <&dma 7>; ++ dma-names = "tx", "rx"; ++ /* the chipselects used - <0> means native GPIO ++ * add more gpios if necessary as <&gpio 6 1> ++ * (but do not forget to make them output!) ++ */ ++ cs-gpios = <0>, <0>; + }; + + i2c0: i2c@7e205000 { +diff --git a/arch/arm/boot/dts/spi-bcm2708-overlay.dts b/arch/arm/boot/dts/spi-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e378ef1 +--- /dev/null ++++ b/arch/arm/boot/dts/spi-bcm2708-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay for spi-bcm2835 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* setting up compatiblity to allow loading the spi-bcm2835 driver */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ compatible = "brcm,bcm2708-spi"; ++ }; ++ }; ++}; + +From 8c5dd3fb2ef21f3dc20a7c999fd2659354afa975 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 23 May 2015 23:30:36 +0200 +Subject: [PATCH 185/216] BCM270x: Move power module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make the power module available on ARCH_BCM2835 by moving it. +The module turns on USB power making it possible to boot +ARCH_BCM2835 directly with the VC bootloader. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/Makefile | 2 +- + arch/arm/mach-bcm2708/include/mach/arm_power.h | 62 -------- + arch/arm/mach-bcm2708/include/mach/power.h | 26 ---- + arch/arm/mach-bcm2708/power.c | 201 ------------------------- + arch/arm/mach-bcm2709/Makefile | 2 +- + arch/arm/mach-bcm2709/include/mach/arm_power.h | 62 -------- + arch/arm/mach-bcm2709/include/mach/power.h | 26 ---- + arch/arm/mach-bcm2709/power.c | 199 ------------------------ + drivers/soc/Kconfig | 1 + + drivers/soc/Makefile | 1 + + drivers/soc/bcm2835/Kconfig | 9 ++ + drivers/soc/bcm2835/Makefile | 1 + + drivers/soc/bcm2835/bcm2708-power.c | 200 ++++++++++++++++++++++++ + include/soc/bcm2835/power.h | 61 ++++++++ + 14 files changed, 275 insertions(+), 578 deletions(-) + delete mode 100644 arch/arm/mach-bcm2708/include/mach/arm_power.h + delete mode 100644 arch/arm/mach-bcm2708/include/mach/power.h + delete mode 100644 arch/arm/mach-bcm2708/power.c + delete mode 100644 arch/arm/mach-bcm2709/include/mach/arm_power.h + delete mode 100644 arch/arm/mach-bcm2709/include/mach/power.h + delete mode 100644 arch/arm/mach-bcm2709/power.c + create mode 100644 drivers/soc/bcm2835/Kconfig + create mode 100644 drivers/soc/bcm2835/Makefile + create mode 100644 drivers/soc/bcm2835/bcm2708-power.c + create mode 100644 include/soc/bcm2835/power.h + +diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile +index c1e7d41..5552ae8 100644 +--- a/arch/arm/mach-bcm2708/Makefile ++++ b/arch/arm/mach-bcm2708/Makefile +@@ -2,6 +2,6 @@ + # Makefile for the linux kernel. + # + +-obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o power.o ++obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2708/include/mach/arm_power.h b/arch/arm/mach-bcm2708/include/mach/arm_power.h +deleted file mode 100644 +index d3bf245..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/arm_power.h ++++ /dev/null +@@ -1,62 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/include/mach/arm_power.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#ifndef _ARM_POWER_H +-#define _ARM_POWER_H +- +-/* Use meaningful names on each side */ +-#ifdef __VIDEOCORE__ +-#define PREFIX(x) ARM_##x +-#else +-#define PREFIX(x) BCM_##x +-#endif +- +-enum { +- PREFIX(POWER_SDCARD_BIT), +- PREFIX(POWER_UART_BIT), +- PREFIX(POWER_MINIUART_BIT), +- PREFIX(POWER_USB_BIT), +- PREFIX(POWER_I2C0_BIT), +- PREFIX(POWER_I2C1_BIT), +- PREFIX(POWER_I2C2_BIT), +- PREFIX(POWER_SPI_BIT), +- PREFIX(POWER_CCP2TX_BIT), +- PREFIX(POWER_DSI_BIT), +- +- PREFIX(POWER_MAX) +-}; +- +-enum { +- PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), +- PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), +- PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), +- PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), +- PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), +- PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), +- PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), +- PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), +- PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), +- PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), +- +- PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, +- PREFIX(POWER_NONE) = 0 +-}; +- +-#endif +diff --git a/arch/arm/mach-bcm2708/include/mach/power.h b/arch/arm/mach-bcm2708/include/mach/power.h +deleted file mode 100644 +index 52b3b02..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/power.h ++++ /dev/null +@@ -1,26 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/power.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for controlling the power to +- * VideoCore subsystems. +- */ +- +-#ifndef _MACH_BCM2708_POWER_H +-#define _MACH_BCM2708_POWER_H +- +-#include +-#include +- +-typedef unsigned int BCM_POWER_HANDLE_T; +- +-extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); +-extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); +-extern int bcm_power_close(BCM_POWER_HANDLE_T handle); +- +-#endif +diff --git a/arch/arm/mach-bcm2708/power.c b/arch/arm/mach-bcm2708/power.c +deleted file mode 100644 +index 796837f..0000000 +--- a/arch/arm/mach-bcm2708/power.c ++++ /dev/null +@@ -1,201 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/power.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for controlling the power to +- * VideoCore subsystems. +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define DRIVER_NAME "bcm2708_power" +- +-#define BCM_POWER_MAXCLIENTS 4 +-#define BCM_POWER_NOCLIENT (1<<31) +- +-/* Some drivers expect there devices to be permanently powered */ +- +-#ifdef CONFIG_USB +-#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) +-#endif +- +-#if 1 +-#define DPRINTK printk +-#else +-#define DPRINTK if (0) printk +-#endif +- +-struct state_struct { +- uint32_t global_request; +- uint32_t client_request[BCM_POWER_MAXCLIENTS]; +- struct semaphore client_mutex; +- struct semaphore mutex; +-} g_state; +- +-int bcm_power_open(BCM_POWER_HANDLE_T *handle) +-{ +- BCM_POWER_HANDLE_T i; +- int ret = -EBUSY; +- +- down(&g_state.client_mutex); +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { +- if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { +- g_state.client_request[i] = BCM_POWER_NONE; +- *handle = i; +- ret = 0; +- break; +- } +- } +- +- up(&g_state.client_mutex); +- +- DPRINTK("bcm_power_open() -> %d\n", *handle); +- +- return ret; +-} +-EXPORT_SYMBOL_GPL(bcm_power_open); +- +-int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) +-{ +- int rc = 0; +- +- DPRINTK("bcm_power_request(%d, %x)\n", handle, request); +- +- if ((handle < BCM_POWER_MAXCLIENTS) && +- (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { +- if (down_interruptible(&g_state.mutex) != 0) { +- DPRINTK("bcm_power_request -> interrupted\n"); +- return -EINTR; +- } +- +- if (request != g_state.client_request[handle]) { +- uint32_t others_request = 0; +- uint32_t global_request; +- BCM_POWER_HANDLE_T i; +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { +- if (i != handle) +- others_request |= +- g_state.client_request[i]; +- } +- others_request &= ~BCM_POWER_NOCLIENT; +- +- global_request = request | others_request; +- if (global_request != g_state.global_request) { +- uint32_t actual; +- +- /* Send a request to VideoCore */ +- bcm_mailbox_write(MBOX_CHAN_POWER, +- global_request << 4); +- +- /* Wait for a response during power-up */ +- if (global_request & ~g_state.global_request) { +- rc = bcm_mailbox_read(MBOX_CHAN_POWER, +- &actual); +- DPRINTK +- ("bcm_mailbox_read -> %08x, %d\n", +- actual, rc); +- actual >>= 4; +- } else { +- rc = 0; +- actual = global_request; +- } +- +- if (rc == 0) { +- if (actual != global_request) { +- printk(KERN_ERR +- "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", +- __func__, +- g_state.global_request, +- global_request, actual, request, others_request); +- /* A failure */ +- BUG_ON((others_request & actual) +- != others_request); +- request &= actual; +- rc = -EIO; +- } +- +- g_state.global_request = actual; +- g_state.client_request[handle] = +- request; +- } +- } +- } +- up(&g_state.mutex); +- } else { +- rc = -EINVAL; +- } +- DPRINTK("bcm_power_request -> %d\n", rc); +- return rc; +-} +-EXPORT_SYMBOL_GPL(bcm_power_request); +- +-int bcm_power_close(BCM_POWER_HANDLE_T handle) +-{ +- int rc; +- +- DPRINTK("bcm_power_close(%d)\n", handle); +- +- rc = bcm_power_request(handle, BCM_POWER_NONE); +- if (rc == 0) +- g_state.client_request[handle] = BCM_POWER_NOCLIENT; +- +- return rc; +-} +-EXPORT_SYMBOL_GPL(bcm_power_close); +- +-static int __init bcm_power_init(void) +-{ +-#if defined(BCM_POWER_ALWAYS_ON) +- BCM_POWER_HANDLE_T always_on_handle; +-#endif +- int rc = 0; +- int i; +- +- printk(KERN_INFO "bcm_power: Broadcom power driver\n"); +- bcm_mailbox_write(MBOX_CHAN_POWER, 0); +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) +- g_state.client_request[i] = BCM_POWER_NOCLIENT; +- +- sema_init(&g_state.client_mutex, 1); +- sema_init(&g_state.mutex, 1); +- +- g_state.global_request = 0; +- +-#if defined(BCM_POWER_ALWAYS_ON) +- if (BCM_POWER_ALWAYS_ON) { +- bcm_power_open(&always_on_handle); +- bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); +- } +-#endif +- +- return rc; +-} +- +-static void __exit bcm_power_exit(void) +-{ +- bcm_mailbox_write(MBOX_CHAN_POWER, 0); +-} +- +-/* +- * Load after the mailbox driver is initialized (arch_initcall), +- * but before depending drivers (module_init). +- */ +-subsys_initcall(bcm_power_init); +-module_exit(bcm_power_exit); +- +-MODULE_AUTHOR("Phil Elwell"); +-MODULE_DESCRIPTION("Interface to BCM2708 power management"); +-MODULE_LICENSE("GPL"); +diff --git a/arch/arm/mach-bcm2709/Makefile b/arch/arm/mach-bcm2709/Makefile +index 77b8429..706116f 100644 +--- a/arch/arm/mach-bcm2709/Makefile ++++ b/arch/arm/mach-bcm2709/Makefile +@@ -2,6 +2,6 @@ + # Makefile for the linux kernel. + # + +-obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o power.o ++obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2709/include/mach/arm_power.h b/arch/arm/mach-bcm2709/include/mach/arm_power.h +deleted file mode 100644 +index d3bf245..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/arm_power.h ++++ /dev/null +@@ -1,62 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/include/mach/arm_power.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +- +-#ifndef _ARM_POWER_H +-#define _ARM_POWER_H +- +-/* Use meaningful names on each side */ +-#ifdef __VIDEOCORE__ +-#define PREFIX(x) ARM_##x +-#else +-#define PREFIX(x) BCM_##x +-#endif +- +-enum { +- PREFIX(POWER_SDCARD_BIT), +- PREFIX(POWER_UART_BIT), +- PREFIX(POWER_MINIUART_BIT), +- PREFIX(POWER_USB_BIT), +- PREFIX(POWER_I2C0_BIT), +- PREFIX(POWER_I2C1_BIT), +- PREFIX(POWER_I2C2_BIT), +- PREFIX(POWER_SPI_BIT), +- PREFIX(POWER_CCP2TX_BIT), +- PREFIX(POWER_DSI_BIT), +- +- PREFIX(POWER_MAX) +-}; +- +-enum { +- PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), +- PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), +- PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), +- PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), +- PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), +- PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), +- PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), +- PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), +- PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), +- PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), +- +- PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, +- PREFIX(POWER_NONE) = 0 +-}; +- +-#endif +diff --git a/arch/arm/mach-bcm2709/include/mach/power.h b/arch/arm/mach-bcm2709/include/mach/power.h +deleted file mode 100644 +index 52b3b02..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/power.h ++++ /dev/null +@@ -1,26 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/power.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for controlling the power to +- * VideoCore subsystems. +- */ +- +-#ifndef _MACH_BCM2708_POWER_H +-#define _MACH_BCM2708_POWER_H +- +-#include +-#include +- +-typedef unsigned int BCM_POWER_HANDLE_T; +- +-extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); +-extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); +-extern int bcm_power_close(BCM_POWER_HANDLE_T handle); +- +-#endif +diff --git a/arch/arm/mach-bcm2709/power.c b/arch/arm/mach-bcm2709/power.c +deleted file mode 100644 +index 960e472..0000000 +--- a/arch/arm/mach-bcm2709/power.c ++++ /dev/null +@@ -1,199 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/power.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * 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. +- * +- * This device provides a shared mechanism for controlling the power to +- * VideoCore subsystems. +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define DRIVER_NAME "bcm2708_power" +- +-#define BCM_POWER_MAXCLIENTS 4 +-#define BCM_POWER_NOCLIENT (1<<31) +- +-/* Some drivers expect there devices to be permanently powered */ +-#ifdef CONFIG_USB +-#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) +-#endif +- +-#if 1 +-#define DPRINTK printk +-#else +-#define DPRINTK if (0) printk +-#endif +- +-struct state_struct { +- uint32_t global_request; +- uint32_t client_request[BCM_POWER_MAXCLIENTS]; +- struct semaphore client_mutex; +- struct semaphore mutex; +-} g_state; +- +-int bcm_power_open(BCM_POWER_HANDLE_T *handle) +-{ +- BCM_POWER_HANDLE_T i; +- int ret = -EBUSY; +- +- down(&g_state.client_mutex); +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { +- if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { +- g_state.client_request[i] = BCM_POWER_NONE; +- *handle = i; +- ret = 0; +- break; +- } +- } +- +- up(&g_state.client_mutex); +- +- DPRINTK("bcm_power_open() -> %d\n", *handle); +- +- return ret; +-} +-EXPORT_SYMBOL_GPL(bcm_power_open); +- +-int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) +-{ +- int rc = 0; +- +- DPRINTK("bcm_power_request(%d, %x)\n", handle, request); +- +- if ((handle < BCM_POWER_MAXCLIENTS) && +- (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { +- if (down_interruptible(&g_state.mutex) != 0) { +- DPRINTK("bcm_power_request -> interrupted\n"); +- return -EINTR; +- } +- +- if (request != g_state.client_request[handle]) { +- uint32_t others_request = 0; +- uint32_t global_request; +- BCM_POWER_HANDLE_T i; +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { +- if (i != handle) +- others_request |= +- g_state.client_request[i]; +- } +- others_request &= ~BCM_POWER_NOCLIENT; +- +- global_request = request | others_request; +- if (global_request != g_state.global_request) { +- uint32_t actual; +- +- /* Send a request to VideoCore */ +- bcm_mailbox_write(MBOX_CHAN_POWER, +- global_request << 4); +- +- /* Wait for a response during power-up */ +- if (global_request & ~g_state.global_request) { +- rc = bcm_mailbox_read(MBOX_CHAN_POWER, +- &actual); +- DPRINTK +- ("bcm_mailbox_read -> %08x, %d\n", +- actual, rc); +- actual >>= 4; +- } else { +- rc = 0; +- actual = global_request; +- } +- +- if (rc == 0) { +- if (actual != global_request) { +- printk(KERN_ERR +- "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", +- __func__, +- g_state.global_request, +- global_request, actual, request, others_request); +- /* A failure */ +- BUG_ON((others_request & actual) +- != others_request); +- request &= actual; +- rc = -EIO; +- } +- +- g_state.global_request = actual; +- g_state.client_request[handle] = +- request; +- } +- } +- } +- up(&g_state.mutex); +- } else { +- rc = -EINVAL; +- } +- DPRINTK("bcm_power_request -> %d\n", rc); +- return rc; +-} +-EXPORT_SYMBOL_GPL(bcm_power_request); +- +-int bcm_power_close(BCM_POWER_HANDLE_T handle) +-{ +- int rc; +- +- DPRINTK("bcm_power_close(%d)\n", handle); +- +- rc = bcm_power_request(handle, BCM_POWER_NONE); +- if (rc == 0) +- g_state.client_request[handle] = BCM_POWER_NOCLIENT; +- +- return rc; +-} +-EXPORT_SYMBOL_GPL(bcm_power_close); +- +-static int __init bcm_power_init(void) +-{ +-#if defined(BCM_POWER_ALWAYS_ON) +- BCM_POWER_HANDLE_T always_on_handle; +-#endif +- int rc = 0; +- int i; +- +- printk(KERN_INFO "bcm_power: Broadcom power driver\n"); +- bcm_mailbox_write(MBOX_CHAN_POWER, 0); +- +- for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) +- g_state.client_request[i] = BCM_POWER_NOCLIENT; +- +- sema_init(&g_state.client_mutex, 1); +- sema_init(&g_state.mutex, 1); +- +- g_state.global_request = 0; +-#if defined(BCM_POWER_ALWAYS_ON) +- if (BCM_POWER_ALWAYS_ON) { +- bcm_power_open(&always_on_handle); +- bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); +- } +-#endif +- +- return rc; +-} +- +-static void __exit bcm_power_exit(void) +-{ +- bcm_mailbox_write(MBOX_CHAN_POWER, 0); +-} +- +-/* +- * Load after the mailbox driver is initialized (arch_initcall), +- * but before depending drivers (module_init). +- */ +-subsys_initcall(bcm_power_init); +-module_exit(bcm_power_exit); +- +-MODULE_AUTHOR("Phil Elwell"); +-MODULE_DESCRIPTION("Interface to BCM2708 power management"); +-MODULE_LICENSE("GPL"); +diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig +index 76d6bd4..aed58f4 100644 +--- a/drivers/soc/Kconfig ++++ b/drivers/soc/Kconfig +@@ -1,5 +1,6 @@ + menu "SOC (System On Chip) specific Drivers" + ++source "drivers/soc/bcm2835/Kconfig" + source "drivers/soc/qcom/Kconfig" + source "drivers/soc/ti/Kconfig" + source "drivers/soc/versatile/Kconfig" +diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile +index 063113d..897de0c5 100644 +--- a/drivers/soc/Makefile ++++ b/drivers/soc/Makefile +@@ -2,6 +2,7 @@ + # Makefile for the Linux Kernel SOC specific device drivers. + # + ++obj-y += bcm2835/ + obj-$(CONFIG_ARCH_QCOM) += qcom/ + obj-$(CONFIG_ARCH_TEGRA) += tegra/ + obj-$(CONFIG_SOC_TI) += ti/ +diff --git a/drivers/soc/bcm2835/Kconfig b/drivers/soc/bcm2835/Kconfig +new file mode 100644 +index 0000000..c2980f3 +--- /dev/null ++++ b/drivers/soc/bcm2835/Kconfig +@@ -0,0 +1,9 @@ ++# ++# BCM2835 Soc drivers ++# ++config BCM2708_POWER ++ tristate "BCM2708 legacy power driver" ++ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) && BCM2708_MBOX ++ default y ++ help ++ Turns on USB power and provides an API for controlling power. +diff --git a/drivers/soc/bcm2835/Makefile b/drivers/soc/bcm2835/Makefile +new file mode 100644 +index 0000000..3614ad9 +--- /dev/null ++++ b/drivers/soc/bcm2835/Makefile +@@ -0,0 +1 @@ ++obj-$(CONFIG_BCM2708_POWER) += bcm2708-power.o +diff --git a/drivers/soc/bcm2835/bcm2708-power.c b/drivers/soc/bcm2835/bcm2708-power.c +new file mode 100644 +index 0000000..e7931a9 +--- /dev/null ++++ b/drivers/soc/bcm2835/bcm2708-power.c +@@ -0,0 +1,200 @@ ++/* ++ * linux/arch/arm/mach-bcm2708/power.c ++ * ++ * Copyright (C) 2010 Broadcom ++ * ++ * 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. ++ * ++ * This device provides a shared mechanism for controlling the power to ++ * VideoCore subsystems. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define DRIVER_NAME "bcm2708_power" ++ ++#define BCM_POWER_MAXCLIENTS 4 ++#define BCM_POWER_NOCLIENT (1<<31) ++ ++/* Some drivers expect there devices to be permanently powered */ ++ ++#ifdef CONFIG_USB ++#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) ++#endif ++ ++#if 1 ++#define DPRINTK printk ++#else ++#define DPRINTK if (0) printk ++#endif ++ ++struct state_struct { ++ uint32_t global_request; ++ uint32_t client_request[BCM_POWER_MAXCLIENTS]; ++ struct semaphore client_mutex; ++ struct semaphore mutex; ++} g_state; ++ ++int bcm_power_open(BCM_POWER_HANDLE_T *handle) ++{ ++ BCM_POWER_HANDLE_T i; ++ int ret = -EBUSY; ++ ++ down(&g_state.client_mutex); ++ ++ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { ++ if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { ++ g_state.client_request[i] = BCM_POWER_NONE; ++ *handle = i; ++ ret = 0; ++ break; ++ } ++ } ++ ++ up(&g_state.client_mutex); ++ ++ DPRINTK("bcm_power_open() -> %d\n", *handle); ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(bcm_power_open); ++ ++int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) ++{ ++ int rc = 0; ++ ++ DPRINTK("bcm_power_request(%d, %x)\n", handle, request); ++ ++ if ((handle < BCM_POWER_MAXCLIENTS) && ++ (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { ++ if (down_interruptible(&g_state.mutex) != 0) { ++ DPRINTK("bcm_power_request -> interrupted\n"); ++ return -EINTR; ++ } ++ ++ if (request != g_state.client_request[handle]) { ++ uint32_t others_request = 0; ++ uint32_t global_request; ++ BCM_POWER_HANDLE_T i; ++ ++ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { ++ if (i != handle) ++ others_request |= ++ g_state.client_request[i]; ++ } ++ others_request &= ~BCM_POWER_NOCLIENT; ++ ++ global_request = request | others_request; ++ if (global_request != g_state.global_request) { ++ uint32_t actual; ++ ++ /* Send a request to VideoCore */ ++ bcm_mailbox_write(MBOX_CHAN_POWER, ++ global_request << 4); ++ ++ /* Wait for a response during power-up */ ++ if (global_request & ~g_state.global_request) { ++ rc = bcm_mailbox_read(MBOX_CHAN_POWER, ++ &actual); ++ DPRINTK ++ ("bcm_mailbox_read -> %08x, %d\n", ++ actual, rc); ++ actual >>= 4; ++ } else { ++ rc = 0; ++ actual = global_request; ++ } ++ ++ if (rc == 0) { ++ if (actual != global_request) { ++ printk(KERN_ERR ++ "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", ++ __func__, ++ g_state.global_request, ++ global_request, actual, request, others_request); ++ /* A failure */ ++ BUG_ON((others_request & actual) ++ != others_request); ++ request &= actual; ++ rc = -EIO; ++ } ++ ++ g_state.global_request = actual; ++ g_state.client_request[handle] = ++ request; ++ } ++ } ++ } ++ up(&g_state.mutex); ++ } else { ++ rc = -EINVAL; ++ } ++ DPRINTK("bcm_power_request -> %d\n", rc); ++ return rc; ++} ++EXPORT_SYMBOL_GPL(bcm_power_request); ++ ++int bcm_power_close(BCM_POWER_HANDLE_T handle) ++{ ++ int rc; ++ ++ DPRINTK("bcm_power_close(%d)\n", handle); ++ ++ rc = bcm_power_request(handle, BCM_POWER_NONE); ++ if (rc == 0) ++ g_state.client_request[handle] = BCM_POWER_NOCLIENT; ++ ++ return rc; ++} ++EXPORT_SYMBOL_GPL(bcm_power_close); ++ ++static int __init bcm_power_init(void) ++{ ++#if defined(BCM_POWER_ALWAYS_ON) ++ BCM_POWER_HANDLE_T always_on_handle; ++#endif ++ int rc = 0; ++ int i; ++ ++ printk(KERN_INFO "bcm_power: Broadcom power driver\n"); ++ bcm_mailbox_write(MBOX_CHAN_POWER, 0); ++ ++ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) ++ g_state.client_request[i] = BCM_POWER_NOCLIENT; ++ ++ sema_init(&g_state.client_mutex, 1); ++ sema_init(&g_state.mutex, 1); ++ ++ g_state.global_request = 0; ++ ++#if defined(BCM_POWER_ALWAYS_ON) ++ if (BCM_POWER_ALWAYS_ON) { ++ bcm_power_open(&always_on_handle); ++ bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); ++ } ++#endif ++ ++ return rc; ++} ++ ++static void __exit bcm_power_exit(void) ++{ ++ bcm_mailbox_write(MBOX_CHAN_POWER, 0); ++} ++ ++/* ++ * Load after the mailbox driver is initialized (arch_initcall), ++ * but before depending drivers (module_init). ++ */ ++subsys_initcall(bcm_power_init); ++module_exit(bcm_power_exit); ++ ++MODULE_AUTHOR("Phil Elwell"); ++MODULE_DESCRIPTION("Interface to BCM2708 power management"); ++MODULE_LICENSE("GPL"); +diff --git a/include/soc/bcm2835/power.h b/include/soc/bcm2835/power.h +new file mode 100644 +index 0000000..bf22b26 +--- /dev/null ++++ b/include/soc/bcm2835/power.h +@@ -0,0 +1,61 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * ++ * 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. ++ * ++ * This device provides a shared mechanism for controlling the power to ++ * VideoCore subsystems. ++ */ ++ ++#ifndef _BCM2708_POWER_H ++#define _BCM2708_POWER_H ++ ++#include ++ ++/* Use meaningful names on each side */ ++#ifdef __VIDEOCORE__ ++#define PREFIX(x) ARM_##x ++#else ++#define PREFIX(x) BCM_##x ++#endif ++ ++enum { ++ PREFIX(POWER_SDCARD_BIT), ++ PREFIX(POWER_UART_BIT), ++ PREFIX(POWER_MINIUART_BIT), ++ PREFIX(POWER_USB_BIT), ++ PREFIX(POWER_I2C0_BIT), ++ PREFIX(POWER_I2C1_BIT), ++ PREFIX(POWER_I2C2_BIT), ++ PREFIX(POWER_SPI_BIT), ++ PREFIX(POWER_CCP2TX_BIT), ++ PREFIX(POWER_DSI_BIT), ++ ++ PREFIX(POWER_MAX) ++}; ++ ++enum { ++ PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), ++ PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), ++ PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), ++ PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), ++ PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), ++ PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), ++ PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), ++ PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), ++ PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), ++ PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), ++ ++ PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, ++ PREFIX(POWER_NONE) = 0 ++}; ++ ++typedef unsigned int BCM_POWER_HANDLE_T; ++ ++extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); ++extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); ++extern int bcm_power_close(BCM_POWER_HANDLE_T handle); ++ ++#endif + +From 7ea54e2541e0445c98c3b5bb4b0e80af76c5c197 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 23 May 2015 23:31:40 +0200 +Subject: [PATCH 186/216] bcm2835: Use empty bootargs in Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The VideoCore bootloader concatenates the bootargs property together +with /boot/cmdline.txt and includes it's own set of options. +Set bootargs to an empty string to behave like BCM270x. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 72d0354..40fc759 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -6,7 +6,7 @@ + interrupt-parent = <&intc>; + + chosen { +- bootargs = "earlyprintk console=ttyAMA0"; ++ bootargs = ""; + }; + + soc { + +From b340f9126d88eafd83e2ae6e0b593bea562f92f5 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 11 May 2015 09:00:42 +0100 +Subject: [PATCH 187/216] scripts: Add mkknlimg and knlinfo scripts from tools + repo + +The Raspberry Pi firmware looks for a trailer on the kernel image to +determine whether it was compiled with Device Tree support enabled. +If the firmware finds a kernel without this trailer, or which has a +trailer indicating that it isn't DT-capable, it disables DT support +and reverts to using ATAGs. + +The mkknlimg utility adds that trailer, having first analysed the +image to look for signs of DT support and the kernel version string. + +knlinfo displays the contents of the trailer in the given kernel image. +--- + scripts/knlinfo | 167 +++++++++++++++++++++++++++++++++++ + scripts/mkknlimg | 260 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 427 insertions(+) + create mode 100755 scripts/knlinfo + create mode 100755 scripts/mkknlimg + +diff --git a/scripts/knlinfo b/scripts/knlinfo +new file mode 100755 +index 0000000..9c9b42e3 +--- /dev/null ++++ b/scripts/knlinfo +@@ -0,0 +1,167 @@ ++#!/usr/bin/env perl ++# ---------------------------------------------------------------------- ++# knlinfo by Phil Elwell for Raspberry Pi ++# ++# (c) 2014,2015 Raspberry Pi (Trading) Limited ++# ++# Licensed under the terms of the GNU General Public License. ++# ---------------------------------------------------------------------- ++ ++use strict; ++use integer; ++ ++use Fcntl ":seek"; ++ ++my $trailer_magic = 'RPTL'; ++ ++my %atom_formats = ++( ++ 'DTOK' => \&format_bool, ++ 'KVer' => \&format_string, ++); ++ ++if (@ARGV != 1) ++{ ++ print ("Usage: knlinfo \n"); ++ exit(1); ++} ++ ++my $kernel_file = $ARGV[0]; ++ ++ ++my ($atoms, $pos) = read_trailer($kernel_file); ++ ++exit(1) if (!$atoms); ++ ++printf("Kernel trailer found at %d/0x%x:\n", $pos, $pos); ++ ++foreach my $atom (@$atoms) ++{ ++ printf(" %s: %s\n", $atom->[0], format_atom($atom)); ++} ++ ++exit(0); ++ ++sub read_trailer ++{ ++ my ($kernel_file) = @_; ++ my $fh; ++ ++ if (!open($fh, '<', $kernel_file)) ++ { ++ print ("* Failed to open '$kernel_file'\n"); ++ return undef; ++ } ++ ++ if (!seek($fh, -12, SEEK_END)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ my $last_bytes; ++ sysread($fh, $last_bytes, 12); ++ ++ my ($trailer_len, $data_len, $magic) = unpack('VVa4', $last_bytes); ++ ++ if (($magic ne $trailer_magic) || ($data_len != 4)) ++ { ++ print ("* no trailer\n"); ++ return undef; ++ } ++ if (!seek($fh, -12, SEEK_END)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ $trailer_len -= 12; ++ ++ while ($trailer_len > 0) ++ { ++ if ($trailer_len < 8) ++ { ++ print ("* truncated atom header in trailer\n"); ++ return undef; ++ } ++ if (!seek($fh, -8, SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ $trailer_len -= 8; ++ ++ my $atom_hdr; ++ sysread($fh, $atom_hdr, 8); ++ my ($atom_len, $atom_type) = unpack('Va4', $atom_hdr); ++ ++ if ($trailer_len < $atom_len) ++ { ++ print ("* truncated atom data in trailer\n"); ++ return undef; ++ } ++ ++ my $rounded_len = (($atom_len + 3) & ~3); ++ if (!seek($fh, -(8 + $rounded_len), SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ $trailer_len -= $rounded_len; ++ ++ my $atom_data; ++ sysread($fh, $atom_data, $atom_len); ++ ++ if (!seek($fh, -$atom_len, SEEK_CUR)) ++ { ++ print ("* seek error in '$kernel_file'\n"); ++ return undef; ++ } ++ ++ push @$atoms, [ $atom_type, $atom_data ]; ++ } ++ ++ if (($$atoms[-1][0] eq "\x00\x00\x00\x00") && ++ ($$atoms[-1][1] eq "")) ++ { ++ pop @$atoms; ++ } ++ else ++ { ++ print ("* end marker missing from trailer\n"); ++ } ++ ++ return ($atoms, tell($fh)); ++} ++ ++sub format_atom ++{ ++ my ($atom) = @_; ++ ++ my $format_func = $atom_formats{$atom->[0]} || \&format_hex; ++ return $format_func->($atom->[1]); ++} ++ ++sub format_bool ++{ ++ my ($data) = @_; ++ return unpack('V', $data) ? 'true' : 'false'; ++} ++ ++sub format_int ++{ ++ my ($data) = @_; ++ return unpack('V', $data); ++} ++ ++sub format_string ++{ ++ my ($data) = @_; ++ return '"'.$data.'"'; ++} ++ ++sub format_hex ++{ ++ my ($data) = @_; ++ return unpack('H*', $data); ++} +diff --git a/scripts/mkknlimg b/scripts/mkknlimg +new file mode 100755 +index 0000000..ac829d0 +--- /dev/null ++++ b/scripts/mkknlimg +@@ -0,0 +1,260 @@ ++#!/usr/bin/env perl ++# ---------------------------------------------------------------------- ++# mkknlimg by Phil Elwell for Raspberry Pi ++# based on extract-ikconfig Dick Streefland ++# ++# (c) 2009,2010 Dick Streefland ++# (c) 2014,2015 Raspberry Pi (Trading) Limited ++# ++# Licensed under the terms of the GNU General Public License. ++# ---------------------------------------------------------------------- ++ ++use strict; ++use warnings; ++use integer; ++ ++my $trailer_magic = 'RPTL'; ++ ++my $tmpfile1 = "/tmp/mkknlimg_$$.1"; ++my $tmpfile2 = "/tmp/mkknlimg_$$.2"; ++ ++my $dtok = 0; ++ ++while (@ARGV && ($ARGV[0] =~ /^-/)) ++{ ++ my $arg = shift(@ARGV); ++ if ($arg eq '--dtok') ++ { ++ $dtok = 1; ++ } ++ else ++ { ++ print ("* Unknown option '$arg'\n"); ++ usage(); ++ } ++} ++ ++usage() if (@ARGV != 2); ++ ++my $kernel_file = $ARGV[0]; ++my $out_file = $ARGV[1]; ++ ++if (! -r $kernel_file) ++{ ++ print ("* File '$kernel_file' not found\n"); ++ usage(); ++} ++ ++my @wanted_config_lines = ++( ++ 'CONFIG_BCM2708_DT' ++); ++ ++my @wanted_strings = ++( ++ 'bcm2708_fb', ++ 'brcm,bcm2708-pinctrl', ++ 'brcm,bcm2835-gpio', ++ 'of_find_property' ++); ++ ++my $res = try_extract($kernel_file, $tmpfile1); ++$res = try_decompress('\037\213\010', 'xy', 'gunzip', 0, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('\3757zXZ\000', 'abcde', 'unxz --single-stream', -1, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('BZh', 'xy', 'bunzip2', 0, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('\135\0\0\0', 'xxx', 'unlzma', 0, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('\211\114\132', 'xy', 'lzop -d', 0, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++$res = try_decompress('\002\041\114\030', 'xy', 'lz4 -d', 1, ++ $kernel_file, $tmpfile1, $tmpfile2) if (!$res); ++ ++my $append_trailer; ++my $trailer; ++my $kver = '?'; ++ ++$append_trailer = $dtok; ++ ++if ($res) ++{ ++ $kver = $res->{''} || '?'; ++ print("Version: $kver\n"); ++ ++ $append_trailer = $dtok; ++ if (!$dtok) ++ { ++ if (config_bool($res, 'bcm2708_fb')) ++ { ++ $dtok ||= config_bool($res, 'CONFIG_BCM2708_DT'); ++ $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); ++ $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); ++ $append_trailer = 1; ++ } ++ else ++ { ++ print ("* This doesn't look like a Raspberry Pi kernel. In pass-through mode.\n"); ++ } ++ } ++} ++elsif (!$dtok) ++{ ++ print ("* Is this a valid kernel? In pass-through mode.\n"); ++} ++ ++if ($append_trailer) ++{ ++ printf("DT: %s\n", $dtok ? "y" : "n"); ++ ++ my @atoms; ++ ++ push @atoms, [ $trailer_magic, pack('V', 0) ]; ++ push @atoms, [ 'KVer', $kver ]; ++ push @atoms, [ 'DTOK', pack('V', $dtok) ]; ++ ++ $trailer = pack_trailer(\@atoms); ++ $atoms[0]->[1] = pack('V', length($trailer)); ++ ++ $trailer = pack_trailer(\@atoms); ++} ++ ++my $ofh; ++my $total_len = 0; ++ ++if ($out_file eq $kernel_file) ++{ ++ die "* Failed to open '$out_file' for append\n" ++ if (!open($ofh, '>>', $out_file)); ++ $total_len = tell($ofh); ++} ++else ++{ ++ die "* Failed to open '$kernel_file'\n" ++ if (!open(my $ifh, '<', $kernel_file)); ++ die "* Failed to create '$out_file'\n" ++ if (!open($ofh, '>', $out_file)); ++ ++ my $copybuf; ++ while (1) ++ { ++ my $bytes = sysread($ifh, $copybuf, 64*1024); ++ last if (!$bytes); ++ syswrite($ofh, $copybuf, $bytes); ++ $total_len += $bytes; ++ } ++ close($ifh); ++} ++ ++if ($trailer) ++{ ++ # Pad to word-alignment ++ syswrite($ofh, "\x000\x000\x000", (-$total_len & 0x3)); ++ syswrite($ofh, $trailer); ++} ++ ++close($ofh); ++ ++exit($trailer ? 0 : 1); ++ ++END { ++ unlink($tmpfile1) if ($tmpfile1); ++ unlink($tmpfile2) if ($tmpfile2); ++} ++ ++ ++sub usage ++{ ++ print ("Usage: mkknlimg [--dtok] \n"); ++ exit(1); ++} ++ ++sub try_extract ++{ ++ my ($knl, $tmp) = @_; ++ ++ my $ver = `strings "$knl" | grep -a -E "^Linux version [1-9]"`; ++ ++ return undef if (!$ver); ++ ++ chomp($ver); ++ ++ my $res = { ''=>$ver }; ++ my $string_pattern = '^('.join('|', @wanted_strings).')$'; ++ ++ my @matches = `strings \"$knl\" | grep -E \"$string_pattern\"`; ++ foreach my $match (@matches) ++ { ++ chomp($match); ++ $res->{$match} = 1; ++ } ++ ++ my $config_pattern = '^('.join('|', @wanted_config_lines).')=(.*)$'; ++ my $cf1 = 'IKCFG_ST\037\213\010'; ++ my $cf2 = '0123456789'; ++ ++ my $pos = `tr "$cf1\n$cf2" "\n$cf2=" < "$knl" | grep -abo "^$cf2"`; ++ if ($pos) ++ { ++ $pos =~ s/:.*[\r\n]*$//s; ++ $pos += 8; ++ my $err = (system("tail -c+$pos \"$knl\" | zcat > $tmp 2> /dev/null") >> 8); ++ if (($err == 0) || ($err == 2)) ++ { ++ if (open(my $fh, '<', $tmp)) ++ { ++ while (my $line = <$fh>) ++ { ++ chomp($line); ++ $res->{$1} = $2 if ($line =~ /$config_pattern/); ++ } ++ ++ close($fh); ++ } ++ } ++ } ++ ++ return $res; ++} ++ ++ ++sub try_decompress ++{ ++ my ($magic, $subst, $zcat, $idx, $knl, $tmp1, $tmp2) = @_; ++ ++ my $pos = `tr "$magic\n$subst" "\n$subst=" < "$knl" | grep -abo "^$subst"`; ++ if ($pos) ++ { ++ chomp($pos); ++ $pos = (split(/[\r\n]+/, $pos))[$idx]; ++ return undef if (!defined($pos)); ++ $pos =~ s/:.*[\r\n]*$//s; ++ my $cmd = "tail -c+$pos \"$knl\" | $zcat > $tmp2 2> /dev/null"; ++ my $err = (system($cmd) >> 8); ++ return undef if (($err != 0) && ($err != 2)); ++ ++ return try_extract($tmp2, $tmp1); ++ } ++ ++ return undef; ++} ++ ++sub pack_trailer ++{ ++ my ($atoms) = @_; ++ my $trailer = pack('VV', 0, 0); ++ for (my $i = $#$atoms; $i>=0; $i--) ++ { ++ my $atom = $atoms->[$i]; ++ $trailer .= pack('a*x!4Va4', $atom->[1], length($atom->[1]), $atom->[0]); ++ } ++ return $trailer; ++} ++ ++sub config_bool ++{ ++ my ($configs, $wanted) = @_; ++ my $val = $configs->{$wanted} || 'n'; ++ return (($val eq 'y') || ($val eq '1')); ++} + +From 2ab7f22fc98a7e6f66c3924d0eff9a721b159029 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 28 May 2015 18:35:44 +0100 +Subject: [PATCH 188/216] scripts/mkknlimg: Add support for ARCH_BCM2835 + +Add a new trailer field indicating whether this is an ARCH_BCM2835 +build, as opposed to MACH_BCM2708/9. If the loader finds this flag +is set it changes the default base dtb file name from bcm270x... +to bcm283y... + +Also update knlinfo to show the status of the field. +--- + scripts/knlinfo | 1 + + scripts/mkknlimg | 25 ++++++++++++++++++++----- + 2 files changed, 21 insertions(+), 5 deletions(-) + +diff --git a/scripts/knlinfo b/scripts/knlinfo +index 9c9b42e3..a0e8663 100755 +--- a/scripts/knlinfo ++++ b/scripts/knlinfo +@@ -18,6 +18,7 @@ my %atom_formats = + ( + 'DTOK' => \&format_bool, + 'KVer' => \&format_string, ++ '283x' => \&format_bool, + ); + + if (@ARGV != 1) +diff --git a/scripts/mkknlimg b/scripts/mkknlimg +index ac829d0..3dff948 100755 +--- a/scripts/mkknlimg ++++ b/scripts/mkknlimg +@@ -1,7 +1,7 @@ + #!/usr/bin/env perl + # ---------------------------------------------------------------------- + # mkknlimg by Phil Elwell for Raspberry Pi +-# based on extract-ikconfig Dick Streefland ++# based on extract-ikconfig by Dick Streefland + # + # (c) 2009,2010 Dick Streefland + # (c) 2014,2015 Raspberry Pi (Trading) Limited +@@ -19,6 +19,7 @@ my $tmpfile1 = "/tmp/mkknlimg_$$.1"; + my $tmpfile2 = "/tmp/mkknlimg_$$.2"; + + my $dtok = 0; ++my $is_283x = 0; + + while (@ARGV && ($ARGV[0] =~ /^-/)) + { +@@ -27,6 +28,10 @@ while (@ARGV && ($ARGV[0] =~ /^-/)) + { + $dtok = 1; + } ++ elsif ($arg eq '--283x') ++ { ++ $is_283x = 1; ++ } + else + { + print ("* Unknown option '$arg'\n"); +@@ -47,15 +52,18 @@ if (! -r $kernel_file) + + my @wanted_config_lines = + ( +- 'CONFIG_BCM2708_DT' ++ 'CONFIG_BCM2708_DT', ++ 'CONFIG_ARCH_BCM2835' + ); + + my @wanted_strings = + ( + 'bcm2708_fb', ++ 'brcm,bcm2835-mmc', ++ 'brcm,bcm2835-sdhost', + 'brcm,bcm2708-pinctrl', + 'brcm,bcm2835-gpio', +- 'of_find_property' ++ 'brcm,bcm2835-pm-wdt' + ); + + my $res = try_extract($kernel_file, $tmpfile1); +@@ -86,11 +94,16 @@ if ($res) + $append_trailer = $dtok; + if (!$dtok) + { +- if (config_bool($res, 'bcm2708_fb')) ++ if (config_bool($res, 'bcm2708_fb') || ++ config_bool($res, 'brcm,bcm2835-mmc') || ++ config_bool($res, 'brcm,bcm2835-sdhost')) + { + $dtok ||= config_bool($res, 'CONFIG_BCM2708_DT'); ++ $dtok ||= config_bool($res, 'CONFIG_ARCH_BCM2835'); + $dtok ||= config_bool($res, 'brcm,bcm2708-pinctrl'); + $dtok ||= config_bool($res, 'brcm,bcm2835-gpio'); ++ $is_283x ||= config_bool($res, 'CONFIG_ARCH_BCM2835'); ++ $is_283x ||= config_bool($res, 'brcm,bcm2835-pm-wdt'); + $append_trailer = 1; + } + else +@@ -107,12 +120,14 @@ elsif (!$dtok) + if ($append_trailer) + { + printf("DT: %s\n", $dtok ? "y" : "n"); ++ printf("283x: %s\n", $is_283x ? "y" : "n"); + + my @atoms; + + push @atoms, [ $trailer_magic, pack('V', 0) ]; + push @atoms, [ 'KVer', $kver ]; + push @atoms, [ 'DTOK', pack('V', $dtok) ]; ++ push @atoms, [ '283x', pack('V', $is_283x) ]; + + $trailer = pack_trailer(\@atoms); + $atoms[0]->[1] = pack('V', length($trailer)); +@@ -166,7 +181,7 @@ END { + + sub usage + { +- print ("Usage: mkknlimg [--dtok] \n"); ++ print ("Usage: mkknlimg [--dtok] [--283x] \n"); + exit(1); + } + + +From 73bb23f8980890aad84dc6b852f0aac91ab71981 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 10 Mar 2015 18:35:18 +0100 +Subject: [PATCH 189/216] config: add KEYBOARD_GPIO + +--- + arch/arm/configs/bcm2709_defconfig | 3 ++- + arch/arm/configs/bcmrpi_defconfig | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 9daaeb7..5ce9a01 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -520,7 +520,8 @@ CONFIG_INPUT_POLLDEV=m + # CONFIG_INPUT_MOUSEDEV_PSAUX is not set + CONFIG_INPUT_JOYDEV=m + CONFIG_INPUT_EVDEV=m +-# CONFIG_INPUT_KEYBOARD is not set ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m + # CONFIG_INPUT_MOUSE is not set + CONFIG_INPUT_JOYSTICK=y + CONFIG_JOYSTICK_IFORCE=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index dc27aeb..da443da 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -513,7 +513,8 @@ CONFIG_INPUT_POLLDEV=m + # CONFIG_INPUT_MOUSEDEV_PSAUX is not set + CONFIG_INPUT_JOYDEV=m + CONFIG_INPUT_EVDEV=m +-# CONFIG_INPUT_KEYBOARD is not set ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m + # CONFIG_INPUT_MOUSE is not set + CONFIG_INPUT_JOYSTICK=y + CONFIG_JOYSTICK_IFORCE=m + +From d7d347201d595ccc495da617ab583fdb3e282829 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 10 Mar 2015 18:35:59 +0100 +Subject: [PATCH 190/216] dts: overlay: add support for tinylcd.com 3.5" + display +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree overlay for 3.5" display by tinylcd.com + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/tinylcd35-overlay.dts | 216 ++++++++++++++++++++++++++++++++ + 2 files changed, 217 insertions(+) + create mode 100644 arch/arm/boot/dts/tinylcd35-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 9124dfb..25ea8eb 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -38,6 +38,7 @@ dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb +diff --git a/arch/arm/boot/dts/tinylcd35-overlay.dts b/arch/arm/boot/dts/tinylcd35-overlay.dts +new file mode 100644 +index 0000000..f7102c8 +--- /dev/null ++++ b/arch/arm/boot/dts/tinylcd35-overlay.dts +@@ -0,0 +1,216 @@ ++/* ++ * tinylcd35-overlay.dts ++ * ++ * ------------------------------------------------- ++ * www.tinlylcd.com ++ * ------------------------------------------------- ++ * Device---Driver-----BUS GPIO's ++ * display tinylcd35 spi0.0 25 24 18 ++ * touch ads7846 spi0.1 5 ++ * rtc ds1307 i2c1-0068 ++ * rtc pcf8563 i2c1-0051 ++ * keypad gpio-keys --------- 17 22 27 23 28 ++ * ++ * ++ * TinyLCD.com 3.5 inch TFT ++ * ++ * Version 001 ++ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework ++ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ tinylcd35_pins: tinylcd35_pins { ++ brcm,pins = <25 24 18>; ++ brcm,function = <1>; /* out */ ++ }; ++ tinylcd35_ts_pins: tinylcd35_ts_pins { ++ brcm,pins = <5>; ++ brcm,function = <0>; /* in */ ++ }; ++ keypad_pins: keypad_pins { ++ brcm,pins = <4 17 22 23 27>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <1>; /* down */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tinylcd35: tinylcd35@0{ ++ compatible = "neosec,tinylcd"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&tinylcd35_pins>, ++ <&tinylcd35_ts_pins>; ++ ++ spi-max-frequency = <48000000>; ++ rotate = <270>; ++ fps = <20>; ++ bgr; ++ buswidth = <8>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ ++ init = <0x10000B0 0x80 ++ 0x10000C0 0x0A 0x0A ++ 0x10000C1 0x01 0x01 ++ 0x10000C2 0x33 ++ 0x10000C5 0x00 0x42 0x80 ++ 0x10000B1 0xD0 0x11 ++ 0x10000B4 0x02 ++ 0x10000B6 0x00 0x22 0x3B ++ 0x10000B7 0x07 ++ 0x1000036 0x58 ++ 0x10000F0 0x36 0xA5 0xD3 ++ 0x10000E5 0x80 ++ 0x10000E5 0x01 ++ 0x10000B3 0x00 ++ 0x10000E5 0x00 ++ 0x10000F0 0x36 0xA5 0x53 ++ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 ++ 0x100003A 0x55 ++ 0x1000011 ++ 0x2000001 ++ 0x1000029>; ++ }; ++ ++ tinylcd35_ts: tinylcd35_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ status = "disabled"; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 5 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ ++ /* RTC */ ++ ++ fragment@3 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* ++ * Values for input event code is found under the ++ * 'Keys and buttons' heading in include/uapi/linux/input.h ++ */ ++ fragment@5 { ++ target-path = "/soc"; ++ __overlay__ { ++ keypad: keypad { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&keypad_pins>; ++ status = "disabled"; ++ autorepeat; ++ ++ button@17 { ++ label = "GPIO KEY_UP"; ++ linux,code = <103>; ++ gpios = <&gpio 17 0>; ++ }; ++ button@22 { ++ label = "GPIO KEY_DOWN"; ++ linux,code = <108>; ++ gpios = <&gpio 22 0>; ++ }; ++ button@27 { ++ label = "GPIO KEY_LEFT"; ++ linux,code = <105>; ++ gpios = <&gpio 27 0>; ++ }; ++ button@23 { ++ label = "GPIO KEY_RIGHT"; ++ linux,code = <106>; ++ gpios = <&gpio 23 0>; ++ }; ++ button@4 { ++ label = "GPIO KEY_ENTER"; ++ linux,code = <28>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&tinylcd35>,"spi-max-frequency:0"; ++ rotate = <&tinylcd35>,"rotate:0"; ++ fps = <&tinylcd35>,"fps:0"; ++ debug = <&tinylcd35>,"debug:0"; ++ touch = <&tinylcd35_ts>,"status"; ++ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", ++ <&tinylcd35_ts>,"interrupts:0", ++ <&tinylcd35_ts>,"pendown-gpio:4"; ++ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; ++ rtc-pcf = <&i2c1>,"status", ++ <&pcf8563>,"status"; ++ rtc-ds = <&i2c1>,"status", ++ <&ds1307>,"status"; ++ keypad = <&keypad>,"status"; ++ }; ++}; + +From 4b843d5be018d8d392a4be34a7fdfe3640e3c2a7 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 29 May 2015 14:16:47 +0100 +Subject: [PATCH 191/216] BCM270X_DT: Move the overlays into a subdirectory, + adding the README + +--- + arch/arm/boot/dts/Makefile | 31 +- + arch/arm/boot/dts/ads7846-overlay.dts | 83 ---- + arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts | 23 - + arch/arm/boot/dts/ds1307-rtc-overlay.dts | 22 - + arch/arm/boot/dts/enc28j60-overlay.dts | 29 -- + arch/arm/boot/dts/hifiberry-amp-overlay.dts | 39 -- + arch/arm/boot/dts/hifiberry-dac-overlay.dts | 34 -- + arch/arm/boot/dts/hifiberry-dacplus-overlay.dts | 39 -- + arch/arm/boot/dts/hifiberry-digi-overlay.dts | 39 -- + arch/arm/boot/dts/hy28a-overlay.dts | 87 ---- + arch/arm/boot/dts/hy28b-overlay.dts | 142 ------- + arch/arm/boot/dts/i2c-rtc-overlay.dts | 43 -- + arch/arm/boot/dts/iqaudio-dac-overlay.dts | 39 -- + arch/arm/boot/dts/iqaudio-dacplus-overlay.dts | 39 -- + arch/arm/boot/dts/lirc-rpi-overlay.dts | 57 --- + arch/arm/boot/dts/mmc-overlay.dts | 19 - + arch/arm/boot/dts/mz61581-overlay.dts | 109 ----- + arch/arm/boot/dts/overlays/Makefile | 51 +++ + arch/arm/boot/dts/overlays/README | 470 +++++++++++++++++++++ + arch/arm/boot/dts/overlays/ads7846-overlay.dts | 83 ++++ + .../dts/overlays/bmp085_i2c-sensor-overlay.dts | 23 + + arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts | 22 + + arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 29 ++ + .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 ++ + .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 ++ + .../dts/overlays/hifiberry-dacplus-overlay.dts | 39 ++ + .../boot/dts/overlays/hifiberry-digi-overlay.dts | 39 ++ + arch/arm/boot/dts/overlays/hy28a-overlay.dts | 87 ++++ + arch/arm/boot/dts/overlays/hy28b-overlay.dts | 142 +++++++ + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 49 +++ + arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 39 ++ + .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 39 ++ + arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 +++ + arch/arm/boot/dts/overlays/mmc-overlay.dts | 19 + + arch/arm/boot/dts/overlays/mz61581-overlay.dts | 109 +++++ + arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts | 22 + + arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts | 22 + + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 94 +++++ + .../dts/overlays/pitft28-resistive-overlay.dts | 115 +++++ + arch/arm/boot/dts/overlays/pps-gpio-overlay.dts | 34 ++ + arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 ++ + arch/arm/boot/dts/overlays/rpi-display-overlay.dts | 82 ++++ + arch/arm/boot/dts/overlays/rpi-proto-overlay.dts | 39 ++ + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 75 ++++ + arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts | 18 + + arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts | 18 + + arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 216 ++++++++++ + arch/arm/boot/dts/overlays/w1-gpio-overlay.dts | 39 ++ + .../boot/dts/overlays/w1-gpio-pullup-overlay.dts | 41 ++ + arch/arm/boot/dts/pcf2127-rtc-overlay.dts | 22 - + arch/arm/boot/dts/pcf8523-rtc-overlay.dts | 22 - + arch/arm/boot/dts/piscreen-overlay.dts | 94 ----- + arch/arm/boot/dts/pitft28-resistive-overlay.dts | 115 ----- + arch/arm/boot/dts/pps-gpio-overlay.dts | 34 -- + arch/arm/boot/dts/rpi-dac-overlay.dts | 34 -- + arch/arm/boot/dts/rpi-display-overlay.dts | 82 ---- + arch/arm/boot/dts/rpi-proto-overlay.dts | 39 -- + arch/arm/boot/dts/sdhost-overlay.dts | 75 ---- + arch/arm/boot/dts/spi-bcm2708-overlay.dts | 18 - + arch/arm/boot/dts/spi-bcm2835-overlay.dts | 18 - + arch/arm/boot/dts/tinylcd35-overlay.dts | 216 ---------- + arch/arm/boot/dts/w1-gpio-overlay.dts | 39 -- + arch/arm/boot/dts/w1-gpio-pullup-overlay.dts | 41 -- + 63 files changed, 2220 insertions(+), 1722 deletions(-) + delete mode 100644 arch/arm/boot/dts/ads7846-overlay.dts + delete mode 100644 arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts + delete mode 100644 arch/arm/boot/dts/ds1307-rtc-overlay.dts + delete mode 100755 arch/arm/boot/dts/enc28j60-overlay.dts + delete mode 100644 arch/arm/boot/dts/hifiberry-amp-overlay.dts + delete mode 100644 arch/arm/boot/dts/hifiberry-dac-overlay.dts + delete mode 100644 arch/arm/boot/dts/hifiberry-dacplus-overlay.dts + delete mode 100644 arch/arm/boot/dts/hifiberry-digi-overlay.dts + delete mode 100644 arch/arm/boot/dts/hy28a-overlay.dts + delete mode 100644 arch/arm/boot/dts/hy28b-overlay.dts + delete mode 100644 arch/arm/boot/dts/i2c-rtc-overlay.dts + delete mode 100644 arch/arm/boot/dts/iqaudio-dac-overlay.dts + delete mode 100644 arch/arm/boot/dts/iqaudio-dacplus-overlay.dts + delete mode 100644 arch/arm/boot/dts/lirc-rpi-overlay.dts + delete mode 100644 arch/arm/boot/dts/mmc-overlay.dts + delete mode 100644 arch/arm/boot/dts/mz61581-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/Makefile + create mode 100644 arch/arm/boot/dts/overlays/README + create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/hy28b-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/piscreen-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/pps-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-display-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rpi-proto-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/sdhost-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/tinylcd35-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts + delete mode 100644 arch/arm/boot/dts/pcf2127-rtc-overlay.dts + delete mode 100644 arch/arm/boot/dts/pcf8523-rtc-overlay.dts + delete mode 100644 arch/arm/boot/dts/piscreen-overlay.dts + delete mode 100644 arch/arm/boot/dts/pitft28-resistive-overlay.dts + delete mode 100644 arch/arm/boot/dts/pps-gpio-overlay.dts + delete mode 100644 arch/arm/boot/dts/rpi-dac-overlay.dts + delete mode 100644 arch/arm/boot/dts/rpi-display-overlay.dts + delete mode 100644 arch/arm/boot/dts/rpi-proto-overlay.dts + delete mode 100644 arch/arm/boot/dts/sdhost-overlay.dts + delete mode 100644 arch/arm/boot/dts/spi-bcm2708-overlay.dts + delete mode 100644 arch/arm/boot/dts/spi-bcm2835-overlay.dts + delete mode 100644 arch/arm/boot/dts/tinylcd35-overlay.dts + delete mode 100644 arch/arm/boot/dts/w1-gpio-overlay.dts + delete mode 100644 arch/arm/boot/dts/w1-gpio-pullup-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index 25ea8eb..ea93e1d 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -13,36 +13,7 @@ ifeq ($(CONFIG_BCM2709_DT),y) + RPI_DT_OVERLAYS=y + endif + +-dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += ds1307-rtc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += pcf2127-rtc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += pcf8523-rtc-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb +-dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb ++subdir-$(RPI_DT_OVERLAYS) += overlays + + dtb-$(CONFIG_MACH_ASM9260) += \ + alphascale-asm9260-devkit.dtb +diff --git a/arch/arm/boot/dts/ads7846-overlay.dts b/arch/arm/boot/dts/ads7846-overlay.dts +deleted file mode 100644 +index 6a92cd1..0000000 +--- a/arch/arm/boot/dts/ads7846-overlay.dts ++++ /dev/null +@@ -1,83 +0,0 @@ +-/* +- * Generic Device Tree overlay for the ADS7846 touch controller +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- ads7846_pins: ads7846_pins { +- brcm,pins = <255>; /* illegal default value */ +- brcm,function = <0>; /* in */ +- brcm,pull = <0>; /* none */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- ads7846: ads7846@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- pinctrl-names = "default"; +- pinctrl-0 = <&ads7846_pins>; +- +- spi-max-frequency = <2000000>; +- interrupts = <255 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 255 0>; +- +- /* driver defaults */ +- ti,x-min = /bits/ 16 <0>; +- ti,y-min = /bits/ 16 <0>; +- ti,x-max = /bits/ 16 <0x0FFF>; +- ti,y-max = /bits/ 16 <0x0FFF>; +- ti,pressure-min = /bits/ 16 <0>; +- ti,pressure-max = /bits/ 16 <0xFFFF>; +- ti,x-plate-ohms = /bits/ 16 <400>; +- }; +- }; +- }; +- __overrides__ { +- cs = <&ads7846>,"reg:0"; +- speed = <&ads7846>,"spi-max-frequency:0"; +- penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ +- <&ads7846>,"interrupts:0", +- <&ads7846>,"pendown-gpio:4"; +- penirq_pull = <&ads7846_pins>,"brcm,pull:0"; +- swapxy = <&ads7846>,"ti,swap-xy?"; +- xmin = <&ads7846>,"ti,x-min;0"; +- ymin = <&ads7846>,"ti,y-min;0"; +- xmax = <&ads7846>,"ti,x-max;0"; +- ymax = <&ads7846>,"ti,y-max;0"; +- pmin = <&ads7846>,"ti,pressure-min;0"; +- pmax = <&ads7846>,"ti,pressure-max;0"; +- xohms = <&ads7846>,"ti,x-plate-ohms;0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts +deleted file mode 100644 +index b830bf2..0000000 +--- a/arch/arm/boot/dts/bmp085_i2c-sensor-overlay.dts ++++ /dev/null +@@ -1,23 +0,0 @@ +-// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- bmp085@77 { +- compatible = "bosch,bmp085"; +- reg = <0x77>; +- default-oversampling = <3>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/ds1307-rtc-overlay.dts b/arch/arm/boot/dts/ds1307-rtc-overlay.dts +deleted file mode 100644 +index 7d27044..0000000 +--- a/arch/arm/boot/dts/ds1307-rtc-overlay.dts ++++ /dev/null +@@ -1,22 +0,0 @@ +-// Definitions for DS1307 Real Time Clock +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- ds1307@68 { +- compatible = "maxim,ds1307"; +- reg = <0x68>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/enc28j60-overlay.dts b/arch/arm/boot/dts/enc28j60-overlay.dts +deleted file mode 100755 +index aa9b645..0000000 +--- a/arch/arm/boot/dts/enc28j60-overlay.dts ++++ /dev/null +@@ -1,29 +0,0 @@ +-// Overlay for the Microchip ENC28J60 Ethernet Controller +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- enc28j60@0{ +- compatible = "microchip,enc28j60"; +- reg = <0>; /* CE0 */ +- spi-max-frequency = <12000000>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/hifiberry-amp-overlay.dts +deleted file mode 100644 +index 2c81448..0000000 +--- a/arch/arm/boot/dts/hifiberry-amp-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for HiFiBerry Amp/Amp+ +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "hifiberry,hifiberry-amp"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- tas5713@1b { +- #sound-dai-cells = <0>; +- compatible = "ti,tas5713"; +- reg = <0x1b>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/hifiberry-dac-overlay.dts +deleted file mode 100644 +index 5e7633a..0000000 +--- a/arch/arm/boot/dts/hifiberry-dac-overlay.dts ++++ /dev/null +@@ -1,34 +0,0 @@ +-// Definitions for HiFiBerry DAC +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "hifiberry,hifiberry-dac"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target-path = "/"; +- __overlay__ { +- pcm5102a-codec { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm5102a"; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/hifiberry-dacplus-overlay.dts +deleted file mode 100644 +index deb9c625..0000000 +--- a/arch/arm/boot/dts/hifiberry-dacplus-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for HiFiBerry DAC+ +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "hifiberry,hifiberry-dacplus"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcm5122@4d { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm5122"; +- reg = <0x4d>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/hifiberry-digi-overlay.dts +deleted file mode 100644 +index d0e0d8a..0000000 +--- a/arch/arm/boot/dts/hifiberry-digi-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for HiFiBerry Digi +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "hifiberry,hifiberry-digi"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- wm8804@3b { +- #sound-dai-cells = <0>; +- compatible = "wlf,wm8804"; +- reg = <0x3b>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/hy28a-overlay.dts b/arch/arm/boot/dts/hy28a-overlay.dts +deleted file mode 100644 +index 3cd3083..0000000 +--- a/arch/arm/boot/dts/hy28a-overlay.dts ++++ /dev/null +@@ -1,87 +0,0 @@ +-/* +- * Device Tree overlay for HY28A display +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- hy28a_pins: hy28a_pins { +- brcm,pins = <17 25 18>; +- brcm,function = <0 1 1>; /* in out out */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- hy28a: hy28a@0{ +- compatible = "ilitek,ili9320"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&hy28a_pins>; +- +- spi-max-frequency = <32000000>; +- spi-cpol; +- spi-cpha; +- rotate = <270>; +- bgr; +- fps = <50>; +- buswidth = <8>; +- startbyte = <0x70>; +- reset-gpios = <&gpio 25 0>; +- led-gpios = <&gpio 18 1>; +- debug = <0>; +- }; +- +- hy28a_ts: hy28a-ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <17 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 17 0>; +- ti,x-plate-ohms = /bits/ 16 <100>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&hy28a>,"spi-max-frequency:0"; +- rotate = <&hy28a>,"rotate:0"; +- fps = <&hy28a>,"fps:0"; +- debug = <&hy28a>,"debug:0"; +- xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; +- resetgpio = <&hy28a>,"reset-gpios:4", +- <&hy28a_pins>, "brcm,pins:1"; +- ledgpio = <&hy28a>,"led-gpios:4", +- <&hy28a_pins>, "brcm,pins:2"; +- }; +-}; +diff --git a/arch/arm/boot/dts/hy28b-overlay.dts b/arch/arm/boot/dts/hy28b-overlay.dts +deleted file mode 100644 +index f774c4a..0000000 +--- a/arch/arm/boot/dts/hy28b-overlay.dts ++++ /dev/null +@@ -1,142 +0,0 @@ +-/* +- * Device Tree overlay for HY28b display shield by Texy +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- hy28b_pins: hy28b_pins { +- brcm,pins = <17 25 18>; +- brcm,function = <0 1 1>; /* in out out */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- hy28b: hy28b@0{ +- compatible = "ilitek,ili9325"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&hy28b_pins>; +- +- spi-max-frequency = <48000000>; +- spi-cpol; +- spi-cpha; +- rotate = <270>; +- bgr; +- fps = <50>; +- buswidth = <8>; +- startbyte = <0x70>; +- reset-gpios = <&gpio 25 0>; +- led-gpios = <&gpio 18 1>; +- +- gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; +- +- init = <0x10000e7 0x0010 +- 0x1000000 0x0001 +- 0x1000001 0x0100 +- 0x1000002 0x0700 +- 0x1000003 0x1030 +- 0x1000004 0x0000 +- 0x1000008 0x0207 +- 0x1000009 0x0000 +- 0x100000a 0x0000 +- 0x100000c 0x0001 +- 0x100000d 0x0000 +- 0x100000f 0x0000 +- 0x1000010 0x0000 +- 0x1000011 0x0007 +- 0x1000012 0x0000 +- 0x1000013 0x0000 +- 0x2000032 +- 0x1000010 0x1590 +- 0x1000011 0x0227 +- 0x2000032 +- 0x1000012 0x009c +- 0x2000032 +- 0x1000013 0x1900 +- 0x1000029 0x0023 +- 0x100002b 0x000e +- 0x2000032 +- 0x1000020 0x0000 +- 0x1000021 0x0000 +- 0x2000032 +- 0x1000050 0x0000 +- 0x1000051 0x00ef +- 0x1000052 0x0000 +- 0x1000053 0x013f +- 0x1000060 0xa700 +- 0x1000061 0x0001 +- 0x100006a 0x0000 +- 0x1000080 0x0000 +- 0x1000081 0x0000 +- 0x1000082 0x0000 +- 0x1000083 0x0000 +- 0x1000084 0x0000 +- 0x1000085 0x0000 +- 0x1000090 0x0010 +- 0x1000092 0x0000 +- 0x1000093 0x0003 +- 0x1000095 0x0110 +- 0x1000097 0x0000 +- 0x1000098 0x0000 +- 0x1000007 0x0133 +- 0x1000020 0x0000 +- 0x1000021 0x0000 +- 0x2000064>; +- debug = <0>; +- }; +- +- hy28b_ts: hy28b-ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <17 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 17 0>; +- ti,x-plate-ohms = /bits/ 16 <100>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&hy28b>,"spi-max-frequency:0"; +- rotate = <&hy28b>,"rotate:0"; +- fps = <&hy28b>,"fps:0"; +- debug = <&hy28b>,"debug:0"; +- xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; +- resetgpio = <&hy28b>,"reset-gpios:4", +- <&hy28b_pins>, "brcm,pins:1"; +- ledgpio = <&hy28b>,"led-gpios:4", +- <&hy28b_pins>, "brcm,pins:2"; +- }; +-}; +diff --git a/arch/arm/boot/dts/i2c-rtc-overlay.dts b/arch/arm/boot/dts/i2c-rtc-overlay.dts +deleted file mode 100644 +index 5d5abb1..0000000 +--- a/arch/arm/boot/dts/i2c-rtc-overlay.dts ++++ /dev/null +@@ -1,43 +0,0 @@ +-// Definitions for several I2C based Real Time Clocks +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- ds1307: ds1307@68 { +- compatible = "maxim,ds1307"; +- reg = <0x68>; +- status = "disable"; +- }; +- ds3231: ds3231@68 { +- compatible = "maxim,ds3231"; +- reg = <0x68>; +- status = "disable"; +- }; +- pcf2127: pcf2127@51 { +- compatible = "nxp,pcf2127"; +- reg = <0x51>; +- status = "disable"; +- }; +- pcf8523: pcf8523@68 { +- compatible = "nxp,pcf8523"; +- reg = <0x68>; +- status = "disable"; +- }; +- }; +- }; +- __overrides__ { +- ds1307 = <&ds1307>,"status"; +- ds3231 = <&ds3231>,"status"; +- pcf2127 = <&pcf2127>,"status"; +- pcf8523 = <&pcf8523>,"status"; +- }; +-}; +diff --git a/arch/arm/boot/dts/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/iqaudio-dac-overlay.dts +deleted file mode 100644 +index ea8173e..0000000 +--- a/arch/arm/boot/dts/iqaudio-dac-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for IQaudIO DAC +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "iqaudio,iqaudio-dac"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcm5122@4c { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm5122"; +- reg = <0x4c>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/iqaudio-dacplus-overlay.dts +deleted file mode 100644 +index 735d8ab..0000000 +--- a/arch/arm/boot/dts/iqaudio-dacplus-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for IQaudIO DAC+ +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "iqaudio,iqaudio-dac"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcm5122@4c { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm5122"; +- reg = <0x4c>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/lirc-rpi-overlay.dts b/arch/arm/boot/dts/lirc-rpi-overlay.dts +deleted file mode 100644 +index 7d5d82b..0000000 +--- a/arch/arm/boot/dts/lirc-rpi-overlay.dts ++++ /dev/null +@@ -1,57 +0,0 @@ +-// Definitions for lirc-rpi module +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target-path = "/"; +- __overlay__ { +- lirc_rpi: lirc_rpi { +- compatible = "rpi,lirc-rpi"; +- pinctrl-names = "default"; +- pinctrl-0 = <&lirc_pins>; +- status = "okay"; +- +- // Override autodetection of IR receiver circuit +- // (0 = active high, 1 = active low, -1 = no override ) +- rpi,sense = <0xffffffff>; +- +- // Software carrier +- // (0 = off, 1 = on) +- rpi,softcarrier = <1>; +- +- // Invert output +- // (0 = off, 1 = on) +- rpi,invert = <0>; +- +- // Enable debugging messages +- // (0 = off, 1 = on) +- rpi,debug = <0>; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- lirc_pins: lirc_pins { +- brcm,pins = <17 18>; +- brcm,function = <1 0>; // out in +- brcm,pull = <0 1>; // off down +- }; +- }; +- }; +- +- __overrides__ { +- gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; +- gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; +- gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; +- +- sense = <&lirc_rpi>,"rpi,sense:0"; +- softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; +- invert = <&lirc_rpi>,"rpi,invert:0"; +- debug = <&lirc_rpi>,"rpi,debug:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/mmc-overlay.dts b/arch/arm/boot/dts/mmc-overlay.dts +deleted file mode 100644 +index 0a37cf4..0000000 +--- a/arch/arm/boot/dts/mmc-overlay.dts ++++ /dev/null +@@ -1,19 +0,0 @@ +-/dts-v1/; +-/plugin/; +- +-/{ +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&mmc>; +- +- __overlay__ { +- brcm,overclock-50 = <0>; +- }; +- }; +- +- __overrides__ { +- overclock_50 = <&mmc>,"brcm,overclock-50:0"; +- force_pio = <&mmc>,"brcm,force-pio?"; +- }; +-}; +diff --git a/arch/arm/boot/dts/mz61581-overlay.dts b/arch/arm/boot/dts/mz61581-overlay.dts +deleted file mode 100644 +index c06fe12..0000000 +--- a/arch/arm/boot/dts/mz61581-overlay.dts ++++ /dev/null +@@ -1,109 +0,0 @@ +-/* +- * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- mz61581_pins: mz61581_pins { +- brcm,pins = <4 15 18 25>; +- brcm,function = <0 1 1 1>; /* in out out out */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- mz61581: mz61581@0{ +- compatible = "samsung,s6d02a1"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&mz61581_pins>; +- +- spi-max-frequency = <128000000>; +- spi-cpol; +- spi-cpha; +- +- width = <320>; +- height = <480>; +- rotate = <270>; +- bgr; +- fps = <30>; +- buswidth = <8>; +- +- reset-gpios = <&gpio 15 0>; +- dc-gpios = <&gpio 25 0>; +- led-gpios = <&gpio 18 0>; +- +- init = <0x10000b0 00 +- 0x1000011 +- 0x20000ff +- 0x10000b3 0x02 0x00 0x00 0x00 +- 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 +- 0x10000c1 0x08 0x16 0x08 0x08 +- 0x10000c4 0x11 0x07 0x03 0x03 +- 0x10000c6 0x00 +- 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 +- 0x1000035 0x00 +- 0x1000036 0xa0 +- 0x100003a 0x55 +- 0x1000044 0x00 0x01 +- 0x10000d0 0x07 0x07 0x1d 0x03 +- 0x10000d1 0x03 0x30 0x10 +- 0x10000d2 0x03 0x14 0x04 +- 0x1000029 +- 0x100002c>; +- +- /* This is a workaround to make sure the init sequence slows down and doesn't fail */ +- debug = <3>; +- }; +- +- mz61581_ts: mz61581_ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <4 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 4 0>; +- +- ti,x-plate-ohms = /bits/ 16 <60>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&mz61581>, "spi-max-frequency:0"; +- rotate = <&mz61581>, "rotate:0"; +- fps = <&mz61581>, "fps:0"; +- debug = <&mz61581>, "debug:0"; +- xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +new file mode 100644 +index 0000000..d64e6b4 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -0,0 +1,51 @@ ++ifeq ($(CONFIG_OF),y) ++ ++# Overlays for the Raspberry Pi platform ++ ++ifeq ($(CONFIG_BCM2708_DT),y) ++ RPI_DT_OVERLAYS=y ++endif ++ifeq ($(CONFIG_BCM2709_DT),y) ++ RPI_DT_OVERLAYS=y ++endif ++ ++dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hifiberry-amp-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hifiberry-dac-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hifiberry-dacplus-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hifiberry-digi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hy28a-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += hy28b-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += pitft28-resistive-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += pps-gpio-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb ++ ++targets += dtbs dtbs_install ++targets += $(dtb-y) ++ ++endif ++ ++always := $(dtb-y) ++clean-files := *.dtb ++ ++# Enable fixups to support overlays on BCM2708 platforms ++ifeq ($(RPI_DT_OVERLAYS),y) ++ DTC_FLAGS ?= -@ ++endif +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +new file mode 100644 +index 0000000..c260612 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/README +@@ -0,0 +1,470 @@ ++Introduction ++============ ++ ++This directory contains Device Tree overlays. Device Tree makes it possible ++to support many hardware configurations with a single kernel and without the ++need to explicitly load or blacklist kernel modules. Note that this isn't a ++"pure" Device Tree configuration (c.f. MACH_BCM2835) - some on-board devices ++are still configured by the board support code, but the intention is to ++eventually reach that goal. ++ ++On Raspberry Pi, Device Tree usage is controlled from /boot/config.txt. By ++default, the Raspberry Pi kernel boots with device tree enabled. You can ++completely disable DT usage (for now) by adding: ++ ++ device_tree= ++ ++to your config.txt, which should cause your Pi to revert to the old way of ++doing things after a reboot. ++ ++In /boot you will find a .dtb for each base platform. This describes the ++hardware that is part of the Raspberry Pi board. The loader (start.elf and its ++siblings) selects the .dtb file appropriate for the platform by name, and reads ++it into memory. At this point, all of the optional interfaces (i2c, i2s, spi) ++are disabled, but they can be enabled using Device Tree parameters: ++ ++ dtparam=i2c=on,i2s=on,spi=on ++ ++However, this shouldn't be necessary in many use cases because loading an ++overlay that requires one of those interfaces will cause it to be enabled ++automatically, and it is advisable to only enable interfaces if they are ++needed. ++ ++Configuring additional, optional hardware is done using Device Tree overlays ++(see below). ++ ++raspi-config ++============ ++ ++The Advanced Options section of the raspi-config utility can enable and disable ++Device Tree use, as well as toggling the I2C and SPI interfaces. Note that it ++is possible to both enable an interface and blacklist the driver, if for some ++reason you should want to defer the loading. ++ ++Modules ++======= ++ ++As well as describing the hardware, Device Tree also gives enough information ++to allow suitable driver modules to be located and loaded, with the corollary ++that unneeded modules are not loaded. As a result it should be possible to ++remove lines from /etc/modules, and /etc/modprobe.d/raspi-blacklist.conf can ++have its contents deleted (or commented out). ++ ++Using Overlays ++============== ++ ++Overlays are loaded using the "dtoverlay" directive. As an example, consider the ++popular lirc-rpi module, the Linux Infrared Remote Control driver. In the ++pre-DT world this would be loaded from /etc/modules, with an explicit ++"modprobe lirc-rpi" command, or programmatically by lircd. With DT enabled, ++this becomes a line in config.txt: ++ ++ dtoverlay=lirc-rpi ++ ++This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By ++default it will use GPIOs 17 (out) and 18 (in), but this can be modified using ++DT parameters: ++ ++ dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 ++ ++Parameters always have default values, although in some cases (e.g. "w1-gpio") ++it is necessary to provided multiple overlays in order to get the desired ++behaviour. See the list of overlays below for a description of the parameters and their defaults. ++ ++The Overlay and Parameter Reference ++=================================== ++ ++Name: ++Info: Configures the base Raspberry Pi hardware ++Load: ++Params: ++ i2c_arm Set to "on" to enable the ARM's i2c interface ++ (default "off") ++ ++ i2c_vc Set to "on" to enable the i2c interface ++ usually reserved for the VideoCore processor ++ (default "off") ++ ++ i2c An alias for i2c_arm ++ ++ i2c_arm_baudrate Set the baudrate of the ARM's i2c interface ++ (default "100000") ++ ++ i2c_vc_baudrate Set the baudrate of the VideoCore i2c interface ++ (default "100000") ++ ++ i2c_baudrate An alias for i2c_arm_baudrate ++ ++ i2s Set to "on" to enable the i2s interface ++ (default "off") ++ ++ spi Set to "on" to enable the spi interfaces ++ (default "off") ++ ++ act_led_trigger Choose which activity the LED tracks. ++ Use "heartbeat" for a nice load indicator. ++ (default "mmc") ++ ++ act_led_activelow Set to "on" to invert the sense of the LED ++ (default "off") ++ ++ act_led_gpio Set which GPIO to use for the activity LED ++ (in case you want to connect it to an external ++ device) ++ (default "16" on a non-Plus board, "47" on a ++ Plus or Pi 2) ++ ++ pwr_led_trigger ++ pwr_led_activelow ++ pwr_led_gpio ++ As for act_led_*, but using the PWR LED. ++ Not available on Model A/B boards. ++ ++ N.B. It is recommended to only enable those interfaces that are needed. ++ Leaving all interfaces enabled can lead to unwanted behaviour (i2c_vc ++ interfering with Pi Camera, I2S and SPI hogging GPIO pins, etc.) ++ Note also that i2c, i2c_arm and i2c_vc are aliases for the physical ++ interfaces i2c0 and i2c1. Use of the numeric variants is still possible ++ but deprecated because the ARM/VC assignments differ between board ++ revisions. The same board-specific mapping applies to i2c_baudrate, ++ and the other i2c baudrate parameters. ++ ++ ++Name: ads7846 ++Info: ADS7846 Touch controller ++Load: dtoverlay=ads7846,= ++Params: cs SPI bus Chip Select (default 1) ++ speed SPI bus speed (default 2Mhz, max 3.25MHz) ++ penirq GPIO used for PENIRQ. REQUIRED ++ penirq_pull Set GPIO pull (default 0=none, 2=pullup) ++ swapxy Swap x and y axis ++ xmin Minimum value on the X axis (default 0) ++ ymin Minimum value on the Y axis (default 0) ++ xmax Maximum value on the X axis (default 4095) ++ ymax Maximum value on the Y axis (default 4095) ++ pmin Minimum reported pressure value (default 0) ++ pmax Maximum reported pressure value (default 65535) ++ xohms Touchpanel sensitivity (X-plate resistance) ++ (default 400) ++ ++ penirq is required and usually xohms (60-100) has to be set as well. ++ Apart from that, pmax (255) and swapxy are also common. ++ The rest of the calibration can be done with xinput-calibrator. ++ See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian ++ Device Tree binding document: ++ www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt ++ ++ ++Name: bmp085_i2c-sensor ++Info: Configures the BMP085/BMP180 digital barometric pressure and temperature ++ sensors from Bosch Sensortec ++Load: dtoverlay=bmp085_i2c-sensor ++Params: ++ ++ ++[ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: enc28j60 ++Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) ++Load: dtoverlay=enc28j60,= ++Params: int_pin GPIO used for INT (default 25) ++ ++ speed SPI bus speed (default 12000000) ++ ++ ++Name: hifiberry-amp ++Info: Configures the HifiBerry Amp and Amp+ audio cards ++Load: dtoverlay=hifiberry-amp ++Params: ++ ++ ++Name: hifiberry-dac ++Info: Configures the HifiBerry DAC audio card ++Load: dtoverlay=hifiberry-dac ++Params: ++ ++ ++Name: hifiberry-dacplus ++Info: Configures the HifiBerry DAC+ audio card ++Load: dtoverlay=hifiberry-dacplus ++Params: ++ ++ ++Name: hifiberry-digi ++Info: Configures the HifiBerry Digi audio card ++Load: dtoverlay=hifiberry-digi ++Params: ++ ++ ++Name: hy28a ++Info: HY28A - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28a,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ resetgpio GPIO used to reset controller ++ ++ ledgpio GPIO used to control backlight ++ ++ ++Name: hy28b ++Info: HY28B - 2.8" TFT LCD Display Module by HAOYU Electronics ++ Default values match Texy's display shield ++Load: dtoverlay=hy28b,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ resetgpio GPIO used to reset controller ++ ++ ledgpio GPIO used to control backlight ++ ++ ++Name: i2c-rtc ++Info: Adds support for a number of I2C Real Time Clock devices ++Load: dtoverlay=i2c-rtc, ++Params: ds1307 Select the DS1307 device ++ ++ ds3231 Select the DS3231 device ++ ++ pcf2127 Select the PCF2127 device ++ ++ pcf8523 Select the PCF8523 device ++ ++ pcf8563 Select the PCF8563 device ++ ++ ++Name: iqaudio-dac ++Info: Configures the IQaudio DAC audio card ++Load: dtoverlay=iqaudio-dac ++Params: ++ ++ ++Name: iqaudio-dacplus ++Info: Configures the IQaudio DAC+ audio card ++Load: dtoverlay=iqaudio-dacplus ++Params: ++ ++ ++Name: lirc-rpi ++Info: Configures lirc-rpi (Linux Infrared Remote Control for Raspberry Pi) ++ Consult the module documentation for more details. ++Load: dtoverlay=lirc-rpi,=,... ++Params: gpio_out_pin GPIO for output (default "17") ++ ++ gpio_in_pin GPIO for input (default "18") ++ ++ gpio_in_pull Pull up/down/off on the input pin ++ (default "down") ++ ++ sense Override the IR receive auto-detection logic: ++ "1" = force active high ++ "0" = force active low ++ "-1" = use auto-detection ++ (default "-1") ++ ++ softcarrier Turn the software carrier "on" or "off" ++ (default "on") ++ ++ invert "on" = invert the output pin (default "off") ++ ++ debug "on" = enable additional debug messages ++ (default "off") ++ ++ ++Name: mmc ++Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock ++Load: dtoverlay=mmc,= ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ force_pio Disable DMA support ++ ++ ++Name: mz61581 ++Info: MZ61581 display by Tontec ++Load: dtoverlay=mz61581,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++[ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8523-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++[ The pcf8563-rtc overlay has been deleted. See i2c-rtc. ] ++ ++ ++Name: piscreen ++Info: PiScreen display by OzzMaker.com ++Load: dtoverlay=piscreen,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pitft28-resistive ++Info: Adafruit PiTFT 2.8" resistive touch screen ++Load: dtoverlay=pitft28-resistive,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ ++Name: pps-gpio ++Info: Configures the pps-gpio (pulse-per-second time signal via GPIO). ++Load: dtoverlay=pps-gpio,= ++Params: gpiopin Input GPIO (default "18") ++ ++ ++Name: rpi-dac ++Info: Configures the RPi DAC audio card ++Load: dtoverlay=rpi-dac ++Params: ++ ++ ++Name: rpi-display ++Info: RPi-Display - 2.8" Touch Display by Watterott ++Load: dtoverlay=rpi-display,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ xohms Touchpanel sensitivity (X-plate resistance) ++ ++ ++Name: rpi-proto ++Info: Configures the RPi Proto audio card ++Load: dtoverlay=rpi-proto ++Params: ++ ++ ++Name: sdhost ++Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock ++Load: dtoverlay=sdhost,= ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ force_pio Disable DMA support ++ ++ ++Name: spi-bcm2708 ++Info: Selects the bcm2708-spi SPI driver ++Load: dtoverlay=spi-bcm2708 ++Params: ++ ++ ++Name: spi-bcm2835 ++Info: Selects the bcm2835-spi SPI driver ++Load: dtoverlay=spi-bcm2835 ++Params: ++ ++ ++Name: tinylcd35 ++Info: 3.5" Color TFT Display by www.tinlylcd.com ++ Options: Touch, RTC, keypad ++Load: dtoverlay=tinylcd35,= ++Params: speed Display SPI bus speed ++ ++ rotate Display rotation {0,90,180,270} ++ ++ fps Delay between frame updates ++ ++ debug Debug output level {0-7} ++ ++ touch Enable touch panel ++ ++ touchgpio Touch controller IRQ GPIO ++ ++ xohms Touchpanel: Resistance of X-plate in ohms ++ ++ rtc-pcf PCF8563 Real Time Clock ++ ++ rtc-ds DS1307 Real Time Clock ++ ++ keypad Enable keypad ++ ++ Examples: ++ Display with touchpanel, PCF8563 RTC and keypad: ++ dtoverlay=tinylcd35,touch,rtc-pcf,keypad ++ Old touch display: ++ dtoverlay=tinylcd35,touch,touchgpio=3 ++ ++ ++Name: w1-gpio ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *don't* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio,= ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ ++Name: w1-gpio-pullup ++Info: Configures the w1-gpio Onewire interface module. ++ Use this overlay if you *do* need a GPIO to drive an external pullup. ++Load: dtoverlay=w1-gpio-pullup,=,... ++Params: gpiopin GPIO for I/O (default "4") ++ ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature ++ ++ extpullup GPIO for external pullup (default "5") ++ ++ ++Troubleshooting ++=============== ++ ++If you are experiencing problems that you think are DT-related, enable DT ++diagnostic output by adding this to /boot/config.txt: ++ ++ dtdebug=on ++ ++and rebooting. Then run: ++ ++ sudo vcdbg log msg ++ ++and look for relevant messages. ++ ++Further reading ++=============== ++ ++This is only meant to be a quick introduction to the subject of Device Tree on ++Raspberry Pi. There is a more complete explanation here: ++ ++http://www.raspberrypi.org/documentation/configuration/device-tree.md +diff --git a/arch/arm/boot/dts/overlays/ads7846-overlay.dts b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +new file mode 100644 +index 0000000..6a92cd1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/ads7846-overlay.dts +@@ -0,0 +1,83 @@ ++/* ++ * Generic Device Tree overlay for the ADS7846 touch controller ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ ads7846_pins: ads7846_pins { ++ brcm,pins = <255>; /* illegal default value */ ++ brcm,function = <0>; /* in */ ++ brcm,pull = <0>; /* none */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ads7846: ads7846@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ads7846_pins>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <255 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 255 0>; ++ ++ /* driver defaults */ ++ ti,x-min = /bits/ 16 <0>; ++ ti,y-min = /bits/ 16 <0>; ++ ti,x-max = /bits/ 16 <0x0FFF>; ++ ti,y-max = /bits/ 16 <0x0FFF>; ++ ti,pressure-min = /bits/ 16 <0>; ++ ti,pressure-max = /bits/ 16 <0xFFFF>; ++ ti,x-plate-ohms = /bits/ 16 <400>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ cs = <&ads7846>,"reg:0"; ++ speed = <&ads7846>,"spi-max-frequency:0"; ++ penirq = <&ads7846_pins>,"brcm,pins:0", /* REQUIRED */ ++ <&ads7846>,"interrupts:0", ++ <&ads7846>,"pendown-gpio:4"; ++ penirq_pull = <&ads7846_pins>,"brcm,pull:0"; ++ swapxy = <&ads7846>,"ti,swap-xy?"; ++ xmin = <&ads7846>,"ti,x-min;0"; ++ ymin = <&ads7846>,"ti,y-min;0"; ++ xmax = <&ads7846>,"ti,x-max;0"; ++ ymax = <&ads7846>,"ti,y-max;0"; ++ pmin = <&ads7846>,"ti,pressure-min;0"; ++ pmax = <&ads7846>,"ti,pressure-max;0"; ++ xohms = <&ads7846>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +new file mode 100644 +index 0000000..b830bf2 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/bmp085_i2c-sensor-overlay.dts +@@ -0,0 +1,23 @@ ++// Definitions for BMP085/BMP180 digital barometric pressure and temperature sensors from Bosch Sensortec ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ bmp085@77 { ++ compatible = "bosch,bmp085"; ++ reg = <0x77>; ++ default-oversampling = <3>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts b/arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts +new file mode 100644 +index 0000000..7d27044 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/ds1307-rtc-overlay.dts +@@ -0,0 +1,22 @@ ++// Definitions for DS1307 Real Time Clock ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/enc28j60-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +new file mode 100644 +index 0000000..aa9b645 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/enc28j60-overlay.dts +@@ -0,0 +1,29 @@ ++// Overlay for the Microchip ENC28J60 Ethernet Controller ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ enc28j60@0{ ++ compatible = "microchip,enc28j60"; ++ reg = <0>; /* CE0 */ ++ spi-max-frequency = <12000000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts +new file mode 100644 +index 0000000..2c81448 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Amp/Amp+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-amp"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ tas5713@1b { ++ #sound-dai-cells = <0>; ++ compatible = "ti,tas5713"; ++ reg = <0x1b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +new file mode 100644 +index 0000000..5e7633a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for HiFiBerry DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/"; ++ __overlay__ { ++ pcm5102a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +new file mode 100644 +index 0000000..deb9c625 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry DAC+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-dacplus"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4d { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4d>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +new file mode 100644 +index 0000000..d0e0d8a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for HiFiBerry Digi ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "hifiberry,hifiberry-digi"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hy28a-overlay.dts b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +new file mode 100644 +index 0000000..3cd3083 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hy28a-overlay.dts +@@ -0,0 +1,87 @@ ++/* ++ * Device Tree overlay for HY28A display ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ hy28a_pins: hy28a_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28a: hy28a@0{ ++ compatible = "ilitek,ili9320"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28a_pins>; ++ ++ spi-max-frequency = <32000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ hy28a_ts: hy28a-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&hy28a>,"spi-max-frequency:0"; ++ rotate = <&hy28a>,"rotate:0"; ++ fps = <&hy28a>,"fps:0"; ++ debug = <&hy28a>,"debug:0"; ++ xohms = <&hy28a_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28a>,"reset-gpios:4", ++ <&hy28a_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28a>,"led-gpios:4", ++ <&hy28a_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/hy28b-overlay.dts b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +new file mode 100644 +index 0000000..f774c4a +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/hy28b-overlay.dts +@@ -0,0 +1,142 @@ ++/* ++ * Device Tree overlay for HY28b display shield by Texy ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ hy28b_pins: hy28b_pins { ++ brcm,pins = <17 25 18>; ++ brcm,function = <0 1 1>; /* in out out */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hy28b: hy28b@0{ ++ compatible = "ilitek,ili9325"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&hy28b_pins>; ++ ++ spi-max-frequency = <48000000>; ++ spi-cpol; ++ spi-cpha; ++ rotate = <270>; ++ bgr; ++ fps = <50>; ++ buswidth = <8>; ++ startbyte = <0x70>; ++ reset-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 1>; ++ ++ gamma = "04 1F 4 7 7 0 7 7 6 0\n0F 00 1 7 4 0 0 0 6 7"; ++ ++ init = <0x10000e7 0x0010 ++ 0x1000000 0x0001 ++ 0x1000001 0x0100 ++ 0x1000002 0x0700 ++ 0x1000003 0x1030 ++ 0x1000004 0x0000 ++ 0x1000008 0x0207 ++ 0x1000009 0x0000 ++ 0x100000a 0x0000 ++ 0x100000c 0x0001 ++ 0x100000d 0x0000 ++ 0x100000f 0x0000 ++ 0x1000010 0x0000 ++ 0x1000011 0x0007 ++ 0x1000012 0x0000 ++ 0x1000013 0x0000 ++ 0x2000032 ++ 0x1000010 0x1590 ++ 0x1000011 0x0227 ++ 0x2000032 ++ 0x1000012 0x009c ++ 0x2000032 ++ 0x1000013 0x1900 ++ 0x1000029 0x0023 ++ 0x100002b 0x000e ++ 0x2000032 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000032 ++ 0x1000050 0x0000 ++ 0x1000051 0x00ef ++ 0x1000052 0x0000 ++ 0x1000053 0x013f ++ 0x1000060 0xa700 ++ 0x1000061 0x0001 ++ 0x100006a 0x0000 ++ 0x1000080 0x0000 ++ 0x1000081 0x0000 ++ 0x1000082 0x0000 ++ 0x1000083 0x0000 ++ 0x1000084 0x0000 ++ 0x1000085 0x0000 ++ 0x1000090 0x0010 ++ 0x1000092 0x0000 ++ 0x1000093 0x0003 ++ 0x1000095 0x0110 ++ 0x1000097 0x0000 ++ 0x1000098 0x0000 ++ 0x1000007 0x0133 ++ 0x1000020 0x0000 ++ 0x1000021 0x0000 ++ 0x2000064>; ++ debug = <0>; ++ }; ++ ++ hy28b_ts: hy28b-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&hy28b>,"spi-max-frequency:0"; ++ rotate = <&hy28b>,"rotate:0"; ++ fps = <&hy28b>,"fps:0"; ++ debug = <&hy28b>,"debug:0"; ++ xohms = <&hy28b_ts>,"ti,x-plate-ohms;0"; ++ resetgpio = <&hy28b>,"reset-gpios:4", ++ <&hy28b_pins>, "brcm,pins:1"; ++ ledgpio = <&hy28b>,"led-gpios:4", ++ <&hy28b_pins>, "brcm,pins:2"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +new file mode 100644 +index 0000000..6bccfdc +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -0,0 +1,49 @@ ++// Definitions for several I2C based Real Time Clocks ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ ds3231: ds3231@68 { ++ compatible = "maxim,ds3231"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf2127: pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ pcf8523: pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "disable"; ++ }; ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disable"; ++ }; ++ }; ++ }; ++ __overrides__ { ++ ds1307 = <&ds1307>,"status"; ++ ds3231 = <&ds3231>,"status"; ++ pcf2127 = <&pcf2127>,"status"; ++ pcf8523 = <&pcf8523>,"status"; ++ pcf8563 = <&pcf8563>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +new file mode 100644 +index 0000000..ea8173e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for IQaudIO DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +new file mode 100644 +index 0000000..735d8ab +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for IQaudIO DAC+ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "iqaudio,iqaudio-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcm5122@4c { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5122"; ++ reg = <0x4c>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +new file mode 100644 +index 0000000..7d5d82b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts +@@ -0,0 +1,57 @@ ++// Definitions for lirc-rpi module ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ lirc_rpi: lirc_rpi { ++ compatible = "rpi,lirc-rpi"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&lirc_pins>; ++ status = "okay"; ++ ++ // Override autodetection of IR receiver circuit ++ // (0 = active high, 1 = active low, -1 = no override ) ++ rpi,sense = <0xffffffff>; ++ ++ // Software carrier ++ // (0 = off, 1 = on) ++ rpi,softcarrier = <1>; ++ ++ // Invert output ++ // (0 = off, 1 = on) ++ rpi,invert = <0>; ++ ++ // Enable debugging messages ++ // (0 = off, 1 = on) ++ rpi,debug = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ lirc_pins: lirc_pins { ++ brcm,pins = <17 18>; ++ brcm,function = <1 0>; // out in ++ brcm,pull = <0 1>; // off down ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpio_out_pin = <&lirc_pins>,"brcm,pins:0"; ++ gpio_in_pin = <&lirc_pins>,"brcm,pins:4"; ++ gpio_in_pull = <&lirc_pins>,"brcm,pull:4"; ++ ++ sense = <&lirc_rpi>,"rpi,sense:0"; ++ softcarrier = <&lirc_rpi>,"rpi,softcarrier:0"; ++ invert = <&lirc_rpi>,"rpi,invert:0"; ++ debug = <&lirc_rpi>,"rpi,debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts +new file mode 100644 +index 0000000..0a37cf4 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts +@@ -0,0 +1,19 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&mmc>; ++ ++ __overlay__ { ++ brcm,overclock-50 = <0>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&mmc>,"brcm,overclock-50:0"; ++ force_pio = <&mmc>,"brcm,force-pio?"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +new file mode 100644 +index 0000000..c06fe12 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mz61581-overlay.dts +@@ -0,0 +1,109 @@ ++/* ++ * Device Tree overlay for MZ61581-PI-EXT 2014.12.28 by Tontec ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ mz61581_pins: mz61581_pins { ++ brcm,pins = <4 15 18 25>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ mz61581: mz61581@0{ ++ compatible = "samsung,s6d02a1"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mz61581_pins>; ++ ++ spi-max-frequency = <128000000>; ++ spi-cpol; ++ spi-cpha; ++ ++ width = <320>; ++ height = <480>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ ++ reset-gpios = <&gpio 15 0>; ++ dc-gpios = <&gpio 25 0>; ++ led-gpios = <&gpio 18 0>; ++ ++ init = <0x10000b0 00 ++ 0x1000011 ++ 0x20000ff ++ 0x10000b3 0x02 0x00 0x00 0x00 ++ 0x10000c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43 ++ 0x10000c1 0x08 0x16 0x08 0x08 ++ 0x10000c4 0x11 0x07 0x03 0x03 ++ 0x10000c6 0x00 ++ 0x10000c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00 ++ 0x1000035 0x00 ++ 0x1000036 0xa0 ++ 0x100003a 0x55 ++ 0x1000044 0x00 0x01 ++ 0x10000d0 0x07 0x07 0x1d 0x03 ++ 0x10000d1 0x03 0x30 0x10 ++ 0x10000d2 0x03 0x14 0x04 ++ 0x1000029 ++ 0x100002c>; ++ ++ /* This is a workaround to make sure the init sequence slows down and doesn't fail */ ++ debug = <3>; ++ }; ++ ++ mz61581_ts: mz61581_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <4 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 4 0>; ++ ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&mz61581>, "spi-max-frequency:0"; ++ rotate = <&mz61581>, "rotate:0"; ++ fps = <&mz61581>, "fps:0"; ++ debug = <&mz61581>, "debug:0"; ++ xohms = <&mz61581_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts b/arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts +new file mode 100644 +index 0000000..01fc81d +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pcf2127-rtc-overlay.dts +@@ -0,0 +1,22 @@ ++// Definitions for PCF2127 Real Time Clock ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts b/arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts +new file mode 100644 +index 0000000..0071f62 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pcf8523-rtc-overlay.dts +@@ -0,0 +1,22 @@ ++// Definitions for PCF8523 Real Time Clock ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +new file mode 100644 +index 0000000..b7fd7ea +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -0,0 +1,94 @@ ++/* ++ * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ piscreen_pins: piscreen_pins { ++ brcm,pins = <17 25 24 22>; ++ brcm,function = <0 1 1 1>; /* in out out out */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ piscreen: piscreen@0{ ++ compatible = "ilitek,ili9486"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&piscreen_pins>; ++ ++ spi-max-frequency = <24000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ regwidth = <16>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 22 1>; ++ debug = <0>; ++ ++ init = <0x10000b0 0x00 ++ 0x1000011 ++ 0x20000ff ++ 0x100003a 0x55 ++ 0x1000036 0x28 ++ 0x10000c2 0x44 ++ 0x10000c5 0x00 0x00 0x00 0x00 ++ 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 ++ 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 ++ 0x1000011 ++ 0x1000029>; ++ }; ++ ++ piscreen-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <17 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 17 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&piscreen>,"spi-max-frequency:0"; ++ rotate = <&piscreen>,"rotate:0"; ++ fps = <&piscreen>,"fps:0"; ++ debug = <&piscreen>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +new file mode 100644 +index 0000000..d506eae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pitft28-resistive-overlay.dts +@@ -0,0 +1,115 @@ ++/* ++ * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pitft_pins: pitft_pins { ++ brcm,pins = <24 25>; ++ brcm,function = <0 1>; /* in out */ ++ brcm,pull = <2 0>; /* pullup none */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pitft: pitft@0{ ++ compatible = "ilitek,ili9340"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pitft_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <90>; ++ fps = <25>; ++ bgr; ++ buswidth = <8>; ++ dc-gpios = <&gpio 25 0>; ++ debug = <0>; ++ }; ++ ++ pitft_ts@1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "st,stmpe610"; ++ reg = <1>; ++ ++ spi-max-frequency = <500000>; ++ irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ ++ interrupts = <24 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ interrupt-controller; ++ ++ stmpe_touchscreen { ++ compatible = "st,stmpe-ts"; ++ st,sample-time = <4>; ++ st,mod-12b = <1>; ++ st,ref-sel = <0>; ++ st,adc-freq = <2>; ++ st,ave-ctrl = <3>; ++ st,touch-det-delay = <4>; ++ st,settling = <2>; ++ st,fraction-z = <7>; ++ st,i-drive = <0>; ++ }; ++ ++ stmpe_gpio: stmpe_gpio { ++ #gpio-cells = <2>; ++ compatible = "st,stmpe-gpio"; ++ /* ++ * only GPIO2 is wired/available ++ * and it is wired to the backlight ++ */ ++ st,norequest-mask = <0x7b>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/soc"; ++ __overlay__ { ++ backlight { ++ compatible = "gpio-backlight"; ++ gpios = <&stmpe_gpio 2 0>; ++ default-on; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&pitft>,"spi-max-frequency:0"; ++ rotate = <&pitft>,"rotate:0"; ++ fps = <&pitft>,"fps:0"; ++ debug = <&pitft>,"debug:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +new file mode 100644 +index 0000000..40bf0e1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/pps-gpio-overlay.dts +@@ -0,0 +1,34 @@ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ pps: pps { ++ compatible = "pps-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pps_pins>; ++ gpios = <&gpio 18 0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ pps_pins: pps_pins { ++ brcm,pins = <18>; ++ brcm,function = <0>; // in ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&pps>,"gpios:4", ++ <&pps_pins>,"brcm,pins:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +new file mode 100644 +index 0000000..7fc6ac9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts +@@ -0,0 +1,34 @@ ++// Definitions for RPi DAC ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-dac"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target-path = "/"; ++ __overlay__ { ++ pcm1794a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm1794a"; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +new file mode 100644 +index 0000000..a8fa974 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts +@@ -0,0 +1,82 @@ ++/* ++ * Device Tree overlay for rpi-display by Watterott ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ rpi_display_pins: rpi_display_pins { ++ brcm,pins = <18 23 24 25>; ++ brcm,function = <1 1 1 0>; /* out out out in */ ++ brcm,pull = <0 0 0 2>; /* - - - up */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rpidisplay: rpi-display@0{ ++ compatible = "ilitek,ili9341"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rpi_display_pins>; ++ ++ spi-max-frequency = <32000000>; ++ rotate = <270>; ++ bgr; ++ fps = <30>; ++ buswidth = <8>; ++ reset-gpios = <&gpio 23 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ }; ++ ++ rpidisplay_ts: rpi-display-ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <25 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 25 0>; ++ ti,x-plate-ohms = /bits/ 16 <60>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ speed = <&rpidisplay>,"spi-max-frequency:0"; ++ rotate = <&rpidisplay>,"rotate:0"; ++ fps = <&rpidisplay>,"fps:0"; ++ debug = <&rpidisplay>,"debug:0"; ++ xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +new file mode 100644 +index 0000000..2029930 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-proto-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for Rpi-Proto ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "rpi,rpi-proto"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8731@1a { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8731"; ++ reg = <0x1a>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +new file mode 100644 +index 0000000..b2653e9 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -0,0 +1,75 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&soc>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ sdhost: sdhost@7e202000 { ++ compatible = "brcm,bcm2835-sdhost"; ++ reg = <0x7e202000 0x100>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ interrupts = <2 24>; ++ clocks = <&clk_sdhost>; ++ dmas = <&dma 13>, ++ <&dma 13>; ++ dma-names = "tx", "rx"; ++ brcm,delay-after-stop = <0>; ++ brcm,overclock-50 = <0>; ++ status = "okay"; ++ }; ++ ++ clocks { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ clk_sdhost: clock@3 { ++ compatible = "fixed-clock"; ++ reg = <0>; ++ #clock-cells = <0>; ++ clock-output-names = "sdhost"; ++ clock-frequency = <250000000>; ++ }; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&mmc>; ++ __overlay__ { ++ /* Find a way to disable the other driver */ ++ compatible = ""; ++ status = "disabled"; ++ }; ++ }; ++ ++ fragment@3 { ++ target-path = "/__overrides__"; ++ __overlay__ { ++ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; ++ }; ++ }; ++ ++ __overrides__ { ++ delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; ++ overclock_50 = <&sdhost>,"brcm,overclock-50:0"; ++ force_pio = <&sdhost>,"brcm,force-pio?"; ++ sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e378ef1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi-bcm2708-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay for spi-bcm2835 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* setting up compatiblity to allow loading the spi-bcm2835 driver */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ compatible = "brcm,bcm2708-spi"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts b/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts +new file mode 100644 +index 0000000..fc1e39b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi-bcm2835-overlay.dts +@@ -0,0 +1,18 @@ ++/* ++ * Device tree overlay for spi-bcm2835 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* setting up compatiblity to allow loading the spi-bcm2835 driver */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ compatible = "brcm,bcm2835-spi"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +new file mode 100644 +index 0000000..f7102c8 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/tinylcd35-overlay.dts +@@ -0,0 +1,216 @@ ++/* ++ * tinylcd35-overlay.dts ++ * ++ * ------------------------------------------------- ++ * www.tinlylcd.com ++ * ------------------------------------------------- ++ * Device---Driver-----BUS GPIO's ++ * display tinylcd35 spi0.0 25 24 18 ++ * touch ads7846 spi0.1 5 ++ * rtc ds1307 i2c1-0068 ++ * rtc pcf8563 i2c1-0051 ++ * keypad gpio-keys --------- 17 22 27 23 28 ++ * ++ * ++ * TinyLCD.com 3.5 inch TFT ++ * ++ * Version 001 ++ * 5/3/2015 -- Noralf Trønnes Initial Device tree framework ++ * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ ++ spidev@0{ ++ status = "disabled"; ++ }; ++ ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ tinylcd35_pins: tinylcd35_pins { ++ brcm,pins = <25 24 18>; ++ brcm,function = <1>; /* out */ ++ }; ++ tinylcd35_ts_pins: tinylcd35_ts_pins { ++ brcm,pins = <5>; ++ brcm,function = <0>; /* in */ ++ }; ++ keypad_pins: keypad_pins { ++ brcm,pins = <4 17 22 23 27>; ++ brcm,function = <0>; /* in */ ++ brcm,pull = <1>; /* down */ ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ tinylcd35: tinylcd35@0{ ++ compatible = "neosec,tinylcd"; ++ reg = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&tinylcd35_pins>, ++ <&tinylcd35_ts_pins>; ++ ++ spi-max-frequency = <48000000>; ++ rotate = <270>; ++ fps = <20>; ++ bgr; ++ buswidth = <8>; ++ reset-gpios = <&gpio 25 0>; ++ dc-gpios = <&gpio 24 0>; ++ led-gpios = <&gpio 18 1>; ++ debug = <0>; ++ ++ init = <0x10000B0 0x80 ++ 0x10000C0 0x0A 0x0A ++ 0x10000C1 0x01 0x01 ++ 0x10000C2 0x33 ++ 0x10000C5 0x00 0x42 0x80 ++ 0x10000B1 0xD0 0x11 ++ 0x10000B4 0x02 ++ 0x10000B6 0x00 0x22 0x3B ++ 0x10000B7 0x07 ++ 0x1000036 0x58 ++ 0x10000F0 0x36 0xA5 0xD3 ++ 0x10000E5 0x80 ++ 0x10000E5 0x01 ++ 0x10000B3 0x00 ++ 0x10000E5 0x00 ++ 0x10000F0 0x36 0xA5 0x53 ++ 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 ++ 0x100003A 0x55 ++ 0x1000011 ++ 0x2000001 ++ 0x1000029>; ++ }; ++ ++ tinylcd35_ts: tinylcd35_ts@1 { ++ compatible = "ti,ads7846"; ++ reg = <1>; ++ status = "disabled"; ++ ++ spi-max-frequency = <2000000>; ++ interrupts = <5 2>; /* high-to-low edge triggered */ ++ interrupt-parent = <&gpio>; ++ pendown-gpio = <&gpio 5 0>; ++ ti,x-plate-ohms = /bits/ 16 <100>; ++ ti,pressure-max = /bits/ 16 <255>; ++ }; ++ }; ++ }; ++ ++ /* RTC */ ++ ++ fragment@3 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* ++ * Values for input event code is found under the ++ * 'Keys and buttons' heading in include/uapi/linux/input.h ++ */ ++ fragment@5 { ++ target-path = "/soc"; ++ __overlay__ { ++ keypad: keypad { ++ compatible = "gpio-keys"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&keypad_pins>; ++ status = "disabled"; ++ autorepeat; ++ ++ button@17 { ++ label = "GPIO KEY_UP"; ++ linux,code = <103>; ++ gpios = <&gpio 17 0>; ++ }; ++ button@22 { ++ label = "GPIO KEY_DOWN"; ++ linux,code = <108>; ++ gpios = <&gpio 22 0>; ++ }; ++ button@27 { ++ label = "GPIO KEY_LEFT"; ++ linux,code = <105>; ++ gpios = <&gpio 27 0>; ++ }; ++ button@23 { ++ label = "GPIO KEY_RIGHT"; ++ linux,code = <106>; ++ gpios = <&gpio 23 0>; ++ }; ++ button@4 { ++ label = "GPIO KEY_ENTER"; ++ linux,code = <28>; ++ gpios = <&gpio 4 0>; ++ }; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ speed = <&tinylcd35>,"spi-max-frequency:0"; ++ rotate = <&tinylcd35>,"rotate:0"; ++ fps = <&tinylcd35>,"fps:0"; ++ debug = <&tinylcd35>,"debug:0"; ++ touch = <&tinylcd35_ts>,"status"; ++ touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", ++ <&tinylcd35_ts>,"interrupts:0", ++ <&tinylcd35_ts>,"pendown-gpio:4"; ++ xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; ++ rtc-pcf = <&i2c1>,"status", ++ <&pcf8563>,"status"; ++ rtc-ds = <&i2c1>,"status", ++ <&ds1307>,"status"; ++ keypad = <&keypad>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +new file mode 100644 +index 0000000..29a3b48 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-overlay.dts +@@ -0,0 +1,39 @@ ++// Definitions for w1-gpio module (without external pullup) ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4>; ++ brcm,function = <0>; // in (initially) ++ brcm,pull = <0>; // off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +new file mode 100644 +index 0000000..66a98f6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/w1-gpio-pullup-overlay.dts +@@ -0,0 +1,41 @@ ++// Definitions for w1-gpio module (with external pullup) ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target-path = "/"; ++ __overlay__ { ++ ++ w1: onewire@0 { ++ compatible = "w1-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&w1_pins>; ++ gpios = <&gpio 4 0>, <&gpio 5 1>; ++ rpi,parasitic-power = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ w1_pins: w1_pins { ++ brcm,pins = <4 5>; ++ brcm,function = <0 1>; // in out ++ brcm,pull = <0 0>; // off off ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ gpiopin = <&w1>,"gpios:4", ++ <&w1_pins>,"brcm,pins:0"; ++ extpullup = <&w1>,"gpios:16", ++ <&w1_pins>,"brcm,pins:4"; ++ pullup = <&w1>,"rpi,parasitic-power:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/pcf2127-rtc-overlay.dts b/arch/arm/boot/dts/pcf2127-rtc-overlay.dts +deleted file mode 100644 +index 01fc81d..0000000 +--- a/arch/arm/boot/dts/pcf2127-rtc-overlay.dts ++++ /dev/null +@@ -1,22 +0,0 @@ +-// Definitions for PCF2127 Real Time Clock +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcf2127@51 { +- compatible = "nxp,pcf2127"; +- reg = <0x51>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/pcf8523-rtc-overlay.dts b/arch/arm/boot/dts/pcf8523-rtc-overlay.dts +deleted file mode 100644 +index 0071f62..0000000 +--- a/arch/arm/boot/dts/pcf8523-rtc-overlay.dts ++++ /dev/null +@@ -1,22 +0,0 @@ +-// Definitions for PCF8523 Real Time Clock +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- pcf8523@68 { +- compatible = "nxp,pcf8523"; +- reg = <0x68>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/piscreen-overlay.dts b/arch/arm/boot/dts/piscreen-overlay.dts +deleted file mode 100644 +index b7fd7ea..0000000 +--- a/arch/arm/boot/dts/piscreen-overlay.dts ++++ /dev/null +@@ -1,94 +0,0 @@ +-/* +- * Device Tree overlay for PiScreen 3.5" display shield by Ozzmaker +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- piscreen_pins: piscreen_pins { +- brcm,pins = <17 25 24 22>; +- brcm,function = <0 1 1 1>; /* in out out out */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- piscreen: piscreen@0{ +- compatible = "ilitek,ili9486"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&piscreen_pins>; +- +- spi-max-frequency = <24000000>; +- rotate = <270>; +- bgr; +- fps = <30>; +- buswidth = <8>; +- regwidth = <16>; +- reset-gpios = <&gpio 25 0>; +- dc-gpios = <&gpio 24 0>; +- led-gpios = <&gpio 22 1>; +- debug = <0>; +- +- init = <0x10000b0 0x00 +- 0x1000011 +- 0x20000ff +- 0x100003a 0x55 +- 0x1000036 0x28 +- 0x10000c2 0x44 +- 0x10000c5 0x00 0x00 0x00 0x00 +- 0x10000e0 0x0f 0x1f 0x1c 0x0c 0x0f 0x08 0x48 0x98 0x37 0x0a 0x13 0x04 0x11 0x0d 0x00 +- 0x10000e1 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 +- 0x10000e2 0x0f 0x32 0x2e 0x0b 0x0d 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 +- 0x1000011 +- 0x1000029>; +- }; +- +- piscreen-ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <17 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 17 0>; +- ti,x-plate-ohms = /bits/ 16 <100>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&piscreen>,"spi-max-frequency:0"; +- rotate = <&piscreen>,"rotate:0"; +- fps = <&piscreen>,"fps:0"; +- debug = <&piscreen>,"debug:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/pitft28-resistive-overlay.dts b/arch/arm/boot/dts/pitft28-resistive-overlay.dts +deleted file mode 100644 +index d506eae..0000000 +--- a/arch/arm/boot/dts/pitft28-resistive-overlay.dts ++++ /dev/null +@@ -1,115 +0,0 @@ +-/* +- * Device Tree overlay for Adafruit PiTFT 2.8" resistive touch screen +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- pitft_pins: pitft_pins { +- brcm,pins = <24 25>; +- brcm,function = <0 1>; /* in out */ +- brcm,pull = <2 0>; /* pullup none */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- pitft: pitft@0{ +- compatible = "ilitek,ili9340"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&pitft_pins>; +- +- spi-max-frequency = <32000000>; +- rotate = <90>; +- fps = <25>; +- bgr; +- buswidth = <8>; +- dc-gpios = <&gpio 25 0>; +- debug = <0>; +- }; +- +- pitft_ts@1 { +- #address-cells = <1>; +- #size-cells = <0>; +- compatible = "st,stmpe610"; +- reg = <1>; +- +- spi-max-frequency = <500000>; +- irq-gpio = <&gpio 24 0x2>; /* IRQF_TRIGGER_FALLING */ +- interrupts = <24 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- interrupt-controller; +- +- stmpe_touchscreen { +- compatible = "st,stmpe-ts"; +- st,sample-time = <4>; +- st,mod-12b = <1>; +- st,ref-sel = <0>; +- st,adc-freq = <2>; +- st,ave-ctrl = <3>; +- st,touch-det-delay = <4>; +- st,settling = <2>; +- st,fraction-z = <7>; +- st,i-drive = <0>; +- }; +- +- stmpe_gpio: stmpe_gpio { +- #gpio-cells = <2>; +- compatible = "st,stmpe-gpio"; +- /* +- * only GPIO2 is wired/available +- * and it is wired to the backlight +- */ +- st,norequest-mask = <0x7b>; +- }; +- }; +- }; +- }; +- +- fragment@3 { +- target-path = "/soc"; +- __overlay__ { +- backlight { +- compatible = "gpio-backlight"; +- gpios = <&stmpe_gpio 2 0>; +- default-on; +- }; +- }; +- }; +- +- __overrides__ { +- speed = <&pitft>,"spi-max-frequency:0"; +- rotate = <&pitft>,"rotate:0"; +- fps = <&pitft>,"fps:0"; +- debug = <&pitft>,"debug:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/pps-gpio-overlay.dts b/arch/arm/boot/dts/pps-gpio-overlay.dts +deleted file mode 100644 +index 40bf0e1..0000000 +--- a/arch/arm/boot/dts/pps-gpio-overlay.dts ++++ /dev/null +@@ -1,34 +0,0 @@ +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- fragment@0 { +- target-path = "/"; +- __overlay__ { +- pps: pps { +- compatible = "pps-gpio"; +- pinctrl-names = "default"; +- pinctrl-0 = <&pps_pins>; +- gpios = <&gpio 18 0>; +- status = "okay"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- pps_pins: pps_pins { +- brcm,pins = <18>; +- brcm,function = <0>; // in +- brcm,pull = <0>; // off +- }; +- }; +- }; +- +- __overrides__ { +- gpiopin = <&pps>,"gpios:4", +- <&pps_pins>,"brcm,pins:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/rpi-dac-overlay.dts b/arch/arm/boot/dts/rpi-dac-overlay.dts +deleted file mode 100644 +index 7fc6ac9..0000000 +--- a/arch/arm/boot/dts/rpi-dac-overlay.dts ++++ /dev/null +@@ -1,34 +0,0 @@ +-// Definitions for RPi DAC +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "rpi,rpi-dac"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target-path = "/"; +- __overlay__ { +- pcm1794a-codec { +- #sound-dai-cells = <0>; +- compatible = "ti,pcm1794a"; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/rpi-display-overlay.dts b/arch/arm/boot/dts/rpi-display-overlay.dts +deleted file mode 100644 +index a8fa974..0000000 +--- a/arch/arm/boot/dts/rpi-display-overlay.dts ++++ /dev/null +@@ -1,82 +0,0 @@ +-/* +- * Device Tree overlay for rpi-display by Watterott +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- rpi_display_pins: rpi_display_pins { +- brcm,pins = <18 23 24 25>; +- brcm,function = <1 1 1 0>; /* out out out in */ +- brcm,pull = <0 0 0 2>; /* - - - up */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- rpidisplay: rpi-display@0{ +- compatible = "ilitek,ili9341"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&rpi_display_pins>; +- +- spi-max-frequency = <32000000>; +- rotate = <270>; +- bgr; +- fps = <30>; +- buswidth = <8>; +- reset-gpios = <&gpio 23 0>; +- dc-gpios = <&gpio 24 0>; +- led-gpios = <&gpio 18 1>; +- debug = <0>; +- }; +- +- rpidisplay_ts: rpi-display-ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- +- spi-max-frequency = <2000000>; +- interrupts = <25 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 25 0>; +- ti,x-plate-ohms = /bits/ 16 <60>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- __overrides__ { +- speed = <&rpidisplay>,"spi-max-frequency:0"; +- rotate = <&rpidisplay>,"rotate:0"; +- fps = <&rpidisplay>,"fps:0"; +- debug = <&rpidisplay>,"debug:0"; +- xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/rpi-proto-overlay.dts b/arch/arm/boot/dts/rpi-proto-overlay.dts +deleted file mode 100644 +index 2029930..0000000 +--- a/arch/arm/boot/dts/rpi-proto-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for Rpi-Proto +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&sound>; +- __overlay__ { +- compatible = "rpi,rpi-proto"; +- i2s-controller = <&i2s>; +- status = "okay"; +- }; +- }; +- +- fragment@1 { +- target = <&i2s>; +- __overlay__ { +- status = "okay"; +- }; +- }; +- +- fragment@2 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- status = "okay"; +- +- wm8731@1a { +- #sound-dai-cells = <0>; +- compatible = "wlf,wm8731"; +- reg = <0x1a>; +- status = "okay"; +- }; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/sdhost-overlay.dts b/arch/arm/boot/dts/sdhost-overlay.dts +deleted file mode 100644 +index b2653e9..0000000 +--- a/arch/arm/boot/dts/sdhost-overlay.dts ++++ /dev/null +@@ -1,75 +0,0 @@ +-/dts-v1/; +-/plugin/; +- +-/{ +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target = <&soc>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <1>; +- +- sdhost: sdhost@7e202000 { +- compatible = "brcm,bcm2835-sdhost"; +- reg = <0x7e202000 0x100>; +- pinctrl-names = "default"; +- pinctrl-0 = <&sdhost_pins>; +- interrupts = <2 24>; +- clocks = <&clk_sdhost>; +- dmas = <&dma 13>, +- <&dma 13>; +- dma-names = "tx", "rx"; +- brcm,delay-after-stop = <0>; +- brcm,overclock-50 = <0>; +- status = "okay"; +- }; +- +- clocks { +- #address-cells = <1>; +- #size-cells = <0>; +- +- clk_sdhost: clock@3 { +- compatible = "fixed-clock"; +- reg = <0>; +- #clock-cells = <0>; +- clock-output-names = "sdhost"; +- clock-frequency = <250000000>; +- }; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- sdhost_pins: sdhost_pins { +- brcm,pins = <48 49 50 51 52 53>; +- brcm,function = <4>; /* alt0 */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&mmc>; +- __overlay__ { +- /* Find a way to disable the other driver */ +- compatible = ""; +- status = "disabled"; +- }; +- }; +- +- fragment@3 { +- target-path = "/__overrides__"; +- __overlay__ { +- sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; +- }; +- }; +- +- __overrides__ { +- delay_after_stop = <&sdhost>,"brcm,delay-after-stop:0"; +- overclock_50 = <&sdhost>,"brcm,overclock-50:0"; +- force_pio = <&sdhost>,"brcm,force-pio?"; +- sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/spi-bcm2708-overlay.dts b/arch/arm/boot/dts/spi-bcm2708-overlay.dts +deleted file mode 100644 +index e378ef1..0000000 +--- a/arch/arm/boot/dts/spi-bcm2708-overlay.dts ++++ /dev/null +@@ -1,18 +0,0 @@ +-/* +- * Device tree overlay for spi-bcm2835 +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; +- /* setting up compatiblity to allow loading the spi-bcm2835 driver */ +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- compatible = "brcm,bcm2708-spi"; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/spi-bcm2835-overlay.dts b/arch/arm/boot/dts/spi-bcm2835-overlay.dts +deleted file mode 100644 +index fc1e39b..0000000 +--- a/arch/arm/boot/dts/spi-bcm2835-overlay.dts ++++ /dev/null +@@ -1,18 +0,0 @@ +-/* +- * Device tree overlay for spi-bcm2835 +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; +- /* setting up compatiblity to allow loading the spi-bcm2835 driver */ +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- compatible = "brcm,bcm2835-spi"; +- }; +- }; +-}; +diff --git a/arch/arm/boot/dts/tinylcd35-overlay.dts b/arch/arm/boot/dts/tinylcd35-overlay.dts +deleted file mode 100644 +index f7102c8..0000000 +--- a/arch/arm/boot/dts/tinylcd35-overlay.dts ++++ /dev/null +@@ -1,216 +0,0 @@ +-/* +- * tinylcd35-overlay.dts +- * +- * ------------------------------------------------- +- * www.tinlylcd.com +- * ------------------------------------------------- +- * Device---Driver-----BUS GPIO's +- * display tinylcd35 spi0.0 25 24 18 +- * touch ads7846 spi0.1 5 +- * rtc ds1307 i2c1-0068 +- * rtc pcf8563 i2c1-0051 +- * keypad gpio-keys --------- 17 22 27 23 28 +- * +- * +- * TinyLCD.com 3.5 inch TFT +- * +- * Version 001 +- * 5/3/2015 -- Noralf Trønnes Initial Device tree framework +- * 10/3/2015 -- tinylcd@gmail.com added ds1307 support. +- * +- */ +- +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; +- +- fragment@0 { +- target = <&spi0>; +- __overlay__ { +- status = "okay"; +- +- spidev@0{ +- status = "disabled"; +- }; +- +- spidev@1{ +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- tinylcd35_pins: tinylcd35_pins { +- brcm,pins = <25 24 18>; +- brcm,function = <1>; /* out */ +- }; +- tinylcd35_ts_pins: tinylcd35_ts_pins { +- brcm,pins = <5>; +- brcm,function = <0>; /* in */ +- }; +- keypad_pins: keypad_pins { +- brcm,pins = <4 17 22 23 27>; +- brcm,function = <0>; /* in */ +- brcm,pull = <1>; /* down */ +- }; +- }; +- }; +- +- fragment@2 { +- target = <&spi0>; +- __overlay__ { +- /* needed to avoid dtc warning */ +- #address-cells = <1>; +- #size-cells = <0>; +- +- tinylcd35: tinylcd35@0{ +- compatible = "neosec,tinylcd"; +- reg = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&tinylcd35_pins>, +- <&tinylcd35_ts_pins>; +- +- spi-max-frequency = <48000000>; +- rotate = <270>; +- fps = <20>; +- bgr; +- buswidth = <8>; +- reset-gpios = <&gpio 25 0>; +- dc-gpios = <&gpio 24 0>; +- led-gpios = <&gpio 18 1>; +- debug = <0>; +- +- init = <0x10000B0 0x80 +- 0x10000C0 0x0A 0x0A +- 0x10000C1 0x01 0x01 +- 0x10000C2 0x33 +- 0x10000C5 0x00 0x42 0x80 +- 0x10000B1 0xD0 0x11 +- 0x10000B4 0x02 +- 0x10000B6 0x00 0x22 0x3B +- 0x10000B7 0x07 +- 0x1000036 0x58 +- 0x10000F0 0x36 0xA5 0xD3 +- 0x10000E5 0x80 +- 0x10000E5 0x01 +- 0x10000B3 0x00 +- 0x10000E5 0x00 +- 0x10000F0 0x36 0xA5 0x53 +- 0x10000E0 0x00 0x35 0x33 0x00 0x00 0x00 0x00 0x35 0x33 0x00 0x00 0x00 +- 0x100003A 0x55 +- 0x1000011 +- 0x2000001 +- 0x1000029>; +- }; +- +- tinylcd35_ts: tinylcd35_ts@1 { +- compatible = "ti,ads7846"; +- reg = <1>; +- status = "disabled"; +- +- spi-max-frequency = <2000000>; +- interrupts = <5 2>; /* high-to-low edge triggered */ +- interrupt-parent = <&gpio>; +- pendown-gpio = <&gpio 5 0>; +- ti,x-plate-ohms = /bits/ 16 <100>; +- ti,pressure-max = /bits/ 16 <255>; +- }; +- }; +- }; +- +- /* RTC */ +- +- fragment@3 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- +- pcf8563: pcf8563@51 { +- compatible = "nxp,pcf8563"; +- reg = <0x51>; +- status = "disabled"; +- }; +- }; +- }; +- +- fragment@4 { +- target = <&i2c1>; +- __overlay__ { +- #address-cells = <1>; +- #size-cells = <0>; +- +- ds1307: ds1307@68 { +- compatible = "maxim,ds1307"; +- reg = <0x68>; +- status = "disabled"; +- }; +- }; +- }; +- +- /* +- * Values for input event code is found under the +- * 'Keys and buttons' heading in include/uapi/linux/input.h +- */ +- fragment@5 { +- target-path = "/soc"; +- __overlay__ { +- keypad: keypad { +- compatible = "gpio-keys"; +- #address-cells = <1>; +- #size-cells = <0>; +- pinctrl-names = "default"; +- pinctrl-0 = <&keypad_pins>; +- status = "disabled"; +- autorepeat; +- +- button@17 { +- label = "GPIO KEY_UP"; +- linux,code = <103>; +- gpios = <&gpio 17 0>; +- }; +- button@22 { +- label = "GPIO KEY_DOWN"; +- linux,code = <108>; +- gpios = <&gpio 22 0>; +- }; +- button@27 { +- label = "GPIO KEY_LEFT"; +- linux,code = <105>; +- gpios = <&gpio 27 0>; +- }; +- button@23 { +- label = "GPIO KEY_RIGHT"; +- linux,code = <106>; +- gpios = <&gpio 23 0>; +- }; +- button@4 { +- label = "GPIO KEY_ENTER"; +- linux,code = <28>; +- gpios = <&gpio 4 0>; +- }; +- }; +- }; +- }; +- +- __overrides__ { +- speed = <&tinylcd35>,"spi-max-frequency:0"; +- rotate = <&tinylcd35>,"rotate:0"; +- fps = <&tinylcd35>,"fps:0"; +- debug = <&tinylcd35>,"debug:0"; +- touch = <&tinylcd35_ts>,"status"; +- touchgpio = <&tinylcd35_ts_pins>,"brcm,pins:0", +- <&tinylcd35_ts>,"interrupts:0", +- <&tinylcd35_ts>,"pendown-gpio:4"; +- xohms = <&tinylcd35_ts>,"ti,x-plate-ohms;0"; +- rtc-pcf = <&i2c1>,"status", +- <&pcf8563>,"status"; +- rtc-ds = <&i2c1>,"status", +- <&ds1307>,"status"; +- keypad = <&keypad>,"status"; +- }; +-}; +diff --git a/arch/arm/boot/dts/w1-gpio-overlay.dts b/arch/arm/boot/dts/w1-gpio-overlay.dts +deleted file mode 100644 +index 29a3b48..0000000 +--- a/arch/arm/boot/dts/w1-gpio-overlay.dts ++++ /dev/null +@@ -1,39 +0,0 @@ +-// Definitions for w1-gpio module (without external pullup) +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target-path = "/"; +- __overlay__ { +- +- w1: onewire@0 { +- compatible = "w1-gpio"; +- pinctrl-names = "default"; +- pinctrl-0 = <&w1_pins>; +- gpios = <&gpio 4 0>; +- rpi,parasitic-power = <0>; +- status = "okay"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- w1_pins: w1_pins { +- brcm,pins = <4>; +- brcm,function = <0>; // in (initially) +- brcm,pull = <0>; // off +- }; +- }; +- }; +- +- __overrides__ { +- gpiopin = <&w1>,"gpios:4", +- <&w1_pins>,"brcm,pins:0"; +- pullup = <&w1>,"rpi,parasitic-power:0"; +- }; +-}; +diff --git a/arch/arm/boot/dts/w1-gpio-pullup-overlay.dts b/arch/arm/boot/dts/w1-gpio-pullup-overlay.dts +deleted file mode 100644 +index 66a98f6..0000000 +--- a/arch/arm/boot/dts/w1-gpio-pullup-overlay.dts ++++ /dev/null +@@ -1,41 +0,0 @@ +-// Definitions for w1-gpio module (with external pullup) +-/dts-v1/; +-/plugin/; +- +-/ { +- compatible = "brcm,bcm2708"; +- +- fragment@0 { +- target-path = "/"; +- __overlay__ { +- +- w1: onewire@0 { +- compatible = "w1-gpio"; +- pinctrl-names = "default"; +- pinctrl-0 = <&w1_pins>; +- gpios = <&gpio 4 0>, <&gpio 5 1>; +- rpi,parasitic-power = <0>; +- status = "okay"; +- }; +- }; +- }; +- +- fragment@1 { +- target = <&gpio>; +- __overlay__ { +- w1_pins: w1_pins { +- brcm,pins = <4 5>; +- brcm,function = <0 1>; // in out +- brcm,pull = <0 0>; // off off +- }; +- }; +- }; +- +- __overrides__ { +- gpiopin = <&w1>,"gpios:4", +- <&w1_pins>,"brcm,pins:0"; +- extpullup = <&w1>,"gpios:16", +- <&w1_pins>,"brcm,pins:4"; +- pullup = <&w1>,"rpi,parasitic-power:0"; +- }; +-}; + +From 9c2920928cae9f7d35cb3c0e4f677b7f266a7ae3 Mon Sep 17 00:00:00 2001 +From: mwilliams03 +Date: Fri, 3 Apr 2015 12:40:10 +0000 +Subject: [PATCH 192/216] Swap X Y axis of ads7846 touchscreen controller for + PiScreen TFT + +--- + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +index b7fd7ea..be1e2ec 100644 +--- a/arch/arm/boot/dts/overlays/piscreen-overlay.dts ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -80,6 +80,7 @@ + interrupts = <17 2>; /* high-to-low edge triggered */ + interrupt-parent = <&gpio>; + pendown-gpio = <&gpio 17 0>; ++ ti,swap-xy; + ti,x-plate-ohms = /bits/ 16 <100>; + ti,pressure-max = /bits/ 16 <255>; + }; + +From a4d119709c817d2bf6caea401b8266f55ad861c2 Mon Sep 17 00:00:00 2001 +From: mwilliams03 +Date: Wed, 8 Apr 2015 01:13:47 +0000 +Subject: [PATCH 193/216] Added optional parameter to set resistance of touch + plate(x-plate-ohms) + +--- + arch/arm/boot/dts/overlays/README | 2 ++ + arch/arm/boot/dts/overlays/piscreen-overlay.dts | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index c260612..9d4f283 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -329,6 +329,8 @@ Params: speed Display SPI bus speed + + debug Debug output level {0-7} + ++ xohms Touchpanel sensitivity (X-plate resistance) ++ + + Name: pitft28-resistive + Info: Adafruit PiTFT 2.8" resistive touch screen +diff --git a/arch/arm/boot/dts/overlays/piscreen-overlay.dts b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +index be1e2ec..ba4ad33 100644 +--- a/arch/arm/boot/dts/overlays/piscreen-overlay.dts ++++ b/arch/arm/boot/dts/overlays/piscreen-overlay.dts +@@ -72,7 +72,7 @@ + 0x1000029>; + }; + +- piscreen-ts@1 { ++ piscreen_ts: piscreen-ts@1 { + compatible = "ti,ads7846"; + reg = <1>; + +@@ -91,5 +91,6 @@ + rotate = <&piscreen>,"rotate:0"; + fps = <&piscreen>,"fps:0"; + debug = <&piscreen>,"debug:0"; ++ xohms = <&piscreen_ts>,"ti,x-plate-ohms;0"; + }; + }; + +From df11ad948112ccee4eae40b6f4810946a8dc5019 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 28 May 2015 18:50:21 +0200 +Subject: [PATCH 194/216] BCM270x: Move vc_mem +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make the vc_mem module available for ARCH_BCM2835 by moving it. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/Kconfig | 7 - + arch/arm/mach-bcm2708/Makefile | 1 - + arch/arm/mach-bcm2708/include/mach/vc_mem.h | 35 --- + arch/arm/mach-bcm2708/vc_mem.c | 431 ---------------------------- + arch/arm/mach-bcm2709/Kconfig | 7 - + arch/arm/mach-bcm2709/Makefile | 1 - + arch/arm/mach-bcm2709/include/mach/vc_mem.h | 35 --- + arch/arm/mach-bcm2709/vc_mem.c | 431 ---------------------------- + drivers/char/broadcom/Kconfig | 13 +- + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vc_mem.c | 423 +++++++++++++++++++++++++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 3 +- + include/linux/broadcom/vc_mem.h | 35 +++ + 13 files changed, 472 insertions(+), 951 deletions(-) + delete mode 100644 arch/arm/mach-bcm2708/include/mach/vc_mem.h + delete mode 100644 arch/arm/mach-bcm2708/vc_mem.c + delete mode 100644 arch/arm/mach-bcm2709/include/mach/vc_mem.h + delete mode 100644 arch/arm/mach-bcm2709/vc_mem.c + create mode 100644 drivers/char/broadcom/vc_mem.c + create mode 100644 include/linux/broadcom/vc_mem.h + +diff --git a/arch/arm/mach-bcm2708/Kconfig b/arch/arm/mach-bcm2708/Kconfig +index 4cfae55..68e3706 100644 +--- a/arch/arm/mach-bcm2708/Kconfig ++++ b/arch/arm/mach-bcm2708/Kconfig +@@ -28,13 +28,6 @@ config BCM2708_GPIO + help + Include support for the Broadcom(R) BCM2708 gpio. + +-config BCM2708_VCMEM +- bool "Videocore Memory" +- depends on MACH_BCM2708 +- default y +- help +- Helper for videocore memory access and total size allocation. +- + config BCM2708_NOL2CACHE + bool "Videocore L2 cache disable" + depends on MACH_BCM2708 +diff --git a/arch/arm/mach-bcm2708/Makefile b/arch/arm/mach-bcm2708/Makefile +index 5552ae8..5120994 100644 +--- a/arch/arm/mach-bcm2708/Makefile ++++ b/arch/arm/mach-bcm2708/Makefile +@@ -4,4 +4,3 @@ + + obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o +-obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2708/include/mach/vc_mem.h b/arch/arm/mach-bcm2708/include/mach/vc_mem.h +deleted file mode 100644 +index 4a4a338..0000000 +--- a/arch/arm/mach-bcm2708/include/mach/vc_mem.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#if !defined( VC_MEM_H ) +-#define VC_MEM_H +- +-#include +- +-#define VC_MEM_IOC_MAGIC 'v' +- +-#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) +-#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) +-#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) +-#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) +- +-#if defined( __KERNEL__ ) +-#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF +- +-extern unsigned long mm_vc_mem_phys_addr; +-extern unsigned int mm_vc_mem_size; +-extern int vc_mem_get_current_size( void ); +-#endif +- +-#endif /* VC_MEM_H */ +diff --git a/arch/arm/mach-bcm2708/vc_mem.c b/arch/arm/mach-bcm2708/vc_mem.c +deleted file mode 100644 +index 226b737..0000000 +--- a/arch/arm/mach-bcm2708/vc_mem.c ++++ /dev/null +@@ -1,431 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#ifdef CONFIG_ARCH_KONA +-#include +-#elif CONFIG_ARCH_BCM2708 +-#else +-#include +-#endif +- +-#include "mach/vc_mem.h" +- +-#define DRIVER_NAME "vc-mem" +- +-// Device (/dev) related variables +-static dev_t vc_mem_devnum = 0; +-static struct class *vc_mem_class = NULL; +-static struct cdev vc_mem_cdev; +-static int vc_mem_inited = 0; +- +-#ifdef CONFIG_DEBUG_FS +-static struct dentry *vc_mem_debugfs_entry; +-#endif +- +-/* +- * Videocore memory addresses and size +- * +- * Drivers that wish to know the videocore memory addresses and sizes should +- * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in +- * headers. This allows the other drivers to not be tied down to a a certain +- * address/size at compile time. +- * +- * In the future, the goal is to have the videocore memory virtual address and +- * size be calculated at boot time rather than at compile time. The decision of +- * where the videocore memory resides and its size would be in the hands of the +- * bootloader (and/or kernel). When that happens, the values of these variables +- * would be calculated and assigned in the init function. +- */ +-// in the 2835 VC in mapped above ARM, but ARM has full access to VC space +-unsigned long mm_vc_mem_phys_addr = 0x00000000; +-unsigned int mm_vc_mem_size = 0; +-unsigned int mm_vc_mem_base = 0; +- +-EXPORT_SYMBOL(mm_vc_mem_phys_addr); +-EXPORT_SYMBOL(mm_vc_mem_size); +-EXPORT_SYMBOL(mm_vc_mem_base); +- +-static uint phys_addr = 0; +-static uint mem_size = 0; +-static uint mem_base = 0; +- +- +-/**************************************************************************** +-* +-* vc_mem_open +-* +-***************************************************************************/ +- +-static int +-vc_mem_open(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_release +-* +-***************************************************************************/ +- +-static int +-vc_mem_release(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_size +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_size(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_base +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_base(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_current_size +-* +-***************************************************************************/ +- +-int +-vc_mem_get_current_size(void) +-{ +- return mm_vc_mem_size; +-} +- +-EXPORT_SYMBOL_GPL(vc_mem_get_current_size); +- +-/**************************************************************************** +-* +-* vc_mem_ioctl +-* +-***************************************************************************/ +- +-static long +-vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +-{ +- int rc = 0; +- +- (void) cmd; +- (void) arg; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- switch (cmd) { +- case VC_MEM_IOC_MEM_PHYS_ADDR: +- { +- pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", +- __func__, (void *) mm_vc_mem_phys_addr); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, +- sizeof (mm_vc_mem_phys_addr)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_SIZE: +- { +- // Get the videocore memory size first +- vc_mem_get_size(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, +- mm_vc_mem_size); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_size, +- sizeof (mm_vc_mem_size)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_BASE: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_LOAD: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- default: +- { +- return -ENOTTY; +- } +- } +- pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* vc_mem_mmap +-* +-***************************************************************************/ +- +-static int +-vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) +-{ +- int rc = 0; +- unsigned long length = vma->vm_end - vma->vm_start; +- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; +- +- pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", +- __func__, (long) vma->vm_start, (long) vma->vm_end, +- (long) vma->vm_pgoff); +- +- if (offset + length > mm_vc_mem_size) { +- pr_err("%s: length %ld is too big\n", __func__, length); +- return -EINVAL; +- } +- // Do not cache the memory map +- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +- +- rc = remap_pfn_range(vma, vma->vm_start, +- (mm_vc_mem_phys_addr >> PAGE_SHIFT) + +- vma->vm_pgoff, length, vma->vm_page_prot); +- if (rc != 0) { +- pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); +- } +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for the driver. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_mem_fops = { +- .owner = THIS_MODULE, +- .open = vc_mem_open, +- .release = vc_mem_release, +- .unlocked_ioctl = vc_mem_ioctl, +- .mmap = vc_mem_mmap, +-}; +- +-#ifdef CONFIG_DEBUG_FS +-static void vc_mem_debugfs_deinit(void) +-{ +- debugfs_remove_recursive(vc_mem_debugfs_entry); +- vc_mem_debugfs_entry = NULL; +-} +- +- +-static int vc_mem_debugfs_init( +- struct device *dev) +-{ +- vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); +- if (!vc_mem_debugfs_entry) { +- dev_warn(dev, "could not create debugfs entry\n"); +- return -EFAULT; +- } +- +- if (!debugfs_create_x32("vc_mem_phys_addr", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_phys_addr)) { +- dev_warn(dev, "%s:could not create vc_mem_phys entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_size", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_size)) { +- dev_warn(dev, "%s:could not create vc_mem_size entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_base", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_base)) { +- dev_warn(dev, "%s:could not create vc_mem_base entry\n", +- __func__); +- goto fail; +- } +- +- return 0; +- +-fail: +- vc_mem_debugfs_deinit(); +- return -EFAULT; +-} +- +-#endif /* CONFIG_DEBUG_FS */ +- +- +-/**************************************************************************** +-* +-* vc_mem_init +-* +-***************************************************************************/ +- +-static int __init +-vc_mem_init(void) +-{ +- int rc = -EFAULT; +- struct device *dev; +- +- pr_debug("%s: called\n", __func__); +- +- mm_vc_mem_phys_addr = phys_addr; +- mm_vc_mem_size = mem_size; +- mm_vc_mem_base = mem_base; +- +- vc_mem_get_size(); +- +- pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", +- mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); +- +- if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { +- pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", +- __func__, rc); +- goto out_err; +- } +- +- cdev_init(&vc_mem_cdev, &vc_mem_fops); +- if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { +- pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); +- goto out_unregister; +- } +- +- vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vc_mem_class)) { +- rc = PTR_ERR(vc_mem_class); +- pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); +- goto out_cdev_del; +- } +- +- dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, +- DRIVER_NAME); +- if (IS_ERR(dev)) { +- rc = PTR_ERR(dev); +- pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); +- goto out_class_destroy; +- } +- +-#ifdef CONFIG_DEBUG_FS +- /* don't fail if the debug entries cannot be created */ +- vc_mem_debugfs_init(dev); +-#endif +- +- vc_mem_inited = 1; +- return 0; +- +- device_destroy(vc_mem_class, vc_mem_devnum); +- +- out_class_destroy: +- class_destroy(vc_mem_class); +- vc_mem_class = NULL; +- +- out_cdev_del: +- cdev_del(&vc_mem_cdev); +- +- out_unregister: +- unregister_chrdev_region(vc_mem_devnum, 1); +- +- out_err: +- return -1; +-} +- +-/**************************************************************************** +-* +-* vc_mem_exit +-* +-***************************************************************************/ +- +-static void __exit +-vc_mem_exit(void) +-{ +- pr_debug("%s: called\n", __func__); +- +- if (vc_mem_inited) { +-#if CONFIG_DEBUG_FS +- vc_mem_debugfs_deinit(); +-#endif +- device_destroy(vc_mem_class, vc_mem_devnum); +- class_destroy(vc_mem_class); +- cdev_del(&vc_mem_cdev); +- unregister_chrdev_region(vc_mem_devnum, 1); +- } +-} +- +-module_init(vc_mem_init); +-module_exit(vc_mem_exit); +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Broadcom Corporation"); +- +-module_param(phys_addr, uint, 0644); +-module_param(mem_size, uint, 0644); +-module_param(mem_base, uint, 0644); +diff --git a/arch/arm/mach-bcm2709/Kconfig b/arch/arm/mach-bcm2709/Kconfig +index 4fb6e1b..d61ade0 100644 +--- a/arch/arm/mach-bcm2709/Kconfig ++++ b/arch/arm/mach-bcm2709/Kconfig +@@ -25,13 +25,6 @@ config BCM2708_GPIO + help + Include support for the Broadcom(R) BCM2709 gpio. + +-config BCM2708_VCMEM +- bool "Videocore Memory" +- depends on MACH_BCM2709 +- default y +- help +- Helper for videocore memory access and total size allocation. +- + config BCM2708_NOL2CACHE + bool "Videocore L2 cache disable" + depends on MACH_BCM2709 +diff --git a/arch/arm/mach-bcm2709/Makefile b/arch/arm/mach-bcm2709/Makefile +index 706116f..1ae8b80 100644 +--- a/arch/arm/mach-bcm2709/Makefile ++++ b/arch/arm/mach-bcm2709/Makefile +@@ -4,4 +4,3 @@ + + obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o + obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o +-obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/arch/arm/mach-bcm2709/include/mach/vc_mem.h b/arch/arm/mach-bcm2709/include/mach/vc_mem.h +deleted file mode 100644 +index 4a4a338..0000000 +--- a/arch/arm/mach-bcm2709/include/mach/vc_mem.h ++++ /dev/null +@@ -1,35 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#if !defined( VC_MEM_H ) +-#define VC_MEM_H +- +-#include +- +-#define VC_MEM_IOC_MAGIC 'v' +- +-#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) +-#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) +-#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) +-#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) +- +-#if defined( __KERNEL__ ) +-#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF +- +-extern unsigned long mm_vc_mem_phys_addr; +-extern unsigned int mm_vc_mem_size; +-extern int vc_mem_get_current_size( void ); +-#endif +- +-#endif /* VC_MEM_H */ +diff --git a/arch/arm/mach-bcm2709/vc_mem.c b/arch/arm/mach-bcm2709/vc_mem.c +deleted file mode 100644 +index d2adfd1..0000000 +--- a/arch/arm/mach-bcm2709/vc_mem.c ++++ /dev/null +@@ -1,431 +0,0 @@ +-/***************************************************************************** +-* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#ifdef CONFIG_ARCH_KONA +-#include +-#elif defined(CONFIG_ARCH_BCM2708) || defined(CONFIG_ARCH_BCM2709) +-#else +-#include +-#endif +- +-#include "mach/vc_mem.h" +- +-#define DRIVER_NAME "vc-mem" +- +-// Device (/dev) related variables +-static dev_t vc_mem_devnum = 0; +-static struct class *vc_mem_class = NULL; +-static struct cdev vc_mem_cdev; +-static int vc_mem_inited = 0; +- +-#ifdef CONFIG_DEBUG_FS +-static struct dentry *vc_mem_debugfs_entry; +-#endif +- +-/* +- * Videocore memory addresses and size +- * +- * Drivers that wish to know the videocore memory addresses and sizes should +- * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in +- * headers. This allows the other drivers to not be tied down to a a certain +- * address/size at compile time. +- * +- * In the future, the goal is to have the videocore memory virtual address and +- * size be calculated at boot time rather than at compile time. The decision of +- * where the videocore memory resides and its size would be in the hands of the +- * bootloader (and/or kernel). When that happens, the values of these variables +- * would be calculated and assigned in the init function. +- */ +-// in the 2835 VC in mapped above ARM, but ARM has full access to VC space +-unsigned long mm_vc_mem_phys_addr = 0x00000000; +-unsigned int mm_vc_mem_size = 0; +-unsigned int mm_vc_mem_base = 0; +- +-EXPORT_SYMBOL(mm_vc_mem_phys_addr); +-EXPORT_SYMBOL(mm_vc_mem_size); +-EXPORT_SYMBOL(mm_vc_mem_base); +- +-static uint phys_addr = 0; +-static uint mem_size = 0; +-static uint mem_base = 0; +- +- +-/**************************************************************************** +-* +-* vc_mem_open +-* +-***************************************************************************/ +- +-static int +-vc_mem_open(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_release +-* +-***************************************************************************/ +- +-static int +-vc_mem_release(struct inode *inode, struct file *file) +-{ +- (void) inode; +- (void) file; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_size +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_size(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_base +-* +-***************************************************************************/ +- +-static void +-vc_mem_get_base(void) +-{ +-} +- +-/**************************************************************************** +-* +-* vc_mem_get_current_size +-* +-***************************************************************************/ +- +-int +-vc_mem_get_current_size(void) +-{ +- return mm_vc_mem_size; +-} +- +-EXPORT_SYMBOL_GPL(vc_mem_get_current_size); +- +-/**************************************************************************** +-* +-* vc_mem_ioctl +-* +-***************************************************************************/ +- +-static long +-vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +-{ +- int rc = 0; +- +- (void) cmd; +- (void) arg; +- +- pr_debug("%s: called file = 0x%p\n", __func__, file); +- +- switch (cmd) { +- case VC_MEM_IOC_MEM_PHYS_ADDR: +- { +- pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", +- __func__, (void *) mm_vc_mem_phys_addr); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, +- sizeof (mm_vc_mem_phys_addr)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_SIZE: +- { +- // Get the videocore memory size first +- vc_mem_get_size(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, +- mm_vc_mem_size); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_size, +- sizeof (mm_vc_mem_size)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_BASE: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- case VC_MEM_IOC_MEM_LOAD: +- { +- // Get the videocore memory base +- vc_mem_get_base(); +- +- pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, +- mm_vc_mem_base); +- +- if (copy_to_user((void *) arg, &mm_vc_mem_base, +- sizeof (mm_vc_mem_base)) != 0) { +- rc = -EFAULT; +- } +- break; +- } +- default: +- { +- return -ENOTTY; +- } +- } +- pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* vc_mem_mmap +-* +-***************************************************************************/ +- +-static int +-vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) +-{ +- int rc = 0; +- unsigned long length = vma->vm_end - vma->vm_start; +- unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; +- +- pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", +- __func__, (long) vma->vm_start, (long) vma->vm_end, +- (long) vma->vm_pgoff); +- +- if (offset + length > mm_vc_mem_size) { +- pr_err("%s: length %ld is too big\n", __func__, length); +- return -EINVAL; +- } +- // Do not cache the memory map +- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +- +- rc = remap_pfn_range(vma, vma->vm_start, +- (mm_vc_mem_phys_addr >> PAGE_SHIFT) + +- vma->vm_pgoff, length, vma->vm_page_prot); +- if (rc != 0) { +- pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); +- } +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for the driver. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_mem_fops = { +- .owner = THIS_MODULE, +- .open = vc_mem_open, +- .release = vc_mem_release, +- .unlocked_ioctl = vc_mem_ioctl, +- .mmap = vc_mem_mmap, +-}; +- +-#ifdef CONFIG_DEBUG_FS +-static void vc_mem_debugfs_deinit(void) +-{ +- debugfs_remove_recursive(vc_mem_debugfs_entry); +- vc_mem_debugfs_entry = NULL; +-} +- +- +-static int vc_mem_debugfs_init( +- struct device *dev) +-{ +- vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); +- if (!vc_mem_debugfs_entry) { +- dev_warn(dev, "could not create debugfs entry\n"); +- return -EFAULT; +- } +- +- if (!debugfs_create_x32("vc_mem_phys_addr", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_phys_addr)) { +- dev_warn(dev, "%s:could not create vc_mem_phys entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_size", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_size)) { +- dev_warn(dev, "%s:could not create vc_mem_size entry\n", +- __func__); +- goto fail; +- } +- +- if (!debugfs_create_x32("vc_mem_base", +- 0444, +- vc_mem_debugfs_entry, +- (u32 *)&mm_vc_mem_base)) { +- dev_warn(dev, "%s:could not create vc_mem_base entry\n", +- __func__); +- goto fail; +- } +- +- return 0; +- +-fail: +- vc_mem_debugfs_deinit(); +- return -EFAULT; +-} +- +-#endif /* CONFIG_DEBUG_FS */ +- +- +-/**************************************************************************** +-* +-* vc_mem_init +-* +-***************************************************************************/ +- +-static int __init +-vc_mem_init(void) +-{ +- int rc = -EFAULT; +- struct device *dev; +- +- pr_debug("%s: called\n", __func__); +- +- mm_vc_mem_phys_addr = phys_addr; +- mm_vc_mem_size = mem_size; +- mm_vc_mem_base = mem_base; +- +- vc_mem_get_size(); +- +- pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", +- mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); +- +- if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { +- pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", +- __func__, rc); +- goto out_err; +- } +- +- cdev_init(&vc_mem_cdev, &vc_mem_fops); +- if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { +- pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); +- goto out_unregister; +- } +- +- vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vc_mem_class)) { +- rc = PTR_ERR(vc_mem_class); +- pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); +- goto out_cdev_del; +- } +- +- dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, +- DRIVER_NAME); +- if (IS_ERR(dev)) { +- rc = PTR_ERR(dev); +- pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); +- goto out_class_destroy; +- } +- +-#ifdef CONFIG_DEBUG_FS +- /* don't fail if the debug entries cannot be created */ +- vc_mem_debugfs_init(dev); +-#endif +- +- vc_mem_inited = 1; +- return 0; +- +- device_destroy(vc_mem_class, vc_mem_devnum); +- +- out_class_destroy: +- class_destroy(vc_mem_class); +- vc_mem_class = NULL; +- +- out_cdev_del: +- cdev_del(&vc_mem_cdev); +- +- out_unregister: +- unregister_chrdev_region(vc_mem_devnum, 1); +- +- out_err: +- return -1; +-} +- +-/**************************************************************************** +-* +-* vc_mem_exit +-* +-***************************************************************************/ +- +-static void __exit +-vc_mem_exit(void) +-{ +- pr_debug("%s: called\n", __func__); +- +- if (vc_mem_inited) { +-#if CONFIG_DEBUG_FS +- vc_mem_debugfs_deinit(); +-#endif +- device_destroy(vc_mem_class, vc_mem_devnum); +- class_destroy(vc_mem_class); +- cdev_del(&vc_mem_cdev); +- unregister_chrdev_region(vc_mem_devnum, 1); +- } +-} +- +-module_init(vc_mem_init); +-module_exit(vc_mem_exit); +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Broadcom Corporation"); +- +-module_param(phys_addr, uint, 0644); +-module_param(mem_size, uint, 0644); +-module_param(mem_base, uint, 0644); +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index fd23e00..c310d9d 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -7,16 +7,27 @@ menuconfig BRCM_CHAR_DRIVERS + help + Broadcom's char drivers + ++if BRCM_CHAR_DRIVERS ++ + config BCM_VC_CMA + bool "Videocore CMA" +- depends on CMA && BRCM_CHAR_DRIVERS && BCM2708_VCHIQ ++ depends on CMA && BCM2708_VCHIQ + default n + help + Helper for videocore CMA access. + + config BCM_VC_SM + bool "VMCS Shared Memory" ++ select BCM2708_VCMEM + default n + help + Support for the VC shared memory on the Broadcom reference + design. Uses the VCHIQ stack. ++ ++config BCM2708_VCMEM ++ bool "Videocore Memory" ++ default y ++ help ++ Helper for videocore memory access and total size allocation. ++ ++endif +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 0bf7fdf..b4f8e39d 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,2 +1,3 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ ++obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o +diff --git a/drivers/char/broadcom/vc_mem.c b/drivers/char/broadcom/vc_mem.c +new file mode 100644 +index 0000000..fcde6b1 +--- /dev/null ++++ b/drivers/char/broadcom/vc_mem.c +@@ -0,0 +1,423 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DRIVER_NAME "vc-mem" ++ ++// Device (/dev) related variables ++static dev_t vc_mem_devnum = 0; ++static struct class *vc_mem_class = NULL; ++static struct cdev vc_mem_cdev; ++static int vc_mem_inited = 0; ++ ++#ifdef CONFIG_DEBUG_FS ++static struct dentry *vc_mem_debugfs_entry; ++#endif ++ ++/* ++ * Videocore memory addresses and size ++ * ++ * Drivers that wish to know the videocore memory addresses and sizes should ++ * use these variables instead of the MM_IO_BASE and MM_ADDR_IO defines in ++ * headers. This allows the other drivers to not be tied down to a a certain ++ * address/size at compile time. ++ * ++ * In the future, the goal is to have the videocore memory virtual address and ++ * size be calculated at boot time rather than at compile time. The decision of ++ * where the videocore memory resides and its size would be in the hands of the ++ * bootloader (and/or kernel). When that happens, the values of these variables ++ * would be calculated and assigned in the init function. ++ */ ++// in the 2835 VC in mapped above ARM, but ARM has full access to VC space ++unsigned long mm_vc_mem_phys_addr = 0x00000000; ++unsigned int mm_vc_mem_size = 0; ++unsigned int mm_vc_mem_base = 0; ++ ++EXPORT_SYMBOL(mm_vc_mem_phys_addr); ++EXPORT_SYMBOL(mm_vc_mem_size); ++EXPORT_SYMBOL(mm_vc_mem_base); ++ ++static uint phys_addr = 0; ++static uint mem_size = 0; ++static uint mem_base = 0; ++ ++ ++/**************************************************************************** ++* ++* vc_mem_open ++* ++***************************************************************************/ ++ ++static int ++vc_mem_open(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_release ++* ++***************************************************************************/ ++ ++static int ++vc_mem_release(struct inode *inode, struct file *file) ++{ ++ (void) inode; ++ (void) file; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ return 0; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_size ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_size(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_base ++* ++***************************************************************************/ ++ ++static void ++vc_mem_get_base(void) ++{ ++} ++ ++/**************************************************************************** ++* ++* vc_mem_get_current_size ++* ++***************************************************************************/ ++ ++int ++vc_mem_get_current_size(void) ++{ ++ return mm_vc_mem_size; ++} ++ ++EXPORT_SYMBOL_GPL(vc_mem_get_current_size); ++ ++/**************************************************************************** ++* ++* vc_mem_ioctl ++* ++***************************************************************************/ ++ ++static long ++vc_mem_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ++{ ++ int rc = 0; ++ ++ (void) cmd; ++ (void) arg; ++ ++ pr_debug("%s: called file = 0x%p\n", __func__, file); ++ ++ switch (cmd) { ++ case VC_MEM_IOC_MEM_PHYS_ADDR: ++ { ++ pr_debug("%s: VC_MEM_IOC_MEM_PHYS_ADDR=0x%p\n", ++ __func__, (void *) mm_vc_mem_phys_addr); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_phys_addr, ++ sizeof (mm_vc_mem_phys_addr)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_SIZE: ++ { ++ // Get the videocore memory size first ++ vc_mem_get_size(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_SIZE=%u\n", __func__, ++ mm_vc_mem_size); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_size, ++ sizeof (mm_vc_mem_size)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_BASE: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_BASE=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ case VC_MEM_IOC_MEM_LOAD: ++ { ++ // Get the videocore memory base ++ vc_mem_get_base(); ++ ++ pr_debug("%s: VC_MEM_IOC_MEM_LOAD=%u\n", __func__, ++ mm_vc_mem_base); ++ ++ if (copy_to_user((void *) arg, &mm_vc_mem_base, ++ sizeof (mm_vc_mem_base)) != 0) { ++ rc = -EFAULT; ++ } ++ break; ++ } ++ default: ++ { ++ return -ENOTTY; ++ } ++ } ++ pr_debug("%s: file = 0x%p returning %d\n", __func__, file, rc); ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_mmap ++* ++***************************************************************************/ ++ ++static int ++vc_mem_mmap(struct file *filp, struct vm_area_struct *vma) ++{ ++ int rc = 0; ++ unsigned long length = vma->vm_end - vma->vm_start; ++ unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; ++ ++ pr_debug("%s: vm_start = 0x%08lx vm_end = 0x%08lx vm_pgoff = 0x%08lx\n", ++ __func__, (long) vma->vm_start, (long) vma->vm_end, ++ (long) vma->vm_pgoff); ++ ++ if (offset + length > mm_vc_mem_size) { ++ pr_err("%s: length %ld is too big\n", __func__, length); ++ return -EINVAL; ++ } ++ // Do not cache the memory map ++ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); ++ ++ rc = remap_pfn_range(vma, vma->vm_start, ++ (mm_vc_mem_phys_addr >> PAGE_SHIFT) + ++ vma->vm_pgoff, length, vma->vm_page_prot); ++ if (rc != 0) { ++ pr_err("%s: remap_pfn_range failed (rc=%d)\n", __func__, rc); ++ } ++ ++ return rc; ++} ++ ++/**************************************************************************** ++* ++* File Operations for the driver. ++* ++***************************************************************************/ ++ ++static const struct file_operations vc_mem_fops = { ++ .owner = THIS_MODULE, ++ .open = vc_mem_open, ++ .release = vc_mem_release, ++ .unlocked_ioctl = vc_mem_ioctl, ++ .mmap = vc_mem_mmap, ++}; ++ ++#ifdef CONFIG_DEBUG_FS ++static void vc_mem_debugfs_deinit(void) ++{ ++ debugfs_remove_recursive(vc_mem_debugfs_entry); ++ vc_mem_debugfs_entry = NULL; ++} ++ ++ ++static int vc_mem_debugfs_init( ++ struct device *dev) ++{ ++ vc_mem_debugfs_entry = debugfs_create_dir(DRIVER_NAME, NULL); ++ if (!vc_mem_debugfs_entry) { ++ dev_warn(dev, "could not create debugfs entry\n"); ++ return -EFAULT; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_phys_addr", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_phys_addr)) { ++ dev_warn(dev, "%s:could not create vc_mem_phys entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_size", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_size)) { ++ dev_warn(dev, "%s:could not create vc_mem_size entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ if (!debugfs_create_x32("vc_mem_base", ++ 0444, ++ vc_mem_debugfs_entry, ++ (u32 *)&mm_vc_mem_base)) { ++ dev_warn(dev, "%s:could not create vc_mem_base entry\n", ++ __func__); ++ goto fail; ++ } ++ ++ return 0; ++ ++fail: ++ vc_mem_debugfs_deinit(); ++ return -EFAULT; ++} ++ ++#endif /* CONFIG_DEBUG_FS */ ++ ++ ++/**************************************************************************** ++* ++* vc_mem_init ++* ++***************************************************************************/ ++ ++static int __init ++vc_mem_init(void) ++{ ++ int rc = -EFAULT; ++ struct device *dev; ++ ++ pr_debug("%s: called\n", __func__); ++ ++ mm_vc_mem_phys_addr = phys_addr; ++ mm_vc_mem_size = mem_size; ++ mm_vc_mem_base = mem_base; ++ ++ vc_mem_get_size(); ++ ++ pr_info("vc-mem: phys_addr:0x%08lx mem_base=0x%08x mem_size:0x%08x(%u MiB)\n", ++ mm_vc_mem_phys_addr, mm_vc_mem_base, mm_vc_mem_size, mm_vc_mem_size / (1024 * 1024)); ++ ++ if ((rc = alloc_chrdev_region(&vc_mem_devnum, 0, 1, DRIVER_NAME)) < 0) { ++ pr_err("%s: alloc_chrdev_region failed (rc=%d)\n", ++ __func__, rc); ++ goto out_err; ++ } ++ ++ cdev_init(&vc_mem_cdev, &vc_mem_fops); ++ if ((rc = cdev_add(&vc_mem_cdev, vc_mem_devnum, 1)) != 0) { ++ pr_err("%s: cdev_add failed (rc=%d)\n", __func__, rc); ++ goto out_unregister; ++ } ++ ++ vc_mem_class = class_create(THIS_MODULE, DRIVER_NAME); ++ if (IS_ERR(vc_mem_class)) { ++ rc = PTR_ERR(vc_mem_class); ++ pr_err("%s: class_create failed (rc=%d)\n", __func__, rc); ++ goto out_cdev_del; ++ } ++ ++ dev = device_create(vc_mem_class, NULL, vc_mem_devnum, NULL, ++ DRIVER_NAME); ++ if (IS_ERR(dev)) { ++ rc = PTR_ERR(dev); ++ pr_err("%s: device_create failed (rc=%d)\n", __func__, rc); ++ goto out_class_destroy; ++ } ++ ++#ifdef CONFIG_DEBUG_FS ++ /* don't fail if the debug entries cannot be created */ ++ vc_mem_debugfs_init(dev); ++#endif ++ ++ vc_mem_inited = 1; ++ return 0; ++ ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ ++ out_class_destroy: ++ class_destroy(vc_mem_class); ++ vc_mem_class = NULL; ++ ++ out_cdev_del: ++ cdev_del(&vc_mem_cdev); ++ ++ out_unregister: ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ ++ out_err: ++ return -1; ++} ++ ++/**************************************************************************** ++* ++* vc_mem_exit ++* ++***************************************************************************/ ++ ++static void __exit ++vc_mem_exit(void) ++{ ++ pr_debug("%s: called\n", __func__); ++ ++ if (vc_mem_inited) { ++#if CONFIG_DEBUG_FS ++ vc_mem_debugfs_deinit(); ++#endif ++ device_destroy(vc_mem_class, vc_mem_devnum); ++ class_destroy(vc_mem_class); ++ cdev_del(&vc_mem_cdev); ++ unregister_chrdev_region(vc_mem_devnum, 1); ++ } ++} ++ ++module_init(vc_mem_init); ++module_exit(vc_mem_exit); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Broadcom Corporation"); ++ ++module_param(phys_addr, uint, 0644); ++module_param(mem_size, uint, 0644); ++module_param(mem_base, uint, 0644); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 39a8971..0bfb42e 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -15,6 +15,7 @@ + /* ---- Include Files ----------------------------------------------------- */ + + #include ++#include + #include + #include + #include +@@ -35,8 +36,6 @@ + #include + #include + +-#include +- + #include "vchiq_connected.h" + #include "vc_vchi_sm.h" + +diff --git a/include/linux/broadcom/vc_mem.h b/include/linux/broadcom/vc_mem.h +new file mode 100644 +index 0000000..20a4753 +--- /dev/null ++++ b/include/linux/broadcom/vc_mem.h +@@ -0,0 +1,35 @@ ++/***************************************************************************** ++* Copyright 2010 - 2011 Broadcom Corporation. All rights reserved. ++* ++* Unless you and Broadcom execute a separate written software license ++* agreement governing use of this software, this software is licensed to you ++* under the terms of the GNU General Public License version 2, available at ++* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++* ++* Notwithstanding the above, under no circumstances may you combine this ++* software in any way with any other Broadcom software provided under a ++* license other than the GPL, without Broadcom's express prior written ++* consent. ++*****************************************************************************/ ++ ++#ifndef _VC_MEM_H ++#define _VC_MEM_H ++ ++#include ++ ++#define VC_MEM_IOC_MAGIC 'v' ++ ++#define VC_MEM_IOC_MEM_PHYS_ADDR _IOR( VC_MEM_IOC_MAGIC, 0, unsigned long ) ++#define VC_MEM_IOC_MEM_SIZE _IOR( VC_MEM_IOC_MAGIC, 1, unsigned int ) ++#define VC_MEM_IOC_MEM_BASE _IOR( VC_MEM_IOC_MAGIC, 2, unsigned int ) ++#define VC_MEM_IOC_MEM_LOAD _IOR( VC_MEM_IOC_MAGIC, 3, unsigned int ) ++ ++#if defined( __KERNEL__ ) ++#define VC_MEM_TO_ARM_ADDR_MASK 0x3FFFFFFF ++ ++extern unsigned long mm_vc_mem_phys_addr; ++extern unsigned int mm_vc_mem_size; ++extern int vc_mem_get_current_size( void ); ++#endif ++ ++#endif /* _VC_MEM_H */ + +From 7495f032da212d310393adf5c4d1694190e6f309 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Mon, 1 Jun 2015 20:40:11 +0200 +Subject: [PATCH 195/216] BCM270x: Add USB controller to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree support to dwc_otg driver. +Add device to Device Tree. +Don't add platform devices when booting in DT mode. + +Tested on Pi1 and Pi2 with and without DT. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 8 ++++++++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + drivers/usb/host/dwc_otg/dwc_otg_driver.c | 7 +++++++ + 4 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 3f8af85..dc7df47 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -121,6 +121,14 @@ + status = "disabled"; + }; + ++ usb: usb@7e980000 { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ }; ++ + leds: leds { + compatible = "gpio-leds"; + }; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 06438df..6298309 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -955,7 +955,7 @@ void __init bcm2708_init(void) + #endif + bcm_register_device(&bcm2708_systemtimer_device); + bcm_register_device_dt(&bcm2708_fb_device); +- bcm_register_device(&bcm2708_usb_device); ++ bcm_register_device_dt(&bcm2708_usb_device); + bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index ce06b7d..d8c2336 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -978,7 +978,7 @@ void __init bcm2709_init(void) + bcm_register_device(&bcm2708_systemtimer_device); + #endif + bcm_register_device_dt(&bcm2708_fb_device); +- bcm_register_device(&bcm2708_usb_device); ++ bcm_register_device_dt(&bcm2708_usb_device); + bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +index dc7cd32..53307f0 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c +@@ -1043,9 +1043,16 @@ static struct platform_device_id platform_ids[] = { + }; + MODULE_DEVICE_TABLE(platform, platform_ids); + ++static const struct of_device_id dwc_otg_of_match_table[] = { ++ { .compatible = "brcm,bcm2708-usb", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, dwc_otg_of_match_table); ++ + static struct platform_driver dwc_otg_driver = { + .driver = { + .name = (char *)dwc_driver_name, ++ .of_match_table = dwc_otg_of_match_table, + }, + .id_table = platform_ids, + + +From da5345649e7ad4deb51692d4d969ba4a2f86974b Mon Sep 17 00:00:00 2001 +From: Martin Sperl +Date: Mon, 2 Mar 2015 17:57:30 +0000 +Subject: [PATCH 196/216] added mcp251x module to list of modules to get + compiled as well as the corresponding overlay + +--- + arch/arm/boot/dts/Makefile | 2 +- + arch/arm/boot/dts/overlays/Makefile | 1 + + .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 69 ++++++++++++++++++++++ + arch/arm/configs/bcm2709_defconfig | 5 ++ + arch/arm/configs/bcmrpi_defconfig | 8 +++ + 5 files changed, 84 insertions(+), 1 deletion(-) + create mode 100755 arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index ea93e1d..d5b6a82 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -1,9 +1,9 @@ + ifeq ($(CONFIG_OF),y) + + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b.dtb +-dtb-$(CONFIG_BCM2709_DT) += bcm2709-rpi-2-b.dtb + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-b-plus.dtb + dtb-$(CONFIG_BCM2708_DT) += bcm2708-rpi-cm.dtb ++dtb-$(CONFIG_BCM2709_DT) += bcm2709-rpi-2-b.dtb + + # Raspberry Pi + ifeq ($(CONFIG_BCM2708_DT),y) +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index d64e6b4..d18a1f2 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -22,6 +22,7 @@ dtb-$(RPI_DT_OVERLAYS) += i2c-rtc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +new file mode 100755 +index 0000000..398d59c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can0-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device tree overlay for mcp251x/can0 on spi0.0 ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.0 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ spidev@0{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ can0_pins: can0_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@2 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on SPI0.0 */ ++ can0_osc: can0_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can0: mcp2515@0 { ++ reg = <0>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can0_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can0_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can0_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can0>,"spi-max-frequency:0"; ++ interrupt = <&can0_pins>,"brcm,pins:0",<&can0>,"interrupts:0"; ++ }; ++}; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 5ce9a01..2a1a15a 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -344,7 +344,12 @@ CONFIG_BAYCOM_SER_FDX=m + CONFIG_BAYCOM_SER_HDX=m + CONFIG_YAM=m + CONFIG_CAN=m ++CONFIG_CAN_RAW=m ++CONFIG_CAN_BCM=m ++CONFIG_CAN_GW=m + CONFIG_CAN_VCAN=m ++CONFIG_CAN_DEV=m ++CONFIG_CAN_CALC_BITTIMING=y + CONFIG_CAN_MCP251X=m + CONFIG_IRDA=m + CONFIG_IRLAN=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index da443da..a2d7291 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -335,6 +335,14 @@ CONFIG_6PACK=m + CONFIG_BPQETHER=m + CONFIG_BAYCOM_SER_FDX=m + CONFIG_BAYCOM_SER_HDX=m ++CONFIG_CAN=m ++CONFIG_CAN_RAW=m ++CONFIG_CAN_BCM=m ++CONFIG_CAN_GW=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_DEV=m ++CONFIG_CAN_CALC_BITTIMING=y ++CONFIG_CAN_MCP251X=m + CONFIG_YAM=m + CONFIG_CAN=m + CONFIG_CAN_VCAN=m + +From 8e999dc420b342d1304fc2bcd755ab6a36d6896c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 2 Jun 2015 13:55:05 +0200 +Subject: [PATCH 197/216] BCM270x: Move thermal sensor to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add Device Tree support to bcm2835-thermal driver. +Add thermal sensor device to Device Tree. +Don't add platform device when booting in DT mode. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 4 ++++ + arch/arm/mach-bcm2708/bcm2708.c | 2 +- + arch/arm/mach-bcm2709/bcm2709.c | 2 +- + drivers/thermal/bcm2835-thermal.c | 8 +++++++- + 4 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index dc7df47..fcb5828 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -143,6 +143,10 @@ + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; + }; ++ ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ }; + }; + + clocks { +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 6298309..e141c0b 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -984,7 +984,7 @@ void __init bcm2708_init(void) + } + + bcm_register_device(&bcm2835_hwmon_device); +- bcm_register_device(&bcm2835_thermal_device); ++ bcm_register_device_dt(&bcm2835_thermal_device); + + #if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE) + bcm_register_device_dt(&bcm2708_i2s_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index d8c2336..6dadb80 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -1007,7 +1007,7 @@ void __init bcm2709_init(void) + } + + bcm_register_device(&bcm2835_hwmon_device); +- bcm_register_device(&bcm2835_thermal_device); ++ bcm_register_device_dt(&bcm2835_thermal_device); + + #if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE) + bcm_register_device_dt(&bcm2708_i2s_device); +diff --git a/drivers/thermal/bcm2835-thermal.c b/drivers/thermal/bcm2835-thermal.c +index 0c556d1..3bc80f1 100644 +--- a/drivers/thermal/bcm2835-thermal.c ++++ b/drivers/thermal/bcm2835-thermal.c +@@ -167,13 +167,19 @@ static struct thermal_zone_device_ops ops = { + .get_mode = bcm2835_get_mode, + }; + +-/* Thermal Driver */ ++static const struct of_device_id bcm2835_thermal_of_match_table[] = { ++ { .compatible = "brcm,bcm2835-thermal", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_thermal_of_match_table); ++ + static struct platform_driver bcm2835_thermal_driver = { + .probe = bcm2835_thermal_probe, + .remove = bcm2835_thermal_remove, + .driver = { + .name = "bcm2835_thermal", + .owner = THIS_MODULE, ++ .of_match_table = bcm2835_thermal_of_match_table, + }, + }; + + +From fd724791a4d515e8069884b72f52752501ee0f92 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 2 Jun 2015 13:55:22 +0200 +Subject: [PATCH 198/216] bcm2835: Add thermal sensor to Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add the BCM2835 thermal sensor to Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 40fc759..efaf4df 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -170,6 +170,10 @@ + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; + }; ++ ++ thermal: thermal { ++ compatible = "brcm,bcm2835-thermal"; ++ }; + }; + + clocks { + +From 34638ffefe49111b137c8b0927c47f9aab23215b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 2 Jun 2015 15:51:24 +0200 +Subject: [PATCH 199/216] BCM270x: Enable bcm2835_wdt and bcm2835-rng +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change the kconfig dependency to make bcm2835_wdt and bcm2835-rng +available on ARCH_BCM2708 and ARCH_BCM2709. +Enable them as loadable modules in bcmrpi_defconfig and +bcm2709_defconfig. + +There is a commit in linux-next that will move restart/pm_power_off +to bcm2835_wdt for ARCH_BCM2835. This will not affect ARCH_BCM270x +since arm_pm_restart (.restart = bcm2708_restart) and +pm_power_off (=bcm2708_power_off) is set in +arch/arm/mach-bcm270X/bcm270X.c and will take presedence. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2709_defconfig | 2 ++ + arch/arm/configs/bcmrpi_defconfig | 2 ++ + drivers/char/hw_random/Kconfig | 2 +- + drivers/watchdog/Kconfig | 2 +- + 4 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 2a1a15a..d08ae51 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -561,6 +561,7 @@ CONFIG_SERIAL_AMBA_PL011=y + CONFIG_SERIAL_AMBA_PL011_CONSOLE=y + CONFIG_TTY_PRINTK=y + CONFIG_HW_RANDOM=y ++CONFIG_HW_RANDOM_BCM2835=m + CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y +@@ -603,6 +604,7 @@ CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y + CONFIG_BCM2708_WDT=m ++CONFIG_BCM2835_WDT=m + CONFIG_UCB1400_CORE=m + CONFIG_MFD_STMPE=y + CONFIG_STMPE_SPI=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index a2d7291..11bbfac 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -557,6 +557,7 @@ CONFIG_SERIAL_AMBA_PL011=y + CONFIG_SERIAL_AMBA_PL011_CONSOLE=y + CONFIG_TTY_PRINTK=y + CONFIG_HW_RANDOM=y ++CONFIG_HW_RANDOM_BCM2835=m + CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y +@@ -599,6 +600,7 @@ CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y + CONFIG_BCM2708_WDT=m ++CONFIG_BCM2835_WDT=m + CONFIG_UCB1400_CORE=m + CONFIG_MFD_STMPE=y + CONFIG_STMPE_SPI=y +diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig +index 1c97093..0996083 100644 +--- a/drivers/char/hw_random/Kconfig ++++ b/drivers/char/hw_random/Kconfig +@@ -90,7 +90,7 @@ config HW_RANDOM_BCM63XX + + config HW_RANDOM_BCM2835 + tristate "Broadcom BCM2835 Random Number Generator support" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + default HW_RANDOM + ---help--- + This driver provides kernel-side support for the Random Number +diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig +index ca7d6463..e010420 100644 +--- a/drivers/watchdog/Kconfig ++++ b/drivers/watchdog/Kconfig +@@ -1222,7 +1222,7 @@ config BCM63XX_WDT + + config BCM2835_WDT + tristate "Broadcom BCM2835 hardware watchdog" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + select WATCHDOG_CORE + help + Watchdog driver for the built in watchdog hardware in Broadcom + +From 6779bd793d41be8d73ee771b149606e13e13e0b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Tue, 2 Jun 2015 15:51:52 +0200 +Subject: [PATCH 200/216] BCM270X_DT: Add bcm2835-pm-wdt and bcm2835-rng +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This makes it possible to use the mainline watchdog and +random generator drivers: +dtparam=watchdog=on +dtparam=random=on + +bcm2708_wdog and bcm2708-rng can still be used. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 ++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 2 ++ + arch/arm/boot/dts/bcm2708_common.dtsi | 12 ++++++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 ++ + 4 files changed, 18 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 75df21c..52b1404 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -124,5 +124,7 @@ + pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + + audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index df12b7d..876dfca 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -114,5 +114,7 @@ + act_led_trigger = <&act_led>,"linux,default-trigger"; + + audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index fcb5828..a80b1a8 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -43,6 +43,18 @@ + #interrupt-cells = <2>; + }; + ++ watchdog: watchdog@7e100000 { ++ compatible = "brcm,bcm2835-pm-wdt"; ++ reg = <0x7e100000 0x28>; ++ status = "disabled"; ++ }; ++ ++ random: rng@7e104000 { ++ compatible = "brcm,bcm2835-rng"; ++ reg = <0x7e104000 0x10>; ++ status = "disabled"; ++ }; ++ + mailbox: mailbox@7e00b800 { + compatible = "brcm,bcm2708-vcio"; + reg = <0x7e00b880 0x40>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 78bc756..b226dfb 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -124,5 +124,7 @@ + pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + + audio = <&audio>,"status"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; + }; + }; + +From 493b7b5c56b4afd21bd980e38deb0f9d7d06061c Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:26:13 +0200 +Subject: [PATCH 201/216] ARM: bcm2835: Set Serial number and Revision +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The VideoCore bootloader passes in Serial number and +Revision number through Device Tree. Make these available to +userspace through /proc/cpuinfo. + +Mainline status: + +There is a commit in linux-next that standardize passing the serial +number through Device Tree (string: /serial-number): +ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo + +There was an attempt to do the same with the revision number, but it +didn't get in: +[PATCH v2 1/2] arm: devtree: Set system_rev from DT revision + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm/board_bcm2835.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c +index 70f2f39..f7fdacd 100644 +--- a/arch/arm/mach-bcm/board_bcm2835.c ++++ b/arch/arm/mach-bcm/board_bcm2835.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -107,6 +108,9 @@ static void __init bcm2835_map_io(void) + + static void __init bcm2835_init(void) + { ++ struct device_node *np = of_find_node_by_path("/system"); ++ u32 val; ++ u64 val64; + int ret; + + bcm2835_setup_restart(); +@@ -121,6 +125,11 @@ static void __init bcm2835_init(void) + pr_err("of_platform_populate failed: %d\n", ret); + BUG(); + } ++ ++ if (!of_property_read_u32(np, "linux,revision", &val)) ++ system_rev = val; ++ if (!of_property_read_u64(np, "linux,serial", &val64)) ++ system_serial_low = val64; + } + + static const char * const bcm2835_compat[] = { + +From e98419e0f836f39ae77a595f0d7218ba4b0576ab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:34:24 +0200 +Subject: [PATCH 202/216] bcm2835: Match BCM270X Device Trees +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 45 +++++++++++------ + arch/arm/boot/dts/bcm2835-rpi-b.dts | 29 +++++++---- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 85 +++++++++++++++++++++++++------- + arch/arm/boot/dts/bcm2835.dtsi | 12 ++--- + 4 files changed, 122 insertions(+), 49 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +index e479515..b0fb0e8 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +@@ -4,27 +4,40 @@ + / { + compatible = "raspberrypi,model-b-plus", "brcm,bcm2835"; + model = "Raspberry Pi Model B+"; ++}; ++ ++&gpio { ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; + +- leds { +- act { +- gpios = <&gpio 47 0>; +- }; ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&act_led { ++ gpios = <&gpio 47 0>; ++}; + +- pwr { +- label = "PWR"; +- gpios = <&gpio 35 0>; +- default-state = "keep"; +- linux,default-trigger = "default-on"; +- }; ++&leds { ++ pwr_led: pwr { ++ label = "led1"; ++ linux,default-trigger = "input"; ++ gpios = <&gpio 35 0>; + }; + }; + +-&gpio { +- pinctrl-0 = <&gpioout &alt0 &i2s_alt0 &alt3>; ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; + +- /* I2S interface */ +- i2s_alt0: i2s_alt0 { +- brcm,pins = <18 19 20 21>; +- brcm,function = <4>; /* alt0 */ ++ pwr_led_gpio = <&pwr_led>,"gpios:4"; ++ pwr_led_activelow = <&pwr_led>,"gpios:8"; ++ pwr_led_trigger = <&pwr_led>,"linux,default-trigger"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts +index bafa46f..b867224 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts +@@ -5,19 +5,28 @@ + compatible = "raspberrypi,model-b", "brcm,bcm2835"; + model = "Raspberry Pi Model B"; + +- leds { +- act { +- gpios = <&gpio 16 1>; +- }; +- }; + }; + + &gpio { +- pinctrl-0 = <&gpioout &alt0 &i2s_alt2 &alt3>; +- +- /* I2S interface */ +- i2s_alt2: i2s_alt2 { ++ i2s_pins: i2s { + brcm,pins = <28 29 30 31>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&act_led { ++ gpios = <&gpio 16 1>; ++}; ++ ++/ { ++ __overrides__ { ++ act_led_gpio = <&act_led>,"gpios:4"; ++ act_led_activelow = <&act_led>,"gpios:8"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index f23835e..466f02b 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -1,17 +1,29 @@ + /include/ "bcm2835.dtsi" + + / { ++ /* This is left here in case u-boot needs it */ + memory { + reg = <0 0x10000000>; + }; + +- leds { ++ aliases { ++ soc = &soc; ++ spi0 = &spi0; ++ i2c0 = &i2c0; ++ i2c1 = &i2c1; ++ i2s = &i2s; ++ gpio = &gpio; ++ intc = &intc; ++ leds = &leds; ++ sound = &sound; ++ }; ++ ++ leds: leds { + compatible = "gpio-leds"; + +- act { +- label = "ACT"; +- default-state = "keep"; +- linux,default-trigger = "heartbeat"; ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; + }; + }; + +@@ -19,35 +31,61 @@ + audio: audio { + compatible = "brcm,bcm2835-audio"; + brcm,pwm-channels = <8>; ++ status = "disabled"; ++ }; ++ ++ /* External sound card */ ++ sound: sound { + }; + }; + + &gpio { +- pinctrl-names = "default"; ++ spi0_pins: spi0_pins { ++ brcm,pins = <7 8 9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; + +- gpioout: gpioout { +- brcm,pins = <6>; +- brcm,function = <1>; /* GPIO out */ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; + }; + +- alt0: alt0 { +- brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>; +- brcm,function = <4>; /* alt0 */ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; + }; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins>; + +- alt3: alt3 { +- brcm,pins = <48 49 50 51 52 53>; +- brcm,function = <7>; /* alt3 */ ++ spidev@0{ ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ }; ++ ++ spidev@1{ ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; + }; + }; + + &i2c0 { +- status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; + clock-frequency = <100000>; + }; + + &i2c1 { +- status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; + clock-frequency = <100000>; + }; + +@@ -59,3 +97,16 @@ + &fb { + status = "okay"; + }; ++ ++/ { ++ __overrides__ { ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ act_led_trigger = <&act_led>,"linux,default-trigger"; ++ audio = <&audio>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index efaf4df..4b6dd65f 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -9,7 +9,7 @@ + bootargs = ""; + }; + +- soc { ++ soc: soc { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; +@@ -51,12 +51,12 @@ + #interrupt-cells = <2>; + }; + +- watchdog@7e100000 { ++ watchdog: watchdog@7e100000 { + compatible = "brcm,bcm2835-pm-wdt"; + reg = <0x7e100000 0x28>; + }; + +- rng@7e104000 { ++ random: rng@7e104000 { + compatible = "brcm,bcm2835-rng"; + reg = <0x7e104000 0x10>; + }; +@@ -90,7 +90,7 @@ + #interrupt-cells = <2>; + }; + +- uart@7e201000 { ++ uart0: uart@7e201000 { + compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; + reg = <0x7e201000 0x1000>; + interrupts = <2 25>; +@@ -109,7 +109,7 @@ + status = "disabled"; + }; + +- spi: spi@7e204000 { ++ spi0: spi@7e204000 { + compatible = "brcm,bcm2835-spi"; + reg = <0x7e204000 0x1000>; + interrupts = <2 22>; +@@ -150,7 +150,7 @@ + status = "disabled"; + }; + +- usb@7e980000 { ++ usb: usb@7e980000 { + compatible = "brcm,bcm2835-usb"; + reg = <0x7e980000 0x10000>; + interrupts = <1 9>; + +From 3ac358b4ca8e0b71da28992689669218e0dbbacf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:35:11 +0200 +Subject: [PATCH 203/216] dts: Enable overlays on ARCH_BCM2835 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Build Device Tree overlays on ARCH_BCM2835. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/Makefile | 3 +++ + arch/arm/boot/dts/overlays/Makefile | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index d5b6a82..e7ce7c4 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -12,6 +12,9 @@ endif + ifeq ($(CONFIG_BCM2709_DT),y) + RPI_DT_OVERLAYS=y + endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif + + subdir-$(RPI_DT_OVERLAYS) += overlays + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index d18a1f2..c449c3f 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -8,6 +8,9 @@ endif + ifeq ($(CONFIG_BCM2709_DT),y) + RPI_DT_OVERLAYS=y + endif ++ifeq ($(CONFIG_ARCH_BCM2835),y) ++ RPI_DT_OVERLAYS=y ++endif + + dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb + +From 6c6321340ea33c79dbfb15441ad58db03ec94167 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:35:55 +0200 +Subject: [PATCH 204/216] bcm2835: Make camera and sound drivers available +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change kconfig dependency to make SND_BCM2708_SOC_* and +VIDEO_BCM2835 available on ARCH_BCM2835. + +Signed-off-by: Noralf Trønnes +--- + drivers/media/platform/bcm2835/Kconfig | 2 +- + sound/soc/bcm/Kconfig | 14 +++++++------- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/drivers/media/platform/bcm2835/Kconfig b/drivers/media/platform/bcm2835/Kconfig +index 2cb1a68..99a5cbc 100644 +--- a/drivers/media/platform/bcm2835/Kconfig ++++ b/drivers/media/platform/bcm2835/Kconfig +@@ -2,7 +2,7 @@ + + config VIDEO_BCM2835 + bool "Broadcom BCM2835 camera interface driver" +- depends on VIDEO_V4L2 && (ARCH_BCM2708 || ARCH_BCM2709) ++ depends on VIDEO_V4L2 && (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) + ---help--- + Say Y here to enable camera host interface devices for + Broadcom BCM2835 SoC. This operates over the VCHIQ interface +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 003ae28..516ab9d 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -21,49 +21,49 @@ config SND_BCM2708_SOC_I2S + + config SND_BCM2708_SOC_HIFIBERRY_DAC + tristate "Support for HifiBerry DAC" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_PCM5102A + help + Say Y or M if you want to add support for HifiBerry DAC. + + config SND_BCM2708_SOC_HIFIBERRY_DACPLUS + tristate "Support for HifiBerry DAC+" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_PCM512x + help + Say Y or M if you want to add support for HifiBerry DAC+. + + config SND_BCM2708_SOC_HIFIBERRY_DIGI + tristate "Support for HifiBerry Digi" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_WM8804 + help + Say Y or M if you want to add support for HifiBerry Digi S/PDIF output board. + + config SND_BCM2708_SOC_HIFIBERRY_AMP + tristate "Support for the HifiBerry Amp" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_TAS5713 + help + Say Y or M if you want to add support for the HifiBerry Amp amplifier board. + + config SND_BCM2708_SOC_RPI_DAC + tristate "Support for RPi-DAC" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_PCM1794A + help + Say Y or M if you want to add support for RPi-DAC. + + config SND_BCM2708_SOC_RPI_PROTO + tristate "Support for Rpi-PROTO" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_WM8731 + help + Say Y or M if you want to add support for Audio Codec Board PROTO (WM8731). + + config SND_BCM2708_SOC_IQAUDIO_DAC + tristate "Support for IQaudIO-DAC" +- depends on SND_BCM2708_SOC_I2S ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S + select SND_SOC_PCM512x_I2C + help + Say Y or M if you want to add support for IQaudIO-DAC. + +From b5b5fa6e2a877089b48daaaac9b135c95c71e24f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Wed, 3 Jun 2015 12:36:19 +0200 +Subject: [PATCH 205/216] bcm2835: Merge bcm2835_defconfig with + bcmrpi_defconfig +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +These commands where used to make this commit: + +./scripts/diffconfig -m arch/arm/configs/bcm2835_defconfig arch/arm/configs/bcmrpi_defconfig > merge.cfg + +cat << EOF > filter +CONFIG_ARCH_BCM2708 +CONFIG_BCM2708_DT +CONFIG_ARM_PATCH_PHYS_VIRT +CONFIG_PHYS_OFFSET +CONFIG_CMDLINE +CONFIG_BCM2708_WDT +CONFIG_HW_RANDOM_BCM2708 +CONFIG_I2C_BCM2708 +CONFIG_SPI_BCM2708 +CONFIG_SND_BCM2708_SOC_I2S +CONFIG_USB_DWCOTG +CONFIG_LIRC_RPI +EOF + +grep -F -v -f filter merge.cfg > filtered.cfg + +cat << EOF > added.cfg +CONFIG_WATCHDOG=y +CONFIG_BCM2835_WDT=y +CONFIG_MISC_FILESYSTEMS=y +CONFIG_SND_BCM2835_SOC_I2S=m +EOF + +ARCH=arm scripts/kconfig/merge_config.sh arch/arm/configs/bcm2835_defconfig filtered.cfg added.cfg +ARCH=arm make oldconfig + +ARCH=arm make savedefconfig +cp defconfig arch/arm/configs/bcm2835_defconfig + +rm merge.cfg filter filtered.cfg added.cfg defconfig + +ARCH=arm make bcm2835_defconfig +ARCH=arm make oldconfig + +Signed-off-by: Noralf Trønnes +--- + arch/arm/configs/bcm2835_defconfig | 1114 +++++++++++++++++++++++++++++++++++- + 1 file changed, 1097 insertions(+), 17 deletions(-) + +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 1af6069..2e8a95a 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -1,107 +1,1071 @@ + # CONFIG_LOCALVERSION_AUTO is not set + CONFIG_SYSVIPC=y ++CONFIG_POSIX_MQUEUE=y + CONFIG_FHANDLE=y + CONFIG_NO_HZ=y + CONFIG_HIGH_RES_TIMERS=y + CONFIG_BSD_PROCESS_ACCT=y + CONFIG_BSD_PROCESS_ACCT_V3=y ++CONFIG_TASKSTATS=y ++CONFIG_TASK_DELAY_ACCT=y ++CONFIG_TASK_XACCT=y ++CONFIG_TASK_IO_ACCOUNTING=y ++CONFIG_IKCONFIG=m ++CONFIG_IKCONFIG_PROC=y + CONFIG_LOG_BUF_SHIFT=18 + CONFIG_CGROUP_FREEZER=y + CONFIG_CGROUP_DEVICE=y + CONFIG_CPUSETS=y + CONFIG_CGROUP_CPUACCT=y ++CONFIG_MEMCG=y + CONFIG_CGROUP_PERF=y + CONFIG_CFS_BANDWIDTH=y + CONFIG_RT_GROUP_SCHED=y ++CONFIG_BLK_CGROUP=y + CONFIG_NAMESPACES=y + CONFIG_SCHED_AUTOGROUP=y +-CONFIG_RELAY=y + CONFIG_BLK_DEV_INITRD=y + CONFIG_CC_OPTIMIZE_FOR_SIZE=y +-CONFIG_KALLSYMS_ALL=y + CONFIG_EMBEDDED=y + # CONFIG_COMPAT_BRK is not set + CONFIG_PROFILING=y +-CONFIG_OPROFILE=y ++CONFIG_OPROFILE=m ++CONFIG_KPROBES=y + CONFIG_JUMP_LABEL=y + CONFIG_CC_STACKPROTECTOR_REGULAR=y ++CONFIG_MODULES=y ++CONFIG_MODULE_UNLOAD=y ++CONFIG_MODVERSIONS=y ++CONFIG_MODULE_SRCVERSION_ALL=y ++CONFIG_BLK_DEV_THROTTLING=y ++CONFIG_PARTITION_ADVANCED=y ++CONFIG_MAC_PARTITION=y ++CONFIG_CFQ_GROUP_IOSCHED=y + CONFIG_ARCH_MULTI_V6=y + # CONFIG_ARCH_MULTI_V7 is not set + CONFIG_ARCH_BCM=y + CONFIG_ARCH_BCM2835=y +-CONFIG_PREEMPT_VOLUNTARY=y ++CONFIG_PREEMPT=y + CONFIG_AEABI=y ++CONFIG_OABI_COMPAT=y + CONFIG_KSM=y + CONFIG_CLEANCACHE=y ++CONFIG_FRONTSWAP=y ++CONFIG_CMA=y ++CONFIG_UACCESS_WITH_MEMCPY=y + CONFIG_SECCOMP=y ++CONFIG_ZBOOT_ROM_TEXT=0x0 ++CONFIG_ZBOOT_ROM_BSS=0x0 + CONFIG_KEXEC=y + CONFIG_CRASH_DUMP=y ++CONFIG_CPU_FREQ=y ++CONFIG_CPU_FREQ_STAT=m ++CONFIG_CPU_FREQ_STAT_DETAILS=y ++CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE=y ++CONFIG_CPU_FREQ_GOV_PERFORMANCE=y ++CONFIG_CPU_FREQ_GOV_USERSPACE=y ++CONFIG_CPU_FREQ_GOV_ONDEMAND=y ++CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y + CONFIG_VFP=y + # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set ++CONFIG_BINFMT_MISC=m + # CONFIG_SUSPEND is not set + CONFIG_NET=y + CONFIG_PACKET=y + CONFIG_UNIX=y ++CONFIG_XFRM_USER=y ++CONFIG_NET_KEY=m + CONFIG_INET=y ++CONFIG_IP_MULTICAST=y ++CONFIG_IP_ADVANCED_ROUTER=y ++CONFIG_IP_MULTIPLE_TABLES=y ++CONFIG_IP_ROUTE_MULTIPATH=y ++CONFIG_IP_ROUTE_VERBOSE=y ++CONFIG_IP_PNP=y ++CONFIG_IP_PNP_DHCP=y ++CONFIG_IP_PNP_RARP=y ++CONFIG_NET_IPIP=m ++CONFIG_NET_IPGRE_DEMUX=m ++CONFIG_NET_IPGRE=m ++CONFIG_IP_MROUTE=y ++CONFIG_IP_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IP_PIMSM_V1=y ++CONFIG_IP_PIMSM_V2=y ++CONFIG_SYN_COOKIES=y ++CONFIG_INET_AH=m ++CONFIG_INET_ESP=m ++CONFIG_INET_IPCOMP=m ++CONFIG_INET_XFRM_MODE_TRANSPORT=m ++CONFIG_INET_XFRM_MODE_TUNNEL=m ++CONFIG_INET_XFRM_MODE_BEET=m ++CONFIG_INET_LRO=m ++CONFIG_INET_DIAG=m ++CONFIG_INET6_AH=m ++CONFIG_INET6_ESP=m ++CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_TUNNEL=m ++CONFIG_IPV6_MULTIPLE_TABLES=y ++CONFIG_IPV6_MROUTE=y ++CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y ++CONFIG_IPV6_PIMSM_V2=y + CONFIG_NETWORK_SECMARK=y + CONFIG_NETFILTER=y +-CONFIG_CFG80211=y +-CONFIG_MAC80211=y ++CONFIG_NF_CONNTRACK=m ++CONFIG_NF_CONNTRACK_ZONES=y ++CONFIG_NF_CONNTRACK_EVENTS=y ++CONFIG_NF_CONNTRACK_TIMESTAMP=y ++CONFIG_NF_CT_PROTO_DCCP=m ++CONFIG_NF_CT_PROTO_UDPLITE=m ++CONFIG_NF_CONNTRACK_AMANDA=m ++CONFIG_NF_CONNTRACK_FTP=m ++CONFIG_NF_CONNTRACK_H323=m ++CONFIG_NF_CONNTRACK_IRC=m ++CONFIG_NF_CONNTRACK_NETBIOS_NS=m ++CONFIG_NF_CONNTRACK_SNMP=m ++CONFIG_NF_CONNTRACK_PPTP=m ++CONFIG_NF_CONNTRACK_SANE=m ++CONFIG_NF_CONNTRACK_SIP=m ++CONFIG_NF_CONNTRACK_TFTP=m ++CONFIG_NF_CT_NETLINK=m ++CONFIG_NETFILTER_XT_SET=m ++CONFIG_NETFILTER_XT_TARGET_CHECKSUM=m ++CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m ++CONFIG_NETFILTER_XT_TARGET_CONNMARK=m ++CONFIG_NETFILTER_XT_TARGET_DSCP=m ++CONFIG_NETFILTER_XT_TARGET_HMARK=m ++CONFIG_NETFILTER_XT_TARGET_IDLETIMER=m ++CONFIG_NETFILTER_XT_TARGET_LED=m ++CONFIG_NETFILTER_XT_TARGET_LOG=m ++CONFIG_NETFILTER_XT_TARGET_MARK=m ++CONFIG_NETFILTER_XT_TARGET_NFLOG=m ++CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m ++CONFIG_NETFILTER_XT_TARGET_NOTRACK=m ++CONFIG_NETFILTER_XT_TARGET_TEE=m ++CONFIG_NETFILTER_XT_TARGET_TPROXY=m ++CONFIG_NETFILTER_XT_TARGET_TRACE=m ++CONFIG_NETFILTER_XT_TARGET_TCPMSS=m ++CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP=m ++CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NETFILTER_XT_MATCH_CLUSTER=m ++CONFIG_NETFILTER_XT_MATCH_COMMENT=m ++CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m ++CONFIG_NETFILTER_XT_MATCH_CONNLABEL=m ++CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_CONNMARK=m ++CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m ++CONFIG_NETFILTER_XT_MATCH_CPU=m ++CONFIG_NETFILTER_XT_MATCH_DCCP=m ++CONFIG_NETFILTER_XT_MATCH_DEVGROUP=m ++CONFIG_NETFILTER_XT_MATCH_DSCP=m ++CONFIG_NETFILTER_XT_MATCH_ESP=m ++CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m ++CONFIG_NETFILTER_XT_MATCH_HELPER=m ++CONFIG_NETFILTER_XT_MATCH_IPRANGE=m ++CONFIG_NETFILTER_XT_MATCH_IPVS=m ++CONFIG_NETFILTER_XT_MATCH_LENGTH=m ++CONFIG_NETFILTER_XT_MATCH_LIMIT=m ++CONFIG_NETFILTER_XT_MATCH_MAC=m ++CONFIG_NETFILTER_XT_MATCH_MARK=m ++CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m ++CONFIG_NETFILTER_XT_MATCH_NFACCT=m ++CONFIG_NETFILTER_XT_MATCH_OSF=m ++CONFIG_NETFILTER_XT_MATCH_OWNER=m ++CONFIG_NETFILTER_XT_MATCH_POLICY=m ++CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m ++CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m ++CONFIG_NETFILTER_XT_MATCH_QUOTA=m ++CONFIG_NETFILTER_XT_MATCH_RATEEST=m ++CONFIG_NETFILTER_XT_MATCH_REALM=m ++CONFIG_NETFILTER_XT_MATCH_RECENT=m ++CONFIG_NETFILTER_XT_MATCH_SOCKET=m ++CONFIG_NETFILTER_XT_MATCH_STATE=m ++CONFIG_NETFILTER_XT_MATCH_STATISTIC=m ++CONFIG_NETFILTER_XT_MATCH_STRING=m ++CONFIG_NETFILTER_XT_MATCH_TCPMSS=m ++CONFIG_NETFILTER_XT_MATCH_TIME=m ++CONFIG_NETFILTER_XT_MATCH_U32=m ++CONFIG_IP_SET=m ++CONFIG_IP_SET_BITMAP_IP=m ++CONFIG_IP_SET_BITMAP_IPMAC=m ++CONFIG_IP_SET_BITMAP_PORT=m ++CONFIG_IP_SET_HASH_IP=m ++CONFIG_IP_SET_HASH_IPPORT=m ++CONFIG_IP_SET_HASH_IPPORTIP=m ++CONFIG_IP_SET_HASH_IPPORTNET=m ++CONFIG_IP_SET_HASH_NET=m ++CONFIG_IP_SET_HASH_NETPORT=m ++CONFIG_IP_SET_HASH_NETIFACE=m ++CONFIG_IP_SET_LIST_SET=m ++CONFIG_IP_VS=m ++CONFIG_IP_VS_PROTO_TCP=y ++CONFIG_IP_VS_PROTO_UDP=y ++CONFIG_IP_VS_PROTO_ESP=y ++CONFIG_IP_VS_PROTO_AH=y ++CONFIG_IP_VS_PROTO_SCTP=y ++CONFIG_IP_VS_RR=m ++CONFIG_IP_VS_WRR=m ++CONFIG_IP_VS_LC=m ++CONFIG_IP_VS_WLC=m ++CONFIG_IP_VS_LBLC=m ++CONFIG_IP_VS_LBLCR=m ++CONFIG_IP_VS_DH=m ++CONFIG_IP_VS_SH=m ++CONFIG_IP_VS_SED=m ++CONFIG_IP_VS_NQ=m ++CONFIG_IP_VS_FTP=m ++CONFIG_IP_VS_PE_SIP=m ++CONFIG_NF_CONNTRACK_IPV4=m ++CONFIG_IP_NF_IPTABLES=m ++CONFIG_IP_NF_MATCH_AH=m ++CONFIG_IP_NF_MATCH_ECN=m ++CONFIG_IP_NF_MATCH_TTL=m ++CONFIG_IP_NF_FILTER=m ++CONFIG_IP_NF_TARGET_REJECT=m ++CONFIG_IP_NF_NAT=m ++CONFIG_IP_NF_TARGET_MASQUERADE=m ++CONFIG_IP_NF_TARGET_NETMAP=m ++CONFIG_IP_NF_TARGET_REDIRECT=m ++CONFIG_IP_NF_MANGLE=m ++CONFIG_IP_NF_TARGET_CLUSTERIP=m ++CONFIG_IP_NF_TARGET_ECN=m ++CONFIG_IP_NF_TARGET_TTL=m ++CONFIG_IP_NF_RAW=m ++CONFIG_IP_NF_ARPTABLES=m ++CONFIG_IP_NF_ARPFILTER=m ++CONFIG_IP_NF_ARP_MANGLE=m ++CONFIG_NF_CONNTRACK_IPV6=m ++CONFIG_IP6_NF_IPTABLES=m ++CONFIG_IP6_NF_MATCH_AH=m ++CONFIG_IP6_NF_MATCH_EUI64=m ++CONFIG_IP6_NF_MATCH_FRAG=m ++CONFIG_IP6_NF_MATCH_OPTS=m ++CONFIG_IP6_NF_MATCH_HL=m ++CONFIG_IP6_NF_MATCH_IPV6HEADER=m ++CONFIG_IP6_NF_MATCH_MH=m ++CONFIG_IP6_NF_MATCH_RT=m ++CONFIG_IP6_NF_TARGET_HL=m ++CONFIG_IP6_NF_FILTER=m ++CONFIG_IP6_NF_TARGET_REJECT=m ++CONFIG_IP6_NF_MANGLE=m ++CONFIG_IP6_NF_RAW=m ++CONFIG_IP6_NF_NAT=m ++CONFIG_IP6_NF_TARGET_MASQUERADE=m ++CONFIG_IP6_NF_TARGET_NPT=m ++CONFIG_BRIDGE_NF_EBTABLES=m ++CONFIG_BRIDGE_EBT_BROUTE=m ++CONFIG_BRIDGE_EBT_T_FILTER=m ++CONFIG_BRIDGE_EBT_T_NAT=m ++CONFIG_BRIDGE_EBT_802_3=m ++CONFIG_BRIDGE_EBT_AMONG=m ++CONFIG_BRIDGE_EBT_ARP=m ++CONFIG_BRIDGE_EBT_IP=m ++CONFIG_BRIDGE_EBT_IP6=m ++CONFIG_BRIDGE_EBT_LIMIT=m ++CONFIG_BRIDGE_EBT_MARK=m ++CONFIG_BRIDGE_EBT_PKTTYPE=m ++CONFIG_BRIDGE_EBT_STP=m ++CONFIG_BRIDGE_EBT_VLAN=m ++CONFIG_BRIDGE_EBT_ARPREPLY=m ++CONFIG_BRIDGE_EBT_DNAT=m ++CONFIG_BRIDGE_EBT_MARK_T=m ++CONFIG_BRIDGE_EBT_REDIRECT=m ++CONFIG_BRIDGE_EBT_SNAT=m ++CONFIG_BRIDGE_EBT_LOG=m ++CONFIG_BRIDGE_EBT_NFLOG=m ++CONFIG_SCTP_COOKIE_HMAC_SHA1=y ++CONFIG_ATM=m ++CONFIG_L2TP=m ++CONFIG_L2TP_V3=y ++CONFIG_L2TP_IP=m ++CONFIG_L2TP_ETH=m ++CONFIG_BRIDGE=m ++CONFIG_VLAN_8021Q=m ++CONFIG_VLAN_8021Q_GVRP=y ++CONFIG_ATALK=m ++CONFIG_6LOWPAN=m ++CONFIG_NET_SCHED=y ++CONFIG_NET_SCH_CBQ=m ++CONFIG_NET_SCH_HTB=m ++CONFIG_NET_SCH_HFSC=m ++CONFIG_NET_SCH_PRIO=m ++CONFIG_NET_SCH_MULTIQ=m ++CONFIG_NET_SCH_RED=m ++CONFIG_NET_SCH_SFB=m ++CONFIG_NET_SCH_SFQ=m ++CONFIG_NET_SCH_TEQL=m ++CONFIG_NET_SCH_TBF=m ++CONFIG_NET_SCH_GRED=m ++CONFIG_NET_SCH_DSMARK=m ++CONFIG_NET_SCH_NETEM=m ++CONFIG_NET_SCH_DRR=m ++CONFIG_NET_SCH_MQPRIO=m ++CONFIG_NET_SCH_CHOKE=m ++CONFIG_NET_SCH_QFQ=m ++CONFIG_NET_SCH_CODEL=m ++CONFIG_NET_SCH_FQ_CODEL=m ++CONFIG_NET_SCH_INGRESS=m ++CONFIG_NET_SCH_PLUG=m ++CONFIG_NET_CLS_BASIC=m ++CONFIG_NET_CLS_TCINDEX=m ++CONFIG_NET_CLS_ROUTE4=m ++CONFIG_NET_CLS_FW=m ++CONFIG_NET_CLS_U32=m ++CONFIG_CLS_U32_MARK=y ++CONFIG_NET_CLS_RSVP=m ++CONFIG_NET_CLS_RSVP6=m ++CONFIG_NET_CLS_FLOW=m ++CONFIG_NET_CLS_CGROUP=m ++CONFIG_NET_EMATCH=y ++CONFIG_NET_EMATCH_CMP=m ++CONFIG_NET_EMATCH_NBYTE=m ++CONFIG_NET_EMATCH_U32=m ++CONFIG_NET_EMATCH_META=m ++CONFIG_NET_EMATCH_TEXT=m ++CONFIG_NET_EMATCH_IPSET=m ++CONFIG_NET_CLS_ACT=y ++CONFIG_NET_ACT_POLICE=m ++CONFIG_NET_ACT_GACT=m ++CONFIG_GACT_PROB=y ++CONFIG_NET_ACT_MIRRED=m ++CONFIG_NET_ACT_IPT=m ++CONFIG_NET_ACT_NAT=m ++CONFIG_NET_ACT_PEDIT=m ++CONFIG_NET_ACT_SIMP=m ++CONFIG_NET_ACT_SKBEDIT=m ++CONFIG_NET_ACT_CSUM=m ++CONFIG_BATMAN_ADV=m ++CONFIG_OPENVSWITCH=m ++CONFIG_NET_PKTGEN=m ++CONFIG_HAMRADIO=y ++CONFIG_AX25=m ++CONFIG_NETROM=m ++CONFIG_ROSE=m ++CONFIG_MKISS=m ++CONFIG_6PACK=m ++CONFIG_BPQETHER=m ++CONFIG_BAYCOM_SER_FDX=m ++CONFIG_BAYCOM_SER_HDX=m ++CONFIG_YAM=m ++CONFIG_CAN=m ++CONFIG_CAN_VCAN=m ++CONFIG_CAN_MCP251X=m ++CONFIG_IRDA=m ++CONFIG_IRLAN=m ++CONFIG_IRNET=m ++CONFIG_IRCOMM=m ++CONFIG_IRDA_ULTRA=y ++CONFIG_IRDA_CACHE_LAST_LSAP=y ++CONFIG_IRDA_FAST_RR=y ++CONFIG_IRTTY_SIR=m ++CONFIG_KINGSUN_DONGLE=m ++CONFIG_KSDAZZLE_DONGLE=m ++CONFIG_KS959_DONGLE=m ++CONFIG_USB_IRDA=m ++CONFIG_SIGMATEL_FIR=m ++CONFIG_MCS_FIR=m ++CONFIG_BT=m ++CONFIG_BT_RFCOMM=m ++CONFIG_BT_RFCOMM_TTY=y ++CONFIG_BT_BNEP=m ++CONFIG_BT_BNEP_MC_FILTER=y ++CONFIG_BT_BNEP_PROTO_FILTER=y ++CONFIG_BT_HIDP=m ++CONFIG_BT_6LOWPAN=m ++CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIBCM203X=m ++CONFIG_BT_HCIBPA10X=m ++CONFIG_BT_HCIBFUSB=m ++CONFIG_BT_HCIVHCI=m ++CONFIG_BT_MRVL=m ++CONFIG_BT_MRVL_SDIO=m ++CONFIG_BT_ATH3K=m ++CONFIG_BT_WILINK=m ++CONFIG_MAC80211=m ++CONFIG_MAC80211_MESH=y ++CONFIG_WIMAX=m ++CONFIG_RFKILL=m ++CONFIG_RFKILL_INPUT=y ++CONFIG_NET_9P=m ++CONFIG_NFC=m ++CONFIG_NFC_PN533=m + CONFIG_DEVTMPFS=y + CONFIG_DEVTMPFS_MOUNT=y + # CONFIG_STANDALONE is not set ++CONFIG_DMA_CMA=y ++CONFIG_CMA_SIZE_MBYTES=5 ++CONFIG_BLK_DEV_LOOP=y ++CONFIG_BLK_DEV_CRYPTOLOOP=m ++CONFIG_BLK_DEV_DRBD=m ++CONFIG_BLK_DEV_NBD=m ++CONFIG_BLK_DEV_RAM=y ++CONFIG_CDROM_PKTCDVD=m ++CONFIG_ATA_OVER_ETH=m ++CONFIG_EEPROM_AT24=m + CONFIG_SCSI=y ++# CONFIG_SCSI_PROC_FS is not set + CONFIG_BLK_DEV_SD=y ++CONFIG_CHR_DEV_ST=m ++CONFIG_CHR_DEV_OSST=m ++CONFIG_BLK_DEV_SR=m ++CONFIG_CHR_DEV_SG=m + CONFIG_SCSI_CONSTANTS=y + CONFIG_SCSI_SCAN_ASYNC=y ++CONFIG_SCSI_ISCSI_ATTRS=y ++CONFIG_ISCSI_TCP=m ++CONFIG_ISCSI_BOOT_SYSFS=m ++CONFIG_MD=y ++CONFIG_MD_LINEAR=m ++CONFIG_MD_RAID0=m ++CONFIG_BLK_DEV_DM=m ++CONFIG_DM_CRYPT=m ++CONFIG_DM_SNAPSHOT=m ++CONFIG_DM_MIRROR=m ++CONFIG_DM_LOG_USERSPACE=m ++CONFIG_DM_RAID=m ++CONFIG_DM_ZERO=m ++CONFIG_DM_DELAY=m + CONFIG_NETDEVICES=y ++CONFIG_BONDING=m ++CONFIG_DUMMY=m ++CONFIG_IFB=m ++CONFIG_MACVLAN=m ++CONFIG_NETCONSOLE=m ++CONFIG_TUN=m ++CONFIG_VETH=m ++CONFIG_ENC28J60=m ++CONFIG_MDIO_BITBANG=m ++CONFIG_PPP=m ++CONFIG_PPP_BSDCOMP=m ++CONFIG_PPP_DEFLATE=m ++CONFIG_PPP_FILTER=y ++CONFIG_PPP_MPPE=m ++CONFIG_PPP_MULTILINK=y ++CONFIG_PPPOATM=m ++CONFIG_PPPOE=m ++CONFIG_PPPOL2TP=m ++CONFIG_PPP_ASYNC=m ++CONFIG_PPP_SYNC_TTY=m ++CONFIG_SLIP=m ++CONFIG_SLIP_COMPRESSED=y ++CONFIG_SLIP_SMART=y ++CONFIG_USB_CATC=m ++CONFIG_USB_KAWETH=m ++CONFIG_USB_PEGASUS=m ++CONFIG_USB_RTL8150=m ++CONFIG_USB_RTL8152=m + CONFIG_USB_USBNET=y ++CONFIG_USB_NET_AX8817X=m ++CONFIG_USB_NET_AX88179_178A=m ++CONFIG_USB_NET_CDCETHER=m ++CONFIG_USB_NET_CDC_EEM=m ++CONFIG_USB_NET_CDC_NCM=m ++CONFIG_USB_NET_HUAWEI_CDC_NCM=m ++CONFIG_USB_NET_CDC_MBIM=m ++CONFIG_USB_NET_DM9601=m ++CONFIG_USB_NET_SR9700=m ++CONFIG_USB_NET_SR9800=m ++CONFIG_USB_NET_SMSC75XX=m + CONFIG_USB_NET_SMSC95XX=y +-CONFIG_ZD1211RW=y +-CONFIG_INPUT_EVDEV=y ++CONFIG_USB_NET_GL620A=m ++CONFIG_USB_NET_NET1080=m ++CONFIG_USB_NET_PLUSB=m ++CONFIG_USB_NET_MCS7830=m ++CONFIG_USB_NET_CDC_SUBSET=m ++CONFIG_USB_ALI_M5632=y ++CONFIG_USB_AN2720=y ++CONFIG_USB_EPSON2888=y ++CONFIG_USB_KC2190=y ++CONFIG_USB_NET_ZAURUS=m ++CONFIG_USB_NET_CX82310_ETH=m ++CONFIG_USB_NET_KALMIA=m ++CONFIG_USB_NET_QMI_WWAN=m ++CONFIG_USB_HSO=m ++CONFIG_USB_NET_INT51X1=m ++CONFIG_USB_IPHETH=m ++CONFIG_USB_SIERRA_NET=m ++CONFIG_USB_VL600=m ++CONFIG_LIBERTAS_THINFIRM=m ++CONFIG_LIBERTAS_THINFIRM_USB=m ++CONFIG_AT76C50X_USB=m ++CONFIG_USB_ZD1201=m ++CONFIG_USB_NET_RNDIS_WLAN=m ++CONFIG_RTL8187=m ++CONFIG_MAC80211_HWSIM=m ++CONFIG_ATH_CARDS=m ++CONFIG_ATH9K=m ++CONFIG_ATH9K_HTC=m ++CONFIG_CARL9170=m ++CONFIG_ATH6KL=m ++CONFIG_ATH6KL_USB=m ++CONFIG_AR5523=m ++CONFIG_B43=m ++# CONFIG_B43_PHY_N is not set ++CONFIG_B43LEGACY=m ++CONFIG_BRCMFMAC=m ++CONFIG_BRCMFMAC_USB=y ++CONFIG_HOSTAP=m ++CONFIG_LIBERTAS=m ++CONFIG_LIBERTAS_USB=m ++CONFIG_LIBERTAS_SDIO=m ++CONFIG_P54_COMMON=m ++CONFIG_P54_USB=m ++CONFIG_RT2X00=m ++CONFIG_RT2500USB=m ++CONFIG_RT73USB=m ++CONFIG_RT2800USB=m ++CONFIG_RT2800USB_RT3573=y ++CONFIG_RT2800USB_RT53XX=y ++CONFIG_RT2800USB_RT55XX=y ++CONFIG_RT2800USB_UNKNOWN=y ++CONFIG_RTL8192CU=m ++CONFIG_ZD1211RW=m ++CONFIG_MWIFIEX=m ++CONFIG_MWIFIEX_SDIO=m ++CONFIG_WIMAX_I2400M_USB=m ++CONFIG_INPUT_POLLDEV=m ++# CONFIG_INPUT_MOUSEDEV_PSAUX is not set ++CONFIG_INPUT_JOYDEV=m ++CONFIG_INPUT_EVDEV=m ++# CONFIG_KEYBOARD_ATKBD is not set ++CONFIG_KEYBOARD_GPIO=m ++# CONFIG_INPUT_MOUSE is not set ++CONFIG_INPUT_JOYSTICK=y ++CONFIG_JOYSTICK_IFORCE=m ++CONFIG_JOYSTICK_IFORCE_USB=y ++CONFIG_JOYSTICK_XPAD=m ++CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_INPUT_TOUCHSCREEN=y ++CONFIG_TOUCHSCREEN_ADS7846=m ++CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_USB_COMPOSITE=m ++CONFIG_TOUCHSCREEN_STMPE=m ++CONFIG_INPUT_MISC=y ++CONFIG_INPUT_AD714X=m ++CONFIG_INPUT_ATI_REMOTE2=m ++CONFIG_INPUT_KEYSPAN_REMOTE=m ++CONFIG_INPUT_POWERMATE=m ++CONFIG_INPUT_YEALINK=m ++CONFIG_INPUT_CM109=m ++CONFIG_INPUT_UINPUT=m ++CONFIG_INPUT_GPIO_ROTARY_ENCODER=m ++CONFIG_INPUT_ADXL34X=m ++CONFIG_INPUT_CMA3000=m ++CONFIG_SERIO=m ++CONFIG_SERIO_RAW=m ++CONFIG_GAMEPORT=m ++CONFIG_GAMEPORT_NS558=m ++CONFIG_GAMEPORT_L4=m ++CONFIG_DEVPTS_MULTIPLE_INSTANCES=y + # CONFIG_LEGACY_PTYS is not set + # CONFIG_DEVKMEM is not set + CONFIG_SERIAL_AMBA_PL011=y + CONFIG_SERIAL_AMBA_PL011_CONSOLE=y + CONFIG_TTY_PRINTK=y ++CONFIG_HW_RANDOM=y ++CONFIG_HW_RANDOM_BCM2835=m ++CONFIG_RAW_DRIVER=y ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VC_SM=y + CONFIG_I2C=y +-CONFIG_I2C_CHARDEV=y ++CONFIG_I2C_CHARDEV=m + CONFIG_I2C_BCM2835=y + CONFIG_SPI=y +-CONFIG_SPI_BCM2835=y ++CONFIG_SPI_BCM2835=m ++CONFIG_SPI_SPIDEV=y ++CONFIG_PPS=m ++CONFIG_PPS_CLIENT_LDISC=m ++CONFIG_PPS_CLIENT_GPIO=m + CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_ARIZONA=m ++CONFIG_GPIO_STMPE=y ++CONFIG_W1=m ++CONFIG_W1_MASTER_DS2490=m ++CONFIG_W1_MASTER_DS2482=m ++CONFIG_W1_MASTER_DS1WM=m ++CONFIG_W1_MASTER_GPIO=m ++CONFIG_W1_SLAVE_THERM=m ++CONFIG_W1_SLAVE_SMEM=m ++CONFIG_W1_SLAVE_DS2408=m ++CONFIG_W1_SLAVE_DS2413=m ++CONFIG_W1_SLAVE_DS2406=m ++CONFIG_W1_SLAVE_DS2423=m ++CONFIG_W1_SLAVE_DS2431=m ++CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2760=m ++CONFIG_W1_SLAVE_DS2780=m ++CONFIG_W1_SLAVE_DS2781=m ++CONFIG_W1_SLAVE_DS28E04=m ++CONFIG_W1_SLAVE_BQ27000=m ++CONFIG_BATTERY_DS2760=m + # CONFIG_HWMON is not set ++CONFIG_THERMAL=y ++CONFIG_THERMAL_BCM2835=y ++CONFIG_WATCHDOG=y ++CONFIG_BCM2835_WDT=y ++CONFIG_UCB1400_CORE=m ++CONFIG_MFD_STMPE=y ++CONFIG_STMPE_SPI=y ++CONFIG_MFD_ARIZONA_I2C=m ++CONFIG_MFD_ARIZONA_SPI=m ++CONFIG_MFD_WM5102=y ++CONFIG_MEDIA_SUPPORT=m ++CONFIG_MEDIA_CAMERA_SUPPORT=y ++CONFIG_MEDIA_ANALOG_TV_SUPPORT=y ++CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y ++CONFIG_MEDIA_RADIO_SUPPORT=y ++CONFIG_MEDIA_RC_SUPPORT=y ++CONFIG_MEDIA_CONTROLLER=y ++CONFIG_LIRC=m ++CONFIG_RC_DEVICES=y ++CONFIG_RC_ATI_REMOTE=m ++CONFIG_IR_IMON=m ++CONFIG_IR_MCEUSB=m ++CONFIG_IR_REDRAT3=m ++CONFIG_IR_STREAMZAP=m ++CONFIG_IR_IGUANA=m ++CONFIG_IR_TTUSBIR=m ++CONFIG_RC_LOOPBACK=m ++CONFIG_IR_GPIO_CIR=m ++CONFIG_MEDIA_USB_SUPPORT=y ++CONFIG_USB_VIDEO_CLASS=m ++CONFIG_USB_M5602=m ++CONFIG_USB_STV06XX=m ++CONFIG_USB_GL860=m ++CONFIG_USB_GSPCA_BENQ=m ++CONFIG_USB_GSPCA_CONEX=m ++CONFIG_USB_GSPCA_CPIA1=m ++CONFIG_USB_GSPCA_DTCS033=m ++CONFIG_USB_GSPCA_ETOMS=m ++CONFIG_USB_GSPCA_FINEPIX=m ++CONFIG_USB_GSPCA_JEILINJ=m ++CONFIG_USB_GSPCA_JL2005BCD=m ++CONFIG_USB_GSPCA_KINECT=m ++CONFIG_USB_GSPCA_KONICA=m ++CONFIG_USB_GSPCA_MARS=m ++CONFIG_USB_GSPCA_MR97310A=m ++CONFIG_USB_GSPCA_NW80X=m ++CONFIG_USB_GSPCA_OV519=m ++CONFIG_USB_GSPCA_OV534=m ++CONFIG_USB_GSPCA_OV534_9=m ++CONFIG_USB_GSPCA_PAC207=m ++CONFIG_USB_GSPCA_PAC7302=m ++CONFIG_USB_GSPCA_PAC7311=m ++CONFIG_USB_GSPCA_SE401=m ++CONFIG_USB_GSPCA_SN9C2028=m ++CONFIG_USB_GSPCA_SN9C20X=m ++CONFIG_USB_GSPCA_SONIXB=m ++CONFIG_USB_GSPCA_SONIXJ=m ++CONFIG_USB_GSPCA_SPCA500=m ++CONFIG_USB_GSPCA_SPCA501=m ++CONFIG_USB_GSPCA_SPCA505=m ++CONFIG_USB_GSPCA_SPCA506=m ++CONFIG_USB_GSPCA_SPCA508=m ++CONFIG_USB_GSPCA_SPCA561=m ++CONFIG_USB_GSPCA_SPCA1528=m ++CONFIG_USB_GSPCA_SQ905=m ++CONFIG_USB_GSPCA_SQ905C=m ++CONFIG_USB_GSPCA_SQ930X=m ++CONFIG_USB_GSPCA_STK014=m ++CONFIG_USB_GSPCA_STK1135=m ++CONFIG_USB_GSPCA_STV0680=m ++CONFIG_USB_GSPCA_SUNPLUS=m ++CONFIG_USB_GSPCA_T613=m ++CONFIG_USB_GSPCA_TOPRO=m ++CONFIG_USB_GSPCA_TV8532=m ++CONFIG_USB_GSPCA_VC032X=m ++CONFIG_USB_GSPCA_VICAM=m ++CONFIG_USB_GSPCA_XIRLINK_CIT=m ++CONFIG_USB_GSPCA_ZC3XX=m ++CONFIG_USB_PWC=m ++CONFIG_VIDEO_CPIA2=m ++CONFIG_USB_ZR364XX=m ++CONFIG_USB_STKWEBCAM=m ++CONFIG_USB_S2255=m ++CONFIG_VIDEO_USBTV=m ++CONFIG_VIDEO_PVRUSB2=m ++CONFIG_VIDEO_HDPVR=m ++CONFIG_VIDEO_USBVISION=m ++CONFIG_VIDEO_STK1160_COMMON=m ++CONFIG_VIDEO_STK1160_AC97=y ++CONFIG_VIDEO_GO7007=m ++CONFIG_VIDEO_GO7007_USB=m ++CONFIG_VIDEO_GO7007_USB_S2250_BOARD=m ++CONFIG_VIDEO_AU0828=m ++CONFIG_VIDEO_AU0828_RC=y ++CONFIG_VIDEO_CX231XX=m ++CONFIG_VIDEO_CX231XX_ALSA=m ++CONFIG_VIDEO_CX231XX_DVB=m ++CONFIG_VIDEO_TM6000=m ++CONFIG_VIDEO_TM6000_ALSA=m ++CONFIG_VIDEO_TM6000_DVB=m ++CONFIG_DVB_USB=m ++CONFIG_DVB_USB_A800=m ++CONFIG_DVB_USB_DIBUSB_MB=m ++CONFIG_DVB_USB_DIBUSB_MB_FAULTY=y ++CONFIG_DVB_USB_DIBUSB_MC=m ++CONFIG_DVB_USB_DIB0700=m ++CONFIG_DVB_USB_UMT_010=m ++CONFIG_DVB_USB_CXUSB=m ++CONFIG_DVB_USB_M920X=m ++CONFIG_DVB_USB_DIGITV=m ++CONFIG_DVB_USB_VP7045=m ++CONFIG_DVB_USB_VP702X=m ++CONFIG_DVB_USB_GP8PSK=m ++CONFIG_DVB_USB_NOVA_T_USB2=m ++CONFIG_DVB_USB_TTUSB2=m ++CONFIG_DVB_USB_DTT200U=m ++CONFIG_DVB_USB_OPERA1=m ++CONFIG_DVB_USB_AF9005=m ++CONFIG_DVB_USB_AF9005_REMOTE=m ++CONFIG_DVB_USB_PCTV452E=m ++CONFIG_DVB_USB_DW2102=m ++CONFIG_DVB_USB_CINERGY_T2=m ++CONFIG_DVB_USB_DTV5100=m ++CONFIG_DVB_USB_FRIIO=m ++CONFIG_DVB_USB_AZ6027=m ++CONFIG_DVB_USB_TECHNISAT_USB2=m ++CONFIG_DVB_USB_V2=m ++CONFIG_DVB_USB_AF9015=m ++CONFIG_DVB_USB_AF9035=m ++CONFIG_DVB_USB_ANYSEE=m ++CONFIG_DVB_USB_AU6610=m ++CONFIG_DVB_USB_AZ6007=m ++CONFIG_DVB_USB_CE6230=m ++CONFIG_DVB_USB_EC168=m ++CONFIG_DVB_USB_GL861=m ++CONFIG_DVB_USB_LME2510=m ++CONFIG_DVB_USB_MXL111SF=m ++CONFIG_DVB_USB_RTL28XXU=m ++CONFIG_DVB_USB_DVBSKY=m ++CONFIG_SMS_USB_DRV=m ++CONFIG_DVB_B2C2_FLEXCOP_USB=m ++CONFIG_DVB_AS102=m ++CONFIG_VIDEO_EM28XX=m ++CONFIG_VIDEO_EM28XX_V4L2=m ++CONFIG_VIDEO_EM28XX_ALSA=m ++CONFIG_VIDEO_EM28XX_DVB=m ++CONFIG_V4L_PLATFORM_DRIVERS=y ++CONFIG_VIDEO_BCM2835=y ++CONFIG_VIDEO_BCM2835_MMAL=m ++CONFIG_RADIO_SI470X=y ++CONFIG_USB_SI470X=m ++CONFIG_I2C_SI470X=m ++CONFIG_RADIO_SI4713=m ++CONFIG_I2C_SI4713=m ++CONFIG_USB_MR800=m ++CONFIG_USB_DSBR=m ++CONFIG_RADIO_SHARK=m ++CONFIG_RADIO_SHARK2=m ++CONFIG_USB_KEENE=m ++CONFIG_USB_MA901=m ++CONFIG_RADIO_TEA5764=m ++CONFIG_RADIO_SAA7706H=m ++CONFIG_RADIO_TEF6862=m ++CONFIG_RADIO_WL1273=m ++CONFIG_RADIO_WL128X=m ++# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set ++CONFIG_VIDEO_UDA1342=m ++CONFIG_VIDEO_SONY_BTF_MPX=m ++CONFIG_VIDEO_TVP5150=m ++CONFIG_VIDEO_TW2804=m ++CONFIG_VIDEO_TW9903=m ++CONFIG_VIDEO_TW9906=m ++CONFIG_VIDEO_OV7640=m ++CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y ++CONFIG_FB_SSD1307=m ++# CONFIG_BACKLIGHT_GENERIC is not set ++CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y ++CONFIG_LOGO=y ++# CONFIG_LOGO_LINUX_MONO is not set ++# CONFIG_LOGO_LINUX_VGA16 is not set ++CONFIG_SOUND=y ++CONFIG_SND=m ++CONFIG_SND_SEQUENCER=m ++CONFIG_SND_SEQ_DUMMY=m ++CONFIG_SND_MIXER_OSS=m ++CONFIG_SND_PCM_OSS=m ++CONFIG_SND_SEQUENCER_OSS=y ++CONFIG_SND_HRTIMER=m ++CONFIG_SND_DUMMY=m ++CONFIG_SND_ALOOP=m ++CONFIG_SND_VIRMIDI=m ++CONFIG_SND_MTPAV=m ++CONFIG_SND_SERIAL_U16550=m ++CONFIG_SND_MPU401=m ++CONFIG_SND_BCM2835=m ++CONFIG_SND_USB_AUDIO=m ++CONFIG_SND_USB_UA101=m ++CONFIG_SND_USB_CAIAQ=m ++CONFIG_SND_USB_CAIAQ_INPUT=y ++CONFIG_SND_USB_6FIRE=m ++CONFIG_SND_SOC=m ++CONFIG_SND_BCM2835_SOC_I2S=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m ++CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m ++CONFIG_SND_BCM2708_SOC_RPI_DAC=m ++CONFIG_SND_BCM2708_SOC_RPI_PROTO=m ++CONFIG_SND_BCM2708_SOC_IQAUDIO_DAC=m ++CONFIG_SND_SIMPLE_CARD=m ++CONFIG_SOUND_PRIME=m ++CONFIG_HIDRAW=y ++CONFIG_HID_A4TECH=m ++CONFIG_HID_ACRUX=m ++CONFIG_HID_APPLE=m ++CONFIG_HID_BELKIN=m ++CONFIG_HID_CHERRY=m ++CONFIG_HID_CHICONY=m ++CONFIG_HID_CYPRESS=m ++CONFIG_HID_DRAGONRISE=m ++CONFIG_HID_EMS_FF=m ++CONFIG_HID_ELECOM=m ++CONFIG_HID_ELO=m ++CONFIG_HID_EZKEY=m ++CONFIG_HID_HOLTEK=m ++CONFIG_HID_KEYTOUCH=m ++CONFIG_HID_KYE=m ++CONFIG_HID_UCLOGIC=m ++CONFIG_HID_WALTOP=m ++CONFIG_HID_GYRATION=m ++CONFIG_HID_TWINHAN=m ++CONFIG_HID_KENSINGTON=m ++CONFIG_HID_LCPOWER=m ++CONFIG_HID_LOGITECH=m ++CONFIG_HID_MAGICMOUSE=m ++CONFIG_HID_MICROSOFT=m ++CONFIG_HID_MONTEREY=m ++CONFIG_HID_MULTITOUCH=m ++CONFIG_HID_NTRIG=m ++CONFIG_HID_ORTEK=m ++CONFIG_HID_PANTHERLORD=m ++CONFIG_HID_PETALYNX=m ++CONFIG_HID_PICOLCD=m ++CONFIG_HID_ROCCAT=m ++CONFIG_HID_SAMSUNG=m ++CONFIG_HID_SONY=m ++CONFIG_HID_SPEEDLINK=m ++CONFIG_HID_SUNPLUS=m ++CONFIG_HID_GREENASIA=m ++CONFIG_HID_SMARTJOYPLUS=m ++CONFIG_HID_TOPSEED=m ++CONFIG_HID_THINGM=m ++CONFIG_HID_THRUSTMASTER=m ++CONFIG_HID_WACOM=m ++CONFIG_HID_WIIMOTE=m ++CONFIG_HID_XINMO=m ++CONFIG_HID_ZEROPLUS=m ++CONFIG_HID_ZYDACRON=m ++CONFIG_HID_PID=y ++CONFIG_USB_HIDDEV=y + CONFIG_USB=y ++CONFIG_USB_ANNOUNCE_NEW_DEVICES=y ++CONFIG_USB_MON=m ++CONFIG_USB_PRINTER=m + CONFIG_USB_STORAGE=y ++CONFIG_USB_STORAGE_REALTEK=m ++CONFIG_USB_STORAGE_DATAFAB=m ++CONFIG_USB_STORAGE_FREECOM=m ++CONFIG_USB_STORAGE_ISD200=m ++CONFIG_USB_STORAGE_USBAT=m ++CONFIG_USB_STORAGE_SDDR09=m ++CONFIG_USB_STORAGE_SDDR55=m ++CONFIG_USB_STORAGE_JUMPSHOT=m ++CONFIG_USB_STORAGE_ALAUDA=m ++CONFIG_USB_STORAGE_ONETOUCH=m ++CONFIG_USB_STORAGE_KARMA=m ++CONFIG_USB_STORAGE_CYPRESS_ATACB=m ++CONFIG_USB_STORAGE_ENE_UB6250=m ++CONFIG_USB_MDC800=m ++CONFIG_USB_MICROTEK=m ++CONFIG_USBIP_CORE=m ++CONFIG_USBIP_VHCI_HCD=m ++CONFIG_USBIP_HOST=m + CONFIG_USB_DWC2=y ++CONFIG_USB_SERIAL=m ++CONFIG_USB_SERIAL_GENERIC=y ++CONFIG_USB_SERIAL_AIRCABLE=m ++CONFIG_USB_SERIAL_ARK3116=m ++CONFIG_USB_SERIAL_BELKIN=m ++CONFIG_USB_SERIAL_CH341=m ++CONFIG_USB_SERIAL_WHITEHEAT=m ++CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m ++CONFIG_USB_SERIAL_CP210X=m ++CONFIG_USB_SERIAL_CYPRESS_M8=m ++CONFIG_USB_SERIAL_EMPEG=m ++CONFIG_USB_SERIAL_FTDI_SIO=m ++CONFIG_USB_SERIAL_VISOR=m ++CONFIG_USB_SERIAL_IPAQ=m ++CONFIG_USB_SERIAL_IR=m ++CONFIG_USB_SERIAL_EDGEPORT=m ++CONFIG_USB_SERIAL_EDGEPORT_TI=m ++CONFIG_USB_SERIAL_F81232=m ++CONFIG_USB_SERIAL_GARMIN=m ++CONFIG_USB_SERIAL_IPW=m ++CONFIG_USB_SERIAL_IUU=m ++CONFIG_USB_SERIAL_KEYSPAN_PDA=m ++CONFIG_USB_SERIAL_KEYSPAN=m ++CONFIG_USB_SERIAL_KLSI=m ++CONFIG_USB_SERIAL_KOBIL_SCT=m ++CONFIG_USB_SERIAL_MCT_U232=m ++CONFIG_USB_SERIAL_METRO=m ++CONFIG_USB_SERIAL_MOS7720=m ++CONFIG_USB_SERIAL_MOS7840=m ++CONFIG_USB_SERIAL_NAVMAN=m ++CONFIG_USB_SERIAL_PL2303=m ++CONFIG_USB_SERIAL_OTI6858=m ++CONFIG_USB_SERIAL_QCAUX=m ++CONFIG_USB_SERIAL_QUALCOMM=m ++CONFIG_USB_SERIAL_SPCP8X5=m ++CONFIG_USB_SERIAL_SAFE=m ++CONFIG_USB_SERIAL_SIERRAWIRELESS=m ++CONFIG_USB_SERIAL_SYMBOL=m ++CONFIG_USB_SERIAL_TI=m ++CONFIG_USB_SERIAL_CYBERJACK=m ++CONFIG_USB_SERIAL_XIRCOM=m ++CONFIG_USB_SERIAL_OPTION=m ++CONFIG_USB_SERIAL_OMNINET=m ++CONFIG_USB_SERIAL_OPTICON=m ++CONFIG_USB_SERIAL_XSENS_MT=m ++CONFIG_USB_SERIAL_WISHBONE=m ++CONFIG_USB_SERIAL_SSU100=m ++CONFIG_USB_SERIAL_QT2=m ++CONFIG_USB_SERIAL_DEBUG=m ++CONFIG_USB_EMI62=m ++CONFIG_USB_EMI26=m ++CONFIG_USB_ADUTUX=m ++CONFIG_USB_SEVSEG=m ++CONFIG_USB_RIO500=m ++CONFIG_USB_LEGOTOWER=m ++CONFIG_USB_LCD=m ++CONFIG_USB_LED=m ++CONFIG_USB_CYPRESS_CY7C63=m ++CONFIG_USB_CYTHERM=m ++CONFIG_USB_IDMOUSE=m ++CONFIG_USB_FTDI_ELAN=m ++CONFIG_USB_APPLEDISPLAY=m ++CONFIG_USB_LD=m ++CONFIG_USB_TRANCEVIBRATOR=m ++CONFIG_USB_IOWARRIOR=m ++CONFIG_USB_TEST=m ++CONFIG_USB_ISIGHTFW=m ++CONFIG_USB_YUREX=m ++CONFIG_USB_ATM=m ++CONFIG_USB_SPEEDTOUCH=m ++CONFIG_USB_CXACRU=m ++CONFIG_USB_UEAGLEATM=m ++CONFIG_USB_XUSBATM=m + CONFIG_MMC=y ++CONFIG_MMC_BLOCK_MINORS=32 + CONFIG_MMC_BCM2835=y + CONFIG_MMC_BCM2835_DMA=y ++CONFIG_MMC_BCM2835_SDHOST=y + CONFIG_MMC_SDHCI=y + CONFIG_MMC_SDHCI_PLTFM=y + CONFIG_MMC_SDHCI_BCM2835=y +-CONFIG_NEW_LEDS=y ++CONFIG_MMC_SPI=m + CONFIG_LEDS_CLASS=y + CONFIG_LEDS_GPIO=y +-CONFIG_LEDS_TRIGGERS=y + CONFIG_LEDS_TRIGGER_TIMER=y + CONFIG_LEDS_TRIGGER_ONESHOT=y + CONFIG_LEDS_TRIGGER_HEARTBEAT=y ++CONFIG_LEDS_TRIGGER_BACKLIGHT=y + CONFIG_LEDS_TRIGGER_CPU=y + CONFIG_LEDS_TRIGGER_GPIO=y + CONFIG_LEDS_TRIGGER_DEFAULT_ON=y +-CONFIG_LEDS_TRIGGER_TRANSIENT=y +-CONFIG_LEDS_TRIGGER_CAMERA=y ++CONFIG_LEDS_TRIGGER_TRANSIENT=m ++CONFIG_LEDS_TRIGGER_CAMERA=m ++CONFIG_LEDS_TRIGGER_INPUT=y ++CONFIG_RTC_CLASS=y ++# CONFIG_RTC_HCTOSYS is not set ++CONFIG_RTC_DRV_DS1307=m ++CONFIG_RTC_DRV_DS1374=m ++CONFIG_RTC_DRV_DS1672=m ++CONFIG_RTC_DRV_DS3232=m ++CONFIG_RTC_DRV_MAX6900=m ++CONFIG_RTC_DRV_RS5C372=m ++CONFIG_RTC_DRV_ISL1208=m ++CONFIG_RTC_DRV_ISL12022=m ++CONFIG_RTC_DRV_ISL12057=m ++CONFIG_RTC_DRV_X1205=m ++CONFIG_RTC_DRV_PCF2127=m ++CONFIG_RTC_DRV_PCF8523=m ++CONFIG_RTC_DRV_PCF8563=m ++CONFIG_RTC_DRV_PCF8583=m ++CONFIG_RTC_DRV_M41T80=m ++CONFIG_RTC_DRV_BQ32K=m ++CONFIG_RTC_DRV_S35390A=m ++CONFIG_RTC_DRV_FM3130=m ++CONFIG_RTC_DRV_RX8581=m ++CONFIG_RTC_DRV_RX8025=m ++CONFIG_RTC_DRV_EM3027=m ++CONFIG_RTC_DRV_RV3029C2=m ++CONFIG_RTC_DRV_M41T93=m ++CONFIG_RTC_DRV_M41T94=m ++CONFIG_RTC_DRV_DS1305=m ++CONFIG_RTC_DRV_DS1390=m ++CONFIG_RTC_DRV_MAX6902=m ++CONFIG_RTC_DRV_R9701=m ++CONFIG_RTC_DRV_RS5C348=m ++CONFIG_RTC_DRV_DS3234=m ++CONFIG_RTC_DRV_PCF2123=m ++CONFIG_RTC_DRV_RX4581=m + CONFIG_DMADEVICES=y + CONFIG_DMA_BCM2708=y ++CONFIG_UIO=m ++CONFIG_UIO_PDRV_GENIRQ=m + CONFIG_STAGING=y ++CONFIG_PRISM2_USB=m ++CONFIG_R8712U=m ++CONFIG_R8188EU=m ++CONFIG_R8723AU=m ++CONFIG_VT6656=m ++CONFIG_SPEAKUP=m ++CONFIG_SPEAKUP_SYNTH_SOFT=m ++CONFIG_STAGING_MEDIA=y ++CONFIG_LIRC_STAGING=y ++CONFIG_LIRC_IMON=m ++CONFIG_LIRC_SASEM=m ++CONFIG_LIRC_SERIAL=m ++CONFIG_FB_TFT=m ++CONFIG_FB_TFT_AGM1264K_FL=m ++CONFIG_FB_TFT_BD663474=m ++CONFIG_FB_TFT_HX8340BN=m ++CONFIG_FB_TFT_HX8347D=m ++CONFIG_FB_TFT_HX8353D=m ++CONFIG_FB_TFT_ILI9320=m ++CONFIG_FB_TFT_ILI9325=m ++CONFIG_FB_TFT_ILI9340=m ++CONFIG_FB_TFT_ILI9341=m ++CONFIG_FB_TFT_ILI9481=m ++CONFIG_FB_TFT_ILI9486=m ++CONFIG_FB_TFT_PCD8544=m ++CONFIG_FB_TFT_RA8875=m ++CONFIG_FB_TFT_S6D02A1=m ++CONFIG_FB_TFT_S6D1121=m ++CONFIG_FB_TFT_SSD1289=m ++CONFIG_FB_TFT_SSD1306=m ++CONFIG_FB_TFT_SSD1331=m ++CONFIG_FB_TFT_SSD1351=m ++CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_TINYLCD=m ++CONFIG_FB_TFT_TLS8204=m ++CONFIG_FB_TFT_UC1701=m ++CONFIG_FB_TFT_UPD161704=m ++CONFIG_FB_TFT_WATTEROTT=m ++CONFIG_FB_FLEX=m ++CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set ++CONFIG_EXTCON=m ++CONFIG_EXTCON_ARIZONA=m + CONFIG_EXT2_FS=y + CONFIG_EXT2_FS_XATTR=y + CONFIG_EXT2_FS_POSIX_ACL=y +@@ -109,18 +1073,110 @@ CONFIG_EXT3_FS=y + CONFIG_EXT3_FS_POSIX_ACL=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y ++CONFIG_EXT4_FS_SECURITY=y ++CONFIG_REISERFS_FS=m ++CONFIG_REISERFS_FS_XATTR=y ++CONFIG_REISERFS_FS_POSIX_ACL=y ++CONFIG_REISERFS_FS_SECURITY=y ++CONFIG_JFS_FS=m ++CONFIG_JFS_POSIX_ACL=y ++CONFIG_JFS_SECURITY=y ++CONFIG_JFS_STATISTICS=y ++CONFIG_XFS_FS=m ++CONFIG_XFS_QUOTA=y ++CONFIG_XFS_POSIX_ACL=y ++CONFIG_XFS_RT=y ++CONFIG_GFS2_FS=m ++CONFIG_OCFS2_FS=m ++CONFIG_BTRFS_FS=m ++CONFIG_BTRFS_FS_POSIX_ACL=y ++CONFIG_NILFS2_FS=m + CONFIG_FANOTIFY=y ++CONFIG_QFMT_V1=m ++CONFIG_QFMT_V2=m ++CONFIG_AUTOFS4_FS=y ++CONFIG_FUSE_FS=m ++CONFIG_CUSE=m ++CONFIG_FSCACHE=y ++CONFIG_FSCACHE_STATS=y ++CONFIG_FSCACHE_HISTOGRAM=y ++CONFIG_CACHEFILES=y ++CONFIG_ISO9660_FS=m ++CONFIG_JOLIET=y ++CONFIG_ZISOFS=y ++CONFIG_UDF_FS=m + CONFIG_MSDOS_FS=y + CONFIG_VFAT_FS=y ++CONFIG_FAT_DEFAULT_IOCHARSET="ascii" ++CONFIG_NTFS_FS=m ++CONFIG_NTFS_RW=y + CONFIG_TMPFS=y + CONFIG_TMPFS_POSIX_ACL=y +-# CONFIG_MISC_FILESYSTEMS is not set ++CONFIG_CONFIGFS_FS=y ++CONFIG_ECRYPT_FS=m ++CONFIG_HFS_FS=m ++CONFIG_HFSPLUS_FS=m ++CONFIG_SQUASHFS=m ++CONFIG_SQUASHFS_XATTR=y ++CONFIG_SQUASHFS_LZO=y ++CONFIG_SQUASHFS_XZ=y ++CONFIG_F2FS_FS=y + CONFIG_NFS_FS=y +-CONFIG_NFSD=y ++CONFIG_NFS_V3_ACL=y ++CONFIG_NFS_V4=y ++CONFIG_NFS_SWAP=y ++CONFIG_ROOT_NFS=y ++CONFIG_NFS_FSCACHE=y ++CONFIG_NFSD=m ++CONFIG_NFSD_V3_ACL=y ++CONFIG_NFSD_V4=y ++CONFIG_CIFS=m ++CONFIG_CIFS_WEAK_PW_HASH=y ++CONFIG_CIFS_UPCALL=y ++CONFIG_CIFS_XATTR=y ++CONFIG_CIFS_POSIX=y ++CONFIG_9P_FS=m ++CONFIG_9P_FS_POSIX_ACL=y ++CONFIG_NLS_DEFAULT="utf8" + CONFIG_NLS_CODEPAGE_437=y ++CONFIG_NLS_CODEPAGE_737=m ++CONFIG_NLS_CODEPAGE_775=m ++CONFIG_NLS_CODEPAGE_850=m ++CONFIG_NLS_CODEPAGE_852=m ++CONFIG_NLS_CODEPAGE_855=m ++CONFIG_NLS_CODEPAGE_857=m ++CONFIG_NLS_CODEPAGE_860=m ++CONFIG_NLS_CODEPAGE_861=m ++CONFIG_NLS_CODEPAGE_862=m ++CONFIG_NLS_CODEPAGE_863=m ++CONFIG_NLS_CODEPAGE_864=m ++CONFIG_NLS_CODEPAGE_865=m ++CONFIG_NLS_CODEPAGE_866=m ++CONFIG_NLS_CODEPAGE_869=m ++CONFIG_NLS_CODEPAGE_936=m ++CONFIG_NLS_CODEPAGE_950=m ++CONFIG_NLS_CODEPAGE_932=m ++CONFIG_NLS_CODEPAGE_949=m ++CONFIG_NLS_CODEPAGE_874=m ++CONFIG_NLS_ISO8859_8=m ++CONFIG_NLS_CODEPAGE_1250=m ++CONFIG_NLS_CODEPAGE_1251=m + CONFIG_NLS_ASCII=y +-CONFIG_NLS_ISO8859_1=y ++CONFIG_NLS_ISO8859_1=m ++CONFIG_NLS_ISO8859_2=m ++CONFIG_NLS_ISO8859_3=m ++CONFIG_NLS_ISO8859_4=m ++CONFIG_NLS_ISO8859_5=m ++CONFIG_NLS_ISO8859_6=m ++CONFIG_NLS_ISO8859_7=m ++CONFIG_NLS_ISO8859_9=m ++CONFIG_NLS_ISO8859_13=m ++CONFIG_NLS_ISO8859_14=m ++CONFIG_NLS_ISO8859_15=m ++CONFIG_NLS_KOI8_R=m ++CONFIG_NLS_KOI8_U=m + CONFIG_NLS_UTF8=y ++CONFIG_DLM=m + CONFIG_PRINTK_TIME=y + CONFIG_BOOT_PRINTK_DELAY=y + CONFIG_DYNAMIC_DEBUG=y +@@ -130,14 +1186,38 @@ CONFIG_DEBUG_INFO=y + CONFIG_UNUSED_SYMBOLS=y + CONFIG_DEBUG_MEMORY_INIT=y + CONFIG_LOCKUP_DETECTOR=y ++CONFIG_TIMER_STATS=y ++# CONFIG_DEBUG_PREEMPT is not set ++CONFIG_LATENCYTOP=y ++CONFIG_IRQSOFF_TRACER=y + CONFIG_SCHED_TRACER=y + CONFIG_STACK_TRACER=y ++CONFIG_BLK_DEV_IO_TRACE=y ++# CONFIG_KPROBE_EVENT is not set + CONFIG_FUNCTION_PROFILER=y + CONFIG_TEST_KSTRTOX=y + CONFIG_KGDB=y + CONFIG_KGDB_KDB=y ++CONFIG_KDB_KEYBOARD=y + CONFIG_STRICT_DEVMEM=y + CONFIG_DEBUG_LL=y + CONFIG_EARLY_PRINTK=y ++CONFIG_CRYPTO_USER=m ++CONFIG_CRYPTO_CRYPTD=m ++CONFIG_CRYPTO_CBC=y ++CONFIG_CRYPTO_CTS=m ++CONFIG_CRYPTO_XTS=m ++CONFIG_CRYPTO_XCBC=m ++CONFIG_CRYPTO_SHA1_ARM=m ++CONFIG_CRYPTO_SHA512=m ++CONFIG_CRYPTO_TGR192=m ++CONFIG_CRYPTO_WP512=m ++CONFIG_CRYPTO_AES_ARM=m ++CONFIG_CRYPTO_CAST5=m ++CONFIG_CRYPTO_DES=y ++# CONFIG_CRYPTO_ANSI_CPRNG is not set ++# CONFIG_CRYPTO_HW is not set ++CONFIG_CRC_ITU_T=y ++CONFIG_LIBCRC32C=y + # CONFIG_XZ_DEC_ARM is not set + # CONFIG_XZ_DEC_ARMTHUMB is not set + +From c712b42d06623b5410a3921f71278963a9a45209 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 24 Mar 2015 16:57:04 +0000 +Subject: [PATCH 206/216] BCM270x_DT: Configure UART using DT + +See: https://github.com/raspberrypi/firmware/issues/393 +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 7 +++++++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 7 +++++++ + arch/arm/boot/dts/bcm2708_common.dtsi | 27 +++++++++++++++++++++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 7 +++++++ + arch/arm/mach-bcm2708/bcm2708.c | 9 +++++---- + arch/arm/mach-bcm2709/bcm2709.c | 9 +++++---- + 6 files changed, 58 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 52b1404..99ab3c9 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -16,6 +16,7 @@ + intc = &intc; + leds = &leds; + sound = &sound; ++ uart0 = &uart0; + }; + + sound: sound { +@@ -53,6 +54,10 @@ + status = "okay"; + }; + ++&uart0 { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +@@ -108,6 +113,8 @@ + + / { + __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 876dfca..e8c80cd 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -16,6 +16,7 @@ + intc = &intc; + leds = &leds; + sound = &sound; ++ uart0 = &uart0; + }; + + sound: sound { +@@ -53,6 +54,10 @@ + status = "okay"; + }; + ++&uart0 { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +@@ -102,6 +107,8 @@ + + / { + __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index a80b1a8..a09a3c7 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -84,6 +84,17 @@ + status = "disabled"; + }; + ++ uart0: uart@7e201000 { ++ compatible = "arm,pl011", "arm,primecell"; ++ reg = <0x7e201000 0x1000>; ++ interrupts = <2 25>; ++ clocks = <&clk_uart0 &clk_apb_p>; ++ clock-names = "uartclk","apb_pclk"; ++ arm,primecell-periphid = <0x00241011>; // For an explanation, see ++ // https://github.com/raspberrypi/linux/commit/13731d862cf5219216533a3b0de052cee4cc5038 ++ status = "disabled"; ++ }; ++ + i2s: i2s@7e203000 { + compatible = "brcm,bcm2708-i2s"; + reg = <0x7e203000 0x20>, +@@ -188,5 +199,21 @@ + clock-output-names = "spi"; + clock-frequency = <250000000>; + }; ++ ++ clk_uart0: clock@3 { ++ compatible = "fixed-clock"; ++ reg = <3>; ++ #clock-cells = <0>; ++ clock-output-names = "uart0_pclk"; ++ clock-frequency = <3000000>; ++ }; ++ ++ clk_apb_p: clock@4 { ++ compatible = "fixed-clock"; ++ reg = <4>; ++ #clock-cells = <0>; ++ clock-output-names = "apb_pclk"; ++ clock-frequency = <126000000>; ++ }; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index b226dfb..39b6fd4 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -16,6 +16,7 @@ + intc = &intc; + leds = &leds; + sound = &sound; ++ uart0 = &uart0; + }; + + sound: sound { +@@ -53,6 +54,10 @@ + status = "okay"; + }; + ++&uart0 { ++ status = "okay"; ++}; ++ + &spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins>; +@@ -108,6 +113,8 @@ + + / { + __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; + i2s = <&i2s>,"status"; + spi = <&spi0>,"status"; + i2c0 = <&i2c0>,"status"; +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index e141c0b..e17c1de 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -1020,10 +1020,11 @@ void __init bcm2708_init(void) + i2c_register_board_info_dt(1, snd_pcm512x_i2c_devices, ARRAY_SIZE(snd_pcm512x_i2c_devices)); + #endif + +- +- for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { +- struct amba_device *d = amba_devs[i]; +- amba_device_register(d, &iomem_resource); ++ if (!use_dt) { ++ for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { ++ struct amba_device *d = amba_devs[i]; ++ amba_device_register(d, &iomem_resource); ++ } + } + system_rev = boardrev; + system_serial_low = serial; +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 6dadb80..8834a10 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -1043,10 +1043,11 @@ void __init bcm2709_init(void) + i2c_register_board_info_dt(1, snd_pcm512x_i2c_devices, ARRAY_SIZE(snd_pcm512x_i2c_devices)); + #endif + +- +- for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { +- struct amba_device *d = amba_devs[i]; +- amba_device_register(d, &iomem_resource); ++ if (!use_dt) { ++ for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { ++ struct amba_device *d = amba_devs[i]; ++ amba_device_register(d, &iomem_resource); ++ } + } + system_rev = boardrev; + system_serial_low = serial; + +From aa05d1fe61d794be63d7e6055881e36c33cdb09c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 4 Jun 2015 16:16:08 +0100 +Subject: [PATCH 207/216] vchiq_arm: ARCH_BCM2835 compatibility + +Use virt_to_dma (not ideal, I know) to calculate the virt-to-bus +offset. This will make use of the "dma-ranges" property, if +present. +--- + drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 660aad2..c739083 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -46,7 +46,7 @@ + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) + +-#define VCHIQ_ARM_ADDRESS(x) ((void *)__virt_to_bus((unsigned)x)) ++#define VCHIQ_ARM_ADDRESS(x) ((void *)((char *)x + g_virt_to_bus_offset)) + + #include "vchiq_arm.h" + #include "vchiq_2835.h" +@@ -66,7 +66,8 @@ typedef struct vchiq_2835_state_struct { + static void __iomem *g_regs; + static FRAGMENTS_T *g_fragments_base; + static FRAGMENTS_T *g_free_fragments; +-struct semaphore g_free_fragments_sema; ++static struct semaphore g_free_fragments_sema; ++static unsigned long g_virt_to_bus_offset; + + extern int vchiq_arm_log_level; + +@@ -92,6 +93,8 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + int slot_mem_size, frag_mem_size; + int err, irq, i; + ++ g_virt_to_bus_offset = virt_to_dma(dev, (void *)0); ++ + /* Allocate space for the channels in coherent memory */ + slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); + frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); + +From fa0a4bff157dddc6207cba9911a1581864cf2307 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 5 Jun 2015 14:00:54 +0100 +Subject: [PATCH 208/216] BCM270x_DT: Enable UART in the example Compute Module + DTS as well + +--- + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 11 +++++++++++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 1 + + arch/arm/boot/dts/bcm2708_common.dtsi | 3 ++- + 3 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 45f8244..238bd65 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -5,3 +5,14 @@ + / { + model = "Raspberry Pi Compute Module"; + }; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 1c2cfcf..43830a6 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -11,6 +11,7 @@ + intc = &intc; + leds = &leds; + sound = &sound; ++ uart0 = &uart0; + }; + + sound: sound { +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index a09a3c7..dc0346b 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -185,10 +185,11 @@ + clock-frequency = <250000000>; + }; + +- clk_i2c: i2c { ++ clk_i2c: clock@1 { + compatible = "fixed-clock"; + reg = <1>; + #clock-cells = <0>; ++ clock-output-names = "i2c"; + clock-frequency = <250000000>; + }; + + +From fae583caba82c37f9a1e0cff81fbaa4c3f768657 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 5 Jun 2015 15:59:08 +0100 +Subject: [PATCH 209/216] bcm270x defconfigs: Remove spurious entries + +--- + arch/arm/configs/bcm2709_defconfig | 5 ----- + arch/arm/configs/bcmrpi_defconfig | 8 -------- + 2 files changed, 13 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index d08ae51..78e1202 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -344,12 +344,7 @@ CONFIG_BAYCOM_SER_FDX=m + CONFIG_BAYCOM_SER_HDX=m + CONFIG_YAM=m + CONFIG_CAN=m +-CONFIG_CAN_RAW=m +-CONFIG_CAN_BCM=m +-CONFIG_CAN_GW=m + CONFIG_CAN_VCAN=m +-CONFIG_CAN_DEV=m +-CONFIG_CAN_CALC_BITTIMING=y + CONFIG_CAN_MCP251X=m + CONFIG_IRDA=m + CONFIG_IRLAN=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 11bbfac..c6a5db2 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -335,14 +335,6 @@ CONFIG_6PACK=m + CONFIG_BPQETHER=m + CONFIG_BAYCOM_SER_FDX=m + CONFIG_BAYCOM_SER_HDX=m +-CONFIG_CAN=m +-CONFIG_CAN_RAW=m +-CONFIG_CAN_BCM=m +-CONFIG_CAN_GW=m +-CONFIG_CAN_VCAN=m +-CONFIG_CAN_DEV=m +-CONFIG_CAN_CALC_BITTIMING=y +-CONFIG_CAN_MCP251X=m + CONFIG_YAM=m + CONFIG_CAN=m + CONFIG_CAN_VCAN=m + +From 549ff9d4fee2f6dc0abdeaa552754ce2197ba331 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 28 May 2015 09:00:01 +0100 +Subject: [PATCH 210/216] BCM270x_DT: Add a label to the clocks node, and a few + aliases + +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 ++ + arch/arm/boot/dts/bcm2708-rpi-b.dts | 2 ++ + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 2 ++ + arch/arm/boot/dts/bcm2708_common.dtsi | 2 +- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 ++ + 5 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 99ab3c9..c9053f8 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -15,8 +15,10 @@ + gpio = &gpio; + intc = &intc; + leds = &leds; ++ audio = &audio; + sound = &sound; + uart0 = &uart0; ++ clocks = &clocks; + }; + + sound: sound { +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index e8c80cd..32066c3 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -15,8 +15,10 @@ + gpio = &gpio; + intc = &intc; + leds = &leds; ++ audio = &audio; + sound = &sound; + uart0 = &uart0; ++ clocks = &clocks; + }; + + sound: sound { +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 43830a6..f38a0c2 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -10,8 +10,10 @@ + gpio = &gpio; + intc = &intc; + leds = &leds; ++ audio = &audio; + sound = &sound; + uart0 = &uart0; ++ clocks = &clocks; + }; + + sound: sound { +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index dc0346b..a9f1507 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -172,7 +172,7 @@ + }; + }; + +- clocks { ++ clocks: clocks { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 39b6fd4..a9adaf4 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -15,8 +15,10 @@ + gpio = &gpio; + intc = &intc; + leds = &leds; ++ audio = &audio; + sound = &sound; + uart0 = &uart0; ++ clocks = &clocks; + }; + + sound: sound { + +From 1b8bcc8ef9b600f7ac5e4d40bd70b507ad02aa01 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 28 May 2015 09:01:02 +0100 +Subject: [PATCH 211/216] sdhost-overlay: Move clock declaration out of /soc + +--- + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 29 +++++++++++++++------------ + 1 file changed, 16 insertions(+), 13 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +index b2653e9..8fb28e9 100644 +--- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -24,23 +24,26 @@ + brcm,overclock-50 = <0>; + status = "okay"; + }; ++ }; ++ }; + +- clocks { +- #address-cells = <1>; +- #size-cells = <0>; ++ fragment@1 { ++ target = <&clocks>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; + +- clk_sdhost: clock@3 { +- compatible = "fixed-clock"; +- reg = <0>; +- #clock-cells = <0>; +- clock-output-names = "sdhost"; +- clock-frequency = <250000000>; +- }; ++ clk_sdhost: sdhost { ++ compatible = "fixed-clock"; ++ reg = <0>; ++ #clock-cells = <0>; ++ clock-output-names = "sdhost"; ++ clock-frequency = <250000000>; + }; + }; + }; + +- fragment@1 { ++ fragment@2 { + target = <&gpio>; + __overlay__ { + sdhost_pins: sdhost_pins { +@@ -50,7 +53,7 @@ + }; + }; + +- fragment@2 { ++ fragment@3 { + target = <&mmc>; + __overlay__ { + /* Find a way to disable the other driver */ +@@ -59,7 +62,7 @@ + }; + }; + +- fragment@3 { ++ fragment@4 { + target-path = "/__overrides__"; + __overlay__ { + sdhost_freq = <&clk_sdhost>,"clock-frequency:0"; + +From 24d8164a16fb825c4bee4a8cca87f55a68f33edf Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 6 Jun 2015 23:45:32 +0200 +Subject: [PATCH 212/216] BCM270X_DT: Enable 'make clean' on overlays directory +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Always add the overlays directory to subdir so it can be +cleaned with 'make clean'. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index e7ce7c4..d85583c 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -16,8 +16,6 @@ ifeq ($(CONFIG_ARCH_BCM2835),y) + RPI_DT_OVERLAYS=y + endif + +-subdir-$(RPI_DT_OVERLAYS) += overlays +- + dtb-$(CONFIG_MACH_ASM9260) += \ + alphascale-asm9260-devkit.dtb + # Keep at91 dtb files sorted alphabetically for each SoC +@@ -676,3 +674,5 @@ clean-files := *.dtb + ifeq ($(RPI_DT_OVERLAYS),y) + DTC_FLAGS ?= -@ + endif ++ ++subdir-y += overlays + +From 2b53c727bbb2ba40102236f127ea6e68b1148335 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sun, 7 Jun 2015 13:35:33 +0200 +Subject: [PATCH 213/216] hwmon: Remove bcm2835-hwmon +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +bcm2835-thermal combined with the configs HWMON=y and +THERMAL_HWMON=y, gives the same functionality. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/bcm2708.c | 5 - + arch/arm/mach-bcm2709/bcm2709.c | 5 - + drivers/hwmon/Kconfig | 10 -- + drivers/hwmon/Makefile | 1 - + drivers/hwmon/bcm2835-hwmon.c | 219 ---------------------------------------- + 5 files changed, 240 deletions(-) + delete mode 100644 drivers/hwmon/bcm2835-hwmon.c + +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index e17c1de..4f191d9 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -697,10 +697,6 @@ static struct platform_device bcm2708_bsc1_device = { + .resource = bcm2708_bsc1_resources, + }; + +-static struct platform_device bcm2835_hwmon_device = { +- .name = "bcm2835_hwmon", +-}; +- + static struct platform_device bcm2835_thermal_device = { + .name = "bcm2835_thermal", + }; +@@ -983,7 +979,6 @@ void __init bcm2708_init(void) + bcm_register_device_dt(&bcm2708_bsc1_device); + } + +- bcm_register_device(&bcm2835_hwmon_device); + bcm_register_device_dt(&bcm2835_thermal_device); + + #if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE) +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index 8834a10..d61bb30 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -718,10 +718,6 @@ static struct platform_device bcm2708_bsc1_device = { + .resource = bcm2708_bsc1_resources, + }; + +-static struct platform_device bcm2835_hwmon_device = { +- .name = "bcm2835_hwmon", +-}; +- + static struct platform_device bcm2835_thermal_device = { + .name = "bcm2835_thermal", + }; +@@ -1006,7 +1002,6 @@ void __init bcm2709_init(void) + bcm_register_device_dt(&bcm2708_bsc1_device); + } + +- bcm_register_device(&bcm2835_hwmon_device); + bcm_register_device_dt(&bcm2835_thermal_device); + + #if defined(CONFIG_SND_BCM2708_SOC_I2S) || defined(CONFIG_SND_BCM2708_SOC_I2S_MODULE) +diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig +index 8c4474d..110fade 100644 +--- a/drivers/hwmon/Kconfig ++++ b/drivers/hwmon/Kconfig +@@ -1703,16 +1703,6 @@ config SENSORS_ULTRA45 + This driver provides support for the Ultra45 workstation environmental + sensors. + +-config SENSORS_BCM2835 +- depends on THERMAL_BCM2835=n +- tristate "Broadcom BCM2835 HWMON Driver" +- help +- If you say yes here you get support for the hardware +- monitoring features of the BCM2835 Chip +- +- This driver can also be built as a module. If so, the module +- will be called bcm2835-hwmon. +- + if ACPI + + comment "ACPI drivers" +diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile +index e7c60cb..6c94147 100644 +--- a/drivers/hwmon/Makefile ++++ b/drivers/hwmon/Makefile +@@ -155,7 +155,6 @@ obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o + obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o + obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o + obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o +-obj-$(CONFIG_SENSORS_BCM2835) += bcm2835-hwmon.o + + obj-$(CONFIG_PMBUS) += pmbus/ + +diff --git a/drivers/hwmon/bcm2835-hwmon.c b/drivers/hwmon/bcm2835-hwmon.c +deleted file mode 100644 +index d14502c..0000000 +--- a/drivers/hwmon/bcm2835-hwmon.c ++++ /dev/null +@@ -1,219 +0,0 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#define MODULE_NAME "bcm2835_hwmon" +- +-/*#define HWMON_DEBUG_ENABLE*/ +- +-#ifdef HWMON_DEBUG_ENABLE +-#define print_debug(fmt,...) printk(KERN_INFO "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__, __LINE__, ##__VA_ARGS__) +-#else +-#define print_debug(fmt,...) +-#endif +-#define print_err(fmt,...) printk(KERN_ERR "%s:%s:%d: "fmt"\n", MODULE_NAME, __func__,__LINE__, ##__VA_ARGS__) +-#define print_info(fmt,...) printk(KERN_INFO "%s: "fmt"\n", MODULE_NAME, ##__VA_ARGS__) +- +-#define VC_TAG_GET_TEMP 0x00030006 +-#define VC_TAG_GET_MAX_TEMP 0x0003000A +- +-/* --- STRUCTS --- */ +-struct bcm2835_hwmon_data { +- struct device *hwmon_dev; +-}; +- +-/* tag part of the message */ +-struct vc_msg_tag { +- uint32_t tag_id; /* the tag ID for the temperature */ +- uint32_t buffer_size; /* size of the buffer (should be 8) */ +- uint32_t request_code; /* identifies message as a request (should be 0) */ +- uint32_t id; /* extra ID field (should be 0) */ +- uint32_t val; /* returned value of the temperature */ +-}; +- +-/* message structure to be sent to videocore */ +-struct vc_msg { +- uint32_t msg_size; /* simply, sizeof(struct vc_msg) */ +- uint32_t request_code; /* holds various information like the success and number of bytes returned (refer to mailboxes wiki) */ +- struct vc_msg_tag tag; /* the tag structure above to make */ +- uint32_t end_tag; /* an end identifier, should be set to NULL */ +-}; +- +-typedef enum { +- TEMP, +- MAX_TEMP, +-} temp_type; +- +-/* --- PROTOTYPES --- */ +-static ssize_t bcm2835_get_temp(struct device *dev, struct device_attribute *attr, char *buf); +-static ssize_t bcm2835_get_name(struct device *dev, struct device_attribute *attr, char *buf); +- +-/* --- GLOBALS --- */ +- +-static struct bcm2835_hwmon_data *bcm2835_data; +-static struct platform_driver bcm2835_hwmon_driver; +- +-static SENSOR_DEVICE_ATTR(name, S_IRUGO,bcm2835_get_name,NULL,0); +-static SENSOR_DEVICE_ATTR(temp1_input,S_IRUGO,bcm2835_get_temp,NULL,TEMP); +-static SENSOR_DEVICE_ATTR(temp1_max,S_IRUGO,bcm2835_get_temp,NULL,MAX_TEMP); +- +-static struct attribute* bcm2835_attributes[] = { +- &sensor_dev_attr_name.dev_attr.attr, +- &sensor_dev_attr_temp1_input.dev_attr.attr, +- &sensor_dev_attr_temp1_max.dev_attr.attr, +- NULL, +-}; +- +-static struct attribute_group bcm2835_attr_group = { +- .attrs = bcm2835_attributes, +-}; +- +-/* --- FUNCTIONS --- */ +- +-static ssize_t bcm2835_get_name(struct device *dev, struct device_attribute *attr, char *buf) +-{ +- return sprintf(buf,"bcm2835_hwmon\n"); +-} +- +-static ssize_t bcm2835_get_temp(struct device *dev, struct device_attribute *attr, char *buf) +-{ +- struct vc_msg msg; +- int result; +- uint temp = 0; +- int index = ((struct sensor_device_attribute*)to_sensor_dev_attr(attr))->index; +- +- print_debug("IN"); +- +- /* wipe all previous message data */ +- memset(&msg, 0, sizeof msg); +- +- /* determine the message type */ +- if(index == TEMP) +- msg.tag.tag_id = VC_TAG_GET_TEMP; +- else if (index == MAX_TEMP) +- msg.tag.tag_id = VC_TAG_GET_MAX_TEMP; +- else +- { +- print_debug("Unknown temperature message!"); +- return -EINVAL; +- } +- +- msg.msg_size = sizeof msg; +- msg.tag.buffer_size = 8; +- +- /* send the message */ +- result = bcm_mailbox_property(&msg, sizeof msg); +- +- /* check if it was all ok and return the rate in milli degrees C */ +- if (result == 0 && (msg.request_code & 0x80000000)) +- temp = (uint)msg.tag.val; +- #ifdef HWMON_DEBUG_ENABLE +- else +- print_debug("Failed to get temperature!"); +- #endif +- print_debug("Got temperature as %u",temp); +- print_debug("OUT"); +- return sprintf(buf, "%u\n", temp); +-} +- +- +-static int bcm2835_hwmon_probe(struct platform_device *pdev) +-{ +- int err; +- +- print_debug("IN"); +- print_debug("HWMON Driver has been probed!"); +- +- /* check that the device isn't null!*/ +- if(pdev == NULL) +- { +- print_debug("Platform device is empty!"); +- return -ENODEV; +- } +- +- /* allocate memory for neccessary data */ +- bcm2835_data = kzalloc(sizeof(struct bcm2835_hwmon_data),GFP_KERNEL); +- if(!bcm2835_data) +- { +- print_debug("Unable to allocate memory for hwmon data!"); +- err = -ENOMEM; +- goto kzalloc_error; +- } +- +- /* create the sysfs files */ +- if(sysfs_create_group(&pdev->dev.kobj, &bcm2835_attr_group)) +- { +- print_debug("Unable to create sysfs files!"); +- err = -EFAULT; +- goto sysfs_error; +- } +- +- /* register the hwmon device */ +- bcm2835_data->hwmon_dev = hwmon_device_register(&pdev->dev); +- if (IS_ERR(bcm2835_data->hwmon_dev)) +- { +- err = PTR_ERR(bcm2835_data->hwmon_dev); +- goto hwmon_error; +- } +- print_debug("OUT"); +- return 0; +- +- /* error goto's */ +- hwmon_error: +- sysfs_remove_group(&pdev->dev.kobj, &bcm2835_attr_group); +- +- sysfs_error: +- kfree(bcm2835_data); +- +- kzalloc_error: +- +- return err; +- +-} +- +-static int bcm2835_hwmon_remove(struct platform_device *pdev) +-{ +- print_debug("IN"); +- hwmon_device_unregister(bcm2835_data->hwmon_dev); +- +- sysfs_remove_group(&pdev->dev.kobj, &bcm2835_attr_group); +- print_debug("OUT"); +- return 0; +-} +- +-/* Hwmon Driver */ +-static struct platform_driver bcm2835_hwmon_driver = { +- .probe = bcm2835_hwmon_probe, +- .remove = bcm2835_hwmon_remove, +- .driver = { +- .name = "bcm2835_hwmon", +- .owner = THIS_MODULE, +- }, +-}; +- +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Dorian Peake"); +-MODULE_DESCRIPTION("HW Monitor driver for bcm2835 chip"); +- +-module_platform_driver(bcm2835_hwmon_driver); + +From a4573f4e07996b61582f828189091bede1296d25 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sat, 6 Jun 2015 22:59:28 +0200 +Subject: [PATCH 214/216] BCM270x: Make uart1 work with Device Tree +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add uart1 to Device Tree. Enable it in AUXENB when it's used. +Remove old platform device. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 1 + + arch/arm/boot/dts/bcm2708-rpi-b.dts | 1 + + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 1 + + arch/arm/boot/dts/bcm2708_common.dtsi | 10 +++++++++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 + + arch/arm/mach-bcm2708/bcm2708.c | 35 +++++++++++--------------------- + arch/arm/mach-bcm2709/bcm2709.c | 34 +++++++++++-------------------- + 7 files changed, 38 insertions(+), 45 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index c9053f8..0fa2210 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -18,6 +18,7 @@ + audio = &audio; + sound = &sound; + uart0 = &uart0; ++ uart1 = &uart1; + clocks = &clocks; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 32066c3..3fd49d0 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -18,6 +18,7 @@ + audio = &audio; + sound = &sound; + uart0 = &uart0; ++ uart1 = &uart1; + clocks = &clocks; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index f38a0c2..3da7d3b 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -13,6 +13,7 @@ + audio = &audio; + sound = &sound; + uart0 = &uart0; ++ uart1 = &uart1; + clocks = &clocks; + }; + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index a9f1507..8caa234 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -134,6 +134,16 @@ + status = "disabled"; + }; + ++ uart1: uart@7e215040 { ++ compatible = "brcm,bcm2835-aux-uart", "ns16550"; ++ reg = <0x7e215040 0x40>; ++ interrupts = <1 29>; ++ clock-frequency = <500000000>; ++ reg-shift = <2>; ++ no-loopback-test; ++ status = "disabled"; ++ }; ++ + i2c1: i2c@7e804000 { + compatible = "brcm,bcm2708-i2c"; + reg = <0x7e804000 0x1000>; +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index a9adaf4..8aaaf1f 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -18,6 +18,7 @@ + audio = &audio; + sound = &sound; + uart0 = &uart0; ++ uart1 = &uart1; + clocks = &clocks; + }; + +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 4f191d9..f1706366 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -353,28 +353,6 @@ static struct platform_device bcm2708_fb_device = { + }, + }; + +-static struct plat_serial8250_port bcm2708_uart1_platform_data[] = { +- { +- .mapbase = UART1_BASE + 0x40, +- .irq = IRQ_AUX, +- .uartclk = 500000000, +- .regshift = 2, +- .iotype = UPIO_MEM, +- .flags = UPF_SHARE_IRQ | UPF_FIXED_TYPE | UPF_FIXED_PORT | +- UPF_IOREMAP | UPF_SKIP_TEST, +- .type = PORT_16550, +- }, +- {}, +-}; +- +-static struct platform_device bcm2708_uart1_device = { +- .name = "serial8250", +- .id = PLAT8250_DEV_PLATFORM, +- .dev = { +- .platform_data = bcm2708_uart1_platform_data, +- }, +-}; +- + static struct resource bcm2708_usb_resources[] = { + [0] = { + .start = USB_BASE, +@@ -897,6 +875,17 @@ static void bcm2708_power_off(void) + } + } + ++static void __init bcm2708_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ pr_info("bcm2708: Mini UART enabled\n"); ++ writel(1, __io_address(UART1_BASE + 0x4)); ++ } ++} ++ + #ifdef CONFIG_OF + static void __init bcm2708_dt_init(void) + { +@@ -952,13 +941,13 @@ void __init bcm2708_init(void) + bcm_register_device(&bcm2708_systemtimer_device); + bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device_dt(&bcm2708_usb_device); +- bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + + #ifdef CONFIG_MMC_BCM2835 + bcm_register_device_dt(&bcm2835_emmc_device); + #endif + bcm2708_init_led(); ++ bcm2708_init_uart1(); + + /* Only create the platform devices for the ALSA driver in the + absence of an enabled "audio" DT node */ +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index d61bb30..ffa667e 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -363,27 +363,6 @@ static struct platform_device bcm2708_fb_device = { + }, + }; + +-static struct plat_serial8250_port bcm2708_uart1_platform_data[] = { +- { +- .mapbase = UART1_BASE + 0x40, +- .irq = IRQ_AUX, +- .uartclk = 125000000, +- .regshift = 2, +- .iotype = UPIO_MEM, +- .flags = UPF_FIXED_TYPE | UPF_IOREMAP | UPF_SKIP_TEST, +- .type = PORT_8250, +- }, +- {}, +-}; +- +-static struct platform_device bcm2708_uart1_device = { +- .name = "serial8250", +- .id = PLAT8250_DEV_PLATFORM, +- .dev = { +- .platform_data = bcm2708_uart1_platform_data, +- }, +-}; +- + static struct resource bcm2708_usb_resources[] = { + [0] = { + .start = USB_BASE, +@@ -918,6 +897,17 @@ static void bcm2709_power_off(void) + } + } + ++static void __init bcm2709_init_uart1(void) ++{ ++ struct device_node *np; ++ ++ np = of_find_compatible_node(NULL, NULL, "brcm,bcm2835-aux-uart"); ++ if (of_device_is_available(np)) { ++ pr_info("bcm2709: Mini UART enabled\n"); ++ writel(1, __io_address(UART1_BASE + 0x4)); ++ } ++} ++ + #ifdef CONFIG_OF + static void __init bcm2709_dt_init(void) + { +@@ -975,13 +965,13 @@ void __init bcm2709_init(void) + #endif + bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device_dt(&bcm2708_usb_device); +- bcm_register_device(&bcm2708_uart1_device); + bcm_register_device(&bcm2708_powerman_device); + + #ifdef CONFIG_MMC_BCM2835 + bcm_register_device_dt(&bcm2835_emmc_device); + #endif + bcm2709_init_led(); ++ bcm2709_init_uart1(); + + /* Only create the platform devices for the ALSA driver in the + absence of an enabled "audio" DT node */ + +From 31c0f40b228b657d4c8968c32768992a3bbcefb6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sun, 7 Jun 2015 20:42:35 +0200 +Subject: [PATCH 215/216] fixup: BCM2709: Remove unused clock implementation + +--- + arch/arm/mach-bcm2709/clock.c | 61 ------------------------------------------- + arch/arm/mach-bcm2709/clock.h | 24 ----------------- + 2 files changed, 85 deletions(-) + delete mode 100644 arch/arm/mach-bcm2709/clock.c + delete mode 100644 arch/arm/mach-bcm2709/clock.h + +diff --git a/arch/arm/mach-bcm2709/clock.c b/arch/arm/mach-bcm2709/clock.c +deleted file mode 100644 +index 4fc556e..0000000 +--- a/arch/arm/mach-bcm2709/clock.c ++++ /dev/null +@@ -1,61 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/clock.c +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include +- +-#include "clock.h" +- +-int clk_enable(struct clk *clk) +-{ +- return 0; +-} +-EXPORT_SYMBOL(clk_enable); +- +-void clk_disable(struct clk *clk) +-{ +-} +-EXPORT_SYMBOL(clk_disable); +- +-unsigned long clk_get_rate(struct clk *clk) +-{ +- return clk->rate; +-} +-EXPORT_SYMBOL(clk_get_rate); +- +-long clk_round_rate(struct clk *clk, unsigned long rate) +-{ +- return clk->rate; +-} +-EXPORT_SYMBOL(clk_round_rate); +- +-int clk_set_rate(struct clk *clk, unsigned long rate) +-{ +- return -EIO; +-} +-EXPORT_SYMBOL(clk_set_rate); +diff --git a/arch/arm/mach-bcm2709/clock.h b/arch/arm/mach-bcm2709/clock.h +deleted file mode 100644 +index 5f9d725..0000000 +--- a/arch/arm/mach-bcm2709/clock.h ++++ /dev/null +@@ -1,24 +0,0 @@ +-/* +- * linux/arch/arm/mach-bcm2708/clock.h +- * +- * Copyright (C) 2010 Broadcom +- * +- * This program is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License as published by +- * the Free Software Foundation; either version 2 of the License, or +- * (at your option) any later version. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +- */ +-struct module; +- +-struct clk { +- unsigned long rate; +-}; + +From 6ae9c7a93909159bde1a92fd305e99443e4ac680 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Sun, 7 Jun 2015 20:42:52 +0200 +Subject: [PATCH 216/216] BCM270x: Remove bcm2708_systemtimer and + bcm2708_powerman +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +These devices do not have a matching driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/mach-bcm2708/bcm2708.c | 50 -------------------------------------- + arch/arm/mach-bcm2709/bcm2709.c | 54 ----------------------------------------- + 2 files changed, 104 deletions(-) + +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index f1706366..00fc5d6 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -465,33 +465,6 @@ static struct platform_device bcm2708_gpio_device = { + }; + #endif + +-static struct resource bcm2708_systemtimer_resources[] = { +- [0] = { /* system timer access */ +- .start = ST_BASE, +- .end = ST_BASE + SZ_4K - 1, +- .flags = IORESOURCE_MEM, +- }, +- { +- .start = IRQ_TIMER3, +- .end = IRQ_TIMER3, +- .flags = IORESOURCE_IRQ, +- } +- +-}; +- +-static u64 systemtimer_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); +- +-static struct platform_device bcm2708_systemtimer_device = { +- .name = "bcm2708_systemtimer", +- .id = -1, /* only one VideoCore I/O area */ +- .resource = bcm2708_systemtimer_resources, +- .num_resources = ARRAY_SIZE(bcm2708_systemtimer_resources), +- .dev = { +- .dma_mask = &systemtimer_dmamask, +- .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), +- }, +-}; +- + #ifdef CONFIG_MMC_BCM2835 /* Arasan emmc SD (new) */ + static struct resource bcm2835_emmc_resources[] = { + [0] = { +@@ -520,27 +493,6 @@ struct platform_device bcm2835_emmc_device = { + }; + #endif /* CONFIG_MMC_BCM2835 */ + +-static struct resource bcm2708_powerman_resources[] = { +- [0] = { +- .start = PM_BASE, +- .end = PM_BASE + SZ_256 - 1, +- .flags = IORESOURCE_MEM, +- }, +-}; +- +-static u64 powerman_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); +- +-struct platform_device bcm2708_powerman_device = { +- .name = "bcm2708_powerman", +- .id = 0, +- .num_resources = ARRAY_SIZE(bcm2708_powerman_resources), +- .resource = bcm2708_powerman_resources, +- .dev = { +- .dma_mask = &powerman_dmamask, +- .coherent_dma_mask = 0xffffffffUL}, +-}; +- +- + static struct platform_device bcm2708_alsa_devices[] = { + [0] = { + .name = "bcm2835_AUD0", +@@ -938,10 +890,8 @@ void __init bcm2708_init(void) + w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup; + bcm_register_device_dt(&w1_device); + #endif +- bcm_register_device(&bcm2708_systemtimer_device); + bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device_dt(&bcm2708_usb_device); +- bcm_register_device(&bcm2708_powerman_device); + + #ifdef CONFIG_MMC_BCM2835 + bcm_register_device_dt(&bcm2835_emmc_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index ffa667e..a5cac5b 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -485,35 +485,6 @@ static struct platform_device bcm2708_gpio_device = { + }; + #endif + +-#ifdef SYSTEM_TIMER +-static struct resource bcm2708_systemtimer_resources[] = { +- [0] = { /* system timer access */ +- .start = ST_BASE, +- .end = ST_BASE + SZ_4K - 1, +- .flags = IORESOURCE_MEM, +- }, +- { +- .start = IRQ_TIMER3, +- .end = IRQ_TIMER3, +- .flags = IORESOURCE_IRQ, +- } +- +-}; +- +-static u64 systemtimer_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); +- +-static struct platform_device bcm2708_systemtimer_device = { +- .name = "bcm2708_systemtimer", +- .id = -1, /* only one VideoCore I/O area */ +- .resource = bcm2708_systemtimer_resources, +- .num_resources = ARRAY_SIZE(bcm2708_systemtimer_resources), +- .dev = { +- .dma_mask = &systemtimer_dmamask, +- .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), +- }, +-}; +-#endif +- + #ifdef CONFIG_MMC_BCM2835 /* Arasan emmc SD (new) */ + static struct resource bcm2835_emmc_resources[] = { + [0] = { +@@ -542,27 +513,6 @@ struct platform_device bcm2835_emmc_device = { + }; + #endif /* CONFIG_MMC_BCM2835 */ + +-static struct resource bcm2708_powerman_resources[] = { +- [0] = { +- .start = PM_BASE, +- .end = PM_BASE + SZ_256 - 1, +- .flags = IORESOURCE_MEM, +- }, +-}; +- +-static u64 powerman_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); +- +-struct platform_device bcm2708_powerman_device = { +- .name = "bcm2708_powerman", +- .id = 0, +- .num_resources = ARRAY_SIZE(bcm2708_powerman_resources), +- .resource = bcm2708_powerman_resources, +- .dev = { +- .dma_mask = &powerman_dmamask, +- .coherent_dma_mask = 0xffffffffUL}, +-}; +- +- + static struct platform_device bcm2708_alsa_devices[] = { + [0] = { + .name = "bcm2835_AUD0", +@@ -960,12 +910,8 @@ void __init bcm2709_init(void) + w1_gpio_pdata.ext_pullup_enable_pin = w1_gpio_pullup; + bcm_register_device_dt(&w1_device); + #endif +-#ifdef SYSTEM_TIMER +- bcm_register_device(&bcm2708_systemtimer_device); +-#endif + bcm_register_device_dt(&bcm2708_fb_device); + bcm_register_device_dt(&bcm2708_usb_device); +- bcm_register_device(&bcm2708_powerman_device); + + #ifdef CONFIG_MMC_BCM2835 + bcm_register_device_dt(&bcm2835_emmc_device);