diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch index ca8cc26f77..89b94b4720 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 e37bf99f8d2de9ff2b179c4f134c9f76d05f6218 Mon Sep 17 00:00:00 2001 +From 2a760213af96c4fc8285fa707590f7d0a7ad7b89 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 01/64] Main bcm2708 linux port +Subject: [PATCH 01/68] Main bcm2708 linux port Signed-off-by: popcornmix --- @@ -8594,10 +8594,10 @@ index 7be12b8..a968bd6 100644 1.9.3 -From c2895111e4d456b641c80c6b8ed364e6a92015fa Mon Sep 17 00:00:00 2001 +From cdd3b5a6b34a25075c2b0cffcf7ed6eb87a6a36f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 7 May 2013 22:20:24 +0100 -Subject: [PATCH 02/64] Add quick config. +Subject: [PATCH 02/68] Add quick config. This is designed for quick compiling when developing. No modules are needed and it includes all Pi specific drivers @@ -8813,10 +8813,10 @@ index 0000000..e5efe75 1.9.3 -From 283b04a18d18b08bcf0eec4384e28e65c01000a7 Mon Sep 17 00:00:00 2001 +From 44a5c34cea8b65897d1ceee6d33aab54749a9b69 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 03/64] Add dwc_otg driver +Subject: [PATCH 03/68] Add dwc_otg driver Signed-off-by: popcornmix --- @@ -65888,10 +65888,10 @@ index 0000000..cdc9963 1.9.3 -From 187820b6662bc8e785f219334c8b915287dbecb5 Mon Sep 17 00:00:00 2001 +From 65a690edf14af90fdd769664659b6055973b6881 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:54:32 +0100 -Subject: [PATCH 04/64] bcm2708 watchdog driver +Subject: [PATCH 04/68] bcm2708 watchdog driver Signed-off-by: popcornmix --- @@ -66322,10 +66322,10 @@ index 0000000..8a27d68 1.9.3 -From fad16f27bf5a63a43c64c728550cff7201a46973 Mon Sep 17 00:00:00 2001 +From 63dddb1abc7e99bfeda24215111d4e5de18c826e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:55:09 +0100 -Subject: [PATCH 05/64] bcm2708 framebuffer driver +Subject: [PATCH 05/68] bcm2708 framebuffer driver Signed-off-by: popcornmix --- @@ -69372,10 +69372,10 @@ index 3c14e43..7626beb 100644 1.9.3 -From 21372dcbbe88e25280099d9fe1357b9fe60b2cce Mon Sep 17 00:00:00 2001 +From 799ee39e59077465fb7c5c7dd5875f93bd214ac0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 06/64] bcm2708 vchiq driver +Subject: [PATCH 06/68] bcm2708 vchiq driver Signed-off-by: popcornmix @@ -81927,10 +81927,10 @@ index 0000000..b6bfa21 1.9.3 -From 05b0be89dd68c37855d771696f1e6f793cafec92 Mon Sep 17 00:00:00 2001 +From 23b7ff8a2fb95aca0e485a21f8529b2b90cf3fcf Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 12 May 2014 15:12:02 +0100 -Subject: [PATCH 07/64] vchiq: Avoid high load when blocked and unkillable +Subject: [PATCH 07/68] vchiq: Avoid high load when blocked and unkillable vchiq: Include SIGSTOP and SIGCONT in list of signals not-masked by vchiq to allow gdb to work --- @@ -82095,10 +82095,10 @@ index c2eefef..05e7979 100644 1.9.3 -From 00b02bc17146a7bc97f0a67154956e6a129b3221 Mon Sep 17 00:00:00 2001 +From f284f0d5a65d152737f1c63a5fc769f37d1e83e7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 08/64] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 08/68] cma: Add vc_cma driver to enable use of CMA Signed-off-by: popcornmix --- @@ -83390,10 +83390,10 @@ index 0000000..5325832 1.9.3 -From 9fb8657030e08cc79d731be06304bdfc976c007a Mon Sep 17 00:00:00 2001 +From 97be6baed7c673b81061654e224cc5ba2aa49ae0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 09/64] bcm2708: alsa sound driver +Subject: [PATCH 09/68] bcm2708: alsa sound driver Signed-off-by: popcornmix --- @@ -85757,10 +85757,10 @@ index 0000000..af3e6eb 1.9.3 -From 4fbf6266e01c0f8b65fc9fc1129d3829bd510460 Mon Sep 17 00:00:00 2001 +From 786767c9bd15e3d80f9693d6403d1cf5652fbe50 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 26 Apr 2013 10:08:31 -0700 -Subject: [PATCH 10/64] alsa: add mmap support and some cleanups to bcm2835 +Subject: [PATCH 10/68] alsa: add mmap support and some cleanups to bcm2835 ALSA driver --- @@ -86240,10 +86240,10 @@ index 080bd5c..36afee3 100755 1.9.3 -From 396aa2537f80f72e916800ac9bf4395ffe63a3aa Mon Sep 17 00:00:00 2001 +From dbc9091813f44049f94eb83a47e6d7daf41c4e23 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:51:55 +0100 -Subject: [PATCH 11/64] Add hwrng (hardware random number generator) driver +Subject: [PATCH 11/68] Add hwrng (hardware random number generator) driver --- arch/arm/mach-bcm2708/include/mach/platform.h | 1 + @@ -86425,10 +86425,10 @@ index 0000000..340f004 1.9.3 -From 5ccb2f9660f478fde39f4142e0eb3e7f3142f816 Mon Sep 17 00:00:00 2001 +From 440194daf06251595fd8c07266d9f99acbf4feaf Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 12/64] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 12/68] 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 @@ -87173,10 +87173,10 @@ index 0000000..57ffacf 1.9.3 -From 2c66ed53ee696fa94b26925ed847baba3bca9641 Mon Sep 17 00:00:00 2001 +From b2f48a32194d84de74d103cb5f319e4d8a67610f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 8 May 2012 23:12:13 +0100 -Subject: [PATCH 13/64] Fixes for sdhci-bcm2708 +Subject: [PATCH 13/68] Fixes for sdhci-bcm2708 possible fix for sdcard missing status. Thank naren @@ -88450,10 +88450,10 @@ index a968bd6..df54b9b 100644 1.9.3 -From 56176302aac5a8f165bce1b2451c1b3bb5b86f46 Mon Sep 17 00:00:00 2001 +From b834d92160dbac4a9705a82178e386a1b45c0d75 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 14/64] Add cpufreq driver +Subject: [PATCH 14/68] Add cpufreq driver --- arch/arm/Kconfig | 1 + @@ -88495,7 +88495,7 @@ index 5805035..59efbe6 100644 bool "TEGRA CPUFreq support" depends on ARCH_TEGRA diff --git a/drivers/cpufreq/Makefile b/drivers/cpufreq/Makefile -index 0dbb963..bd05f53 100644 +index 3254f6c..0cfe6d1 100644 --- a/drivers/cpufreq/Makefile +++ b/drivers/cpufreq/Makefile @@ -73,6 +73,7 @@ obj-$(CONFIG_ARM_S5PV210_CPUFREQ) += s5pv210-cpufreq.o @@ -88755,10 +88755,10 @@ index 0000000..7bc55bd 1.9.3 -From 278de38eaccb432992e4cd33a2c641ddd0163187 Mon Sep 17 00:00:00 2001 +From 61fab66382d7f36f4c2db33f43f5d2153495fba4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 15/64] Added hwmon/thermal driver for reporting core +Subject: [PATCH 15/68] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian --- @@ -89283,10 +89283,10 @@ index 0000000..85fceb5 1.9.3 -From fc3526e11aa4220ebd89ef2e2d3033c8b3c2cb17 Mon Sep 17 00:00:00 2001 +From 3f013c20359de5e19dcada9d81c633e5fb1bcd2e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 16/64] Allow mac address to be set in smsc95xx +Subject: [PATCH 16/68] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -89380,10 +89380,10 @@ index 424db65e..fc1ef4e 100644 1.9.3 -From 0edea5edb123d899961a2f9c7fa5de53e2df6022 Mon Sep 17 00:00:00 2001 +From b04c5a505b8752600b8c3ce39fd37ca7a8823dd2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 4 Nov 2013 18:56:10 +0000 -Subject: [PATCH 17/64] Add Chris Boot's i2c and spi drivers. +Subject: [PATCH 17/68] Add Chris Boot's i2c and spi drivers. i2c-bcm2708: fixed baudrate @@ -90767,10 +90767,10 @@ index 0000000..06dd02f 1.9.3 -From 7779b109af8fc7c051118a631086e56da449f795 Mon Sep 17 00:00:00 2001 +From 388e21b0f5517a2c2171d31e645ca5cc0b0c04e0 Mon Sep 17 00:00:00 2001 From: cbeytas Date: Mon, 24 Jun 2013 00:05:40 -0400 -Subject: [PATCH 18/64] Perform I2C combined transactions when possible +Subject: [PATCH 18/68] Perform I2C combined transactions when possible Perform I2C combined transactions whenever possible, within the restrictions of the Broadcomm Serial Controller. @@ -90845,10 +90845,10 @@ index f266f10..8750634 100644 1.9.3 -From 12d19988b97d88cba14bbef1a0549658f120d79d Mon Sep 17 00:00:00 2001 +From c0f52d42d4c456557cb1bba80208cda75078890e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 19/64] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 19/68] 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 @@ -91123,10 +91123,10 @@ index 2820924..fd0550f 100644 1.9.3 -From 21e6e49ac20d67a469bfa8848ebc8119e8c2377b Mon Sep 17 00:00:00 2001 +From 8dc29e0af938de78fc33a3fd19dbd1a545c0881b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 12 Apr 2013 23:58:47 +0100 -Subject: [PATCH 23/64] config: add missing options from 3.6.y kernel +Subject: [PATCH 23/68] config: add missing options from 3.6.y kernel --- arch/arm/configs/bcmrpi_defconfig | 755 ++++++++++++++++++++++++++++++++------ @@ -92176,10 +92176,10 @@ index 31f5afaa..78d789c 100644 1.9.3 -From 0f34d6fd8de08920c3048899334fca524b3967e1 Mon Sep 17 00:00:00 2001 +From 9a4f92d3c931ba5f53c9be77af157fd60496fbdb Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 24/64] Speed up console framebuffer imageblit function +Subject: [PATCH 24/68] 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 @@ -92391,10 +92391,10 @@ index a2bb276..436494f 100644 1.9.3 -From 8b16ab4a36aa8017c61a8cd32d26577e3bc7289d Mon Sep 17 00:00:00 2001 +From 3326d1afa7a229fa891ec00f7141d443aea6a63a Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 25/64] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 25/68] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -92490,10 +92490,10 @@ index fb795c3..fa72af0 100644 1.9.3 -From d6fe90f30c75df3e38c36d895de95038c1439cf7 Mon Sep 17 00:00:00 2001 +From de83e321ffb295bc605fc0031bce479c93fb1742 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 16:00:25 +0300 -Subject: [PATCH 26/64] bcm2708_fb: DMA acceleration for fb_copyarea +Subject: [PATCH 26/68] bcm2708_fb: DMA acceleration for fb_copyarea Based on http://www.raspberrypi.org/phpBB3/viewtopic.php?p=62425#p62425 Also used Simon's dmaer_master module as a reference for tweaking DMA @@ -92951,10 +92951,10 @@ index 54cd760..798eb52 100644 1.9.3 -From ae63a6fb5500f30dcdf77d807ea15213c8cefe7b Mon Sep 17 00:00:00 2001 +From 96bbb811c683801f1ec7156fd9ad91e5ffe46587 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 27/64] config: Enable CONFIG_MEMCG, but leave it disabled (due +Subject: [PATCH 27/68] config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. --- @@ -92976,10 +92976,10 @@ index 78d789c..e89e430 100644 CONFIG_NAMESPACES=y CONFIG_SCHED_AUTOGROUP=y diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index ceee0c5..39a172b 100644 +index 073226b..e787ee2 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c -@@ -4620,6 +4620,29 @@ static int __init cgroup_disable(char *str) +@@ -4671,6 +4671,29 @@ static int __init cgroup_disable(char *str) } __setup("cgroup_disable=", cgroup_disable); @@ -93025,10 +93025,10 @@ index 67c927a..6512641 100644 1.9.3 -From 7beda6ed6312bbd470bb342040623be4e44f7d94 Mon Sep 17 00:00:00 2001 +From e505e6bb3f7d028f3a173e8dbab807c69956fb6b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:46:42 +0100 -Subject: [PATCH 28/64] Add FIQ patch to dwc_otg driver. Enable with +Subject: [PATCH 28/68] Add FIQ patch to dwc_otg driver. Enable with dwc_otg.fiq_fix_enable=1. Should give about 10% more ARM performance. Thanks to Gordon and Costas @@ -96350,10 +96350,10 @@ index 1b1f83c..c8590b5 100644 1.9.3 -From dfa32d4a5af731c1a41cd850fa959b718b11dbd4 Mon Sep 17 00:00:00 2001 +From c2b30107f473b7bce3aef7ac2fff388e53d7dba6 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 19 Mar 2014 12:58:23 +0000 -Subject: [PATCH 29/64] dwc_otg: fiq_fsm: Base commit for driver rewrite +Subject: [PATCH 29/68] dwc_otg: fiq_fsm: Base commit for driver rewrite This commit removes the previous FIQ fixes entirely and adds fiq_fsm. @@ -101252,10 +101252,10 @@ index 5d310df..4b32941 100644 1.9.3 -From 2b260a7e8a29853dd243e7d6d037f7ad4f6bb69e Mon Sep 17 00:00:00 2001 +From 622988510933af7760ddd4b38fcd49385139177d Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 30/64] bcm2835: add v4l2 camera device +Subject: [PATCH 30/68] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -107243,10 +107243,10 @@ index 0000000..9d1d11e 1.9.3 -From a07a86bb9923797cc2229f8a53fdfa6e1d2b8395 Mon Sep 17 00:00:00 2001 +From f7dbd041461aa8de471511065a677cde15c842a6 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 9 Dec 2013 10:58:01 +0000 -Subject: [PATCH 31/64] V4L2: Fixes from 6by9 +Subject: [PATCH 31/68] V4L2: Fixes from 6by9 V4L2: Fix EV values. Add manual shutter speed control @@ -109621,10 +109621,10 @@ index a06fb44..76f249e 100644 1.9.3 -From fd0cd901b1f4d3c502c2a0fbd0cdf905b17676a4 Mon Sep 17 00:00:00 2001 +From 4a6b249c72c91c27b353347c6981acb9f47ee60d Mon Sep 17 00:00:00 2001 From: Julian Scheel Date: Wed, 19 Feb 2014 16:06:59 +0100 -Subject: [PATCH 32/64] snd-bcm2835: Add support for spdif/hdmi passthrough +Subject: [PATCH 32/68] snd-bcm2835: Add support for spdif/hdmi passthrough This adds a dedicated subdevice which can be used for passthrough of non-audio formats (ie encoded a52) through the hdmi audio link. In addition to this @@ -110095,10 +110095,10 @@ index 36afee3..8c2fe26 100755 1.9.3 -From 65f59cdf17e27195c0f1182064eedb4158d8b392 Mon Sep 17 00:00:00 2001 +From 7377829678e12d41b6d2b73a81732627aa8c86e6 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 33/64] dmaengine: Add support for BCM2708 +Subject: [PATCH 33/68] dmaengine: Add support for BCM2708 Add support for DMA controller of BCM2708 as used in the Raspberry Pi. Currently it only supports cyclic DMA. @@ -110738,10 +110738,10 @@ index 0000000..b244293 1.9.3 -From 025192f091d11ce772b76a0780f3f04808f5098b Mon Sep 17 00:00:00 2001 +From 8a6a720f73cb16e33042edf1df08dbc5fdc9f64b Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:33:38 +0100 -Subject: [PATCH 34/64] ASoC: Add support for BCM2708 +Subject: [PATCH 34/68] ASoC: Add support for BCM2708 This driver adds support for digital audio (I2S) for the BCM2708 SoC that is used by the @@ -111739,10 +111739,10 @@ index 0000000..ebaf3d6 1.9.3 -From 5093874806c58c6b4a956ca3d3ddd3d1f33912d1 Mon Sep 17 00:00:00 2001 +From 47b899a36fc34215510ae701be6822ff031a7b52 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:37:51 +0100 -Subject: [PATCH 35/64] BCM2708: Extend mach header +Subject: [PATCH 35/68] BCM2708: Extend mach header Extend the headers of the mach-bcm2708 in order to support I2S and DMA engine. @@ -111787,10 +111787,10 @@ index 992a630..2e7e1bb 100644 1.9.3 -From 6422382c791d85671a06947a7fa1f5a549d5c3a3 Mon Sep 17 00:00:00 2001 +From 7e43c52ea80363c7135bd2fe1019c666baa1a392 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 36/64] ASoC: Add support for PCM5102A codec +Subject: [PATCH 36/68] ASoC: Add support for PCM5102A codec Some definitions to support the PCM5102A codec by Texas Instruments. @@ -111918,10 +111918,10 @@ index 0000000..126f1e9 1.9.3 -From ad81742a1fbe7c097daf3f6a13a406b19dc13d3d Mon Sep 17 00:00:00 2001 +From 562518d4208bd05bce553f668b0f27c4c5da2b1d Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:04:54 +0100 -Subject: [PATCH 37/64] BCM2708: Add I2S support to board file +Subject: [PATCH 37/68] BCM2708: Add I2S support to board file Adds the required initializations for I2S to the board file of mach-bcm2708. @@ -111979,10 +111979,10 @@ index ef0935f..7cb8a8e 100644 1.9.3 -From bf214bf792fe74bb28af994ec8d0297287b2dbfa Mon Sep 17 00:00:00 2001 +From be1cc3e593cd91c07f71be115c2a09500331e0f2 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 38/64] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 38/68] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -112134,10 +112134,10 @@ index 0000000..4b70b45 1.9.3 -From 0184bd07bc1cbe6a4393e6d921696c00b61cc5c8 Mon Sep 17 00:00:00 2001 +From 3d0f11d995d08d80d3862c847a99a4667064ae6f Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 39/64] BCM2708: Add HifiBerry DAC to board file +Subject: [PATCH 39/68] BCM2708: Add HifiBerry DAC to board file This adds the initalization of the HifiBerry DAC to the mach-bcm2708 board file. @@ -112188,10 +112188,10 @@ index 7cb8a8e..c4dc10e 100644 1.9.3 -From bcfe1b6e75d74f1ea4f114d8b2d6cac38a216197 Mon Sep 17 00:00:00 2001 +From 6b4fbd3604316ef3127bdb5191b6fdba2906eefb Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 6 Dec 2013 18:55:53 +0100 -Subject: [PATCH 40/64] ASoC: BCM2708: Add 24 bit support +Subject: [PATCH 40/68] ASoC: BCM2708: Add 24 bit support This adds 24 bit support to the I2S driver of the BCM2708. Besides enabling the 24 bit flags, it includes two bug fixes: @@ -112266,10 +112266,10 @@ index ebaf3d6..a179216 100644 1.9.3 -From 3354beaded51a2ff69c0df240d4a4b0950928a47 Mon Sep 17 00:00:00 2001 +From e8398d6b894cc11af47f6635a5207d14c7ecce68 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Mon, 2 Dec 2013 20:28:22 +0100 -Subject: [PATCH 41/64] BCM2708: Add I2S and DMA support to default config +Subject: [PATCH 41/68] BCM2708: Add I2S and DMA support to default config This commit adds several modules that are needed for I2S support for the Raspberry Pi to the defconfig. @@ -112312,10 +112312,10 @@ index d70da44..36e7473 100644 1.9.3 -From 8bdb6605a3428512fd974cce4977d7dea7d09647 Mon Sep 17 00:00:00 2001 +From 2c25bf3c32c3e992b67909ba36d281e43d4dab28 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 6 Dec 2013 20:50:28 +0100 -Subject: [PATCH 42/64] ASoC: BCM2708: Add support for RPi-DAC +Subject: [PATCH 42/68] ASoC: BCM2708: Add support for RPi-DAC This adds a machine driver for the RPi-DAC. @@ -112629,10 +112629,10 @@ index 0000000..b4eaa44 1.9.3 -From 53bdb30aeb3fb612dc3317f52d563869064b9262 Mon Sep 17 00:00:00 2001 +From 280746c50f77d6c5ea147c02d80c2c7ee1a91fb4 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 43/64] ASoC: wm8804: Implement MCLK configuration options, add +Subject: [PATCH 43/68] 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 @@ -112749,10 +112749,10 @@ index 8ec14f5..e72d4f4 100644 1.9.3 -From e195e9cab91a44292175d2a2d5a6b7c01b347195 Mon Sep 17 00:00:00 2001 +From 34708ed695368c02163e6594bf8409e1530c3a55 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 44/64] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 44/68] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -112958,10 +112958,10 @@ index 0000000..e4f769d 1.9.3 -From de58101b3a5ba8de5fc1daec86962565ceb3a819 Mon Sep 17 00:00:00 2001 +From fdc5bb7760ca39db355df41694929181b4dfb4b6 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:26:08 +0100 -Subject: [PATCH 45/64] BCM2708: Added support for HiFiBerry Digi board Board +Subject: [PATCH 45/68] BCM2708: Added support for HiFiBerry Digi board Board initalization by I2C Signed-off-by: Daniel Matuschek @@ -113011,10 +113011,10 @@ index f2b3990..f5afd86 100644 1.9.3 -From e82c150fbb033cf6ecad32333c1d71d9acf271e1 Mon Sep 17 00:00:00 2001 +From 507785154ceba9cd655e3b6f006e31cba2fb17b9 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:27:28 +0100 -Subject: [PATCH 46/64] BCM2708: Added HiFiBerry Digi configuration option It +Subject: [PATCH 46/68] BCM2708: Added HiFiBerry Digi configuration option It will be compiled as a module by default. This also includes the WM8804 driver. @@ -113042,10 +113042,10 @@ index f877ab2..3d3c8ab 100644 1.9.3 -From 6a08a9e4a1cf9ef0573f8bc6b807601208aef203 Mon Sep 17 00:00:00 2001 +From 9dc678406947738598d9c6b551bd78ff9b608dfa Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 47/64] ASoC: wm8804: Set idle_bias_off to false Idle bias has +Subject: [PATCH 47/68] ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup Signed-off-by: Daniel Matuschek @@ -113070,10 +113070,10 @@ index d8923c1..2787042 100644 1.9.3 -From 0eaa2754de8646ce49cd8334f61f736fd54b5e41 Mon Sep 17 00:00:00 2001 +From 0ed2afd515567cae00bd81f83ea19bc13e208065 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 12 Mar 2014 11:46:34 +0000 -Subject: [PATCH 48/64] ASoc: Don't report S24_LE support, it produces white +Subject: [PATCH 48/68] ASoc: Don't report S24_LE support, it produces white noise with xbmc --- @@ -113111,10 +113111,10 @@ index 126f1e9..7812d34 100644 1.9.3 -From 63e8d7a7c335421011848520ed1a8cc1ba78d8a9 Mon Sep 17 00:00:00 2001 +From dfa4d76b94b9005d15f6ae6b43a3ba9eadb4d954 Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 49/64] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 49/68] Add IQaudIO Sound Card support for Raspberry Pi --- arch/arm/configs/bcmrpi_defconfig | 1 + @@ -113919,10 +113919,10 @@ index 6ee76aa..b2f518e 100644 1.9.3 -From 7571ebdbb4602cc392e7afeb43dec1d7cf1c5c58 Mon Sep 17 00:00:00 2001 +From 9a06438498eb92ccd03a4c45f2a83621a4bb2e83 Mon Sep 17 00:00:00 2001 From: Howard Mitchell Date: Fri, 28 Mar 2014 16:27:57 +0000 -Subject: [PATCH 50/64] Fix volsw_range functions so SOC_DOUBLE_R_RANGE_TLV +Subject: [PATCH 50/68] Fix volsw_range functions so SOC_DOUBLE_R_RANGE_TLV works. This is so that the correct rabge of values as specified @@ -113998,10 +113998,10 @@ index 051c006..bf39f16 100644 1.9.3 -From 69e39dee769df531ad54dc709670159ebf4341c7 Mon Sep 17 00:00:00 2001 +From 16d00b737eab6ffa1abb67d0e55ddbab8252f86c Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sun, 30 Mar 2014 13:52:33 +0100 -Subject: [PATCH 51/64] fix soc-core's inverse range and let IQaudIO DAC use +Subject: [PATCH 51/68] fix soc-core's inverse range and let IQaudIO DAC use this fixed SOC_DOUBLE_R_RANGE_TLV support --- @@ -114038,10 +114038,10 @@ index bf39f16..4d8917b 100644 1.9.3 -From 84ea137d0e7ae7bc62f37130cd7f26f12247534c Mon Sep 17 00:00:00 2001 +From 73927f1d98ca1e3eefee64e6e4bde7a64c67299f Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Fri, 2 May 2014 16:13:59 +0100 -Subject: [PATCH 52/64] Move GPIO setup to hw_params. +Subject: [PATCH 52/68] Move GPIO setup to hw_params. This is used to stop the I2S driver from breaking the GPIO setup for other uses of the PCM interface @@ -114140,10 +114140,10 @@ index b25e158..9976571 100644 1.9.3 -From 776049380ffa1bda8b77ade8109991a95e50ca7e Mon Sep 17 00:00:00 2001 +From ecbddc52262ebb8b5db9a4d4a51f23af55eac454 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 9 May 2014 15:45:13 +0100 -Subject: [PATCH 53/64] fb: distinguish physical and bus addresses +Subject: [PATCH 53/68] fb: distinguish physical and bus addresses --- drivers/video/fbdev/bcm2708_fb.c | 15 +++++++++------ @@ -114218,10 +114218,10 @@ index 798eb52..b3b1e04 100644 1.9.3 -From 84f90e8ddd31103c570ea7dadffdb1bace8bd985 Mon Sep 17 00:00:00 2001 +From 11dc007644b6a6ccb6ca7d411639f86656da7daa Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 54/64] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 54/68] vmstat: Workaround for issue where dirty page count goes negative See: @@ -114251,10 +114251,10 @@ index 45c9cd1..07dad05 100644 1.9.3 -From f445a8bb0063352894db55cd940b0a0100c301bf Mon Sep 17 00:00:00 2001 +From 4974de4d06bc40913dfada5db26a96b1afe6b41f Mon Sep 17 00:00:00 2001 From: P33M Date: Fri, 20 Jun 2014 16:03:12 +0100 -Subject: [PATCH 55/64] dwc_otg: Fix various issues with root port and +Subject: [PATCH 55/68] dwc_otg: Fix various issues with root port and transaction errors Process the host port interrupts correctly (and don't trample them). @@ -114327,10 +114327,10 @@ index d3e2035..6182d3e 100644 1.9.3 -From 2c049a3ce5174681af289ca153a1331b5e49c50c Mon Sep 17 00:00:00 2001 +From 3a948e56dd7b77241f3b8e74dbb8767701d3ba5a Mon Sep 17 00:00:00 2001 From: P33M Date: Fri, 20 Jun 2014 17:23:20 +0100 -Subject: [PATCH 56/64] fiq_fsm: Implement hack for Split Interrupt +Subject: [PATCH 56/68] fiq_fsm: Implement hack for Split Interrupt transactions Hubs aren't too picky about which endpoint we send Control type split @@ -114419,10 +114419,10 @@ index daea770..35721e5 100644 1.9.3 -From 214f30d8852405583669eb864931c0cf2795113f Mon Sep 17 00:00:00 2001 +From ed953ae0e1644efcaa4a11275c5c37a6e9540469 Mon Sep 17 00:00:00 2001 From: notro Date: Sun, 6 Jul 2014 12:07:25 +0200 -Subject: [PATCH 57/64] spi-bcm2708: Prepare for Common Clock Framework +Subject: [PATCH 57/68] spi-bcm2708: Prepare for Common Clock Framework migration As part of migrating to use the Common Clock Framework, replace clk_enable() @@ -114470,10 +114470,10 @@ index 06dd02f..0952f40 100644 1.9.3 -From b8f8b3c46ade5a9146538a925d81e1c12ead332a Mon Sep 17 00:00:00 2001 +From cdbb67d3b2bee196acb94d97ffd867e9b831e8c0 Mon Sep 17 00:00:00 2001 From: notro Date: Sun, 6 Jul 2014 12:09:30 +0200 -Subject: [PATCH 58/64] BCM2708: Migrate to the Common Clock Framework +Subject: [PATCH 58/68] 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. @@ -114751,10 +114751,10 @@ index 5f9d725..0000000 1.9.3 -From 67ce1030a3a4c43ed6d96964c1f4577832f60f6e Mon Sep 17 00:00:00 2001 +From efd72683ffef207017d5c9551fb3d50c32f6c4a6 Mon Sep 17 00:00:00 2001 From: notro Date: Sun, 6 Jul 2014 16:31:31 +0200 -Subject: [PATCH 59/64] BCM2708: remove 'bcm2708_usb' clkdev +Subject: [PATCH 59/68] BCM2708: remove 'bcm2708_usb' clkdev 'bcm2708_usb' is currently not in use by the USB OTG driver. @@ -114783,10 +114783,10 @@ index 26fe14e..ef5a55dc 100644 1.9.3 -From 79f18a932ed1d3a4517ff339aa92465d279fc9c2 Mon Sep 17 00:00:00 2001 +From 8dc7813529393465d5df7e3e82c08bf0e393f86f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 4 Jul 2014 22:54:16 +0100 -Subject: [PATCH 60/64] config: Add CONFIG_DEVPTS_MULTIPLE_INSTANCES +Subject: [PATCH 60/68] config: Add CONFIG_DEVPTS_MULTIPLE_INSTANCES --- arch/arm/configs/bcmrpi_defconfig | 1 + @@ -114808,10 +114808,10 @@ index a024670..29fe486 100644 1.9.3 -From f799f0130530380d3138c06db2b466559c4c56fd Mon Sep 17 00:00:00 2001 +From b4eb454c2fd04b816a12235caf22a8c250905cc5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 26 Jun 2014 19:03:47 +0100 -Subject: [PATCH 61/64] bcm2708: Avoid hang when timer_set_next_event is called +Subject: [PATCH 61/68] bcm2708: Avoid hang when timer_set_next_event is called with MAX_INT See: https://github.com/raspberrypi/linux/issues/616 @@ -114837,10 +114837,10 @@ index ef5a55dc..9bf2508 100644 1.9.3 -From 42f78884c65f580e246331f715f61a54ee139f5c Mon Sep 17 00:00:00 2001 +From bb9a73de6528e2d1c09ec2b2c2ad996bc6edce83 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 26 Jun 2014 19:00:28 +0100 -Subject: [PATCH 62/64] armctrl: Don't mask interrupts from ack +Subject: [PATCH 62/68] armctrl: Don't mask interrupts from ack --- arch/arm/mach-bcm2708/armctrl.c | 2 +- @@ -114863,10 +114863,10 @@ index 274aa30..d4c5333 100644 1.9.3 -From 33c51dbe7c3307a9c2e5a830d95571fa6296b9c3 Mon Sep 17 00:00:00 2001 +From 7761dc9e9893fa3cdcc64a20af772b33b0e39a9e Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 63/64] BCM2708: Add core Device Tree support +Subject: [PATCH 63/68] BCM2708: Add core Device Tree support Add the bare minimum needed to boot BCM2708 from a Device Tree. @@ -115026,10 +115026,10 @@ index 9bf2508..6929e2e 100644 1.9.3 -From dba14197f482131aa88c5ae4c2606e6635aeee51 Mon Sep 17 00:00:00 2001 +From 7738eace307f0a0dcfa8d969d3e39eb015f305f3 Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:47:48 +0200 -Subject: [PATCH 64/64] BCM2708: armctrl: Add IRQ Device Tree support +Subject: [PATCH 64/68] BCM2708: armctrl: Add IRQ Device Tree support Add Device Tree IRQ support for BCM2708. Usage is the same as for irq-bcm2835. @@ -115195,3 +115195,1382 @@ index d4c5333..42f5e1c 100644 -- 1.9.3 + +From 9dd2af39823b97baf734d3a05f46f13412fa91fe Mon Sep 17 00:00:00 2001 +From: notro +Date: Thu, 10 Jul 2014 13:59:47 +0200 +Subject: [PATCH 65/68] pinctrl: add bcm2708 driver + +This driver is a verbatim copy of the pinctrl-bcm2835 driver, except for: +* changed 2835 to 2708 +* gpio_chip and IRQ part are removed +* Probing function is changed. + +Because armctrl sets up the gpio irqs, we use the bcm2708_gpio driver. +This hack is used to be able to support both DT and non-DT builds. + +Binding document: brcm,bcm2835-gpio.txt +It's not possible to set trigger type and level flags for IRQs in the DT. + +Signed-off-by: Noralf Tronnes +--- + arch/arm/boot/dts/bcm2708.dtsi | 7 + + arch/arm/mach-bcm2708/Kconfig | 3 + + drivers/pinctrl/Kconfig | 5 + + drivers/pinctrl/Makefile | 1 + + drivers/pinctrl/pinctrl-bcm2708.c | 773 ++++++++++++++++++++++++++++++++++++++ + 5 files changed, 789 insertions(+) + create mode 100644 drivers/pinctrl/pinctrl-bcm2708.c + +diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi +index 54ecab7..3f884b3 100644 +--- a/arch/arm/boot/dts/bcm2708.dtsi ++++ b/arch/arm/boot/dts/bcm2708.dtsi +@@ -26,6 +26,13 @@ + interrupt-controller; + #interrupt-cells = <2>; + }; ++ ++ gpio: gpio { ++ compatible = "brcm,bcm2708-pinctrl"; ++ reg = <0x7e200000 0xb4>; ++ gpio-controller; ++ #gpio-cells = <2>; ++ }; + }; + + clocks { +diff --git a/arch/arm/mach-bcm2708/Kconfig b/arch/arm/mach-bcm2708/Kconfig +index 182e7ba..05945d6 100644 +--- a/arch/arm/mach-bcm2708/Kconfig ++++ b/arch/arm/mach-bcm2708/Kconfig +@@ -14,6 +14,9 @@ config BCM2708_DT + depends on MACH_BCM2708 + default n + select USE_OF ++ select PINCTRL ++ select PINCTRL_BCM2708 ++ select BCM2708_GPIO + help + Enable Device Tree support for BCM2708 + +diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig +index e00c02d..1279285 100644 +--- a/drivers/pinctrl/Kconfig ++++ b/drivers/pinctrl/Kconfig +@@ -99,6 +99,11 @@ config PINCTRL_BAYTRAIL + + Requires ACPI device enumeration code to set up a platform device. + ++config PINCTRL_BCM2708 ++ bool ++ select PINMUX ++ select PINCONF ++ + config PINCTRL_BCM2835 + bool + select PINMUX +diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile +index 6d3fd62..eecc87d 100644 +--- a/drivers/pinctrl/Makefile ++++ b/drivers/pinctrl/Makefile +@@ -19,6 +19,7 @@ obj-$(CONFIG_PINCTRL_AS3722) += pinctrl-as3722.o + obj-$(CONFIG_PINCTRL_BF54x) += pinctrl-adi2-bf54x.o + obj-$(CONFIG_PINCTRL_BF60x) += pinctrl-adi2-bf60x.o + obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o ++obj-$(CONFIG_PINCTRL_BCM2708) += pinctrl-bcm2708.o + obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o + obj-$(CONFIG_PINCTRL_BAYTRAIL) += pinctrl-baytrail.o + obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o +diff --git a/drivers/pinctrl/pinctrl-bcm2708.c b/drivers/pinctrl/pinctrl-bcm2708.c +new file mode 100644 +index 0000000..40d9c86 +--- /dev/null ++++ b/drivers/pinctrl/pinctrl-bcm2708.c +@@ -0,0 +1,773 @@ ++/* ++ * Driver for Broadcom BCM2708 GPIO unit (pinctrl only) ++ * ++ * Copyright (C) 2012 Chris Boot, Simon Arlott, Stephen Warren ++ * Copyright (C) 2014 Noralf Tronnes ++ * ++ * This driver is a verbatim copy of the pinctrl-bcm2835 driver, except for: ++ * - changed 2835 to 2708 ++ * - gpio_chip and IRQ part are removed ++ * - Probing function is changed. ++ * ++ * Because armctrl sets up the gpio irqs, we use the bcm2708_gpio driver. ++ * This hack is used to be able to support both DT and non-DT builds. ++ * It's not possible to set trigger type and level flags for IRQs in the DT. ++ * ++ * This driver is inspired by: ++ * pinctrl-nomadik.c, please see original file for copyright information ++ * pinctrl-tegra.c, please see original file for copyright information ++ * ++ * 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. ++ */ ++ ++#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 MODULE_NAME "pinctrl-bcm2708" ++#define BCM2708_NUM_GPIOS 54 ++#define BCM2708_NUM_BANKS 2 ++ ++#define BCM2708_PIN_BITMAP_SZ \ ++ DIV_ROUND_UP(BCM2708_NUM_GPIOS, sizeof(unsigned long) * 8) ++ ++/* GPIO register offsets */ ++#define GPFSEL0 0x0 /* Function Select */ ++#define GPSET0 0x1c /* Pin Output Set */ ++#define GPCLR0 0x28 /* Pin Output Clear */ ++#define GPLEV0 0x34 /* Pin Level */ ++#define GPEDS0 0x40 /* Pin Event Detect Status */ ++#define GPREN0 0x4c /* Pin Rising Edge Detect Enable */ ++#define GPFEN0 0x58 /* Pin Falling Edge Detect Enable */ ++#define GPHEN0 0x64 /* Pin High Detect Enable */ ++#define GPLEN0 0x70 /* Pin Low Detect Enable */ ++#define GPAREN0 0x7c /* Pin Async Rising Edge Detect */ ++#define GPAFEN0 0x88 /* Pin Async Falling Edge Detect */ ++#define GPPUD 0x94 /* Pin Pull-up/down Enable */ ++#define GPPUDCLK0 0x98 /* Pin Pull-up/down Enable Clock */ ++ ++#define FSEL_REG(p) (GPFSEL0 + (((p) / 10) * 4)) ++#define FSEL_SHIFT(p) (((p) % 10) * 3) ++#define GPIO_REG_OFFSET(p) ((p) / 32) ++#define GPIO_REG_SHIFT(p) ((p) % 32) ++ ++enum bcm2708_pinconf_param { ++ /* argument: bcm2708_pinconf_pull */ ++ BCM2708_PINCONF_PARAM_PULL, ++}; ++ ++enum bcm2708_pinconf_pull { ++ BCM2708_PINCONFIG_PULL_NONE, ++ BCM2708_PINCONFIG_PULL_DOWN, ++ BCM2708_PINCONFIG_PULL_UP, ++}; ++ ++#define BCM2708_PINCONF_PACK(_param_, _arg_) ((_param_) << 16 | (_arg_)) ++#define BCM2708_PINCONF_UNPACK_PARAM(_conf_) ((_conf_) >> 16) ++#define BCM2708_PINCONF_UNPACK_ARG(_conf_) ((_conf_) & 0xffff) ++ ++struct bcm2708_gpio_irqdata { ++ struct bcm2708_pinctrl *pc; ++ int bank; ++}; ++ ++struct bcm2708_pinctrl { ++ struct device *dev; ++ void __iomem *base; ++ int irq[BCM2708_NUM_BANKS]; ++ ++ /* note: locking assumes each bank will have its own unsigned long */ ++ unsigned long enabled_irq_map[BCM2708_NUM_BANKS]; ++ unsigned int irq_type[BCM2708_NUM_GPIOS]; ++ ++ struct pinctrl_dev *pctl_dev; ++ struct irq_domain *irq_domain; ++ struct gpio_chip gpio_chip; ++ struct pinctrl_gpio_range gpio_range; ++ ++ struct bcm2708_gpio_irqdata irq_data[BCM2708_NUM_BANKS]; ++ spinlock_t irq_lock[BCM2708_NUM_BANKS]; ++}; ++ ++/* pins are just named GPIO0..GPIO53 */ ++#define BCM2708_GPIO_PIN(a) PINCTRL_PIN(a, "gpio" #a) ++static struct pinctrl_pin_desc bcm2708_gpio_pins[] = { ++ BCM2708_GPIO_PIN(0), ++ BCM2708_GPIO_PIN(1), ++ BCM2708_GPIO_PIN(2), ++ BCM2708_GPIO_PIN(3), ++ BCM2708_GPIO_PIN(4), ++ BCM2708_GPIO_PIN(5), ++ BCM2708_GPIO_PIN(6), ++ BCM2708_GPIO_PIN(7), ++ BCM2708_GPIO_PIN(8), ++ BCM2708_GPIO_PIN(9), ++ BCM2708_GPIO_PIN(10), ++ BCM2708_GPIO_PIN(11), ++ BCM2708_GPIO_PIN(12), ++ BCM2708_GPIO_PIN(13), ++ BCM2708_GPIO_PIN(14), ++ BCM2708_GPIO_PIN(15), ++ BCM2708_GPIO_PIN(16), ++ BCM2708_GPIO_PIN(17), ++ BCM2708_GPIO_PIN(18), ++ BCM2708_GPIO_PIN(19), ++ BCM2708_GPIO_PIN(20), ++ BCM2708_GPIO_PIN(21), ++ BCM2708_GPIO_PIN(22), ++ BCM2708_GPIO_PIN(23), ++ BCM2708_GPIO_PIN(24), ++ BCM2708_GPIO_PIN(25), ++ BCM2708_GPIO_PIN(26), ++ BCM2708_GPIO_PIN(27), ++ BCM2708_GPIO_PIN(28), ++ BCM2708_GPIO_PIN(29), ++ BCM2708_GPIO_PIN(30), ++ BCM2708_GPIO_PIN(31), ++ BCM2708_GPIO_PIN(32), ++ BCM2708_GPIO_PIN(33), ++ BCM2708_GPIO_PIN(34), ++ BCM2708_GPIO_PIN(35), ++ BCM2708_GPIO_PIN(36), ++ BCM2708_GPIO_PIN(37), ++ BCM2708_GPIO_PIN(38), ++ BCM2708_GPIO_PIN(39), ++ BCM2708_GPIO_PIN(40), ++ BCM2708_GPIO_PIN(41), ++ BCM2708_GPIO_PIN(42), ++ BCM2708_GPIO_PIN(43), ++ BCM2708_GPIO_PIN(44), ++ BCM2708_GPIO_PIN(45), ++ BCM2708_GPIO_PIN(46), ++ BCM2708_GPIO_PIN(47), ++ BCM2708_GPIO_PIN(48), ++ BCM2708_GPIO_PIN(49), ++ BCM2708_GPIO_PIN(50), ++ BCM2708_GPIO_PIN(51), ++ BCM2708_GPIO_PIN(52), ++ BCM2708_GPIO_PIN(53), ++}; ++ ++/* one pin per group */ ++static const char * const bcm2708_gpio_groups[] = { ++ "gpio0", ++ "gpio1", ++ "gpio2", ++ "gpio3", ++ "gpio4", ++ "gpio5", ++ "gpio6", ++ "gpio7", ++ "gpio8", ++ "gpio9", ++ "gpio10", ++ "gpio11", ++ "gpio12", ++ "gpio13", ++ "gpio14", ++ "gpio15", ++ "gpio16", ++ "gpio17", ++ "gpio18", ++ "gpio19", ++ "gpio20", ++ "gpio21", ++ "gpio22", ++ "gpio23", ++ "gpio24", ++ "gpio25", ++ "gpio26", ++ "gpio27", ++ "gpio28", ++ "gpio29", ++ "gpio30", ++ "gpio31", ++ "gpio32", ++ "gpio33", ++ "gpio34", ++ "gpio35", ++ "gpio36", ++ "gpio37", ++ "gpio38", ++ "gpio39", ++ "gpio40", ++ "gpio41", ++ "gpio42", ++ "gpio43", ++ "gpio44", ++ "gpio45", ++ "gpio46", ++ "gpio47", ++ "gpio48", ++ "gpio49", ++ "gpio50", ++ "gpio51", ++ "gpio52", ++ "gpio53", ++}; ++ ++enum bcm2708_fsel { ++ BCM2708_FSEL_GPIO_IN = 0, ++ BCM2708_FSEL_GPIO_OUT = 1, ++ BCM2708_FSEL_ALT0 = 4, ++ BCM2708_FSEL_ALT1 = 5, ++ BCM2708_FSEL_ALT2 = 6, ++ BCM2708_FSEL_ALT3 = 7, ++ BCM2708_FSEL_ALT4 = 3, ++ BCM2708_FSEL_ALT5 = 2, ++ BCM2708_FSEL_COUNT = 8, ++ BCM2708_FSEL_MASK = 0x7, ++}; ++ ++static const char * const bcm2708_functions[BCM2708_FSEL_COUNT] = { ++ [BCM2708_FSEL_GPIO_IN] = "gpio_in", ++ [BCM2708_FSEL_GPIO_OUT] = "gpio_out", ++ [BCM2708_FSEL_ALT0] = "alt0", ++ [BCM2708_FSEL_ALT1] = "alt1", ++ [BCM2708_FSEL_ALT2] = "alt2", ++ [BCM2708_FSEL_ALT3] = "alt3", ++ [BCM2708_FSEL_ALT4] = "alt4", ++ [BCM2708_FSEL_ALT5] = "alt5", ++}; ++ ++static const char * const irq_type_names[] = { ++ [IRQ_TYPE_NONE] = "none", ++ [IRQ_TYPE_EDGE_RISING] = "edge-rising", ++ [IRQ_TYPE_EDGE_FALLING] = "edge-falling", ++ [IRQ_TYPE_EDGE_BOTH] = "edge-both", ++ [IRQ_TYPE_LEVEL_HIGH] = "level-high", ++ [IRQ_TYPE_LEVEL_LOW] = "level-low", ++}; ++ ++static inline u32 bcm2708_gpio_rd(struct bcm2708_pinctrl *pc, unsigned reg) ++{ ++ return readl(pc->base + reg); ++} ++ ++static inline void bcm2708_gpio_wr(struct bcm2708_pinctrl *pc, unsigned reg, ++ u32 val) ++{ ++ writel(val, pc->base + reg); ++} ++ ++static inline int bcm2708_gpio_get_bit(struct bcm2708_pinctrl *pc, unsigned reg, ++ unsigned bit) ++{ ++ reg += GPIO_REG_OFFSET(bit) * 4; ++ return (bcm2708_gpio_rd(pc, reg) >> GPIO_REG_SHIFT(bit)) & 1; ++} ++ ++/* note NOT a read/modify/write cycle */ ++static inline void bcm2708_gpio_set_bit(struct bcm2708_pinctrl *pc, ++ unsigned reg, unsigned bit) ++{ ++ reg += GPIO_REG_OFFSET(bit) * 4; ++ bcm2708_gpio_wr(pc, reg, BIT(GPIO_REG_SHIFT(bit))); ++} ++ ++static inline enum bcm2708_fsel bcm2708_pinctrl_fsel_get( ++ struct bcm2708_pinctrl *pc, unsigned pin) ++{ ++ u32 val = bcm2708_gpio_rd(pc, FSEL_REG(pin)); ++ enum bcm2708_fsel status = (val >> FSEL_SHIFT(pin)) & BCM2708_FSEL_MASK; ++ ++ dev_dbg(pc->dev, "get %08x (%u => %s)\n", val, pin, ++ bcm2708_functions[status]); ++ ++ return status; ++} ++ ++static inline void bcm2708_pinctrl_fsel_set( ++ struct bcm2708_pinctrl *pc, unsigned pin, ++ enum bcm2708_fsel fsel) ++{ ++ u32 val = bcm2708_gpio_rd(pc, FSEL_REG(pin)); ++ enum bcm2708_fsel cur = (val >> FSEL_SHIFT(pin)) & BCM2708_FSEL_MASK; ++ ++ dev_dbg(pc->dev, "read %08x (%u => %s)\n", val, pin, ++ bcm2708_functions[cur]); ++ ++ if (cur == fsel) ++ return; ++ ++ if (cur != BCM2708_FSEL_GPIO_IN && fsel != BCM2708_FSEL_GPIO_IN) { ++ /* always transition through GPIO_IN */ ++ val &= ~(BCM2708_FSEL_MASK << FSEL_SHIFT(pin)); ++ val |= BCM2708_FSEL_GPIO_IN << FSEL_SHIFT(pin); ++ ++ dev_dbg(pc->dev, "trans %08x (%u <= %s)\n", val, pin, ++ bcm2708_functions[BCM2708_FSEL_GPIO_IN]); ++ bcm2708_gpio_wr(pc, FSEL_REG(pin), val); ++ } ++ ++ val &= ~(BCM2708_FSEL_MASK << FSEL_SHIFT(pin)); ++ val |= fsel << FSEL_SHIFT(pin); ++ ++ dev_dbg(pc->dev, "write %08x (%u <= %s)\n", val, pin, ++ bcm2708_functions[fsel]); ++ bcm2708_gpio_wr(pc, FSEL_REG(pin), val); ++} ++ ++static int bcm2708_pctl_get_groups_count(struct pinctrl_dev *pctldev) ++{ ++ return ARRAY_SIZE(bcm2708_gpio_groups); ++} ++ ++static const char *bcm2708_pctl_get_group_name(struct pinctrl_dev *pctldev, ++ unsigned selector) ++{ ++ return bcm2708_gpio_groups[selector]; ++} ++ ++static int bcm2708_pctl_get_group_pins(struct pinctrl_dev *pctldev, ++ unsigned selector, ++ const unsigned **pins, ++ unsigned *num_pins) ++{ ++ *pins = &bcm2708_gpio_pins[selector].number; ++ *num_pins = 1; ++ ++ return 0; ++} ++ ++static void bcm2708_pctl_pin_dbg_show(struct pinctrl_dev *pctldev, ++ struct seq_file *s, ++ unsigned offset) ++{ ++ struct bcm2708_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ enum bcm2708_fsel fsel = bcm2708_pinctrl_fsel_get(pc, offset); ++ const char *fname = bcm2708_functions[fsel]; ++ int value = bcm2708_gpio_get_bit(pc, GPLEV0, offset); ++ int irq = irq_find_mapping(pc->irq_domain, offset); ++ ++ seq_printf(s, "function %s in %s; irq %d (%s)", ++ fname, value ? "hi" : "lo", ++ irq, irq_type_names[pc->irq_type[offset]]); ++} ++ ++static void bcm2708_pctl_dt_free_map(struct pinctrl_dev *pctldev, ++ struct pinctrl_map *maps, unsigned num_maps) ++{ ++ int i; ++ ++ for (i = 0; i < num_maps; i++) ++ if (maps[i].type == PIN_MAP_TYPE_CONFIGS_PIN) ++ kfree(maps[i].data.configs.configs); ++ ++ kfree(maps); ++} ++ ++static int bcm2708_pctl_dt_node_to_map_func(struct bcm2708_pinctrl *pc, ++ struct device_node *np, u32 pin, u32 fnum, ++ struct pinctrl_map **maps) ++{ ++ struct pinctrl_map *map = *maps; ++ ++ if (fnum >= ARRAY_SIZE(bcm2708_functions)) { ++ dev_err(pc->dev, "%s: invalid brcm,function %d\n", ++ of_node_full_name(np), fnum); ++ return -EINVAL; ++ } ++ ++ map->type = PIN_MAP_TYPE_MUX_GROUP; ++ map->data.mux.group = bcm2708_gpio_groups[pin]; ++ map->data.mux.function = bcm2708_functions[fnum]; ++ (*maps)++; ++ ++ return 0; ++} ++ ++static int bcm2708_pctl_dt_node_to_map_pull(struct bcm2708_pinctrl *pc, ++ struct device_node *np, u32 pin, u32 pull, ++ struct pinctrl_map **maps) ++{ ++ struct pinctrl_map *map = *maps; ++ unsigned long *configs; ++ ++ if (pull > 2) { ++ dev_err(pc->dev, "%s: invalid brcm,pull %d\n", ++ of_node_full_name(np), pull); ++ return -EINVAL; ++ } ++ ++ configs = kzalloc(sizeof(*configs), GFP_KERNEL); ++ if (!configs) ++ return -ENOMEM; ++ configs[0] = BCM2708_PINCONF_PACK(BCM2708_PINCONF_PARAM_PULL, pull); ++ ++ map->type = PIN_MAP_TYPE_CONFIGS_PIN; ++ map->data.configs.group_or_pin = bcm2708_gpio_pins[pin].name; ++ map->data.configs.configs = configs; ++ map->data.configs.num_configs = 1; ++ (*maps)++; ++ ++ return 0; ++} ++ ++static int bcm2708_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, ++ struct device_node *np, ++ struct pinctrl_map **map, unsigned *num_maps) ++{ ++ struct bcm2708_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ struct property *pins, *funcs, *pulls; ++ int num_pins, num_funcs, num_pulls, maps_per_pin; ++ struct pinctrl_map *maps, *cur_map; ++ int i, err; ++ u32 pin, func, pull; ++ ++ pins = of_find_property(np, "brcm,pins", NULL); ++ if (!pins) { ++ dev_err(pc->dev, "%s: missing brcm,pins property\n", ++ of_node_full_name(np)); ++ return -EINVAL; ++ } ++ ++ funcs = of_find_property(np, "brcm,function", NULL); ++ pulls = of_find_property(np, "brcm,pull", NULL); ++ ++ if (!funcs && !pulls) { ++ dev_err(pc->dev, ++ "%s: neither brcm,function nor brcm,pull specified\n", ++ of_node_full_name(np)); ++ return -EINVAL; ++ } ++ ++ num_pins = pins->length / 4; ++ num_funcs = funcs ? (funcs->length / 4) : 0; ++ num_pulls = pulls ? (pulls->length / 4) : 0; ++ ++ if (num_funcs > 1 && num_funcs != num_pins) { ++ dev_err(pc->dev, ++ "%s: brcm,function must have 1 or %d entries\n", ++ of_node_full_name(np), num_pins); ++ return -EINVAL; ++ } ++ ++ if (num_pulls > 1 && num_pulls != num_pins) { ++ dev_err(pc->dev, ++ "%s: brcm,pull must have 1 or %d entries\n", ++ of_node_full_name(np), num_pins); ++ return -EINVAL; ++ } ++ ++ maps_per_pin = 0; ++ if (num_funcs) ++ maps_per_pin++; ++ if (num_pulls) ++ maps_per_pin++; ++ cur_map = maps = kzalloc(num_pins * maps_per_pin * sizeof(*maps), ++ GFP_KERNEL); ++ if (!maps) ++ return -ENOMEM; ++ ++ for (i = 0; i < num_pins; i++) { ++ err = of_property_read_u32_index(np, "brcm,pins", i, &pin); ++ if (err) ++ goto out; ++ if (pin >= ARRAY_SIZE(bcm2708_gpio_pins)) { ++ dev_err(pc->dev, "%s: invalid brcm,pins value %d\n", ++ of_node_full_name(np), pin); ++ err = -EINVAL; ++ goto out; ++ } ++ ++ if (num_funcs) { ++ err = of_property_read_u32_index(np, "brcm,function", ++ (num_funcs > 1) ? i : 0, &func); ++ if (err) ++ goto out; ++ err = bcm2708_pctl_dt_node_to_map_func(pc, np, pin, ++ func, &cur_map); ++ if (err) ++ goto out; ++ } ++ if (num_pulls) { ++ err = of_property_read_u32_index(np, "brcm,pull", ++ (num_funcs > 1) ? i : 0, &pull); ++ if (err) ++ goto out; ++ err = bcm2708_pctl_dt_node_to_map_pull(pc, np, pin, ++ pull, &cur_map); ++ if (err) ++ goto out; ++ } ++ } ++ ++ *map = maps; ++ *num_maps = num_pins * maps_per_pin; ++ ++ return 0; ++ ++out: ++ kfree(maps); ++ return err; ++} ++ ++static const struct pinctrl_ops bcm2708_pctl_ops = { ++ .get_groups_count = bcm2708_pctl_get_groups_count, ++ .get_group_name = bcm2708_pctl_get_group_name, ++ .get_group_pins = bcm2708_pctl_get_group_pins, ++ .pin_dbg_show = bcm2708_pctl_pin_dbg_show, ++ .dt_node_to_map = bcm2708_pctl_dt_node_to_map, ++ .dt_free_map = bcm2708_pctl_dt_free_map, ++}; ++ ++static int bcm2708_pmx_get_functions_count(struct pinctrl_dev *pctldev) ++{ ++ return BCM2708_FSEL_COUNT; ++} ++ ++static const char *bcm2708_pmx_get_function_name(struct pinctrl_dev *pctldev, ++ unsigned selector) ++{ ++ return bcm2708_functions[selector]; ++} ++ ++static int bcm2708_pmx_get_function_groups(struct pinctrl_dev *pctldev, ++ unsigned selector, ++ const char * const **groups, ++ unsigned * const num_groups) ++{ ++ /* every pin can do every function */ ++ *groups = bcm2708_gpio_groups; ++ *num_groups = ARRAY_SIZE(bcm2708_gpio_groups); ++ ++ return 0; ++} ++ ++static int bcm2708_pmx_enable(struct pinctrl_dev *pctldev, ++ unsigned func_selector, ++ unsigned group_selector) ++{ ++ struct bcm2708_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ ++ bcm2708_pinctrl_fsel_set(pc, group_selector, func_selector); ++ ++ return 0; ++} ++ ++static void bcm2708_pmx_disable(struct pinctrl_dev *pctldev, ++ unsigned func_selector, ++ unsigned group_selector) ++{ ++ struct bcm2708_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ ++ /* disable by setting to GPIO_IN */ ++ bcm2708_pinctrl_fsel_set(pc, group_selector, BCM2708_FSEL_GPIO_IN); ++} ++ ++static void bcm2708_pmx_gpio_disable_free(struct pinctrl_dev *pctldev, ++ struct pinctrl_gpio_range *range, ++ unsigned offset) ++{ ++ struct bcm2708_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ ++ /* disable by setting to GPIO_IN */ ++ bcm2708_pinctrl_fsel_set(pc, offset, BCM2708_FSEL_GPIO_IN); ++} ++ ++static int bcm2708_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, ++ struct pinctrl_gpio_range *range, ++ unsigned offset, ++ bool input) ++{ ++ struct bcm2708_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ enum bcm2708_fsel fsel = input ? ++ BCM2708_FSEL_GPIO_IN : BCM2708_FSEL_GPIO_OUT; ++ ++ bcm2708_pinctrl_fsel_set(pc, offset, fsel); ++ ++ return 0; ++} ++ ++static const struct pinmux_ops bcm2708_pmx_ops = { ++ .get_functions_count = bcm2708_pmx_get_functions_count, ++ .get_function_name = bcm2708_pmx_get_function_name, ++ .get_function_groups = bcm2708_pmx_get_function_groups, ++ .enable = bcm2708_pmx_enable, ++ .disable = bcm2708_pmx_disable, ++ .gpio_disable_free = bcm2708_pmx_gpio_disable_free, ++ .gpio_set_direction = bcm2708_pmx_gpio_set_direction, ++}; ++ ++static int bcm2708_pinconf_get(struct pinctrl_dev *pctldev, ++ unsigned pin, unsigned long *config) ++{ ++ /* No way to read back config in HW */ ++ return -ENOTSUPP; ++} ++ ++static int bcm2708_pinconf_set(struct pinctrl_dev *pctldev, ++ unsigned pin, unsigned long *configs, ++ unsigned num_configs) ++{ ++ struct bcm2708_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); ++ enum bcm2708_pinconf_param param; ++ u16 arg; ++ u32 off, bit; ++ int i; ++ ++ for (i = 0; i < num_configs; i++) { ++ param = BCM2708_PINCONF_UNPACK_PARAM(configs[i]); ++ arg = BCM2708_PINCONF_UNPACK_ARG(configs[i]); ++ ++ dev_dbg(pc->dev, "configure pin %u (%s) = %04X\n", pin, bcm2708_gpio_groups[pin], arg); ++ if (param != BCM2708_PINCONF_PARAM_PULL) ++ return -EINVAL; ++ ++ off = GPIO_REG_OFFSET(pin); ++ bit = GPIO_REG_SHIFT(pin); ++ ++ bcm2708_gpio_wr(pc, GPPUD, arg & 3); ++ /* ++ * Docs say to wait 150 cycles, but not of what. We assume a ++ * 1 MHz clock here, which is pretty slow... ++ */ ++ udelay(150); ++ bcm2708_gpio_wr(pc, GPPUDCLK0 + (off * 4), BIT(bit)); ++ udelay(150); ++ bcm2708_gpio_wr(pc, GPPUDCLK0 + (off * 4), 0); ++ } /* for each config */ ++ ++ return 0; ++} ++ ++static const struct pinconf_ops bcm2708_pinconf_ops = { ++ .pin_config_get = bcm2708_pinconf_get, ++ .pin_config_set = bcm2708_pinconf_set, ++}; ++ ++static struct pinctrl_desc bcm2708_pinctrl_desc = { ++ .name = MODULE_NAME, ++ .pins = bcm2708_gpio_pins, ++ .npins = ARRAY_SIZE(bcm2708_gpio_pins), ++ .pctlops = &bcm2708_pctl_ops, ++ .pmxops = &bcm2708_pmx_ops, ++ .confops = &bcm2708_pinconf_ops, ++ .owner = THIS_MODULE, ++}; ++ ++static struct pinctrl_gpio_range bcm2708_pinctrl_gpio_range = { ++ .name = MODULE_NAME, ++ .npins = BCM2708_NUM_GPIOS, ++}; ++ ++/* bcm2708_gpio has base=0 */ ++static int bcm2708_pinctrl_gpiochip_find(struct gpio_chip *gc, void *data) ++{ ++ pr_debug("%s: base = %d\n", __func__, gc->base); ++ return gc->base == 0 ? 1 : 0; ++} ++ ++static int bcm2708_pinctrl_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct bcm2708_pinctrl *pc; ++ struct gpio_chip *gc; ++ struct resource iomem; ++ int err; ++ BUILD_BUG_ON(ARRAY_SIZE(bcm2708_gpio_pins) != BCM2708_NUM_GPIOS); ++ BUILD_BUG_ON(ARRAY_SIZE(bcm2708_gpio_groups) != BCM2708_NUM_GPIOS); ++ ++ /* use gpio_chip registered by the bcm2708_gpio driver */ ++ gc = gpiochip_find(NULL, bcm2708_pinctrl_gpiochip_find); ++ if (!gc) ++ return -EPROBE_DEFER; ++ ++ gc->of_node = np; ++ gc->of_gpio_n_cells = 2; ++ gc->of_xlate = of_gpio_simple_xlate; ++ ++ pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); ++ if (!pc) ++ return -ENOMEM; ++ ++ platform_set_drvdata(pdev, pc); ++ pc->dev = dev; ++ ++ err = of_address_to_resource(np, 0, &iomem); ++ if (err) { ++ dev_err(dev, "could not get IO memory\n"); ++ return err; ++ } ++ ++ pc->base = devm_ioremap_resource(dev, &iomem); ++ if (IS_ERR(pc->base)) ++ return PTR_ERR(pc->base); ++ ++ pc->gpio_chip = *gc; ++ ++ pc->pctl_dev = pinctrl_register(&bcm2708_pinctrl_desc, dev, pc); ++ if (!pc->pctl_dev) ++ return -EINVAL; ++ ++ pc->gpio_range = bcm2708_pinctrl_gpio_range; ++ pc->gpio_range.base = pc->gpio_chip.base; ++ pc->gpio_range.gc = &pc->gpio_chip; ++ pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range); ++ ++ return 0; ++} ++ ++static int bcm2708_pinctrl_remove(struct platform_device *pdev) ++{ ++ struct bcm2708_pinctrl *pc = platform_get_drvdata(pdev); ++ ++ pinctrl_unregister(pc->pctl_dev); ++ gpiochip_remove(&pc->gpio_chip); ++ ++ return 0; ++} ++ ++static struct of_device_id bcm2708_pinctrl_match[] = { ++ { .compatible = "brcm,bcm2708-pinctrl" }, ++ {} ++}; ++MODULE_DEVICE_TABLE(of, bcm2708_pinctrl_match); ++ ++static struct platform_driver bcm2708_pinctrl_driver = { ++ .probe = bcm2708_pinctrl_probe, ++ .remove = bcm2708_pinctrl_remove, ++ .driver = { ++ .name = MODULE_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2708_pinctrl_match, ++ }, ++}; ++module_platform_driver(bcm2708_pinctrl_driver); ++ ++MODULE_AUTHOR("Chris Boot, Simon Arlott, Stephen Warren, Noralf Tronnes"); ++MODULE_DESCRIPTION("BCM2708 Pin control driver"); ++MODULE_LICENSE("GPL"); +-- +1.9.3 + + +From a29d05c0d544095fe664cc5c7a79889d5b5cd1f0 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sun, 6 Jul 2014 14:58:44 +0100 +Subject: [PATCH 66/68] snd-bcm2708: Add mutex, improve logging + +--- + sound/arm/bcm2835-pcm.c | 35 +++++++++++++++-- + sound/arm/bcm2835-vchiq.c | 95 +++++++++++++++++++++++++++++------------------ + sound/arm/bcm2835.h | 1 + + 3 files changed, 92 insertions(+), 39 deletions(-) + +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index ebd3f62..0929e00 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -119,6 +119,11 @@ static int snd_bcm2835_playback_open_generic( + + audio_info(" .. IN (%d)\n", substream->number); + ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } + audio_info("Alsa open (%d)\n", substream->number); + idx = substream->number; + +@@ -145,7 +150,8 @@ static int snd_bcm2835_playback_open_generic( + + alsa_stream = kzalloc(sizeof(bcm2835_alsa_stream_t), GFP_KERNEL); + if (alsa_stream == NULL) { +- return -ENOMEM; ++ err = -ENOMEM; ++ goto out; + } + + /* Initialise alsa_stream */ +@@ -186,6 +192,8 @@ static int snd_bcm2835_playback_open_generic( + alsa_stream->draining = 1; + + out: ++ mutex_unlock(&chip->audio_mutex); ++ + audio_info(" .. OUT =%d\n", err); + + return err; +@@ -206,11 +214,16 @@ static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream) + { + /* the hardware-specific codes will be here */ + ++ audio_info(" .. IN\n"); ++ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } + struct snd_pcm_runtime *runtime = substream->runtime; + bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; +- bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); + +- audio_info(" .. IN\n"); + audio_info("Alsa close\n"); + + /* +@@ -241,6 +254,7 @@ static int snd_bcm2835_playback_close(struct snd_pcm_substream *substream) + + chip->opened &= ~(1 << substream->number); + ++ mutex_unlock(&chip->audio_mutex); + audio_info(" .. OUT\n"); + + return 0; +@@ -469,6 +483,12 @@ int snd_bcm2835_new_pcm(bcm2835_chip_t * chip) + int err; + + audio_info(" .. IN\n"); ++ mutex_init(&chip->audio_mutex); ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } + err = + snd_pcm_new(chip->card, "bcm2835 ALSA", 0, MAX_SUBSTREAMS, 0, &pcm); + if (err < 0) +@@ -490,6 +510,7 @@ int snd_bcm2835_new_pcm(bcm2835_chip_t * chip) + (GFP_KERNEL), 64 * 1024, + 64 * 1024); + ++ mutex_unlock(&chip->audio_mutex); + audio_info(" .. OUT\n"); + + return 0; +@@ -500,6 +521,12 @@ int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip) + struct snd_pcm *pcm; + int err; + ++ audio_info(" .. IN\n"); ++ if(mutex_lock_interruptible(&chip->audio_mutex)) ++ { ++ audio_error("Interrupted whilst waiting for lock\n"); ++ return -EINTR; ++ } + err = snd_pcm_new(chip->card, "bcm2835 ALSA", 1, 1, 0, &pcm); + if (err < 0) + return err; +@@ -513,6 +540,8 @@ int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip) + snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, + snd_dma_continuous_data (GFP_KERNEL), + 64 * 1024, 64 * 1024); ++ mutex_unlock(&chip->audio_mutex); ++ audio_info(" .. OUT\n"); + + return 0; + } +diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c +index ee09b13..70f37a5 100755 +--- a/sound/arm/bcm2835-vchiq.c ++++ b/sound/arm/bcm2835-vchiq.c +@@ -200,14 +200,22 @@ static void audio_vchi_callback(void *param, + int32_t status; + int32_t msg_len; + VC_AUDIO_MSG_T m; +- bcm2835_alsa_stream_t *alsa_stream = 0; +- LOG_DBG(" .. IN instance=%p, param=%p, reason=%d, handle=%p\n", +- instance, param, reason, msg_handle); ++ LOG_DBG(" .. IN instance=%p, handle=%p, alsa=%p, reason=%d, handle=%p\n", ++ instance, instance ? instance->vchi_handle[0] : NULL, instance ? instance->alsa_stream : NULL, reason, msg_handle); + +- if (!instance || reason != VCHI_CALLBACK_MSG_AVAILABLE) { ++ if (reason != VCHI_CALLBACK_MSG_AVAILABLE) { + return; + } +- alsa_stream = instance->alsa_stream; ++ if (!instance) { ++ LOG_ERR(" .. instance is null\n"); ++ BUG(); ++ return; ++ } ++ if (!instance->vchi_handle[0]) { ++ LOG_ERR(" .. instance->vchi_handle[0] is null\n"); ++ BUG(); ++ return; ++ } + status = vchi_msg_dequeue(instance->vchi_handle[0], + &m, sizeof m, &msg_len, VCHI_FLAGS_NONE); + if (m.type == VC_AUDIO_MSG_TYPE_RESULT) { +@@ -217,6 +225,7 @@ static void audio_vchi_callback(void *param, + instance->result = m.u.result.success; + complete(&instance->msg_avail_comp); + } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) { ++ bcm2835_alsa_stream_t *alsa_stream = instance->alsa_stream; + irq_handler_t callback = (irq_handler_t) m.u.complete.callback; + LOG_DBG + (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_COMPLETE, complete=%d\n", +@@ -225,11 +234,11 @@ static void audio_vchi_callback(void *param, + atomic_add(m.u.complete.count, &alsa_stream->retrieved); + callback(0, alsa_stream); + } else { +- LOG_DBG(" .. unexpected alsa_stream=%p, callback=%p\n", ++ LOG_ERR(" .. unexpected alsa_stream=%p, callback=%p\n", + alsa_stream, callback); + } + } else { +- LOG_DBG(" .. unexpected m.type=%d\n", m.type); ++ LOG_ERR(" .. unexpected m.type=%d\n", m.type); + } + LOG_DBG(" .. OUT\n"); + } +@@ -253,6 +262,8 @@ static AUDIO_INSTANCE_T *vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance, + } + /* Allocate memory for this instance */ + instance = kmalloc(sizeof(*instance), GFP_KERNEL); ++ if (!instance) ++ return NULL; + + memset(instance, 0, sizeof(*instance)); + instance->num_connections = num_connections; +@@ -274,8 +285,10 @@ static AUDIO_INSTANCE_T *vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance, + 0 // want crc check on bulk transfers + }; + ++ LOG_DBG("%s: about to open %i\n", __func__, i); + status = vchi_service_open(vchi_instance, ¶ms, + &instance->vchi_handle[i]); ++ LOG_DBG("%s: opened %i: %p=%d\n", __func__, i, instance->vchi_handle[i], status); + if (status) { + LOG_ERR + ("%s: failed to open VCHI service connection (status=%d)\n", +@@ -287,14 +300,18 @@ static AUDIO_INSTANCE_T *vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance, + vchi_service_release(instance->vchi_handle[i]); + } + ++ LOG_DBG("%s: okay\n", __func__); + return instance; + + err_close_services: + for (i = 0; i < instance->num_connections; i++) { +- vchi_service_close(instance->vchi_handle[i]); ++ LOG_ERR("%s: closing %i: %p\n", __func__, i, instance->vchi_handle[i]); ++ if (instance->vchi_handle[i]) ++ vchi_service_close(instance->vchi_handle[i]); + } + + kfree(instance); ++ LOG_ERR("%s: error\n", __func__); + + return NULL; + } +@@ -345,12 +362,13 @@ static int bcm2835_audio_open_connection(bcm2835_alsa_stream_t * alsa_stream) + { + static VCHI_INSTANCE_T vchi_instance; + static VCHI_CONNECTION_T *vchi_connection; ++ static int initted; + AUDIO_INSTANCE_T *instance = alsa_stream->instance; + int ret; + LOG_DBG(" .. IN\n"); + +- LOG_INFO("%s: start", __func__); +- //BUG_ON(instance); ++ LOG_INFO("%s: start\n", __func__); ++ BUG_ON(instance); + if (instance) { + LOG_ERR("%s: VCHI instance already open (%p)\n", + __func__, instance); +@@ -361,27 +379,30 @@ static int bcm2835_audio_open_connection(bcm2835_alsa_stream_t * alsa_stream) + } + + /* Initialize and create a VCHI connection */ +- ret = vchi_initialise(&vchi_instance); +- if (ret != 0) { +- LOG_ERR("%s: failed to initialise VCHI instance (ret=%d)\n", +- __func__, ret); +- +- ret = -EIO; +- goto err_free_mem; +- } +- ret = vchi_connect(NULL, 0, vchi_instance); +- if (ret != 0) { +- LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", +- __func__, ret); +- +- ret = -EIO; +- goto err_free_mem; ++ if (!initted) { ++ ret = vchi_initialise(&vchi_instance); ++ if (ret != 0) { ++ LOG_ERR("%s: failed to initialise VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ ret = vchi_connect(NULL, 0, vchi_instance); ++ if (ret != 0) { ++ LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", ++ __func__, ret); ++ ++ ret = -EIO; ++ goto err_free_mem; ++ } ++ initted = 1; + } + + /* Initialize an instance of the audio service */ + instance = vc_vchi_audio_init(vchi_instance, &vchi_connection, 1); + +- if (instance == NULL /*|| audio_handle != instance */ ) { ++ if (instance == NULL) { + LOG_ERR("%s: failed to initialize audio service\n", __func__); + + ret = -EPERM; +@@ -414,6 +435,7 @@ int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream) + goto exit; + } + instance = alsa_stream->instance; ++ LOG_DBG(" instance (%p)\n", instance); + + if(mutex_lock_interruptible(&instance->vchi_mutex)) + { +@@ -518,22 +540,23 @@ int bcm2835_audio_set_ctls(bcm2835_chip_t * chip) + int i; + int ret = 0; + LOG_DBG(" .. IN\n"); ++ LOG_DBG(" Setting ALSA dest(%d), volume(%d)\n", chip->dest, chip->volume); + + /* change ctls for all substreams */ + for (i = 0; i < MAX_SUBSTREAMS; i++) { + if (chip->avail_substreams & (1 << i)) { + if (!chip->alsa_stream[i]) + { +- LOG_DBG(" No ALSA stream available?! %i:%p (%x)\n", i, chip->alsa_stream[i], chip->avail_substreams); ++ LOG_ERR(" No ALSA stream available?! %i:%p (%x)\n", i, chip->alsa_stream[i], chip->avail_substreams); + ret = 0; + } + else if (bcm2835_audio_set_ctls_chan /* returns 0 on success */ + (chip->alsa_stream[i], chip) != 0) + { +- LOG_DBG("Couldn't set the controls for stream %d\n", i); ++ LOG_ERR("Couldn't set the controls for stream %d\n", i); + ret = -1; + } +- else LOG_DBG(" Controls set for stream %d\n", i); ++ else LOG_ERR(" Controls set for stream %d\n", i); + } + } + LOG_DBG(" .. OUT ret=%d\n", ret); +@@ -648,7 +671,7 @@ static int bcm2835_audio_start_worker(bcm2835_alsa_stream_t * alsa_stream) + VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); + + if (success != 0) { +- LOG_ERR("%s: failed on vchi_msg_queue (status=%d)", ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", + __func__, success); + + ret = -1; +@@ -688,7 +711,7 @@ static int bcm2835_audio_stop_worker(bcm2835_alsa_stream_t * alsa_stream) + VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); + + if (success != 0) { +- LOG_ERR("%s: failed on vchi_msg_queue (status=%d)", ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", + __func__, success); + + ret = -1; +@@ -732,7 +755,7 @@ int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream) + VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); + + if (success != 0) { +- LOG_ERR("%s: failed on vchi_msg_queue (status=%d)", ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", + __func__, success); + ret = -1; + goto unlock; +@@ -740,12 +763,12 @@ int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream) + + ret = wait_for_completion_interruptible(&instance->msg_avail_comp); + if (ret) { +- LOG_ERR("%s: failed on waiting for event (status=%d)", ++ LOG_ERR("%s: failed on waiting for event (status=%d)\n", + __func__, success); + goto unlock; + } + if (instance->result != 0) { +- LOG_ERR("%s: failed result (status=%d)", ++ LOG_ERR("%s: failed result (status=%d)\n", + __func__, instance->result); + + ret = -1; +@@ -803,7 +826,7 @@ int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, + VCHI_FLAGS_BLOCK_UNTIL_QUEUED, NULL); + + if (success != 0) { +- LOG_ERR("%s: failed on vchi_msg_queue (status=%d)", ++ LOG_ERR("%s: failed on vchi_msg_queue (status=%d)\n", + __func__, success); + + ret = -1; +@@ -832,7 +855,7 @@ int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, + } + if (success != 0) { + LOG_ERR +- ("%s: failed on vchi_bulk_queue_transmit (status=%d)", ++ ("%s: failed on vchi_bulk_queue_transmit (status=%d)\n", + __func__, success); + + ret = -1; +diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h +index 8c2fe26..0f71c5d 100755 +--- a/sound/arm/bcm2835.h ++++ b/sound/arm/bcm2835.h +@@ -110,6 +110,7 @@ typedef struct bcm2835_chip { + + unsigned int opened; + unsigned int spdif_status; ++ struct mutex audio_mutex; + } bcm2835_chip_t; + + typedef struct bcm2835_alsa_stream { +-- +1.9.3 + + +From 2742f5c97e6af80332246634f3f17389d6e06518 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Sun, 13 Jul 2014 20:48:30 +0100 +Subject: [PATCH 67/68] Fix for ALSA driver crash + +Avoids an issue when closing and opening vchiq where a message can arrive before service handle has been written +--- + .../misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c | 7 ++++--- + drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c | 12 ++++++++---- + 2 files changed, 12 insertions(+), 7 deletions(-) + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c +index 5a4182e..25e7011 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c +@@ -288,11 +288,12 @@ VCHIQ_STATUS_T vchiq_open_service( + NULL); + + if (service) { ++ *phandle = service->handle; + status = vchiq_open_service_internal(service, current->pid); +- if (status == VCHIQ_SUCCESS) +- *phandle = service->handle; +- else ++ if (status != VCHIQ_SUCCESS) { + vchiq_remove_service(service->handle); ++ *phandle = VCHIQ_SERVICE_HANDLE_INVALID; ++ } + } + + failed: +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c +index a0b069d..bc27bea 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c +@@ -636,6 +636,9 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, + { + VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; + SHIM_SERVICE_T *service = service_alloc(instance, setup); ++ ++ *handle = (VCHI_SERVICE_HANDLE_T)service; ++ + if (service) { + VCHIQ_SERVICE_PARAMS_T params; + VCHIQ_STATUS_T status; +@@ -652,11 +655,10 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle, + if (status != VCHIQ_SUCCESS) { + service_free(service); + service = NULL; ++ *handle = NULL; + } + } + +- *handle = (VCHI_SERVICE_HANDLE_T)service; +- + return (service != NULL) ? 0 : -1; + } + EXPORT_SYMBOL(vchi_service_open); +@@ -667,6 +669,9 @@ int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle, + { + VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle; + SHIM_SERVICE_T *service = service_alloc(instance, setup); ++ ++ *handle = (VCHI_SERVICE_HANDLE_T)service; ++ + if (service) { + VCHIQ_SERVICE_PARAMS_T params; + VCHIQ_STATUS_T status; +@@ -682,11 +687,10 @@ int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle, + if (status != VCHIQ_SUCCESS) { + service_free(service); + service = NULL; ++ *handle = NULL; + } + } + +- *handle = (VCHI_SERVICE_HANDLE_T)service; +- + return (service != NULL) ? 0 : -1; + } + EXPORT_SYMBOL(vchi_service_create); +-- +1.9.3 + + +From f9b062f9b1c25d2ae3ce480179ad0c4d3033bd23 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 14 Jul 2014 22:02:09 +0100 +Subject: [PATCH 68/68] hid: Reduce default mouse polling interval to 60Hz + +Reduces overhead when using X +--- + drivers/hid/usbhid/hid-core.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c +index 7b88f4c..236a09b 100644 +--- a/drivers/hid/usbhid/hid-core.c ++++ b/drivers/hid/usbhid/hid-core.c +@@ -49,7 +49,7 @@ + * Module parameters. + */ + +-static unsigned int hid_mousepoll_interval; ++static unsigned int hid_mousepoll_interval = ~0; + module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); + MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); + +@@ -1090,8 +1090,11 @@ static int usbhid_start(struct hid_device *hid) + } + + /* Change the polling interval of mice. */ +- if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) +- interval = hid_mousepoll_interval; ++ if (hid->collection->usage == HID_GD_MOUSE) ++ if (hid_mousepoll_interval != ~0) ++ interval = hid_mousepoll_interval; ++ else if (interval < 16) ++ interval = 16; + + ret = -ENOMEM; + if (usb_endpoint_dir_in(endpoint)) { +-- +1.9.3 +