diff --git a/packages/databases/sqlite/package.mk b/packages/databases/sqlite/package.mk index 53029c8c60..0f4722917c 100644 --- a/packages/databases/sqlite/package.mk +++ b/packages/databases/sqlite/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="sqlite" -PKG_VERSION="autoconf-3110000" +PKG_VERSION="autoconf-3110100" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="PublicDomain" diff --git a/packages/network/connman/patches/connman-99-iptables-1.6.patch b/packages/network/connman/patches/connman-99-iptables-1.6.patch new file mode 100644 index 0000000000..30131e690b --- /dev/null +++ b/packages/network/connman/patches/connman-99-iptables-1.6.patch @@ -0,0 +1,36 @@ +From acea08a0e4234a4c1a87bedc087c73ff36de0c7b Mon Sep 17 00:00:00 2001 +From: Wu Zheng +Date: Thu, 28 Jan 2016 18:04:17 +0800 +Subject: iptables: Add missing function item of xtables to match iptables 1.6 + +The struct of xtables_globals has been modified in iptables 1.6. +If connman runs with iptables 1.6, it can crash. + +Program received signal SIGSEGV, Segmentation fault. +0x00000000 in ?? () +0xb7dea89c in xtables_find_target () from /usr/lib/libxtables.so.11 +0xb7deac1c in ?? () from /usr/lib/libxtables.so.11 +0xb7dea793 in xtables_find_target () from /usr/lib/libxtables.so.11 + +The the missing function item of xtables is added to xtables_globals. +--- + src/iptables.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/iptables.c b/src/iptables.c +index bc0c763..5ef757a 100644 +--- a/src/iptables.c ++++ b/src/iptables.c +@@ -1566,6 +1566,9 @@ struct xtables_globals iptables_globals = { + .option_offset = 0, + .opts = iptables_opts, + .orig_opts = iptables_opts, ++#if XTABLES_VERSION_CODE > 10 ++ .compat_rev = xtables_compatible_revision, ++#endif + }; + + static struct xtables_target *prepare_target(struct connman_iptables *table, +-- +cgit v0.12 + diff --git a/packages/network/openssh/package.mk b/packages/network/openssh/package.mk index 66d6609134..e847aff4d6 100644 --- a/packages/network/openssh/package.mk +++ b/packages/network/openssh/package.mk @@ -17,7 +17,7 @@ ################################################################################ PKG_NAME="openssh" -PKG_VERSION="7.1p2" +PKG_VERSION="7.2p1" PKG_REV="1" PKG_ARCH="any" PKG_LICENSE="OSS" diff --git a/packages/network/openssh/patches/openssh-silence-missing-identity-error.patch b/packages/network/openssh/patches/openssh-silence-missing-identity-error.patch index 355fc1e9b5..25749b6fa2 100644 --- a/packages/network/openssh/patches/openssh-silence-missing-identity-error.patch +++ b/packages/network/openssh/patches/openssh-silence-missing-identity-error.patch @@ -5,10 +5,10 @@ index d6af0b9..22c0aa6 100644 @@ -1320,8 +1320,7 @@ load_identity_file(char *filename, int userprovided) struct stat st; - if (stat(filename, &st) < 0) { -- (userprovided ? logit : debug3)("no such identity: %s: %s", -- filename, strerror(errno)); -+ debug3("no such identity: %s", filename); + if (stat(id->filename, &st) < 0) { +- (id->userprovided ? logit : debug3)("no such identity: %s: %s", +- id->filename, strerror(errno)); ++ debug3("no such identity: %s", id->filename); return NULL; } private = key_load_private_type(KEY_UNSPEC, filename, "", NULL, &perm_ok); diff --git a/projects/RPi/options b/projects/RPi/options index 62f2219aca..3e933ad5ff 100644 --- a/projects/RPi/options +++ b/projects/RPi/options @@ -60,10 +60,10 @@ LINUX="default" # NOOBS supported hex versions (legacy) - NOOBS_HEX="2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19" + NOOBS_HEX="2,3,4,5,6,7,8,9,d,e,f,10,11,12,14,19,0092" # NOOBS supported model versions - NOOBS_SUPPORTED_MODELS="'Pi Model','Pi Zero'" + NOOBS_SUPPORTED_MODELS="'Pi Model','Pi Compute Module','Pi Zero'" ################################################################################ # setup build defaults diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch index 30518b9487..863e39ebca 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 7845b06e18af196528ad650eccd152e7989bc69c Mon Sep 17 00:00:00 2001 +From b6cc28abbbf710379772d3da9227ce66926c46a3 Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 01/54] smsx95xx: fix crimes against truesize +Subject: [PATCH 001/170] 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. @@ -35,14 +35,11 @@ index 66b3ab9..b544181 usbnet_skb_return(dev, ax_skb); } --- -2.5.0 - -From 1c4ee85b4d9361be8b58687db4acdb43e7a79c14 Mon Sep 17 00:00:00 2001 +From 37e24d2f0af32632a17692076dddcf176d1af1f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 02/54] smsc95xx: Disable turbo mode by default +Subject: [PATCH 002/170] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- @@ -61,14 +58,11 @@ index b544181..9c0da18 100755 module_param(turbo_mode, bool, 0644); MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); --- -2.5.0 - -From 38a1c0f17082b195b17ee390270377e661d2243b Mon Sep 17 00:00:00 2001 +From d5cb475205138f9df1fdbb74d8810ab1928696ea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 03/54] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 003/170] vmstat: Workaround for issue where dirty page count goes negative See: @@ -79,7 +73,7 @@ http://www.spinics.net/lists/linux-mm/msg72236.html 1 file changed, 4 insertions(+) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h -index 5dbc8b0..3a18061 100644 +index 3e5d907..2539068 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -219,7 +219,11 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) @@ -94,14 +88,11 @@ index 5dbc8b0..3a18061 100644 } static inline void __inc_zone_page_state(struct page *page, --- -2.5.0 - -From 7d76a16073ba70458e82edb4db8254a7a3dced6b Mon Sep 17 00:00:00 2001 +From 249a499b1d4b6f8a57b3377d4f505841e99f60c8 Mon Sep 17 00:00:00 2001 From: Robert Tiemann Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 04/54] BCM2835_DT: Fix I2S register map +Subject: [PATCH 004/170] BCM2835_DT: Fix I2S register map --- Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- @@ -154,15 +145,12 @@ index aef64de..864a3ef 100644 dmas = <&dma 2>, <&dma 3>; --- -2.5.0 - -From 688a5f2ada4fbd16547b574a17e6d359ab2364d0 Mon Sep 17 00:00:00 2001 +From c24657505a2aac71d0409b0ef703fc21ecab4b2e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 05/54] irq-bcm2836: Prevent spurious interrupts, and trap them - early +Subject: [PATCH 005/170] irq-bcm2836: Prevent spurious interrupts, and trap + them early The old arch-specific IRQ macros included a dsb to ensure the write to clear the mailbox interrupt completed before returning @@ -191,14 +179,11 @@ index f687082..4cd8ebe 100644 u32 hwirq = ffs(stat) - 1; handle_IRQ(irq_linear_revmap(intc.domain, hwirq), regs); --- -2.5.0 - -From 6edc4f10cd957d1b3cb705fe06003b965f24fd71 Mon Sep 17 00:00:00 2001 +From 229bcf2e73ce37e8a18d68773471024c848d84bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 12 Jun 2015 19:01:05 +0200 -Subject: [PATCH 06/54] irqchip: bcm2835: Add FIQ support +Subject: [PATCH 006/170] irqchip: bcm2835: Add FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -216,7 +201,7 @@ Acked-by: Stephen Warren 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index 8c53c55..c943747 100644 +index 8c53c55..c943747b 100644 --- a/arch/arm/mach-bcm/Kconfig +++ b/arch/arm/mach-bcm/Kconfig @@ -128,6 +128,7 @@ config ARCH_BCM2835 @@ -326,14 +311,11 @@ index bf9cc5f..3f601f9 100644 return 0; } --- -2.5.0 - -From e24db33d028844ac535e9e8d72a0c77e6dc7cb95 Mon Sep 17 00:00:00 2001 +From 6780f0a5c6af19f2b9850e961a0f81fbfdfa48fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Oct 2015 16:26:55 +0200 -Subject: [PATCH 07/54] irqchip: irq-bcm2835: Add 2836 FIQ support +Subject: [PATCH 007/170] irqchip: irq-bcm2835: Add 2836 FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -428,14 +410,11 @@ index 3f601f9..20deb28 100644 /* Make a duplicate irq range which is used to enable FIQ */ for (b = 0; b < NR_BANKS; b++) { for (i = 0; i < bank_irqs[b]; i++) { --- -2.5.0 - -From a628f89696a423d8be5e4f6afacd1b2164dc72c0 Mon Sep 17 00:00:00 2001 +From 4b9529b98c01569dff06f4e67ba28a47318e5ea5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 08/54] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 008/170] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ @@ -454,14 +433,11 @@ index 3912646..b51a59c 100644 for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; --- -2.5.0 - -From 05998ad69409fe1312ea7070e5ad3394b1a27712 Mon Sep 17 00:00:00 2001 +From 5fd6ab82b1027504faa66cf4fc8b999fafaacd12 Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 09/54] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 009/170] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -482,15 +458,12 @@ index 2e6ca69..62cc363 100644 .ngpio = BCM2835_NUM_GPIOS, .can_sleep = false, }; --- -2.5.0 - -From 511ab7e5940ce9cc535fed78408df6ccea648a5a Mon Sep 17 00:00:00 2001 +From 4254ef2647e89061427836443eac60351b3306a7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 10/54] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 - and 46-53 +Subject: [PATCH 010/170] pinctrl-bcm2835: Fix interrupt handling for GPIOs + 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has four interrupt lines - one each for the three IRQ groups and one common. Rather @@ -634,15 +607,12 @@ index 62cc363..ab345f4 100644 .of_match_table = bcm2835_pinctrl_match, }, }; --- -2.5.0 - -From b02654723367da6ef4be37fc63aadde1d273337a Mon Sep 17 00:00:00 2001 +From 93b12e64d0e2a8a65189dedd667e00b0a0fab60a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 11/54] pinctrl-bcm2835: Only request the interrupts listed in - the DTB +Subject: [PATCH 011/170] pinctrl-bcm2835: Only request the interrupts listed + in the DTB Although the GPIO controller can generate three interrupts (four counting the common one), the device tree files currently only specify two. In the @@ -667,14 +637,11 @@ index ab345f4..640e3b0 100644 pc->irq_data[i].pc = pc; pc->irq_data[i].irqgroup = i; --- -2.5.0 - -From c28b4b938880483817ec763cc8cea8b1b3fa7713 Mon Sep 17 00:00:00 2001 +From bb8ff388ad26721eebb7249afb6f6f57bc196de4 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 12/54] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 012/170] spi-bcm2835: Support pin groups other than 7-11 The spi-bcm2835 driver automatically uses GPIO chip-selects due to some unreliability of the native ones. In doing so it chooses the @@ -754,14 +721,11 @@ index cf04960..a2b1f45 100644 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", --- -2.5.0 - -From 1cb2f8fda15ef921c9d1f51e010ac0073bd54a57 Mon Sep 17 00:00:00 2001 +From bfcfed788d152e828747ea889a88f8b179217ddb 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 13/54] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 013/170] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -786,7 +750,7 @@ Signed-off-by: Noralf Trønnes 1 file changed, 9 insertions(+) diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 0f7b9ea..1e6f1cf 100644 +index 0f7b9ea..1e6f1cf9 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -17,12 +17,16 @@ @@ -818,14 +782,11 @@ index 0f7b9ea..1e6f1cf 100644 } static const char * const bcm2835_compat[] = { --- -2.5.0 - -From 43a75f20eb793a2c528280faab8248b226fe38de Mon Sep 17 00:00:00 2001 +From fb968a02c00e2722df2dcfec6f54b7524ff5a155 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 16:44:05 +0200 -Subject: [PATCH 14/54] bcm2835-i2s: get base address for DMA from devicetree +Subject: [PATCH 014/170] bcm2835-i2s: get base address for DMA from devicetree Code copied from spi-bcm2835. Get physical address from devicetree instead of using hardcoded constant. @@ -889,14 +850,11 @@ index 8c435be..0bc4f47 100644 /* Set the bus width */ dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = --- -2.5.0 - -From e68b70e6087fd6fc8466eeac8db67b3f49813058 Mon Sep 17 00:00:00 2001 +From abbe565abfe075b76e01b9671c6fc4cf42cc0328 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:21:16 +0200 -Subject: [PATCH 15/54] bcm2835-i2s: add 24bit support, update bclk_ratio to +Subject: [PATCH 015/170] bcm2835-i2s: add 24bit support, update bclk_ratio to more correct values Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -974,14 +932,11 @@ index 0bc4f47..cf60390 100644 | SNDRV_PCM_FMTBIT_S32_LE }, .ops = &bcm2835_i2s_dai_ops, --- -2.5.0 - -From 18ecb409ca4b62265dc8638c4feddc74b169e757 Mon Sep 17 00:00:00 2001 +From b2cc62cd13099d6d2f21b9927df248aa3bdd8d5b Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:25:51 +0200 -Subject: [PATCH 16/54] bcm2835-i2s: setup clock only if CPU is clock master +Subject: [PATCH 016/170] bcm2835-i2s: setup clock only if CPU is clock master Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -1035,14 +990,11 @@ index cf60390..4ac4e92 100644 /* Setup the frame format */ format = BCM2835_I2S_CHEN; --- -2.5.0 - -From 34be3cc516c8e1bc9543bb1b1472b916cde0e3d4 Mon Sep 17 00:00:00 2001 +From 71b2c93cd332be280b9ca7f293e463f30d5fb108 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:49:51 +0200 -Subject: [PATCH 17/54] bcm2835-i2s: Eliminate debugfs directory error +Subject: [PATCH 017/170] bcm2835-i2s: Eliminate debugfs directory error Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -1077,14 +1029,11 @@ index 4ac4e92..aab3df9 100644 }, }; --- -2.5.0 - -From 3b910b1bea6daf50ce4a22298d4512178d109fe7 Mon Sep 17 00:00:00 2001 +From fae43fcaa20df1d39c09c98372100bb1dedd6090 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:35:20 +0200 -Subject: [PATCH 18/54] bcm2835-i2s: Register PCM device +Subject: [PATCH 018/170] bcm2835-i2s: Register PCM device Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -1146,14 +1095,11 @@ index aab3df9..0e5c787 100644 if (ret) { dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); return ret; --- -2.5.0 - -From cb2f46fb84024303f11a9da1f949e0092222b537 Mon Sep 17 00:00:00 2001 +From c9e2eeee4889f965a29744718bbff2de409ac649 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:55:21 +0200 -Subject: [PATCH 19/54] bcm2835-i2s: Enable MMAP support via a DT property +Subject: [PATCH 019/170] bcm2835-i2s: Enable MMAP support via a DT property Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -1196,14 +1142,11 @@ index 0e5c787..04c1d13 100644 /* Request both ioareas */ for (i = 0; i <= 1; i++) { void __iomem *base; --- -2.5.0 - -From 5d8da2ced7537ced468f4ec0da0392d31ec59402 Mon Sep 17 00:00:00 2001 +From dc5b926436bccc4efbb1695ec3696b5db6746d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 9 Apr 2015 12:34:11 +0200 -Subject: [PATCH 20/54] dmaengine: bcm2835: Add slave dma support +Subject: [PATCH 020/170] dmaengine: bcm2835: Add slave dma support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1522,14 +1465,11 @@ index 996c4b0..b278c66 100644 MODULE_AUTHOR("Florian Meier "); +MODULE_AUTHOR("Gellert Weisz "); MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 47c823519828f01517803ca5507ce9f942ffa4a7 Mon Sep 17 00:00:00 2001 +From 9c6955f3fbfbb46242c63b4640886b9a0d87910a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 3 Oct 2015 15:58:59 +0200 -Subject: [PATCH 21/54] dmaengine: bcm2835: set residue_granularity field +Subject: [PATCH 021/170] dmaengine: bcm2835: set residue_granularity field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1557,14 +1497,11 @@ index b278c66..696fb30 100644 od->ddev.dev = &pdev->dev; INIT_LIST_HEAD(&od->ddev.channels); spin_lock_init(&od->lock); --- -2.5.0 - -From 8ed5d9cb36862e28d36b17c509321c7496c499b6 Mon Sep 17 00:00:00 2001 +From 8da7ee8d9b714dbbac842fb5ae0471b52e0393ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 3 Oct 2015 22:22:55 +0200 -Subject: [PATCH 22/54] dmaengine: bcm2835: Load driver early and support +Subject: [PATCH 022/170] dmaengine: bcm2835: Load driver early and support legacy API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -1663,14 +1600,11 @@ index 696fb30..5db0a95 100644 MODULE_ALIAS("platform:bcm2835-dma"); MODULE_DESCRIPTION("BCM2835 DMA engine driver"); --- -2.5.0 - -From cc8e848852566125466b1c7f8969193b3bd09952 Mon Sep 17 00:00:00 2001 +From 0f3a30eb7ad7e709fdc6447c70bc3f1d5704eb63 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sat, 10 Oct 2015 12:29:18 +0200 -Subject: [PATCH 23/54] bcm2835-dma: Fix dreq not set for slave transfers +Subject: [PATCH 023/170] bcm2835-dma: Fix dreq not set for slave transfers Set dreq to slave_id if it is not set like in bcm2708-dmaengine. --- @@ -1690,15 +1624,12 @@ index 5db0a95..fe1fd60 100644 return 0; } --- -2.5.0 - -From b4b8964bdad3f33abb3b688832b326372c4e1d41 Mon Sep 17 00:00:00 2001 +From 305370f7caaecafbabb77b630380dbc0c436bb4c Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 12:28:30 +0200 -Subject: [PATCH 24/54] bcm2835-dma: Limit cyclic transfers on lite channels to - 32k +Subject: [PATCH 024/170] bcm2835-dma: Limit cyclic transfers on lite channels + to 32k Transfers larger than 32k cause repeated clicking with I2S soundcards. The exact reason is yet unknown, so limit to 32k as bcm2708-dmaengine @@ -1733,14 +1664,11 @@ index fe1fd60..0adc347 100644 else max_size = MAX_NORMAL_TRANSFER; period_len = min(period_len, max_size); --- -2.5.0 - -From 94acbda110b4bed72b2799550c86aa628abebf02 Mon Sep 17 00:00:00 2001 +From d801c33b7e2fb0d02ac11b95ea92b7d692286ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 15 Aug 2015 20:50:02 +0200 -Subject: [PATCH 25/54] bcm2835: Add support for uart1 +Subject: [PATCH 025/170] bcm2835: Add support for uart1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1754,7 +1682,7 @@ Signed-off-by: Noralf Trønnes 1 file changed, 25 insertions(+) diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 1e6f1cf..ea36eec 100644 +index 1e6f1cf9..ea36eec 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -22,6 +22,29 @@ @@ -1796,14 +1724,11 @@ index 1e6f1cf..ea36eec 100644 } static const char * const bcm2835_compat[] = { --- -2.5.0 - -From 1646baa74c32dc7efe9f1cdc9a38cf55b771cfdd Mon Sep 17 00:00:00 2001 +From 5e90e32b539720ad8c6c8d7ec462378685924f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:21:20 +0200 -Subject: [PATCH 26/54] firmware: bcm2835: Add missing property tags +Subject: [PATCH 026/170] firmware: bcm2835: Add missing property tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1864,14 +1789,11 @@ index c07d74a..525816d 100644 RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, --- -2.5.0 - -From 831c4f4aa0247bf72b21cd38787890fd50cbf766 Mon Sep 17 00:00:00 2001 +From 894f124497e95c9af506af2ed7335857f2e71358 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 27/54] Main bcm2708/bcm2709 linux port +Subject: [PATCH 027/170] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -2011,10 +1933,10 @@ index 34e1569..8f06ea8 100644 source "arch/arm/mach-alpine/Kconfig" diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug -index 259c0ca..097d928 100644 +index ddbb361..340b759 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug -@@ -1241,6 +1241,14 @@ choice +@@ -1240,6 +1240,14 @@ choice options; the platform specific options are deprecated and will be soon removed. @@ -2771,7 +2693,7 @@ index 0000000..502c617 +#define VMALLOC_END (0xe8000000) diff --git a/arch/arm/mach-bcm2709/Kconfig b/arch/arm/mach-bcm2709/Kconfig new file mode 100644 -index 0000000..643b4b9 +index 0000000..643b4b98 --- /dev/null +++ b/arch/arm/mach-bcm2709/Kconfig @@ -0,0 +1,16 @@ @@ -4385,14 +4307,11 @@ index 8673ffe..ad22ebb 100644 mmc_pm_flag_t pm_caps; /* supported pm features */ --- -2.5.0 - -From 4f7a784e0256c10f6200438aa74e385e151c2241 Mon Sep 17 00:00:00 2001 +From 74b2c26348d94949561979a9a3ad61adcac74398 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 11 Nov 2015 21:01:15 +0000 -Subject: [PATCH 28/54] squash: include ARCH_BCM2708 / ARCH_BCM2709 +Subject: [PATCH 028/170] squash: include ARCH_BCM2708 / ARCH_BCM2709 --- drivers/char/hw_random/Kconfig | 2 +- @@ -4481,7 +4400,7 @@ index cfb4b44..d9c6c21 100644 MODULE_AUTHOR("Lubomir Rintel "); MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile -index 738cb49..4fd086f 100644 +index 738cb492..4fd086f 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile @@ -40,6 +40,7 @@ obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o @@ -4543,14 +4462,11 @@ index 6a834e1..c5070ae 100644 select SND_SOC_GENERIC_DMAENGINE_PCM select REGMAP_MMIO help --- -2.5.0 - -From 43a51c6dbdb406826da11b1101cc6511d1185d67 Mon Sep 17 00:00:00 2001 +From a03df8d0f93365689c718f3d1fb62695e9fffe31 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 29/54] Add dwc_otg driver +Subject: [PATCH 029/170] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -5191,7 +5107,7 @@ index 8dd26e1..eef4847 100644 + mov pc, r8 +ENDPROC(__FIQ_Branch) diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile -index d5c57f1..0e15a22 100644 +index d5c57f1e..0e15a22 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile @@ -7,6 +7,7 @@ @@ -5215,10 +5131,10 @@ index 358ca8d..abaac7c 100644 return i; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index ddbf32d..12166e2 100644 +index 1560f3f..dd4dd69 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -4946,7 +4946,7 @@ static void port_event(struct usb_hub *hub, int port1) +@@ -4967,7 +4967,7 @@ static void port_event(struct usb_hub *hub, int port1) if (portchange & USB_PORT_STAT_C_OVERCURRENT) { u16 status = 0, unused; @@ -5231,7 +5147,7 @@ diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 8e641b5..de3ed7d 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c -@@ -1909,6 +1909,85 @@ free_interfaces: +@@ -1909,6 +1909,85 @@ int usb_set_configuration(struct usb_device *dev, int configuration) if (cp->string == NULL && !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) cp->string = usb_cache_string(dev, cp->desc.iConfiguration); @@ -5476,7 +5392,7 @@ index a95b0c9..17b605f 100644 diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c new file mode 100644 -index 0000000..a896d73 +index 0000000..a896d73f --- /dev/null +++ b/drivers/usb/gadget/file_storage.c @@ -0,0 +1,3676 @@ @@ -13314,7 +13230,7 @@ index 0000000..4664684 +#endif /* DWC_LIBMODULE */ diff --git a/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c new file mode 100644 -index 0000000..49b07e1 +index 0000000..49b07e17 --- /dev/null +++ b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c @@ -0,0 +1,1275 @@ @@ -25841,7 +25757,7 @@ index 0000000..bbb3d32 +#endif //DWC_UTE_CFI diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.h b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h new file mode 100644 -index 0000000..55fd337 +index 0000000..55fd337a --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h @@ -0,0 +1,320 @@ @@ -55832,7 +55748,7 @@ index 0000000..c8d2e0e +#endif /* DWC_HOST_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c new file mode 100644 -index 0000000..c8590b5 +index 0000000..c8590b52 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c @@ -0,0 +1,5147 @@ @@ -65528,14 +65444,11 @@ index 0000000..cdc9963 + +test_main(); +0; --- -2.5.0 - -From e84cab190a51bb9d04b38e76ce90a47c0f93da5e Mon Sep 17 00:00:00 2001 +From 845f985818d3d9ba162ab1102da78b0e39eaedba Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 30/54] bcm2708 framebuffer driver +Subject: [PATCH 030/170] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -66507,7 +66420,7 @@ index 0000000..a20539a +MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer"); +MODULE_PARM_DESC(fbswap, "Swap order of red and blue in 24 and 32 bit modes"); diff --git a/drivers/video/logo/logo_linux_clut224.ppm b/drivers/video/logo/logo_linux_clut224.ppm -index 3c14e43..7626beb 100644 +index 3c14e43..7626beb6a 100644 --- a/drivers/video/logo/logo_linux_clut224.ppm +++ b/drivers/video/logo/logo_linux_clut224.ppm @@ -1,1604 +1,883 @@ @@ -68996,14 +68909,11 @@ index 3c14e43..7626beb 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 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 --- -2.5.0 - -From 227880a04368c2840eb27d8d25aaee1cfd7e5c3a Mon Sep 17 00:00:00 2001 +From a35139d316b78606bfdeb0f10656ba6f1729c83f Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 31/54] dmaengine: Add support for BCM2708 +Subject: [PATCH 031/170] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69622,14 +69532,11 @@ index 0000000..99cc7fd +#endif /* CONFIG_DMA_BCM2708 */ + +#endif /* _PLAT_BCM2708_DMA_H */ --- -2.5.0 - -From 68dc1707b0e75ca092319956776e656bc3b42315 Mon Sep 17 00:00:00 2001 +From 462591cf98f15614620667e93b7f8bc0da6e86da Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 32/54] Add blk_pos parameter to mmc multi_io_quirk callback +Subject: [PATCH 032/170] Add blk_pos parameter to mmc multi_io_quirk callback --- drivers/mmc/card/block.c | 1 + @@ -69711,14 +69618,11 @@ index ad22ebb..105b3e6 100644 }; struct mmc_card; --- -2.5.0 - -From c9c3712517791991bc66744c3931cee457a70018 Mon Sep 17 00:00:00 2001 +From 3d0ca77d187abbbde572f4a73b1f864ffb8b5d8a Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 33/54] MMC: added alternative MMC driver +Subject: [PATCH 033/170] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -71415,15 +71319,12 @@ index 0000000..43aed6e +MODULE_DESCRIPTION("BCM2835 SDHCI driver"); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); --- -2.5.0 - -From e43ccd0115b085c56aa7396bdb973d244379222d Mon Sep 17 00:00:00 2001 +From 756bf8b8f081be45e16d4d58d3fbe2ca073df298 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 34/54] Adding bcm2835-sdhost driver, and an overlay to enable - it +Subject: [PATCH 034/170] Adding bcm2835-sdhost driver, and an overlay to + enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -73448,14 +73349,11 @@ index 0000000..da089985 +MODULE_DESCRIPTION("BCM2835 SDHost driver"); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); --- -2.5.0 - -From a1c91b2e27db42a9d753a2d752a4db2339971786 Mon Sep 17 00:00:00 2001 +From 8dbb0430386b772f636f474ed45496076d135428 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 35/54] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 035/170] cma: Add vc_cma driver to enable use of CMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -74797,14 +74695,11 @@ index 0000000..be2819d +#endif + +#endif /* VC_CMA_H */ --- -2.5.0 - -From 288825203141275ee6ce0054b7c19b93468f6ea7 Mon Sep 17 00:00:00 2001 +From 1e8eb30b259278ea7ab9d14c66d2fab5f580f73c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 36/54] bcm2708: alsa sound driver +Subject: [PATCH 036/170] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -77501,14 +77396,11 @@ index 0000000..af3e6eb +} VC_AUDIO_MSG_T; + +#endif // _VC_AUDIO_DEFS_H_ --- -2.5.0 - -From 10bbede5e3a5cda000722a6710342a49c7a66a97 Mon Sep 17 00:00:00 2001 +From 20c0f57db9cca65943519bd404b3e346958f4544 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 37/54] bcm2708 vchiq driver +Subject: [PATCH 037/170] bcm2708 vchiq driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -78766,7 +78658,7 @@ index 0000000..1b17e98 +/****************************** End of file **********************************/ diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h new file mode 100644 -index 0000000..26bc2d3 +index 0000000..26bc2d38 --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h @@ -0,0 +1,224 @@ @@ -90812,14 +90704,11 @@ index 0000000..b6bfa21 +{ + return vchiq_build_time; +} --- -2.5.0 - -From 39ea0d34e648bca5995ae2f578a2a151761e32bb Mon Sep 17 00:00:00 2001 +From 2cabfc660c80dd79f24a8323b3913b5060ebf750 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 16:07:06 +0100 -Subject: [PATCH 38/54] vc_mem: Add vc_mem driver +Subject: [PATCH 038/170] vc_mem: Add vc_mem driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -91823,14 +91712,11 @@ index 0000000..20a4753 +#endif + +#endif /* _VC_MEM_H */ --- -2.5.0 - -From 482bc90fdaa1d40622db38100a193d00948ae585 Mon Sep 17 00:00:00 2001 +From 01574b9e0f1086399e7f796cc1dc8fcadabf4a46 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 39/54] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 039/170] vcsm: VideoCore shared memory service for BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -96245,14 +96131,11 @@ index 0000000..334f36d +/* ---- Function Prototypes ---------------------------------------------- */ + +#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ --- -2.5.0 - -From ffef0c9f7166a243aae23b1bc094d222e4cfecaf Mon Sep 17 00:00:00 2001 +From 832077a0f61e44a9259b153f60eb233fa723c2a9 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 40/54] Add /dev/gpiomem device for rootless user GPIO access +Subject: [PATCH 040/170] Add /dev/gpiomem device for rootless user GPIO access Signed-off-by: Luke Wren @@ -96562,14 +96445,11 @@ index 0000000..911f5b7 +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); +MODULE_AUTHOR("Luke Wren "); --- -2.5.0 - -From fafb1e07bcbf595a3412748fe1243a38f3393757 Mon Sep 17 00:00:00 2001 +From 6609b15c34f26f34b4b49e7726693a1de321078c Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 41/54] Add SMI driver +Subject: [PATCH 041/170] Add SMI driver Signed-off-by: Luke Wren --- @@ -98519,14 +98399,11 @@ index 0000000..ee3a75e +#endif /* BCM2835_SMI_IMPLEMENTATION */ + +#endif /* BCM2835_SMI_H */ --- -2.5.0 - -From a368a4010e0b463a0518eb4dbf1cf8a893727596 Mon Sep 17 00:00:00 2001 +From f4d44b2c447c401791645627e88d0ef9830c1239 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 42/54] Add SMI NAND driver +Subject: [PATCH 042/170] Add SMI NAND driver Signed-off-by: Luke Wren --- @@ -98606,7 +98483,7 @@ index 2896640..56ff00b 100644 tristate diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile -index 2c7f014..30e22f0 100644 +index 2c7f014b..30e22f0 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_NAND_DENALI) += denali.o @@ -98891,14 +98768,11 @@ index 0000000..b747326 +MODULE_DESCRIPTION + ("Driver for NAND chips using Broadcom Secondary Memory Interface"); +MODULE_AUTHOR("Luke Wren "); --- -2.5.0 - -From 14f0b2203b2204c057d7db441e1a292b6a0eb6f3 Mon Sep 17 00:00:00 2001 +From 2faad8f6644fa53418c5a7b80da8d5400b72df3f Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 43/54] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 043/170] 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 @@ -99746,14 +99620,11 @@ index 0000000..fb69624 + bcm2708_gpio_pull_t value); + +#endif --- -2.5.0 - -From 20fd592d940f46939e89d194f0392c0fe00d1e4f Mon Sep 17 00:00:00 2001 +From 3c7ea37319a4974cbf6b89a84c109a53f4d6b408 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 44/54] Add cpufreq driver +Subject: [PATCH 044/170] Add cpufreq driver Signed-off-by: popcornmix --- @@ -100014,14 +99885,11 @@ index 0000000..3eb9e93 + +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); --- -2.5.0 - -From de097ce1fa4d97e711469c8e5ddc0ab0e4e84943 Mon Sep 17 00:00:00 2001 +From 776e87ffc8b137ea465e7b0076e56cd71d9c56d1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 45/54] Added hwmon/thermal driver for reporting core +Subject: [PATCH 045/170] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -100218,14 +100086,11 @@ index 0000000..08d8dc7 +MODULE_AUTHOR("Noralf Trønnes"); +MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); +MODULE_LICENSE("GPL"); --- -2.5.0 - -From 3283ff477bed6a5f3d67e405f7df7b456a864567 Mon Sep 17 00:00:00 2001 +From 72181304010d3aa74cd2b98db592554a541ce4c2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 46/54] Add Chris Boot's i2c driver +Subject: [PATCH 046/170] Add Chris Boot's i2c driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -100864,14 +100729,11 @@ index 0000000..85f411c +MODULE_AUTHOR("Chris Boot "); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); --- -2.5.0 - -From 7c0ed22b9161086cd3e7c3b7175c8e66538dc058 Mon Sep 17 00:00:00 2001 +From abcf04d54ccb3d0897b1f7a95ddf9d9ccf63dc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:27:06 +0200 -Subject: [PATCH 47/54] char: broadcom: Add vcio module +Subject: [PATCH 047/170] char: broadcom: Add vcio module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -101096,14 +100958,11 @@ index 0000000..c19bc20 +MODULE_AUTHOR("Noralf Trønnes"); +MODULE_DESCRIPTION("Mailbox userspace access"); +MODULE_LICENSE("GPL"); --- -2.5.0 - -From 386d9ed9fc8601e4919d29d24161ffcffeed4078 Mon Sep 17 00:00:00 2001 +From a205e934b63b6bf3f5f74bc39974ec6ff09df596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:25:01 +0200 -Subject: [PATCH 48/54] firmware: bcm2835: Support ARCH_BCM270x +Subject: [PATCH 048/170] firmware: bcm2835: Support ARCH_BCM270x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -101208,14 +101067,11 @@ index dd506cd3..b980d53 100644 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("Raspberry Pi firmware driver"); --- -2.5.0 - -From d052c7efe3ebc65ce4c262607028a21a163a755b Mon Sep 17 00:00:00 2001 +From 4d74ee3d433df319ae3fc36bd16fd96b4bbff865 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 49/54] bcm2835: add v4l2 camera device +Subject: [PATCH 049/170] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -104975,7 +104831,7 @@ index 0000000..f9f903f +} diff --git a/drivers/media/platform/bcm2835/mmal-common.h b/drivers/media/platform/bcm2835/mmal-common.h new file mode 100644 -index 0000000..840fd13 +index 0000000..840fd139 --- /dev/null +++ b/drivers/media/platform/bcm2835/mmal-common.h @@ -0,0 +1,53 @@ @@ -106495,7 +106351,7 @@ index 0000000..aa0fd18 +}; diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.c b/drivers/media/platform/bcm2835/mmal-vchiq.c new file mode 100644 -index 0000000..7813225 +index 0000000..78132254 --- /dev/null +++ b/drivers/media/platform/bcm2835/mmal-vchiq.c @@ -0,0 +1,1916 @@ @@ -108599,14 +108455,11 @@ index 0000000..9d1d11e + struct mmal_buffer *buf); + +#endif /* MMAL_VCHIQ_H */ --- -2.5.0 - -From 88f17ab49dec26cef89f7382763e0aea94e380cd Mon Sep 17 00:00:00 2001 +From 03435989bbadbd333a810644c8246dd7eb0bad07 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 50/54] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 050/170] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -109070,21 +108923,18 @@ index 0000000..3998d43 + my $val = $configs->{$wanted} || 'n'; + return (($val eq 'y') || ($val eq '1')); +} --- -2.5.0 - -From 546668ae1382b20c6e80ef49bad762045fc4e1c4 Mon Sep 17 00:00:00 2001 +From a251bf4a37d8fd468bc3ff853bcebe8ee452a31e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 51/54] fdt: Add support for the CONFIG_CMDLINE_EXTEND option +Subject: [PATCH 051/170] fdt: Add support for the CONFIG_CMDLINE_EXTEND option --- drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c -index 655f79d..0508152 100644 +index 655f79d..fdc4501 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -954,19 +954,38 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, @@ -109126,19 +108976,16 @@ index 655f79d..0508152 100644 - strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); + } +#else /* CONFIG_CMDLINE */ -+ if (p != NULL && l > 0) { ++ if (p != NULL && l > 0) + strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); #endif /* CONFIG_CMDLINE */ pr_debug("Command line is: %s\n", (char*)data); --- -2.5.0 - -From 1a604dcf0461ad1a5422f6618686d7ce5beb0a2f Mon Sep 17 00:00:00 2001 +From 0112c4ce9db6cdc53af67dc7634966c3594de7ff Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 52/54] BCM2708: Add core Device Tree support +Subject: [PATCH 052/170] BCM2708: Add core Device Tree support Add the bare minimum needed to boot BCM2708 from a Device Tree. @@ -110472,7 +110319,7 @@ index 0000000..a8cfd7c +}; diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dts b/arch/arm/boot/dts/bcm2835-rpi-cm.dts new file mode 100644 -index 0000000..c6e6860 +index 0000000..c6e6860a --- /dev/null +++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dts @@ -0,0 +1,93 @@ @@ -111640,7 +111487,7 @@ index 0000000..2c81448 +}; 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 +index 0000000..5e7633ae --- /dev/null +++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts @@ -0,0 +1,34 @@ @@ -111680,7 +111527,7 @@ index 0000000..5e7633a +}; 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..deb9c62 +index 0000000..deb9c625 --- /dev/null +++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts @@ -0,0 +1,39 @@ @@ -112970,7 +112817,7 @@ index 0000000..1bd8054 +}; 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 +index 0000000..7fc6ac99 --- /dev/null +++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts @@ -0,0 +1,34 @@ @@ -113863,14 +113710,11 @@ index 0000000..66a98f6 + pullup = <&w1>,"rpi,parasitic-power:0"; + }; +}; --- -2.5.0 - -From a9f4427a230b1ca6e77418330a42042e2b703a10 Mon Sep 17 00:00:00 2001 +From 23eabf2220f0f748df3e88a35e55a82c53242b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 15 Aug 2015 20:47:07 +0200 -Subject: [PATCH 53/54] bcm2835: Match with BCM2708 Device Trees +Subject: [PATCH 053/170] bcm2835: Match with BCM2708 Device Trees MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -114387,14 +114231,11 @@ index 864a3ef..3256bff 100644 +&watchdog { + status = "okay"; +}; --- -2.5.0 - -From 88ef042c414856132deba83d6ff8e9001c71e8d3 Mon Sep 17 00:00:00 2001 +From f978fb3b816681159b6cc97104954dea31488add Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 54/54] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 054/170] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -114471,7 +114312,7 @@ index 0705d88..771992a 100644 case FBIOBLANK: ret = do_fb_ioctl(info, cmd, arg); diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h -index fb795c3..fa72af0 100644 +index fb795c3..fa72af0c 100644 --- a/include/uapi/linux/fb.h +++ b/include/uapi/linux/fb.h @@ -34,6 +34,11 @@ @@ -114486,13 +114327,11 @@ index fb795c3..fa72af0 100644 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ --- -2.5.0 -From 3dd0886d76a33878bfdc67c44f29c9a782f88419 Mon Sep 17 00:00:00 2001 +From 53bcd6e5a43a353508c7aff48abcdcaae1b35ca8 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 1/3] Speed up console framebuffer imageblit function +Subject: [PATCH 058/170] 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 @@ -114700,14 +114539,11 @@ index a2bb276..436494f 100644 slow_imageblit(image, p, dst1, fgcolor, bgcolor, start_index, pitch_index); } else --- -2.5.0 - -From 4641cd894690a65893287ce27e9b98a0e554ac1a Mon Sep 17 00:00:00 2001 +From 6c0a9150827dc58fac38c8e787c050626325842e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 2/3] Allow mac address to be set in smsc95xx +Subject: [PATCH 059/170] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -114797,15 +114633,12 @@ index 9c0da18..3244a90 100755 /* try reading mac address from EEPROM */ if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { --- -2.5.0 - -From 4252d61d6bf3c32b2042de2a0633472e65044bcd Mon Sep 17 00:00:00 2001 +From e172d31b8402f13aed5679cd7023f0c0935aab05 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 3/3] enabling the realtime clock 1-wire chip DS1307 and 1-wire - on GPIO4 (as a module) +Subject: [PATCH 060/170] 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 See: https://github.com/raspberrypi/linux/pull/457 @@ -115053,24 +114886,22 @@ index d58594a..feae942 100644 void (*enable_external_pullup)(int enable); unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; --- -2.5.0 -From 0d2c4c9480b96a2c0a92044f11d59e1893bd5d61 Mon Sep 17 00:00:00 2001 +From d0f48fe7aab3e4036fd55b491a9be94ea24f377d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 01/59] config: Enable CONFIG_MEMCG, but leave it disabled (due - to memory cost). Enable with cgroup_enable=memory. +Subject: [PATCH 062/170] config: Enable CONFIG_MEMCG, but leave it disabled + (due to memory cost). Enable with cgroup_enable=memory. --- kernel/cgroup.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index 470f653..5ecf873 100644 +index fb1ecfd..888d308 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c -@@ -5273,7 +5273,7 @@ int __init cgroup_init_early(void) +@@ -5286,7 +5286,7 @@ int __init cgroup_init_early(void) return 0; } @@ -115079,7 +114910,7 @@ index 470f653..5ecf873 100644 /** * cgroup_init - cgroup initialization -@@ -5769,6 +5769,27 @@ static int __init cgroup_disable(char *str) +@@ -5782,6 +5782,27 @@ static int __init cgroup_disable(char *str) } __setup("cgroup_disable=", cgroup_disable); @@ -115107,14 +114938,11 @@ index 470f653..5ecf873 100644 /** * css_tryget_online_from_dir - get corresponding css from a cgroup dentry * @dentry: directory dentry of interest --- -2.5.0 - -From b29192a8be711b20a5bd623b363a9672df79d762 Mon Sep 17 00:00:00 2001 +From 8d35b3a72d3580ad6f5bc5835bfe13b00cce6086 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 02/59] ASoC: Add support for PCM5102A codec +Subject: [PATCH 063/170] ASoC: Add support for PCM5102A codec Some definitions to support the PCM5102A codec by Texas Instruments. @@ -115246,14 +115074,11 @@ index 0000000..7c6598e +MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 0dedabda0e45bd54adeb39ee435367e4429dfbb6 Mon Sep 17 00:00:00 2001 +From 9ced0e86593de2214ff8a81f71c802d7e7301b05 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 03/59] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 064/170] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -115422,14 +115247,11 @@ index 0000000..3ab0f47 +MODULE_AUTHOR("Florian Meier "); +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From e44fe13cdf2e0857f445870d895a1c8c6b6741e3 Mon Sep 17 00:00:00 2001 +From f16a654f57b024d44fe58d62b660e01de6a7811a Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 04/59] ASoC: Add support for Rpi-DAC +Subject: [PATCH 065/170] ASoC: Add support for Rpi-DAC --- sound/soc/bcm/Kconfig | 7 +++ @@ -115715,17 +115537,14 @@ index 0000000..afe1b41 +MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 5eef515f93059e16a1644ad37a17a624e3038425 Mon Sep 17 00:00:00 2001 +From dbdeca565b0850da182d3bd0b3ed41f667ca8a45 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 05/59] 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 +Subject: [PATCH 066/170] 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 additional mclk_div divider, it is now possible to control the behaviour. This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It should allow lower jitter and better signal quality. The behavior has to be @@ -115761,14 +115580,11 @@ index 8d91470..5795fb1 100644 #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ --- -2.5.0 - -From e73dd7a2fba7ab58c64aa30b785c56d6ee9c213f Mon Sep 17 00:00:00 2001 +From 0c2e64d3eda229c2f52ce6ed9d0b1c1572dd9b19 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 06/59] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 067/170] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -116054,15 +115870,12 @@ index 0000000..80732b8 +MODULE_AUTHOR("Daniel Matuschek "); +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 73edf3a97c839ddf6684271f5485d7c147b80f92 Mon Sep 17 00:00:00 2001 +From f2789622ff7c1297e28f38bb198f5fd24b4602ef Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 07/59] ASoC: wm8804: Set idle_bias_off to false Idle bias has - been change to remove warning on driver startup +Subject: [PATCH 068/170] ASoC: wm8804: Set idle_bias_off to false Idle bias + has been change to remove warning on driver startup Signed-off-by: Daniel Matuschek --- @@ -116082,14 +115895,11 @@ index 5795fb1..c846716 100644 .dapm_widgets = wm8804_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), --- -2.5.0 - -From 1f1e820c63d8385fed2ae1df075a747702756d44 Mon Sep 17 00:00:00 2001 +From 80fa31f923b4967bc86be20c5af780ef284fc972 Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 08/59] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 069/170] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -116271,14 +116081,11 @@ index 0000000..37038d4 +MODULE_AUTHOR("Florian Meier "); +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 26b545d1b78dba5e4a88b3ad38d129b5217c526a Mon Sep 17 00:00:00 2001 +From b15f112ddaf2cd20a8f999ac823ddb51d7d513b9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 09/59] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 070/170] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -116286,7 +116093,7 @@ Reduces overhead when using X 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index 36712e9..910fa89 100644 +index 5dd426f..9ae0cd5 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -49,7 +49,7 @@ @@ -116313,14 +116120,11 @@ index 36712e9..910fa89 100644 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { --- -2.5.0 - -From d00a6d6ab0ad83338de8360fb0c895dc3b780caa Mon Sep 17 00:00:00 2001 +From debd3d30b1127328b5a1e444bd1550cb45c50362 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 10/59] Added support for HiFiBerry DAC+ +Subject: [PATCH 071/170] 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. @@ -116514,14 +116318,11 @@ index 0000000..11e4f39 +MODULE_AUTHOR("Daniel Matuschek "); +MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From e1a0219eddb9732580155b2cb1f8d0e24421b9c3 Mon Sep 17 00:00:00 2001 +From 9c6f0b1812313d39afeefd700b7f9df9a82a47cd Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 11/59] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 072/170] 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. @@ -117351,14 +117152,11 @@ index 0000000..8f019e0 + + +#endif /* _TAS5713_H */ --- -2.5.0 - -From 9491a7d6109f4ad61e1db014d5611c13232bfd65 Mon Sep 17 00:00:00 2001 +From 21d08f232ffc350b2930f761f3da26f9867b1d4d Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 12/59] Update ds1307 driver for device-tree support +Subject: [PATCH 073/170] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -117384,14 +117182,11 @@ index aa705bb..1cb13fee 100644 static struct i2c_driver ds1307_driver = { .driver = { .name = "rtc-ds1307", --- -2.5.0 - -From f7704ed8c0ebb3eb5d4efc203afc58aab6642a2f Mon Sep 17 00:00:00 2001 +From a2b52a3af1314e2b691d9518afb3051193758671 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 13/59] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 074/170] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -117569,14 +117364,11 @@ index fa359c7..4b25a1a 100644 /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ --- -2.5.0 - -From 8a1b126dd7b96658a58c6fcb448599a329b0c681 Mon Sep 17 00:00:00 2001 +From 12ad9b7c670220b1b8b80ebf507651d106cb28c0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 14/59] enc28j60: Add device tree compatible string and an +Subject: [PATCH 075/170] enc28j60: Add device tree compatible string and an overlay --- @@ -117604,14 +117396,11 @@ index 86ea17e..a1b20c1 100644 }, .probe = enc28j60_probe, .remove = enc28j60_remove, --- -2.5.0 - -From dad0f756f15b857a690cd400a57967f1ea17ec51 Mon Sep 17 00:00:00 2001 +From 660d2fba0483aafc4a1ce678016620c0871bb759 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 15/59] Add driver for rpi-proto +Subject: [PATCH 076/170] 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 @@ -117825,28 +117614,25 @@ index 0000000..c6e45a0 +MODULE_AUTHOR("Florian Meier"); +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); --- -2.5.0 - -From f83d2eae29ba396b02e1d1db4f7641c63a22e1ad Mon Sep 17 00:00:00 2001 +From e2af169e60b4ebd710e733996d57ad86264bae27 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 16/59] config: Add default configs +Subject: [PATCH 077/170] config: Add default configs --- - arch/arm/configs/bcm2709_defconfig | 1255 ++++++++++++++++++++++++++++++++++++ - arch/arm/configs/bcmrpi_defconfig | 1251 +++++++++++++++++++++++++++++++++++ - 2 files changed, 2506 insertions(+) + arch/arm/configs/bcm2709_defconfig | 1254 +++++++++++++++++++++++++++++++++++ + arch/arm/configs/bcmrpi_defconfig | 1265 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 2519 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..f5c5e87 +index 0000000..16062bf --- /dev/null +++ b/arch/arm/configs/bcm2709_defconfig -@@ -0,0 +1,1255 @@ +@@ -0,0 +1,1254 @@ +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +CONFIG_PHYS_OFFSET=0 +CONFIG_LOCALVERSION="-v7" @@ -117892,7 +117678,7 @@ index 0000000..f5c5e87 +CONFIG_SMP=y +CONFIG_HAVE_ARM_ARCH_TIMER=y +CONFIG_VMSPLIT_2G=y -+CONFIG_PREEMPT=y ++CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_AEABI=y +CONFIG_OABI_COMPAT=y +# CONFIG_CPU_SW_DOMAIN_PAN is not set @@ -119076,7 +118862,6 @@ index 0000000..f5c5e87 +CONFIG_DEBUG_MEMORY_INIT=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_TIMER_STATS=y -+# CONFIG_DEBUG_PREEMPT is not set +CONFIG_IRQSOFF_TRACER=y +CONFIG_SCHED_TRACER=y +CONFIG_STACK_TRACER=y @@ -119104,10 +118889,10 @@ index 0000000..f5c5e87 +CONFIG_LIBCRC32C=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig new file mode 100644 -index 0000000..c7d31e8 +index 0000000..1d1b799 --- /dev/null +++ b/arch/arm/configs/bcmrpi_defconfig -@@ -0,0 +1,1251 @@ +@@ -0,0 +1,1265 @@ +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +CONFIG_PHYS_OFFSET=0 +# CONFIG_LOCALVERSION_AUTO is not set @@ -119148,7 +118933,7 @@ index 0000000..c7d31e8 +CONFIG_MAC_PARTITION=y +CONFIG_CFQ_GROUP_IOSCHED=y +CONFIG_ARCH_BCM2708=y -+CONFIG_PREEMPT=y ++CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_AEABI=y +CONFIG_OABI_COMPAT=y +# CONFIG_CPU_SW_DOMAIN_PAN is not set @@ -119479,6 +119264,7 @@ index 0000000..c7d31e8 +CONFIG_BT_HIDP=m +CONFIG_BT_6LOWPAN=m +CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m +CONFIG_BT_HCIBCM203X=m +CONFIG_BT_HCIBPA10X=m +CONFIG_BT_HCIBFUSB=m @@ -119693,7 +119479,6 @@ index 0000000..c7d31e8 +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_TTY_PRINTK=y +CONFIG_HW_RANDOM=y -+CONFIG_HW_RANDOM_BCM2835=y +CONFIG_RAW_DRIVER=y +CONFIG_I2C=y +CONFIG_I2C_CHARDEV=m @@ -120024,6 +119809,7 @@ index 0000000..c7d31e8 +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_HOST=m ++CONFIG_USB_DWC2=m +CONFIG_USB_SERIAL=m +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_AIRCABLE=m @@ -120097,6 +119883,20 @@ index 0000000..c7d31e8 +CONFIG_USB_CXACRU=m +CONFIG_USB_UEAGLEATM=m +CONFIG_USB_XUSBATM=m ++CONFIG_USB_GADGET=m ++CONFIG_USB_ZERO=m ++CONFIG_USB_AUDIO=m ++CONFIG_USB_ETH=m ++CONFIG_USB_GADGETFS=m ++CONFIG_USB_MASS_STORAGE=m ++CONFIG_USB_G_SERIAL=m ++CONFIG_USB_MIDI_GADGET=m ++CONFIG_USB_G_PRINTER=m ++CONFIG_USB_CDC_COMPOSITE=m ++CONFIG_USB_G_ACM_MS=m ++CONFIG_USB_G_MULTI=m ++CONFIG_USB_G_HID=m ++CONFIG_USB_G_WEBCAM=m +CONFIG_MMC=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_BCM2835=y @@ -120206,7 +120006,7 @@ index 0000000..c7d31e8 +CONFIG_EXTCON_ARIZONA=m +CONFIG_IIO=m +CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=y ++CONFIG_IIO_BUFFER_CB=m +CONFIG_IIO_KFIFO_BUF=m +CONFIG_MCP320X=m +CONFIG_DHT11=m @@ -120330,7 +120130,6 @@ index 0000000..c7d31e8 +CONFIG_DEBUG_MEMORY_INIT=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_TIMER_STATS=y -+# CONFIG_DEBUG_PREEMPT is not set +CONFIG_LATENCYTOP=y +CONFIG_IRQSOFF_TRACER=y +CONFIG_SCHED_TRACER=y @@ -120359,14 +120158,11 @@ index 0000000..c7d31e8 +CONFIG_CRYPTO_AES_ARM=m +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y --- -2.5.0 - -From 4a03e3e11c4576e0b94a0e6c8e4dd676140d6120 Mon Sep 17 00:00:00 2001 +From e5292198fc83805a9f4751fddeb802f69c0270f0 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 17/59] bcm2835: bcm2835_defconfig +Subject: [PATCH 078/170] bcm2835: bcm2835_defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -120508,7 +120304,7 @@ Signed-off-by: Noralf Trønnes 1 file changed, 1140 insertions(+), 26 deletions(-) diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig -index 31cb073..fdb2e2a 100644 +index 31cb073..fdb2e2a8 100644 --- a/arch/arm/configs/bcm2835_defconfig +++ b/arch/arm/configs/bcm2835_defconfig @@ -1,105 +1,1103 @@ @@ -121791,14 +121587,11 @@ index 31cb073..fdb2e2a 100644 +CONFIG_LIBCRC32C=y # CONFIG_XZ_DEC_ARM is not set # CONFIG_XZ_DEC_ARMTHUMB is not set --- -2.5.0 - -From 9a3fd91c18be1eda26a0637ce6b905c75d6f67e2 Mon Sep 17 00:00:00 2001 +From 6fb12ee15eb9b0f5b6fea66c861a9db8ec6671ed Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 18/59] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 079/170] rpi-ft5406: Add touchscreen driver for pi LCD display Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected @@ -122092,14 +121885,12 @@ index 0000000..b27dbee +MODULE_AUTHOR("Gordon Hollingworth"); +MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); +MODULE_LICENSE("GPL"); --- -2.5.0 - -From 1fb6da46a439a109415dea3ae8967e5b55186303 Mon Sep 17 00:00:00 2001 +From b57a6269e03fe055f78ab50add6e2c68d43254e2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Oct 2014 11:47:53 +0100 -Subject: [PATCH 19/59] Improve __copy_to_user and __copy_from_user performance +Subject: [PATCH 080/170] 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. @@ -123550,7 +123341,7 @@ index 588bbc2..c29df92 100644 __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) { unsigned long ua_flags; -@@ -138,6 +183,54 @@ out: +@@ -138,6 +183,54 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) return n; } @@ -123636,14 +123427,11 @@ index 588bbc2..c29df92 100644 static unsigned long noinline __clear_user_memset(void __user *addr, unsigned long n) --- -2.5.0 - -From e8f7622b797353eb01277b988f5dcb01d4281762 Mon Sep 17 00:00:00 2001 +From 44d43099a94c8b2db818c80c67789ef5f9857b81 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 20/59] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 081/170] gpio-poweroff: Allow it to work on Raspberry Pi The Raspberry Pi firmware manages the power-down and reboot process. To do this it installs a pm_power_off handler, causing @@ -123677,14 +123465,11 @@ index be3d81f..a030ae9 100644 dev_err(&pdev->dev, "%s: pm_power_off function already registered", __func__); --- -2.5.0 - -From 8c8f50a7ed38607026f7d987f9ca2b589d2f0187 Mon Sep 17 00:00:00 2001 +From 5b2d8bca046bd6f1a426e9205f194ece5b95e300 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 21/59] spidev: Add "spidev" compatible string to silence +Subject: [PATCH 082/170] spidev: Add "spidev" compatible string to silence warning See: https://github.com/raspberrypi/linux/issues/1054 @@ -123704,14 +123489,11 @@ index d0e7dfc..57b0760 100644 {}, }; MODULE_DEVICE_TABLE(of, spidev_dt_ids); --- -2.5.0 - -From 3f7779b380bd473670d38dd4ff3d6513ec1a89c2 Mon Sep 17 00:00:00 2001 +From 534c337ea28bee34f886a1d1e00d281365c94efa Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 17:00:18 +0100 -Subject: [PATCH 22/59] scripts/dtc: Add overlay support +Subject: [PATCH 083/170] scripts/dtc: Add overlay support --- scripts/dtc/checks.c | 119 ++- @@ -123882,7 +123664,7 @@ index e81a8c74..efd1bc6 100644 }; diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l -index 0ee1caf..dd44ba2 100644 +index 0ee1caf0..dd44ba2 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l @@ -113,6 +113,11 @@ static void lexical_error(const char *fmt, ...); @@ -128115,16 +127897,12 @@ index 5b8c7d5..86b7338 100644 @@ -1 +1 @@ -#define DTC_VERSION "DTC 1.4.1-g9d3649bd" +#define DTC_VERSION "DTC 1.4.1-g9d3649bd-dirty" --- -2.5.0 - -From 74fb644989dfc1101e5ddca287ce58b8b5f41c79 Mon Sep 17 00:00:00 2001 +From b065c580329ecb7c7e77bb7019c6059d7db83398 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 23/59] Merge pull request #1043 from XECDesign/sense-4.0 +Subject: [PATCH 084/170] mfd: Add Raspberry Pi Sense HAT core driver -mfd: Add Raspberry Pi Sense HAT core driver --- drivers/input/joystick/Kconfig | 8 + drivers/input/joystick/Makefile | 1 + @@ -128147,7 +127925,7 @@ mfd: Add Raspberry Pi Sense HAT core driver create mode 100644 include/linux/mfd/rpisense/joystick.h diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig -index 4215b53..4364d7c 100644 +index 4215b53..4364d7c8 100644 --- a/drivers/input/joystick/Kconfig +++ b/drivers/input/joystick/Kconfig @@ -330,4 +330,12 @@ config JOYSTICK_MAPLE @@ -128175,7 +127953,7 @@ index 92dc0de..1758160 100644 diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c new file mode 100644 -index 0000000..9eca897 +index 0000000..6a41676 --- /dev/null +++ b/drivers/input/joystick/rpisense-js.c @@ -0,0 +1,153 @@ @@ -128199,8 +127977,8 @@ index 0000000..9eca897 +#include +#include + -+struct rpisense *rpisense; -+unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++static struct rpisense *rpisense; ++static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; + +static void keys_work_fn(struct work_struct *work) +{ @@ -128363,7 +128141,7 @@ index a8b76b8..e6339d2 100644 +obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c new file mode 100644 -index 0000000..7539547 +index 0000000..eea9312 --- /dev/null +++ b/drivers/mfd/rpisense-core.c @@ -0,0 +1,157 @@ @@ -128392,7 +128170,7 @@ index 0000000..7539547 +#include +#include + -+struct rpisense *rpisense; ++static struct rpisense *rpisense; + +static void rpisense_client_dev_register(struct rpisense *rpisense, + const char *name, @@ -128559,7 +128337,7 @@ index 9b086ac..7101277 100644 obj-$(CONFIG_FB_VIRTUAL) += vfb.o diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c new file mode 100644 -index 0000000..90553fa +index 0000000..26432a5 --- /dev/null +++ b/drivers/video/fbdev/rpisense-fb.c @@ -0,0 +1,293 @@ @@ -128596,7 +128374,7 @@ index 0000000..90553fa +module_param(lowlight, bool, 0); +MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); + -+struct rpisense *rpisense; ++static struct rpisense *rpisense; + +struct rpisense_fb_param { + char __iomem *vmem; @@ -128988,14 +128766,11 @@ index 0000000..56196dc + + +#endif --- -2.5.0 - -From c403980d1dddcb1c9eb149e6bda2a8057f4f859c Mon Sep 17 00:00:00 2001 +From c86a74aaff9bc42b3cb04881b3aaf7f822edda04 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 24/59] RaspiDAC3 support +Subject: [PATCH 085/170] RaspiDAC3 support Signed-off-by: Jan Grulich @@ -129242,14 +129017,11 @@ index 0000000..3cabf5b +MODULE_AUTHOR("Jan Grulich "); +MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From f1244f1b3c28e2bbf6fcb7887cd2353c19be1ece Mon Sep 17 00:00:00 2001 +From 2d340e2fbbc9f4735b798601a43ae9f0f4cc5742 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 24 Aug 2015 16:02:34 +0100 -Subject: [PATCH 25/59] tpa6130a2: Add headphone switch control +Subject: [PATCH 086/170] tpa6130a2: Add headphone switch control Signed-off-by: Jan Grulich --- @@ -129277,7 +129049,7 @@ index 11d85c5..3caaa17 100644 static int tpa6130a2_i2c_read(int reg) { struct tpa6130a2_data *data; -@@ -189,7 +192,7 @@ exit: +@@ -189,7 +192,7 @@ static int tpa6130a2_power(u8 power) } static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, @@ -129339,14 +129111,11 @@ index 11d85c5..3caaa17 100644 }; /* --- -2.5.0 - -From 4e237ee42e13fd4c1c2b1dd65d8f0ad58f4d601c Mon Sep 17 00:00:00 2001 +From 6fc9d40bec5dbcf3ae8b52ab6850ed0b18193c82 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 28 Sep 2015 23:38:59 +0100 -Subject: [PATCH 26/59] irq-bcm2835: Fix building with 2708 +Subject: [PATCH 087/170] irq-bcm2835: Fix building with 2708 --- drivers/irqchip/irq-bcm2835.c | 3 ++- @@ -129373,14 +129142,11 @@ index 20deb28..c02bf8a 100644 } } init_FIQ(FIQ_START); --- -2.5.0 - -From 256a8a32c69b5eeede30f5eb6674e7e2f4d5d50b Mon Sep 17 00:00:00 2001 +From 0e7ec1e61b149567d5af63169cd4d701c133356f Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 27/59] rpi_display: add backlight driver and overlay +Subject: [PATCH 088/170] rpi_display: add backlight driver and overlay Add a mailbox-driven backlight controller for the Raspberry Pi DSI touchscreen display. Requires updated GPU firmware to recognise the @@ -129458,7 +129224,7 @@ index 0000000..c021d02 + }; +}; diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index f5c5e87..38e46ac 100644 +index 16062bf..13999af 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig @@ -808,6 +808,7 @@ CONFIG_FB_UDL=m @@ -129470,7 +129236,7 @@ index f5c5e87..38e46ac 100644 CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_LOGO=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index c7d31e8..436da55 100644 +index 1d1b799..146add9 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -801,6 +801,7 @@ CONFIG_FB_UDL=m @@ -129647,14 +129413,11 @@ index 525816d..b011489 100644 RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, --- -2.5.0 - -From 4597458b3521c98d3260ed9a4eb739e6a6b5713c Mon Sep 17 00:00:00 2001 +From 0459ca97c1f2753ce805ab58ff17847cb4c142e0 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Mon, 16 Nov 2015 14:05:35 +0000 -Subject: [PATCH 28/59] bcm2835-dma: Fix up convert to DMA pool +Subject: [PATCH 089/170] bcm2835-dma: Fix up convert to DMA pool --- drivers/dma/bcm2835-dma.c | 36 ++++++++++++++++++++++++++---------- @@ -129738,14 +129501,11 @@ index 0adc347..985019b 100644 } else { /* Next block is empty. */ control_block->next = 0; --- -2.5.0 - -From a6a43f492a980a33e31d3960f1709defd6f1bd7b Mon Sep 17 00:00:00 2001 +From f6dd60426dc7970ef4e9e3d9e00d374f80a6abd2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 11 Nov 2015 11:38:59 +0000 -Subject: [PATCH 29/59] scripts: Multi-platform support for mkknlimg and +Subject: [PATCH 090/170] scripts: Multi-platform support for mkknlimg and knlinfo The firmware uses tags in the kernel trailer to choose which dtb file @@ -129993,14 +129753,11 @@ index 3998d43..005f404 100755 - my $val = $configs->{$wanted} || 'n'; - return (($val eq 'y') || ($val eq '1')); -} --- -2.5.0 - -From f95a3c1052bb61d28cc6a4a5ba5dfe691c1e5321 Mon Sep 17 00:00:00 2001 +From 6d38553e5ce7fb70dd1f89665caf58064a7e97d7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Mar 2015 13:01:12 -0800 -Subject: [PATCH 30/59] drm/vc4: Add suport for 3D rendering using the V3D +Subject: [PATCH 091/170] drm/vc4: Add suport for 3D rendering using the V3D engine. This is a squash of the out-of-tree development series. Since that @@ -130837,7 +130594,7 @@ index d5db9e0..3baf1fc 100644 ret = drm_dev_register(drm, 0); if (ret < 0) -@@ -200,8 +229,11 @@ unregister: +@@ -200,8 +229,11 @@ static int vc4_drm_bind(struct device *dev) drm_dev_unregister(drm); unbind_all: component_unbind_all(dev, drm); @@ -135371,7 +135128,7 @@ index 0000000..0aab9d7 +} diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h new file mode 100644 -index 0000000..499daae +index 0000000..499daae5 --- /dev/null +++ b/include/uapi/drm/vc4_drm.h @@ -0,0 +1,229 @@ @@ -135604,14 +135361,11 @@ index 0000000..499daae +}; + +#endif /* _UAPI_VC4_DRM_H_ */ --- -2.5.0 - -From f7c5c235d8ec8dad653d2ba5ddeed98c11ee3dc0 Mon Sep 17 00:00:00 2001 +From aa579c7485e1bae681c50b223e89cd658dd0b2c1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Oct 2015 11:32:14 -0700 -Subject: [PATCH 31/59] drm/vc4: Force HDMI to connected. +Subject: [PATCH 092/170] drm/vc4: Force HDMI to connected. For some reason on the downstream tree, the HPD GPIO isn't working. @@ -135633,14 +135387,11 @@ index da9a36d..d15c529 100644 if (vc4->hdmi->hpd_gpio) { if (gpio_get_value(vc4->hdmi->hpd_gpio)) return connector_status_connected; --- -2.5.0 - -From 77b1bdbe5ff38d999a3c45b4ce34dcf3bb1a59a5 Mon Sep 17 00:00:00 2001 +From edb828d91374e8fa4f05d68be008c40d4f9a158d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:23:18 -0700 -Subject: [PATCH 32/59] drm/vc4: bo cache locking fixes. +Subject: [PATCH 093/170] drm/vc4: bo cache locking fixes. Signed-off-by: Eric Anholt --- @@ -135788,14 +135539,11 @@ index 8cc89d1..c079b82 100644 /* Sequence number for the last job queued in job_list. * Starts at 0 (no jobs emitted). --- -2.5.0 - -From ada48bc2dcabe8dabce74f2700bde6186fc00366 Mon Sep 17 00:00:00 2001 +From eafd7a031a15fb0d51a86b89e42ccde4f23434b4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:29:41 -0700 -Subject: [PATCH 33/59] drm/vc4: bo cache locking cleanup. +Subject: [PATCH 094/170] drm/vc4: bo cache locking cleanup. Signed-off-by: Eric Anholt --- @@ -135886,14 +135634,11 @@ index af0fde6..acd360c 100644 } static void vc4_bo_cache_time_timer(unsigned long data) --- -2.5.0 - -From 7ff769a1ebaa17c37d4a698af37ab71ff38ff5b8 Mon Sep 17 00:00:00 2001 +From 482f2b3e97e919ac0ebc55a6040747495563b9a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:32:24 -0700 -Subject: [PATCH 34/59] drm/vc4: Use job_lock to protect seqno_cb_list. +Subject: [PATCH 095/170] drm/vc4: Use job_lock to protect seqno_cb_list. We're (mostly) not supposed to be using struct_mutex in drivers these days. @@ -135946,14 +135691,11 @@ index 361390b..b1853b2 100644 return ret; } --- -2.5.0 - -From 3f5a87a8113d0026a92a48376dc63e1d3834ca90 Mon Sep 17 00:00:00 2001 +From 4dc15a296586679d5b014011e44a093cf962123e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:44:35 -0700 -Subject: [PATCH 35/59] drm/vc4: Drop struct_mutex around CL validation. +Subject: [PATCH 096/170] drm/vc4: Drop struct_mutex around CL validation. We were using it so that we could make sure that shader validation state didn't change while we were validating, but now shader @@ -136015,14 +135757,11 @@ index b1853b2..32f375a 100644 return ret; } --- -2.5.0 - -From 96ff83b46b899239914c4f82583694b220abf12a Mon Sep 17 00:00:00 2001 +From f1924e632d16f98eee1fe1be636249b8cee4ee6e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:44:35 -0700 -Subject: [PATCH 36/59] drm/vc4: Drop struct_mutex around CL validation. +Subject: [PATCH 097/170] drm/vc4: Drop struct_mutex around CL validation. We were using it so that we could make sure that shader validation state didn't change while we were validating, but now shader @@ -136042,7 +135781,7 @@ diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 32f375a..55551ea 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -439,10 +439,12 @@ fail: +@@ -439,10 +439,12 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) } static void @@ -136095,14 +135834,11 @@ index 32f375a..55551ea 100644 return ret; } --- -2.5.0 - -From 5132c04865bb90f75210e68e2b134a8a81a600a0 Mon Sep 17 00:00:00 2001 +From 0193a1e5b931c7363279282b4169c2152af1a621 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Oct 2015 13:59:15 +0100 -Subject: [PATCH 37/59] drm/vc4: Add support for more display plane formats. +Subject: [PATCH 098/170] drm/vc4: Add support for more display plane formats. Signed-off-by: Eric Anholt --- @@ -136136,14 +135872,11 @@ index 65e5455..0f85eb5 100644 }; static const struct hvs_format *vc4_get_hvs_format(u32 drm_format) --- -2.5.0 - -From aef868d034a4288d82a6c54422a6f995cb406d3b Mon Sep 17 00:00:00 2001 +From 8faa3b83201819d56f997a2b2ecaf8c690080852 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 23 Oct 2015 12:31:56 +0100 -Subject: [PATCH 38/59] drm/vc4: No need to stop the stopped threads. +Subject: [PATCH 099/170] drm/vc4: No need to stop the stopped threads. This was leftover debug code from the hackdriver. We never submit unless the thread is already idle. @@ -136168,14 +135901,11 @@ index 55551ea..eeb0925 100644 V3D_WRITE(V3D_CTNCA(thread), start); barrier(); --- -2.5.0 - -From 977b27a2302f3e2317b4fa28f7aba9c73c77e7ef Mon Sep 17 00:00:00 2001 +From d102d0e145b58bccbea52e89bbe52dcefc044aaa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 23 Oct 2015 12:33:43 +0100 -Subject: [PATCH 39/59] drm/vc4: Remove extra barrier()s aroudn CTnCA/CTnEA +Subject: [PATCH 100/170] drm/vc4: Remove extra barrier()s aroudn CTnCA/CTnEA setup. The writel() that these expand to already does barriers. @@ -136207,14 +135937,11 @@ index eeb0925..0cea723 100644 } int --- -2.5.0 - -From 45832cd341f53f157ae1e679c06faef3d498db37 Mon Sep 17 00:00:00 2001 +From 0f099b4b1354b0377376b91ae60c6c16d82683a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 23 Oct 2015 14:57:22 +0100 -Subject: [PATCH 40/59] drm/vc4: Fix a typo in a V3D debug register. +Subject: [PATCH 101/170] drm/vc4: Fix a typo in a V3D debug register. Signed-off-by: Eric Anholt --- @@ -136248,15 +135975,12 @@ index b9cb7cf..cf35f58 100644 REGDEF(V3D_FDBGO), REGDEF(V3D_FDBGB), REGDEF(V3D_FDBGR), --- -2.5.0 - -From e44474f1a0149abb2608e57d7ad70f6eb160d18b Mon Sep 17 00:00:00 2001 +From 22182768add611b53e33c5dd2e8901acc3d08181 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 2 Nov 2015 17:07:33 +0000 -Subject: [PATCH 41/59] drm/vc4: Enable VC4 modules, and increase CMA size with - overlay +Subject: [PATCH 102/170] drm/vc4: Enable VC4 modules, and increase CMA size + with overlay If using the overlay, be careful not to boot to GUI or run startx, or the Pi will almost hang, reporting stalls in kernel threads. @@ -136389,7 +136113,7 @@ index 0000000..cf5d5c9 + }; +}; diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 38e46ac..49317b9 100644 +index 13999af..4e474c7 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig @@ -802,6 +802,8 @@ CONFIG_VIDEO_TW9903=m @@ -136402,7 +136126,7 @@ index 38e46ac..49317b9 100644 CONFIG_FB_BCM2708=y CONFIG_FB_UDL=m diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 436da55..202dd4b 100644 +index 146add9..d6aa058 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -795,6 +795,8 @@ CONFIG_VIDEO_TW9903=m @@ -136414,14 +136138,11 @@ index 436da55..202dd4b 100644 CONFIG_FB=y CONFIG_FB_BCM2708=y CONFIG_FB_UDL=m --- -2.5.0 - -From 64f336d46a8b61002efa54b58f1612cf03ab9930 Mon Sep 17 00:00:00 2001 +From 88315025318218ac04fcc66614083bb1a51f662f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Nov 2015 18:29:58 +0000 -Subject: [PATCH 42/59] squash: fixups +Subject: [PATCH 103/170] squash: fixups --- drivers/gpu/drm/vc4/Kconfig | 2 +- @@ -136467,14 +136188,12 @@ index c83287a..2082713 100644 drm_atomic_helper_commit_modeset_enables(dev, state); --- -2.5.0 - -From 5b553943a83156a46b864cca4ee0fdb0f2fc6882 Mon Sep 17 00:00:00 2001 +From 3fc233b798ac8498b4e24b42ad67fb3499a30f07 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Nov 2015 20:26:03 +0000 -Subject: [PATCH 43/59] squash: add missing vc4-kms-v3d-overlay.dtb to makefile +Subject: [PATCH 104/170] squash: add missing vc4-kms-v3d-overlay.dtb to + makefile --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -136492,14 +136211,11 @@ index fb7ac49..fc09bfb 100644 dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb --- -2.5.0 - -From 5ac43b46f57d2cbe94c4d8a34e050eec9a625ce5 Mon Sep 17 00:00:00 2001 +From d9888c76bcee2a7c118ab8ba93a1204fb5ff4e44 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Oct 2015 11:23:34 -0700 -Subject: [PATCH 44/59] clk: bcm2835: Also build the driver for downstream +Subject: [PATCH 105/170] clk: bcm2835: Also build the driver for downstream kernels. Signed-off-by: Eric Anholt @@ -136520,14 +136236,11 @@ index 3fc9506..a1b4cbc 100644 obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o --- -2.5.0 - -From c0ba37a2a85130b7a0f88730eba2783c6dcd6951 Mon Sep 17 00:00:00 2001 +From 0dbc0fe760a54bbcff587657062df49dc0eaf2b9 Mon Sep 17 00:00:00 2001 From: Holger Steinhaus Date: Sat, 14 Nov 2015 18:37:43 +0100 -Subject: [PATCH 45/59] dts: Added overlay for gpio_ir_recv driver +Subject: [PATCH 106/170] dts: Added overlay for gpio_ir_recv driver --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -136635,15 +136348,12 @@ index 0000000..a2d6bc7 + rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map + }; +}; --- -2.5.0 - -From 26e029b1b51f165e9cf74ea5ab311adaa1bf2e01 Mon Sep 17 00:00:00 2001 +From 938b09ce6c6736d0861c2c9eec3a7e739585b589 Mon Sep 17 00:00:00 2001 From: Alistair Buxton Date: Sun, 1 Nov 2015 22:27:56 +0000 -Subject: [PATCH 46/59] Build i2c_gpio module and add a device tree overlay to - configure it. +Subject: [PATCH 107/170] Build i2c_gpio module and add a device tree overlay + to configure it. --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -136727,7 +136437,7 @@ index 0000000..2a2dc98 +}; + diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 49317b9..1f47fb7 100644 +index 4e474c7..fc35254 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig @@ -595,6 +595,7 @@ CONFIG_RAW_DRIVER=y @@ -136739,7 +136449,7 @@ index 49317b9..1f47fb7 100644 CONFIG_SPI_BCM2835=m CONFIG_SPI_SPIDEV=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 202dd4b..015a2b3 100644 +index d6aa058..51dc019 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -588,6 +588,7 @@ CONFIG_RAW_DRIVER=y @@ -136750,14 +136460,11 @@ index 202dd4b..015a2b3 100644 CONFIG_SPI=y CONFIG_SPI_BCM2835=m CONFIG_SPI_SPIDEV=y --- -2.5.0 - -From fd5bec91d5ce5bf001f8147a73c79bbf9d50d581 Mon Sep 17 00:00:00 2001 +From a4b5aa412585674d4a4f2ba7c0d818fd796f51c3 Mon Sep 17 00:00:00 2001 From: mwilliams03 Date: Sun, 18 Oct 2015 17:07:24 -0700 -Subject: [PATCH 47/59] New overlay for PiScreen2r +Subject: [PATCH 108/170] New overlay for PiScreen2r --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -136909,14 +136616,11 @@ index 0000000..7c018e0 + }; +}; + --- -2.5.0 - -From 9b04ba6644143db182164e74e06563b9064fca7f Mon Sep 17 00:00:00 2001 +From 1a4fac1ea6bb33a963b06406f6f44b527daa3a90 Mon Sep 17 00:00:00 2001 From: Ondrej Wisniewski Date: Fri, 6 Nov 2015 15:01:28 +0100 -Subject: [PATCH 48/59] dts: Added overlay for Adafruit PiTFT 2.8" capacitive +Subject: [PATCH 109/170] dts: Added overlay for Adafruit PiTFT 2.8" capacitive touch screen --- @@ -137065,14 +136769,11 @@ index 0000000..48920e9 + touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; + }; +}; --- -2.5.0 - -From 22cc43d30298abcdac34ef08074d87104be8edeb Mon Sep 17 00:00:00 2001 +From 660ba9173ca14b48d7cd2f69ff45e67ebe4d947a Mon Sep 17 00:00:00 2001 From: Stuart MacLean Date: Fri, 2 Oct 2015 15:12:59 +0100 -Subject: [PATCH 49/59] Add support for the HiFiBerry DAC+ Pro. +Subject: [PATCH 110/170] Add support for the HiFiBerry DAC+ Pro. The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. @@ -137087,7 +136788,7 @@ An addition bug fix is included for the PCM512x codec where by the physical size create mode 100644 drivers/clk/clk-hifiberry-dacpro.c diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -index deb9c62..f923a48 100644 +index deb9c625..f923a48 100644 --- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts @@ -6,6 +6,16 @@ @@ -137606,7 +137307,7 @@ index 11e4f39..a6b651c 100644 ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c -index 047c489..090fe0e 100644 +index 047c489..090fe0ee 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c @@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, @@ -137619,14 +137320,11 @@ index 047c489..090fe0e 100644 if (lrclk_div == 0) { dev_err(dev, "No LRCLK?\n"); return -EINVAL; --- -2.5.0 - -From 855f9adc802916fa951051daf6ee6af440888688 Mon Sep 17 00:00:00 2001 +From 14b6c7013e62b3917ce73841dc8e379d011d37a5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 5 Oct 2015 10:47:45 +0100 -Subject: [PATCH 50/59] BCM270X_DT: Add at86rf233 overlay +Subject: [PATCH 111/170] BCM270X_DT: Add at86rf233 overlay Add an overlay to support the Atmel AT86RF233 WPAN transceiver on spi0.0. @@ -137760,14 +137458,11 @@ index 0000000..0460269 + trim = <&lowpan0>, "xtal-trim.0"; + }; +}; --- -2.5.0 - -From cb447e6fe0a7f42f915c46362aad4944da91518f Mon Sep 17 00:00:00 2001 +From d33b3717e86cd6aa28c58d465a22e6c11a66bc13 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 51/59] mm: Remove the PFN busy warning +Subject: [PATCH 112/170] mm: Remove the PFN busy warning See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is expected sometimes when using CMA. However, that commit still spams @@ -137791,15 +137486,12 @@ index 9d666df..b682acc 100644 ret = -EBUSY; goto done; } --- -2.5.0 - -From d3ab193e2ccff0b434de0606b3c99802efb6c7b4 Mon Sep 17 00:00:00 2001 +From a71d6ebfcbc401e520fa4a5aa185d027dfbe5ce1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 Nov 2014 12:06:38 -0800 -Subject: [PATCH 52/59] drm: Put an optional field in the driver struct for GEM - obj struct size. +Subject: [PATCH 113/170] drm: Put an optional field in the driver struct for + GEM obj struct size. This allows a driver to derive from the CMA object without copying all of the code. @@ -137839,14 +137531,11 @@ index 0a271ca..54f5469 100644 const struct drm_ioctl_desc *ioctls; int num_ioctls; const struct file_operations *fops; --- -2.5.0 - -From 4eaaf2ad0c84b80573e15529570380a95b6cbfdf Mon Sep 17 00:00:00 2001 +From 1c343ed1f86866d2625518774536bbef77f7a20a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Oct 2015 10:09:02 -0700 -Subject: [PATCH 53/59] drm/vc4: Add an interface for capturing the GPU state +Subject: [PATCH 114/170] drm/vc4: Add an interface for capturing the GPU state after a hang. This can be parsed with vc4-gpu-tools tools for trying to figure out @@ -138119,7 +137808,7 @@ index 0cea723..d90c664 100644 + vc4_free_hang_state(dev, vc4->hang_state); } diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -index 499daae..4a8d19f 100644 +index 499daae5..4a8d19f 100644 --- a/include/uapi/drm/vc4_drm.h +++ b/include/uapi/drm/vc4_drm.h @@ -32,6 +32,7 @@ @@ -138186,14 +137875,11 @@ index 499daae..4a8d19f 100644 +}; + #endif /* _UAPI_VC4_DRM_H_ */ --- -2.5.0 - -From 5f726bd15729062dd4cf89c22d9f15d4c2979d3d Mon Sep 17 00:00:00 2001 +From 431be9af0aa88da94986effdff649330cfde1f5a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 4 Dec 2015 11:35:34 -0800 -Subject: [PATCH 54/59] drm/vc4: Update a bunch of code to match upstream +Subject: [PATCH 115/170] drm/vc4: Update a bunch of code to match upstream submission. This gets almost everything matching, except for the MSAA support and @@ -138745,7 +138431,7 @@ index e8192b4..22061ae 100644 .desc = DRIVER_DESC, .date = DRIVER_DATE, diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 24845c1..53dfa8d 100644 +index 24845c1..53dfa8df 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -72,6 +72,9 @@ struct vc4_dev { @@ -138947,7 +138633,7 @@ index 2082713..f95f2df 100644 } } diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h -index 9757bc8..cee38aa 100644 +index 9757bc8..cee38aad 100644 --- a/drivers/gpu/drm/vc4/vc4_packet.h +++ b/drivers/gpu/drm/vc4/vc4_packet.h @@ -27,60 +27,60 @@ @@ -139654,7 +139340,7 @@ index cf35f58..29a222f 100644 struct drm_device *drm = dev_get_drvdata(master); struct vc4_dev *vc4 = to_vc4_dev(drm); diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index ff3b62f..e44e355 100644 +index ff3b62f..e44e35539 100644 --- a/drivers/gpu/drm/vc4/vc4_validate.c +++ b/drivers/gpu/drm/vc4/vc4_validate.c @@ -48,7 +48,6 @@ @@ -140112,15 +139798,12 @@ index 54f5469..987c25a 100644 const struct drm_ioctl_desc *ioctls; int num_ioctls; const struct file_operations *fops; --- -2.5.0 - -From a8812101ce0faa865c1b75e461d5f05d8a43b9e3 Mon Sep 17 00:00:00 2001 +From 7d4ed9f40e9484ded3965b13fbb7914a1daf85d7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 11 Dec 2015 19:45:03 -0800 -Subject: [PATCH 55/59] drm: Use the driver's gem_object_free function from CMA - helpers. +Subject: [PATCH 116/170] drm: Use the driver's gem_object_free function from + CMA helpers. VC4 wraps the CMA objects in its own structures, so it needs to do its own teardown (waiting for GPU to finish, updating bo_stats tracking). @@ -140179,14 +139862,11 @@ index 0f7b00b..e5df53b 100644 return ERR_PTR(ret); } --- -2.5.0 - -From 7c236c874ffa28be6d8b1b07366bc7821a844db0 Mon Sep 17 00:00:00 2001 +From 522e6f9cc4376fe49e8b41b40e7ddb98cf385a9e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 17 Jul 2015 13:15:50 -0700 -Subject: [PATCH 56/59] drm/vc4: Add support for MSAA rendering. +Subject: [PATCH 117/170] drm/vc4: Add support for MSAA rendering. For MSAA, you set a bit in the binner that halves the size of tiles in each direction, so you can pack 4 samples per pixel in the tile @@ -140205,7 +139885,7 @@ Signed-off-by: Eric Anholt 4 files changed, 258 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h -index cee38aa..0f31cc0 100644 +index cee38aad..0f31cc0 100644 --- a/drivers/gpu/drm/vc4/vc4_packet.h +++ b/drivers/gpu/drm/vc4/vc4_packet.h @@ -123,6 +123,11 @@ enum vc4_packet { @@ -140661,7 +140341,7 @@ index 3516354..8f2ec57 100644 return -EINVAL; } diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index e44e355..2f22f19 100644 +index e44e35539..2f22f19 100644 --- a/drivers/gpu/drm/vc4/vc4_validate.c +++ b/drivers/gpu/drm/vc4/vc4_validate.c @@ -400,9 +400,8 @@ validate_tile_binning_config(VALIDATE_ARGS) @@ -140709,14 +140389,11 @@ index 4a8d19f..49cd992 100644 uint32_t clear_color[2]; uint32_t clear_z; uint8_t clear_s; --- -2.5.0 - -From c5f0c816c8fb2dc259d2ffe1ec6ea143658c3731 Mon Sep 17 00:00:00 2001 +From 50a1843ffd2e6f408dcb6a64ca0a2ef3b062fd5a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 8 Dec 2015 14:00:43 -0800 -Subject: [PATCH 57/59] drm/vc4: A few more non-functional changes to sync to +Subject: [PATCH 118/170] drm/vc4: A few more non-functional changes to sync to upstream. At this point all that's left is the force-enable of HDMI connector, @@ -140730,7 +140407,7 @@ Signed-off-by: Eric Anholt 2 files changed, 92 insertions(+), 92 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -index 29a222f..4d103f7 100644 +index 29a222f..4d103f7f 100644 --- a/drivers/gpu/drm/vc4/vc4_v3d.c +++ b/drivers/gpu/drm/vc4/vc4_v3d.c @@ -109,7 +109,7 @@ static const struct { @@ -141059,14 +140736,11 @@ index 49cd992..eeb37e3 100644 }; #endif /* _UAPI_VC4_DRM_H_ */ --- -2.5.0 - -From a28a42a7faea43197392a90984f5354168494f14 Mon Sep 17 00:00:00 2001 +From 0a373a81664b9e9b8994512fb3d15ed296526e89 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 15 Dec 2015 23:46:32 +0000 -Subject: [PATCH 58/59] drm/vc4: Use "hpd-gpios" for HDMI GPIO, like what +Subject: [PATCH 119/170] drm/vc4: Use "hpd-gpios" for HDMI GPIO, like what landed upstream. Signed-off-by: Eric Anholt @@ -141087,15 +140761,12 @@ index cf5d5c9..da37483 100644 clocks = <&cprman BCM2835_PLLH_PIX>, <&cprman BCM2835_CLOCK_HSM>; clock-names = "pixel", "hdmi"; --- -2.5.0 - -From 8353706bc1d231c15c7113e678cfeeefe03e9eaf Mon Sep 17 00:00:00 2001 +From f8453aacbe60712c31c57580a126017b798bd339 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 7 Dec 2015 12:35:01 -0800 -Subject: [PATCH 59/59] drm/vc4: Synchronize validation code for v2 submission - upstream. +Subject: [PATCH 120/170] drm/vc4: Synchronize validation code for v2 + submission upstream. Signed-off-by: Eric Anholt --- @@ -141106,7 +140777,7 @@ Signed-off-by: Eric Anholt 4 files changed, 135 insertions(+), 196 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 53dfa8d..ed93fa7 100644 +index 53dfa8df..ed93fa78 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -189,17 +189,6 @@ to_vc4_encoder(struct drm_encoder *encoder) @@ -141710,6 +141381,7975 @@ index 2f22f19..0fb5b99 100644 if (ret) return ret; } --- -2.5.0 +From 280bea89916813978b81811c2769411d438eb52f Mon Sep 17 00:00:00 2001 +From: janluca +Date: Sun, 27 Dec 2015 14:34:04 +0100 +Subject: [PATCH 121/170] MMC: Do not use mmc_debug if CONFIG_MMC_BCM2835 is + not set + +If CONFIG_MMC_BCM2835 was not set the compiling of the kernel failed +since mmc_debug was not defined but used in drivers/mmc/core/quirks.c. + +This patch add a ifdef-check for CONFIG_MMC_BCM2835 to the change of +commit 64d395457f793250d2e582eeb38cc3403b1db98c +--- + drivers/mmc/core/quirks.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c +index 87ae2e9..b79fe14 100644 +--- a/drivers/mmc/core/quirks.c ++++ b/drivers/mmc/core/quirks.c +@@ -53,7 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { + + void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + { ++#ifdef CONFIG_MMC_BCM2835 + extern unsigned mmc_debug; ++#endif + const struct mmc_fixup *f; + u64 rev = cid_rev_card(card); + +@@ -81,7 +83,9 @@ 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). + */ ++#ifdef CONFIG_MMC_BCM2835 + if (mmc_debug & (1<<13)) + card->quirks |= MMC_QUIRK_BLK_NO_CMD23; ++#endif + } + EXPORT_SYMBOL(mmc_fixup_device); + +From d0390ae0ff774d8e7b5b4d5f38c33726354996bc Mon Sep 17 00:00:00 2001 +From: Devon Fyson +Date: Wed, 30 Dec 2015 16:40:47 -0500 +Subject: [PATCH 122/170] Extend clock timeout, fix modprobe baudrate + parameter. + +Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs.\n- Increase priority of baudrate parameter passed to modprobe (in /etc/modprobe.d/*.conf or command line). Currently custom baudrates don't work because they are overridden by clock-frequency in the platform_device passed to the function. +--- + drivers/i2c/busses/i2c-bcm2708.c | 45 ++++++++++++++++++++++++++-------------- + 1 file changed, 29 insertions(+), 16 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c +index 85f411c..b152639 100644 +--- a/drivers/i2c/busses/i2c-bcm2708.c ++++ b/drivers/i2c/busses/i2c-bcm2708.c +@@ -71,7 +71,8 @@ + + #define DRV_NAME "bcm2708_i2c" + +-static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE; ++static unsigned int baudrate_default = CONFIG_I2C_BCM2708_BAUDRATE; ++static unsigned int baudrate; + module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); + MODULE_PARM_DESC(baudrate, "The I2C baudrate"); + +@@ -87,6 +88,7 @@ struct bcm2708_i2c { + int irq; + struct clk *clk; + u32 cdiv; ++ u32 clk_tout; + + struct completion done; + +@@ -126,7 +128,7 @@ static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi) + + static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) + { +- u32 cdiv, s; ++ u32 cdiv, s, clk_tout; + u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; + int wait_loops = I2C_WAIT_LOOP_COUNT; + +@@ -134,12 +136,14 @@ static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) + * Use the value that we cached in the probe. + */ + cdiv = bi->cdiv; ++ clk_tout = bi->clk_tout; + + if (bi->msg->flags & I2C_M_RD) + c |= BSC_C_INTR | BSC_C_READ; + else + c |= BSC_C_INTT; + ++ bcm2708_wr(bi, BSC_CLKT, clk_tout); + bcm2708_wr(bi, BSC_DIV, cdiv); + bcm2708_wr(bi, BSC_A, bi->msg->addr); + bcm2708_wr(bi, BSC_DLEN, bi->msg->len); +@@ -312,21 +316,24 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + struct bcm2708_i2c *bi; + struct i2c_adapter *adap; + unsigned long bus_hz; +- u32 cdiv; +- +- if (pdev->dev.of_node) { +- u32 bus_clk_rate; +- pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); +- if (pdev->id < 0) { +- dev_err(&pdev->dev, "alias is missing\n"); +- return -EINVAL; ++ u32 cdiv, clk_tout; ++ ++ if (!baudrate) { ++ baudrate = baudrate_default; ++ if (pdev->dev.of_node) { ++ u32 bus_clk_rate; ++ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); ++ if (pdev->id < 0) { ++ dev_err(&pdev->dev, "alias is missing\n"); ++ return -EINVAL; ++ } ++ if (!of_property_read_u32(pdev->dev.of_node, ++ "clock-frequency", &bus_clk_rate)) ++ baudrate = bus_clk_rate; ++ else ++ dev_warn(&pdev->dev, ++ "Could not read clock-frequency property\n"); + } +- if (!of_property_read_u32(pdev->dev.of_node, +- "clock-frequency", &bus_clk_rate)) +- baudrate = bus_clk_rate; +- else +- dev_warn(&pdev->dev, +- "Could not read clock-frequency property\n"); + } + + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); +@@ -417,7 +424,13 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + cdiv = 0xffff; + baudrate = bus_hz / cdiv; + } ++ ++ clk_tout = 35/1000*baudrate; //35ms timeout as per SMBus specs. ++ if (clk_tout > 0xffff) ++ clk_tout = 0xffff; ++ + bi->cdiv = cdiv; ++ bi->clk_tout = clk_tout; + + dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", + pdev->id, (unsigned long)regs->start, irq, baudrate); + +From 62dca1937fc3acfe4b6471607b7a4d58c34e73b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 31 Dec 2015 16:44:58 +0100 +Subject: [PATCH 123/170] bcm270x_dt: Add dwc2 and dwc-otg overlays + +--- + arch/arm/boot/dts/overlays/Makefile | 2 ++ + arch/arm/boot/dts/overlays/README | 21 +++++++++++++++++++ + arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 ++++++++++++++++++ + arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 ++++++++++++++++++++++++++ + 4 files changed, 72 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index be9dead..aaa8976 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -15,6 +15,8 @@ endif + dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += at86rf233-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += dwc2-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += dwc-otg-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += gpio-ir-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 04e55ce..c70c1e59 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -198,6 +198,27 @@ Params: gpiopin GPIO connected to the sensor's DATA output. + (default 4) + + ++Name: dwc-otg ++Info: Selects the dwc_otg USB controller driver which has fiq support. This ++ is the default on all except the Pi Zero which defaults to dwc2. ++Load: dtoverlay=dwc-otg ++Params: ++ ++ ++Name: dwc2 ++Info: Selects the dwc2 USB controller driver ++Load: dtoverlay=dwc2,= ++Params: dr_mode Dual role mode: "host", "peripheral" or "otg" ++ ++ g-rx-fifo-size Size of rx fifo size in gadget mode ++ ++ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget ++ mode ++ ++ g-tx-fifo-size Size of periodic tx fifo per endpoint ++ (except ep0) in gadget mode ++ ++ + [ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] + + +diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +new file mode 100644 +index 0000000..fc48bd1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +@@ -0,0 +1,20 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ __overlay__ { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +new file mode 100644 +index 0000000..90c9811 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +@@ -0,0 +1,29 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ __overlay__ { ++ compatible = "brcm,bcm2835-usb"; ++ reg = <0x7e980000 0x10000>; ++ interrupts = <1 9>; ++ dr_mode = "otg"; ++ g-np-tx-fifo-size = <32>; ++ g-rx-fifo-size = <256>; ++ g-tx-fifo-size = <256 128 128 64 64 64 32>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ dr_mode = <&usb>, "dr_mode"; ++ g-np-tx-fifo-size = <&usb>,"g-np-tx-fifo-size:0"; ++ g-rx-fifo-size = <&usb>,"g-rx-fifo-size:0"; ++ g-tx-fifo-size = <&usb>,"g-tx-fifo-size:0"; ++ }; ++}; + +From 162dd00041afb2995f90a928ea80aeaa0d141ce5 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 4 Jan 2016 14:42:17 +0000 +Subject: [PATCH 124/170] BCM270X_DT: Add the sdtweak overlay, for tuning + sdhost + +The sdhost overlay declares the sdhost interface and allows parameters +to be set. This is overkill for situations where the user just wants to +tweak the parameters of a pre-declared sdhost interface, so create an +sdtweak overlay that does just that. +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 14 ++++++++++++++ + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 21 +++++++++++++++++++++ + 3 files changed, 36 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index aaa8976..4d9d640 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -53,6 +53,7 @@ dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += sdio-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += sdtweak-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index c70c1e59..00f03fc 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -635,6 +635,20 @@ Params: overclock_50 Clock (in MHz) to use when the MMC framework + (default on: polling once at boot-time) + + ++Name: sdtweak ++Info: Tunes the bcm2835-sdhost SD/MMC driver ++Load: dtoverlay=sdtweak,= ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ + Name: smi + Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! + Load: dtoverlay=smi +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +new file mode 100644 +index 0000000..74c168d +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -0,0 +1,21 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sdhost>; ++ frag1: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag1>,"brcm,overclock-50:0"; ++ force_pio = <&frag1>,"brcm,force-pio?"; ++ pio_limit = <&frag1>,"brcm,pio-limit:0"; ++ debug = <&frag1>,"brcm,debug?"; ++ }; ++}; + +From b07c427a7732a0fabcf521085e0fd61b0ef9047c Mon Sep 17 00:00:00 2001 +From: Andrew Litt +Date: Mon, 11 Jan 2016 07:54:21 +0000 +Subject: [PATCH 125/170] bcm2835-mmc: Don't override bus width capabilities + from devicetree + +Take out the force setting of the MMC_CAP_4_BIT_DATA host capability +so that the result read from devicetree via mmc_of_parse() is +preserved. +--- + drivers/mmc/host/bcm2835-mmc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +index 43aed6e..104f93e 100644 +--- a/drivers/mmc/host/bcm2835-mmc.c ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -1305,7 +1305,7 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host) + /* host controller capabilities */ + mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | + MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | +- MMC_CAP_MMC_HIGHSPEED | MMC_CAP_4_BIT_DATA; ++ MMC_CAP_MMC_HIGHSPEED; + + mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; + + +From f74652d026105ecc4a87b581a9c1c89a6e504d2c Mon Sep 17 00:00:00 2001 +From: Andrew Litt +Date: Mon, 11 Jan 2016 07:55:54 +0000 +Subject: [PATCH 126/170] SDIO-overlay: add bus_width parameter + +Allow setting of the SDIO bus width capability of the bcm2835-mmc +host. This is helpful when only a 1 bit wide bus is connected +between host and device but both host and device advertise 4 bit +mode. +--- + arch/arm/boot/dts/overlays/README | 2 ++ + arch/arm/boot/dts/overlays/sdio-overlay.dts | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 00f03fc..aa57078 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -634,6 +634,8 @@ Params: overclock_50 Clock (in MHz) to use when the MMC framework + poll_once Disable SDIO-device polling every second + (default on: polling once at boot-time) + ++ bus_width Set the SDIO host bus width (default 4 bits) ++ + + Name: sdtweak + Info: Tunes the bcm2835-sdhost SD/MMC driver +diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts +index afc8742..7935e7a 100644 +--- a/arch/arm/boot/dts/overlays/sdio-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts +@@ -11,6 +11,7 @@ + pinctrl-names = "default"; + pinctrl-0 = <&sdio_pins>; + non-removable; ++ bus-width = <4>; + status = "okay"; + }; + }; +@@ -28,5 +29,6 @@ + + __overrides__ { + poll_once = <&sdio_mmc>,"non-removable?"; ++ bus_width = <&sdio_mmc>,"bus-width:0"; + }; + }; + +From 232754cb0ecd1967a8b72d6bd05467843d65a441 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 8 Jan 2016 13:42:06 +0000 +Subject: [PATCH 127/170] FIXUP BCM270X_DT: "random" (HWRNG) dtparam default is + on + +--- + arch/arm/boot/dts/overlays/README | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index aa57078..34a1b7f 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -110,7 +110,7 @@ Params: + (default "off") + + random Set to "on" to enable the hardware random +- number generator (default "off") ++ number generator (default "on") + + uart0 Set to "off" to disable uart0 (default "on") + + +From 320bdec200197f074541e3999fa4b87889c5eb18 Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:41:45 +0100 +Subject: [PATCH 128/170] bcm2835: extend allowed range of channels and + samplerates + +Allow everything the videocore accepts. +--- + sound/arm/bcm2835-pcm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index 8c86375..31e3131 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -26,9 +26,9 @@ static struct snd_pcm_hardware snd_bcm2835_playback_hw = { + .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, + .rate_min = 8000, +- .rate_max = 48000, ++ .rate_max = 192000, + .channels_min = 1, +- .channels_max = 2, ++ .channels_max = 8, + .buffer_bytes_max = 128 * 1024, + .period_bytes_min = 1 * 1024, + .period_bytes_max = 128 * 1024, +@@ -43,9 +43,9 @@ static struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { + .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000, + .rate_min = 44100, +- .rate_max = 48000, ++ .rate_max = 192000, + .channels_min = 2, +- .channels_max = 2, ++ .channels_max = 8, + .buffer_bytes_max = 128 * 1024, + .period_bytes_min = 1 * 1024, + .period_bytes_max = 128 * 1024, + +From 7e634c8f8fe70286e0b8b404494d3143aa7bc3fc Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:42:18 +0100 +Subject: [PATCH 129/170] bcm2835: restrict channels*rate to 8*960000 + +This is required at least for SPDIF. If the bitrate goes above, +videocore will either resample the audio or corrupt it due to +underruns. Supposedly the hardware isn't designed to output +higher rates, but it can still resample it down to supported +rates. + +Some code is based on ac97_pcm.c. +--- + sound/arm/bcm2835-pcm.c | 41 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 41 insertions(+) + +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index 31e3131..b17ed32 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -19,6 +19,9 @@ + + #include "bcm2835.h" + ++/* The hardware can not do much more num_channels*samplerate then this value */ ++#define MAX_COMBINED_RATE 768000 ++ + /* hardware definition */ + static struct snd_pcm_hardware snd_bcm2835_playback_hw = { + .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | +@@ -107,6 +110,31 @@ static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) + return IRQ_HANDLED; + } + ++ ++static int rate_hw_constraint_rate(struct snd_pcm_hw_params *params, ++ struct snd_pcm_hw_rule *rule) ++{ ++ struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); ++ struct snd_interval rates = { ++ .min = 8000, ++ .max = min(192000u, MAX_COMBINED_RATE / max(channels->min, 1u)), ++ }; ++ struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); ++ return snd_interval_refine(rate, &rates); ++} ++ ++static int rate_hw_constraint_channels(struct snd_pcm_hw_params *params, ++ struct snd_pcm_hw_rule *rule) ++{ ++ struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); ++ struct snd_interval channels_interval = { ++ .min = 1, ++ .max = min(8u, MAX_COMBINED_RATE / max(rate->min, 1u)), ++ }; ++ struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); ++ return snd_interval_refine(channels, &channels_interval); ++} ++ + /* open callback */ + static int snd_bcm2835_playback_open_generic( + struct snd_pcm_substream *substream, int spdif) +@@ -188,6 +216,19 @@ static int snd_bcm2835_playback_open_generic( + snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, + 16); + ++ /* When playing PCM, pretend that we support the full range of channels ++ * and sample rates. The GPU can't output it, but is able to resample ++ * the data to a rate the hardware can handle it. This won't work with ++ * compressed data; the resampler would just destroy it. */ ++ if (spdif) { ++ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, ++ rate_hw_constraint_rate, NULL, ++ SNDRV_PCM_HW_PARAM_CHANNELS, -1); ++ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, ++ rate_hw_constraint_channels, NULL, ++ SNDRV_PCM_HW_PARAM_RATE, -1); ++ } ++ + chip->alsa_stream[idx] = alsa_stream; + + chip->opened |= (1 << idx); + +From dcead34f063fc8c37ebfcfc9ab6696060c336bad Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:42:48 +0100 +Subject: [PATCH 130/170] rpi: update vc_vchi_audioserv_defs.h + +Add audioserv 3 extensions. The changes were taken from the paste +linked here: + +https://github.com/raspberrypi/linux/pull/1166#issuecomment-151917067 +--- + sound/arm/vc_vchi_audioserv_defs.h | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h +index af3e6eb..5f4409f 100644 +--- a/sound/arm/vc_vchi_audioserv_defs.h ++++ b/sound/arm/vc_vchi_audioserv_defs.h +@@ -16,7 +16,7 @@ + #define _VC_AUDIO_DEFS_H_ + + #define VC_AUDIOSERV_MIN_VER 1 +-#define VC_AUDIOSERV_VER 2 ++#define VC_AUDIOSERV_VER 3 + + // FourCC code used for VCHI connection + #define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") +@@ -36,6 +36,7 @@ typedef enum { + VC_AUDIO_MSG_TYPE_START, // Configure audio + VC_AUDIO_MSG_TYPE_STOP, // Configure audio + VC_AUDIO_MSG_TYPE_WRITE, // Configure audio ++ VC_AUDIO_MSG_TYPE_LATENCY, // request latency in cycles + VC_AUDIO_MSG_TYPE_MAX + } VC_AUDIO_MSG_TYPE; + +@@ -44,6 +45,7 @@ typedef struct { + uint32_t channels; + uint32_t samplerate; + uint32_t bps; ++ uint32_t channelmap; + + } VC_AUDIO_CONFIG_T; + +@@ -84,6 +86,12 @@ typedef struct { + uint16_t max_packet; + } VC_AUDIO_WRITE_T; + ++// query latency in samples of sink ++typedef struct ++{ ++ uint32_t dummy; ++} VC_AUDIO_LATENCY_T; ++ + // Generic result for a request (VC->HOST) + typedef struct { + int32_t success; // Success value +@@ -108,9 +116,10 @@ typedef struct { + VC_AUDIO_START_T start; + VC_AUDIO_STOP_T stop; + VC_AUDIO_WRITE_T write; ++ VC_AUDIO_LATENCY_T latency; + VC_AUDIO_RESULT_T result; + VC_AUDIO_COMPLETE_T complete; + } u; + } VC_AUDIO_MSG_T; + +-#endif // _VC_AUDIO_DEFS_H_ ++#endif // _VC_AUDIO_DEFS_H_ +\ No newline at end of file + +From 7c7d2db494fbf1fd0b014dab0bb4c5c740f90442 Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:43:12 +0100 +Subject: [PATCH 131/170] bcm2835: implement channel map API + +Report all layouts supported by the HDMI protocol to userspace. +Make the videocore set the correct layout according to the +userspace request. + +Some code taken from patch_hdmi.c. In particular, the HDMI channel +layout table was copied without changes - with the idea in mind that +hopefully it can be shared one day. Or at least updating it will be +simpler. + +In my tests, everything appears to work, except when outputting +FL FR RL RR. Then my receiver outputs RL on both the RL and RR +speakers, while RR is never heard. +--- + sound/arm/bcm2835-ctl.c | 276 ++++++++++++++++++++++++++++++++++++++++++++++ + sound/arm/bcm2835-pcm.c | 22 +++- + sound/arm/bcm2835-vchiq.c | 13 +++ + sound/arm/bcm2835.h | 4 + + 4 files changed, 311 insertions(+), 4 deletions(-) + +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +index aad905f..92d3f76 100755 +--- a/sound/arm/bcm2835-ctl.c ++++ b/sound/arm/bcm2835-ctl.c +@@ -300,6 +300,281 @@ static struct snd_kcontrol_new snd_bcm2835_spdif[] = { + }, + }; + ++struct cea_channel_speaker_allocation { ++ int ca_index; ++ int speakers[8]; ++}; ++ ++#define FL SNDRV_CHMAP_FL ++#define FR SNDRV_CHMAP_FR ++#define RL SNDRV_CHMAP_RL ++#define RR SNDRV_CHMAP_RR ++#define LFE SNDRV_CHMAP_LFE ++#define FC SNDRV_CHMAP_FC ++#define RLC SNDRV_CHMAP_RLC ++#define RRC SNDRV_CHMAP_RRC ++#define RC SNDRV_CHMAP_RC ++#define FLC SNDRV_CHMAP_FLC ++#define FRC SNDRV_CHMAP_FRC ++#define FLH SNDRV_CHMAP_TFL ++#define FRH SNDRV_CHMAP_TFR ++#define FLW SNDRV_CHMAP_FLW ++#define FRW SNDRV_CHMAP_FRW ++#define TC SNDRV_CHMAP_TC ++#define FCH SNDRV_CHMAP_TFC ++ ++/* ++ * CEA-861 channel maps ++ * ++ * Stolen from sound/pci/hda/patch_hdmi.c ++ * (unlike the source, this uses SNDRV_* constants directly, as by the ++ * map_tables array in patch_hdmi.c) ++ * Unknown entries use 0, which unfortunately is SNDRV_CHMAP_UNKNOWN instead ++ * of SNDRV_CHMAP_NA. ++ */ ++static struct cea_channel_speaker_allocation channel_allocations[] = { ++/* channel: 7 6 5 4 3 2 1 0 */ ++{ .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, ++ /* 2.1 */ ++{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, ++ /* Dolby Surround */ ++{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, ++ /* surround40 */ ++{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, ++ /* surround41 */ ++{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, ++ /* surround50 */ ++{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, ++ /* surround51 */ ++{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, ++ /* 6.1 */ ++{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, ++ /* surround71 */ ++{ .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, ++ ++{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, ++{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, ++{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, ++{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, ++{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, ++{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, ++{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, ++{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, ++{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, ++{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, ++{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, ++{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, ++{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, ++{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, ++}; ++ ++static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, ++ unsigned int size, unsigned int __user *tlv) ++{ ++ unsigned int __user *dst; ++ int count = 0; ++ int i; ++ ++ if (size < 8) ++ return -ENOMEM; ++ if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv)) ++ return -EFAULT; ++ size -= 8; ++ dst = tlv + 2; ++ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { ++ struct cea_channel_speaker_allocation *ch = &channel_allocations[i]; ++ int num_chs = 0; ++ int chs_bytes; ++ int c; ++ ++ for (c = 0; c < 8; c++) { ++ if (ch->speakers[c]) ++ num_chs++; ++ } ++ ++ chs_bytes = num_chs * 4; ++ if (size < 8) ++ return -ENOMEM; ++ if (put_user(SNDRV_CTL_TLVT_CHMAP_FIXED, dst) || ++ put_user(chs_bytes, dst + 1)) ++ return -EFAULT; ++ dst += 2; ++ size -= 8; ++ count += 8; ++ if (size < chs_bytes) ++ return -ENOMEM; ++ size -= chs_bytes; ++ count += chs_bytes; ++ for (c = 0; c < 8; c++) { ++ int sp = ch->speakers[7 - c]; ++ if (sp) { ++ if (put_user(sp, dst)) ++ return -EFAULT; ++ dst++; ++ } ++ } ++ } ++ if (put_user(count, tlv + 1)) ++ return -EFAULT; ++ return 0; ++} ++ ++static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); ++ bcm2835_chip_t *chip = info->private_data; ++ unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); ++ struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); ++ struct cea_channel_speaker_allocation *ch = NULL; ++ int cur = 0; ++ int i; ++ ++ if (!substream || !substream->runtime) ++ return -ENODEV; ++ ++ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { ++ if (channel_allocations[i].ca_index == chip->cea_chmap) ++ ch = &channel_allocations[i]; ++ } ++ ++ /* If no layout was set yet, return a dummy. Apparently the userspace ++ * API will be confused if we don't. */ ++ if (!ch) ++ ch = &channel_allocations[0]; ++ ++ for (i = 0; i < 8; i++) { ++ if (ch->speakers[7 - i]) ++ ucontrol->value.integer.value[cur++] = ch->speakers[7 - i]; ++ } ++ while (cur < 8) ++ ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA; ++ return 0; ++} ++ ++static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); ++ bcm2835_chip_t *chip = info->private_data; ++ unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); ++ struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); ++ int i, prepared = 0, cea_chmap = -1; ++ int remap[8]; ++ ++ if (!substream || !substream->runtime) ++ return -ENODEV; ++ ++ switch (substream->runtime->status->state) { ++ case SNDRV_PCM_STATE_OPEN: ++ case SNDRV_PCM_STATE_SETUP: ++ break; ++ case SNDRV_PCM_STATE_PREPARED: ++ prepared = 1; ++ break; ++ default: ++ return -EBUSY; ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { ++ struct cea_channel_speaker_allocation *ch = &channel_allocations[i]; ++ int matches = 1; ++ int cur = 0; ++ int x; ++ memset(remap, 0, sizeof(remap)); ++ for (x = 0; x < substream->runtime->channels; x++) { ++ int sp = ucontrol->value.integer.value[x]; ++ while (cur < 8 && !ch->speakers[7 - cur]) ++ cur++; ++ if (cur >= 8) { ++ /* user has more channels than ch */ ++ matches = 0; ++ break; ++ } ++ if (ch->speakers[7 - cur] != sp) { ++ matches = 0; ++ break; ++ } ++ remap[x] = cur; ++ cur++; ++ } ++ for (x = cur; x < 8; x++) { ++ if (ch->speakers[7 - x]) { ++ /* ch has more channels than user */ ++ matches = 0; ++ break; ++ } ++ } ++ if (matches) { ++ cea_chmap = ch->ca_index; ++ break; ++ } ++ } ++ ++ if (cea_chmap < 0) ++ return -EINVAL; ++ ++ /* don't change the layout if another substream is active */ ++ if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) ++ return -EBUSY; /* unsure whether this is a good error code */ ++ ++ chip->cea_chmap = cea_chmap; ++ for (i = 0; i < 8; i++) ++ chip->map_channels[i] = remap[i]; ++ if (prepared) ++ snd_bcm2835_pcm_prepare_again(substream); ++ return 0; ++} ++ ++static int snd_bcm2835_add_chmap_ctl(bcm2835_chip_t * chip) ++{ ++ struct snd_pcm_chmap *chmap; ++ struct snd_kcontrol *kctl; ++ int err, i; ++ ++ err = snd_pcm_add_chmap_ctls(chip->pcm, ++ SNDRV_PCM_STREAM_PLAYBACK, ++ NULL, 8, 0, &chmap); ++ if (err < 0) ++ return err; ++ /* override handlers */ ++ chmap->private_data = chip; ++ kctl = chmap->kctl; ++ for (i = 0; i < kctl->count; i++) ++ kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_WRITE; ++ kctl->get = snd_bcm2835_chmap_ctl_get; ++ kctl->put = snd_bcm2835_chmap_ctl_put; ++ kctl->tlv.c = snd_bcm2835_chmap_ctl_tlv; ++ return 0; ++} ++ + int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) + { + int err; +@@ -313,6 +588,7 @@ int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) + if (err < 0) + return err; + } ++ snd_bcm2835_add_chmap_ctl(chip); + for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_spdif); idx++) { + err = snd_ctl_add(chip->card, + snd_ctl_new1(&snd_bcm2835_spdif[idx], chip)); +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index b17ed32..1067460 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -231,6 +231,9 @@ static int snd_bcm2835_playback_open_generic( + + chip->alsa_stream[idx] = alsa_stream; + ++ if (!chip->opened) ++ chip->cea_chmap = -1; ++ + chip->opened |= (1 << idx); + alsa_stream->open = 1; + alsa_stream->draining = 1; +@@ -341,8 +344,7 @@ static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream) + return snd_pcm_lib_free_pages(substream); + } + +-/* prepare callback */ +-static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) ++int snd_bcm2835_pcm_prepare_again(struct snd_pcm_substream *substream) + { + bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; +@@ -350,8 +352,6 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + int channels; + int err; + +- audio_info(" .. IN\n"); +- + /* notify the vchiq that it should enter spdif passthrough mode by + * setting channels=0 (see + * https://github.com/raspberrypi/linux/issues/528) */ +@@ -367,6 +367,20 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + audio_error(" error setting hw params\n"); + } + ++ return err; ++} ++ ++/* prepare callback */ ++static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) ++{ ++ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ ++ audio_info(" .. IN\n"); ++ ++ snd_bcm2835_pcm_prepare_again(substream); ++ + bcm2835_audio_setup(alsa_stream); + + /* in preparation of the stream, set the controls (volume level) of the stream */ +diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c +index 3de3094..8ecd2d73 100755 +--- a/sound/arm/bcm2835-vchiq.c ++++ b/sound/arm/bcm2835-vchiq.c +@@ -570,6 +570,8 @@ int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, + VC_AUDIO_MSG_T m; + AUDIO_INSTANCE_T *instance = alsa_stream->instance; + int32_t success; ++ uint32_t chmap_value; ++ int i; + int ret; + LOG_DBG(" .. IN\n"); + +@@ -593,10 +595,21 @@ int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, + + instance->result = -1; + ++ if (alsa_stream->chip->cea_chmap >= 0) { ++ chmap_value = (unsigned)alsa_stream->chip->cea_chmap << 24; ++ } else { ++ chmap_value = 0; /* force stereo */ ++ for (i = 0; i < 8; i++) ++ alsa_stream->chip->map_channels[i] = i; ++ } ++ for (i = 0; i < 8; i++) ++ chmap_value |= alsa_stream->chip->map_channels[i] << (i * 3); ++ + m.type = VC_AUDIO_MSG_TYPE_CONFIG; + m.u.config.channels = channels; + m.u.config.samplerate = samplerate; + m.u.config.bps = bps; ++ m.u.config.channelmap = chmap_value; + + /* Create the message available completion */ + init_completion(&instance->msg_avail_comp); +diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h +index 0f71c5d..997fb69 100755 +--- a/sound/arm/bcm2835.h ++++ b/sound/arm/bcm2835.h +@@ -107,6 +107,8 @@ typedef struct bcm2835_chip { + int old_volume; /* stores the volume value whist muted */ + int dest; + int mute; ++ int cea_chmap; /* currently requested Audio InfoFrame Data Byte 4 */ ++ int map_channels[8]; + + unsigned int opened; + unsigned int spdif_status; +@@ -149,6 +151,8 @@ int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); + int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); + int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip); + ++int snd_bcm2835_pcm_prepare_again(struct snd_pcm_substream *substream); ++ + int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); + int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); + int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, + +From 2a64337156d0f84537e04338b2ebd89eb6ec1f09 Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:43:35 +0100 +Subject: [PATCH 132/170] bcm2835: access controls under the audio mutex + +I don't think the ALSA framework provides any kind of automatic +synchronization within the control callbacks. We most likely need +to ensure this manually, so add locking around all access to shared +mutable data. In particular, bcm2835_audio_set_ctls() should +probably always be called under our own audio lock. +--- + sound/arm/bcm2835-ctl.c | 74 +++++++++++++++++++++++++++++++++++++++++-------- + sound/arm/bcm2835-pcm.c | 4 +++ + 2 files changed, 66 insertions(+), 12 deletions(-) + +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +index 92d3f76..5b8e6bd2 100755 +--- a/sound/arm/bcm2835-ctl.c ++++ b/sound/arm/bcm2835-ctl.c +@@ -94,6 +94,9 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, + { + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); + + if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) +@@ -103,6 +106,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, + else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) + ucontrol->value.integer.value[0] = chip->dest; + ++ mutex_unlock(&chip->audio_mutex); + return 0; + } + +@@ -112,11 +116,15 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int changed = 0; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { + audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); + if (chip->mute == CTRL_VOL_MUTE) { + /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ +- return 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ goto unlock; + } + if (changed + || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { +@@ -142,6 +150,8 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, + printk(KERN_ERR "Failed to set ALSA controls..\n"); + } + ++unlock: ++ mutex_unlock(&chip->audio_mutex); + return changed; + } + +@@ -198,10 +208,14 @@ static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol, + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int i; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + ucontrol->value.iec958.status[i] = + (chip->spdif_status >> (i * 8)) && 0xff; + ++ mutex_unlock(&chip->audio_mutex); + return 0; + } + +@@ -212,12 +226,16 @@ static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol, + unsigned int val = 0; + int i, change; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); + + change = val != chip->spdif_status; + chip->spdif_status = val; + ++ mutex_unlock(&chip->audio_mutex); + return change; + } + +@@ -253,9 +271,14 @@ static int snd_bcm2835_spdif_stream_get(struct snd_kcontrol *kcontrol, + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int i; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + ucontrol->value.iec958.status[i] = + (chip->spdif_status >> (i * 8)) & 0xff; ++ ++ mutex_unlock(&chip->audio_mutex); + return 0; + } + +@@ -266,11 +289,15 @@ static int snd_bcm2835_spdif_stream_put(struct snd_kcontrol *kcontrol, + unsigned int val = 0; + int i, change; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); + change = val != chip->spdif_status; + chip->spdif_status = val; + ++ mutex_unlock(&chip->audio_mutex); + return change; + } + +@@ -454,11 +481,17 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, + unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); + struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); + struct cea_channel_speaker_allocation *ch = NULL; ++ int res = 0; + int cur = 0; + int i; + +- if (!substream || !substream->runtime) +- return -ENODEV; ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ if (!substream || !substream->runtime) { ++ res = -ENODEV; ++ goto unlock; ++ } + + for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { + if (channel_allocations[i].ca_index == chip->cea_chmap) +@@ -476,7 +509,10 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, + } + while (cur < 8) + ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA; +- return 0; ++ ++unlock: ++ mutex_unlock(&chip->audio_mutex); ++ return res; + } + + static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, +@@ -487,10 +523,16 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, + unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); + struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); + int i, prepared = 0, cea_chmap = -1; ++ int res = 0; + int remap[8]; + +- if (!substream || !substream->runtime) +- return -ENODEV; ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ if (!substream || !substream->runtime) { ++ res = -ENODEV; ++ goto unlock; ++ } + + switch (substream->runtime->status->state) { + case SNDRV_PCM_STATE_OPEN: +@@ -500,7 +542,8 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, + prepared = 1; + break; + default: +- return -EBUSY; ++ res = -EBUSY; ++ goto unlock; + } + + for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { +@@ -538,19 +581,26 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, + } + } + +- if (cea_chmap < 0) +- return -EINVAL; ++ if (cea_chmap < 0) { ++ res = -EINVAL; ++ goto unlock; ++ } + + /* don't change the layout if another substream is active */ +- if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) +- return -EBUSY; /* unsure whether this is a good error code */ ++ if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) { ++ res = -EBUSY; /* unsure whether this is a good error code */ ++ goto unlock; ++ } + + chip->cea_chmap = cea_chmap; + for (i = 0; i < 8; i++) + chip->map_channels[i] = remap[i]; + if (prepared) + snd_bcm2835_pcm_prepare_again(substream); +- return 0; ++ ++unlock: ++ mutex_unlock(&chip->audio_mutex); ++ return res; + } + + static int snd_bcm2835_add_chmap_ctl(bcm2835_chip_t * chip) +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index 1067460..48da3bb 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -379,6 +379,9 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + + audio_info(" .. IN\n"); + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + snd_bcm2835_pcm_prepare_again(substream); + + bcm2835_audio_setup(alsa_stream); +@@ -401,6 +404,7 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + alsa_stream->buffer_size, alsa_stream->period_size, + alsa_stream->pos, runtime->frame_bits); + ++ mutex_unlock(&chip->audio_mutex); + audio_info(" .. OUT\n"); + return 0; + } + +From 6e781f631f7e23f7d88256d020d83950c9bf213a Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:44:03 +0100 +Subject: [PATCH 133/170] bcm2835: always use 2/4/8 channels for multichannel + layouts + +Pad the unused channels with NA. This means userspace needs to write +additional, silent padding channels, which is not ideal, but better +than noise. + +Works around noise at the following channel counts: 3, 5, 6, 7 +--- + sound/arm/bcm2835-ctl.c | 89 +++++++++++++++++++++++++------------------------ + 1 file changed, 45 insertions(+), 44 deletions(-) + +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +index 5b8e6bd2..dec052b 100755 +--- a/sound/arm/bcm2835-ctl.c ++++ b/sound/arm/bcm2835-ctl.c +@@ -349,6 +349,7 @@ struct cea_channel_speaker_allocation { + #define FRW SNDRV_CHMAP_FRW + #define TC SNDRV_CHMAP_TC + #define FCH SNDRV_CHMAP_TFC ++#define NA SNDRV_CHMAP_NA + + /* + * CEA-861 channel maps +@@ -356,69 +357,69 @@ struct cea_channel_speaker_allocation { + * Stolen from sound/pci/hda/patch_hdmi.c + * (unlike the source, this uses SNDRV_* constants directly, as by the + * map_tables array in patch_hdmi.c) +- * Unknown entries use 0, which unfortunately is SNDRV_CHMAP_UNKNOWN instead +- * of SNDRV_CHMAP_NA. ++ * Entries which do not have a physical output channel use 0. Entries which ++ * require userspace to output silence use NA (SNDRV_CHMAP_NA). + */ + static struct cea_channel_speaker_allocation channel_allocations[] = { + /* channel: 7 6 5 4 3 2 1 0 */ + { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, + /* 2.1 */ +-{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, ++{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, NA, LFE, FR, FL } }, + /* Dolby Surround */ +-{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, ++{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, NA, FR, FL } }, + /* surround40 */ +-{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x08, .speakers = { NA, NA, RR, RL, NA, NA, FR, FL } }, + /* surround41 */ +-{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x09, .speakers = { NA, NA, RR, RL, NA, LFE, FR, FL } }, + /* surround50 */ +-{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x0a, .speakers = { NA, NA, RR, RL, FC, NA, FR, FL } }, + /* surround51 */ +-{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x0b, .speakers = { NA, NA, RR, RL, FC, LFE, FR, FL } }, + /* 6.1 */ +-{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x0f, .speakers = { NA, RC, RR, RL, FC, LFE, FR, FL } }, + /* surround71 */ + { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, + +-{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, +-{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, +-{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, +-{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, +-{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, +-{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, +-{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, +-{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, +-{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, +-{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, +-{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, +-{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, +-{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, +-{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, +-{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, +-{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x03, .speakers = { NA, NA, NA, NA, FC, LFE, FR, FL } }, ++{ .ca_index = 0x04, .speakers = { NA, NA, NA, RC, NA, NA, FR, FL } }, ++{ .ca_index = 0x05, .speakers = { NA, NA, NA, RC, NA, LFE, FR, FL } }, ++{ .ca_index = 0x06, .speakers = { NA, NA, NA, RC, FC, NA, FR, FL } }, ++{ .ca_index = 0x07, .speakers = { NA, NA, NA, RC, FC, LFE, FR, FL } }, ++{ .ca_index = 0x0c, .speakers = { NA, RC, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x0d, .speakers = { NA, RC, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x0e, .speakers = { NA, RC, RR, RL, FC, NA, FR, FL } }, ++{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, NA, FR, FL } }, ++{ .ca_index = 0x14, .speakers = { FRC, FLC, NA, NA, NA, NA, FR, FL } }, ++{ .ca_index = 0x15, .speakers = { FRC, FLC, NA, NA, NA, LFE, FR, FL } }, ++{ .ca_index = 0x16, .speakers = { FRC, FLC, NA, NA, FC, NA, FR, FL } }, ++{ .ca_index = 0x17, .speakers = { FRC, FLC, NA, NA, FC, LFE, FR, FL } }, ++{ .ca_index = 0x18, .speakers = { FRC, FLC, NA, RC, NA, NA, FR, FL } }, ++{ .ca_index = 0x19, .speakers = { FRC, FLC, NA, RC, NA, LFE, FR, FL } }, ++{ .ca_index = 0x1a, .speakers = { FRC, FLC, NA, RC, FC, NA, FR, FL } }, ++{ .ca_index = 0x1b, .speakers = { FRC, FLC, NA, RC, FC, LFE, FR, FL } }, ++{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, +-{ .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, +-{ .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x20, .speakers = { NA, FCH, RR, RL, FC, NA, FR, FL } }, ++{ .ca_index = 0x21, .speakers = { NA, FCH, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x22, .speakers = { TC, NA, RR, RL, FC, NA, FR, FL } }, ++{ .ca_index = 0x23, .speakers = { TC, NA, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, + }; + + +From aaa2a41f44a0fc141b9a983a5f9f30bb8b6dbc8b Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:44:24 +0100 +Subject: [PATCH 134/170] bcm2835: only allow stereo if analogue jack is + selected + +Sending more than 2 channels to videocore while outputting to analogue +mysteriously outputs heavy artifacts. So just paint it over with a +hack: if analogue is explicitly selected as destination, do not +reporting support for anything other than stereo. + +I'm not sure how to deal with the auto case (destination 0). There's +probably way to retrieve this and even to listen to plug events, but +I didn't find one yet, and it's probably not worth the trouble. Just +don't use this setting, I guess. Unless you like noise. + +Changing the setting while an audio stream is active also doesn't +work properly. We could probably interrupt running streams by +returning ENODEV or using kernel hotplug stuff (maybe), but that +also doesn't seem worth the trouble. +--- + sound/arm/bcm2835-ctl.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +index dec052b..e930718 100755 +--- a/sound/arm/bcm2835-ctl.c ++++ b/sound/arm/bcm2835-ctl.c +@@ -423,9 +423,16 @@ static struct cea_channel_speaker_allocation channel_allocations[] = { + { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, + }; + ++static int uses_analogue(bcm2835_chip_t *chip) ++{ ++ return chip->dest == 1; ++} ++ + static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, + unsigned int size, unsigned int __user *tlv) + { ++ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); ++ bcm2835_chip_t *chip = info->private_data; + unsigned int __user *dst; + int count = 0; + int i; +@@ -442,6 +449,9 @@ static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, + int chs_bytes; + int c; + ++ if (i > 0 && uses_analogue(chip)) ++ break; ++ + for (c = 0; c < 8; c++) { + if (ch->speakers[c]) + num_chs++; +@@ -552,6 +562,8 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, + int matches = 1; + int cur = 0; + int x; ++ if (i > 0 && uses_analogue(chip)) ++ break; + memset(remap, 0, sizeof(remap)); + for (x = 0; x < substream->runtime->channels; x++) { + int sp = ucontrol->value.integer.value[x]; + +From 2c967fa0f5b0d10c86c796098574ba09ffe66cd5 Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:44:47 +0100 +Subject: [PATCH 135/170] bcm2835: interpolate audio delay + +It appears the GPU only sends us a message all 10ms to update +the playback progress. Other than this, the playback position +(what SNDRV_PCM_IOCTL_DELAY will return) is not updated at all. +Userspace will see jitter up to 10ms in the audio position. + +Make this a bit nicer for userspace by interpolating the +position using the CPU clock. + +I'm not sure if setting snd_pcm_runtime.delay is the right +approach for this. Or if there is maybe an already existing +mechanism for position interpolation in the ALSA core. + +I only set SNDRV_PCM_INFO_BATCH because this appears to remove +at least one situation snd_pcm_runtime.delay is used, so I have +to worry less in which place I have to update this field, or +how it interacts with the rest of ALSA. + +In the future, it might be nice to use VC_AUDIO_MSG_TYPE_LATENCY. +One problem is that it requires sending a videocore message, and +waiting for a reply, which could make the implementation much +harder due to locking and synchronization requirements. +--- + sound/arm/bcm2835-pcm.c | 12 +++++++++++- + sound/arm/bcm2835.h | 1 + + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index 48da3bb..f3a4c6d 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -25,7 +25,7 @@ + /* hardware definition */ + static struct snd_pcm_hardware snd_bcm2835_playback_hw = { + .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | +- SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BATCH), + .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, + .rate_min = 8000, +@@ -99,6 +99,8 @@ static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) + alsa_stream->pos %= alsa_stream->buffer_size; + } + ++ alsa_stream->interpolate_start = ktime_get_ns(); ++ + if (alsa_stream->substream) { + if (new_period) + snd_pcm_period_elapsed(alsa_stream->substream); +@@ -399,6 +401,7 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream); + alsa_stream->period_size = snd_pcm_lib_period_bytes(substream); + alsa_stream->pos = 0; ++ alsa_stream->interpolate_start = ktime_get_ns(); + + audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n", + alsa_stream->buffer_size, alsa_stream->period_size, +@@ -495,6 +498,7 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) + { + struct snd_pcm_runtime *runtime = substream->runtime; + bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ u64 now = ktime_get_ns(); + + audio_info(" .. IN\n"); + +@@ -503,6 +507,12 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) + frames_to_bytes(runtime, runtime->control->appl_ptr), + alsa_stream->pos); + ++ /* Give userspace better delay reporting by interpolating between GPU ++ * notifications, assuming audio speed is close enough to the clock ++ * used for ktime */ ++ if (alsa_stream->interpolate_start && alsa_stream->interpolate_start < now) ++ runtime->delay = -(int)div_u64((now - alsa_stream->interpolate_start) * runtime->rate, 1000000000); ++ + audio_info(" .. OUT\n"); + return snd_pcm_indirect_playback_pointer(substream, + &alsa_stream->pcm_indirect, +diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h +index 997fb69..20ef108 100755 +--- a/sound/arm/bcm2835.h ++++ b/sound/arm/bcm2835.h +@@ -137,6 +137,7 @@ typedef struct bcm2835_alsa_stream { + unsigned int pos; + unsigned int buffer_size; + unsigned int period_size; ++ u64 interpolate_start; + + uint32_t enable_fifo_irq; + irq_handler_t fifo_irq_handler; + +From 205e27a7f94a5531764cc517ce43623361ca466c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 19 Jan 2016 17:16:38 +0000 +Subject: [PATCH 136/170] bcm2835-sdhost: Add workaround for odd behaviour on + some cards + +For reasons not understood, the sdhost driver fails when reading +sectors very near the end of some SD cards. The problem could +be related to the similar issue that reading the final sector +of any card as part of a multiple read never completes, and the +workaround is an extension of the mechanism introduced to solve +that problem which ensures those sectors are always read singly. +--- + drivers/mmc/host/bcm2835-sdhost.c | 61 +++++++++++++++++++++++++++++++++------ + 1 file changed, 52 insertions(+), 9 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index da089985..309633c 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -173,6 +173,9 @@ struct bcm2835_host { + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + u32 overclock; /* Current frequency if overclocked, else zero */ + u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ ++ ++ u32 sectors; /* Cached card size in sectors */ ++ u32 single_read_sectors[8]; + }; + + +@@ -277,6 +280,9 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) + { + u32 temp; + ++ if (host->debug) ++ pr_info("%s: reset\n", mmc_hostname(host->mmc)); ++ + bcm2835_sdhost_set_power(host, false); + + bcm2835_sdhost_write(host, 0, SDCMD); +@@ -299,6 +305,8 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) + bcm2835_sdhost_set_power(host, true); + mdelay(10); + host->clock = 0; ++ host->sectors = 0; ++ host->single_read_sectors[0] = ~0; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + mmiowb(); +@@ -309,8 +317,6 @@ static void bcm2835_sdhost_reset(struct mmc_host *mmc) + { + struct bcm2835_host *host = mmc_priv(mmc); + unsigned long flags; +- if (host->debug) +- pr_info("%s: reset\n", mmc_hostname(mmc)); + spin_lock_irqsave(&host->lock, flags); + + bcm2835_sdhost_reset_internal(host); +@@ -676,6 +682,32 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + ++ if (!host->sectors && host->mmc->card) ++ { ++ struct mmc_card *card = host->mmc->card; ++ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { ++ /* ++ * The EXT_CSD sector count is in number of 512 byte ++ * sectors. ++ */ ++ host->sectors = card->ext_csd.sectors; ++ pr_err("%s: using ext_csd!\n", mmc_hostname(host->mmc)); ++ } else { ++ /* ++ * The CSD capacity field is in units of read_blkbits. ++ * set_capacity takes units of 512 bytes. ++ */ ++ host->sectors = card->csd.capacity << ++ (card->csd.read_blkbits - 9); ++ } ++ host->single_read_sectors[0] = host->sectors - 65; ++ host->single_read_sectors[1] = host->sectors - 64; ++ host->single_read_sectors[2] = host->sectors - 33; ++ host->single_read_sectors[3] = host->sectors - 32; ++ host->single_read_sectors[4] = host->sectors - 1; ++ host->single_read_sectors[5] = ~0; /* Safety net */ ++ } ++ + host->use_dma = host->have_dma && (data->blocks > host->pio_limit); + if (!host->use_dma) { + int flags; +@@ -1246,6 +1278,10 @@ static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) + + bcm2835_sdhost_finish_data(host); + } else { ++ /* Reset the timer */ ++ mod_timer(&host->pio_timer, ++ jiffies + host->pio_timeout); ++ + bcm2835_sdhost_transfer_pio(host); + + /* Reset the timer */ +@@ -1450,8 +1486,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + +- /* Set the timeout to 500ms */ +- bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); ++ /* Set the timeout to 250ms */ ++ bcm2835_sdhost_write(host, host->mmc->actual_clock/4, SDTOUT); + + if (host->debug) + pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", +@@ -1566,13 +1602,20 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, + reading the final sector of the card as part of a multiple read + problematic. Detect that case and shorten the read accordingly. + */ +- /* csd.capacity is in weird units - convert to sectors */ +- u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); ++ struct bcm2835_host *host; ++ ++ host = mmc_priv(card->host); + +- if ((direction == MMC_DATA_READ) && +- ((blk_pos + blk_size) == card_sectors)) +- blk_size--; ++ if (direction == MMC_DATA_READ) ++ { ++ int i; ++ int sector; ++ for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) ++ continue; + ++ if ((blk_pos + blk_size) > sector) ++ blk_size = (blk_pos == sector) ? 1 : (sector - blk_pos); ++ } + return blk_size; + } + + +From c5d24cba808118647d01a1869cf1c46d0658d78b Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 22 Jan 2016 16:03:24 +0000 +Subject: [PATCH 137/170] bcm2835-sdhost: Add debug_flags dtparam + +Bit zero disables the single-read-sectors map: + +If the default MMC driver is bcm2835-mmc: + dtoverlay=sdhost,debug_flags=1 +If the default MMC driver is bcm2835-sdhost: + dtoverlay=sdtweak,debug_flags=1 +(although the sdhost overlay may also work, sdtweak is +less invasive and will work in more circumstances). + +Also revert the timeout change, just in case. +--- + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 2 ++ + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 2 ++ + drivers/mmc/host/bcm2835-sdhost.c | 26 +++++++++++++++++++++----- + 3 files changed, 25 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +index 85f0725..dbe6574 100644 +--- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -16,6 +16,7 @@ + frag1: __overlay__ { + brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; ++ brcm,debug-flags = <0>; + status = "okay"; + }; + }; +@@ -25,5 +26,6 @@ + force_pio = <&frag1>,"brcm,force-pio?"; + pio_limit = <&frag1>,"brcm,pio-limit:0"; + debug = <&frag1>,"brcm,debug?"; ++ debug_flags = <&frag1>,"brcm,debug-flags:0"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +index 74c168d..b0b208c 100644 +--- a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -9,6 +9,7 @@ + frag1: __overlay__ { + brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; ++ brcm,debug-flags = <0>; + }; + }; + +@@ -17,5 +18,6 @@ + force_pio = <&frag1>,"brcm,force-pio?"; + pio_limit = <&frag1>,"brcm,pio-limit:0"; + debug = <&frag1>,"brcm,debug?"; ++ debug_flags = <&frag1>,"brcm,debug-flags:0"; + }; + }; +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 309633c..ef9b1e6 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -174,6 +174,8 @@ struct bcm2835_host { + u32 overclock; /* Current frequency if overclocked, else zero */ + u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ + ++ u32 debug_flags; ++ + u32 sectors; /* Cached card size in sectors */ + u32 single_read_sectors[8]; + }; +@@ -682,7 +684,7 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + +- if (!host->sectors && host->mmc->card) ++ if (!host->sectors && host->mmc->card && !(host->debug_flags & 1)) + { + struct mmc_card *card = host->mmc->card; + if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { +@@ -1486,8 +1488,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + +- /* Set the timeout to 250ms */ +- bcm2835_sdhost_write(host, host->mmc->actual_clock/4, SDTOUT); ++ /* Set the timeout to 500ms */ ++ bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); + + if (host->debug) + pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", +@@ -1606,8 +1608,16 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, + + host = mmc_priv(card->host); + +- if (direction == MMC_DATA_READ) +- { ++ if (!host->sectors) { ++ /* csd.capacity is in weird units - convert to sectors */ ++ u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); ++ if ((direction == MMC_DATA_READ) && ++ ((blk_pos + blk_size) == card_sectors)) ++ blk_size--; ++ return blk_size; ++ } ++ ++ if (direction == MMC_DATA_READ) { + int i; + int sector; + for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) +@@ -1838,8 +1848,14 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + host->allow_dma = ALLOW_DMA && + !of_property_read_bool(node, "brcm,force-pio"); + host->debug = of_property_read_bool(node, "brcm,debug"); ++ of_property_read_u32(node, ++ "brcm,debug-flags", ++ &host->debug_flags); + } + ++ if (host->debug_flags) ++ dev_err(dev, "debug_flags=%x\n", host->debug_flags); ++ + if (host->allow_dma) { + if (node) { + host->dma_chan_tx = + +From 1a451a35b70fa9ed32f23a4ba925e5b2c2c3af78 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 25 Jan 2016 09:12:06 +0000 +Subject: [PATCH 138/170] BCM270X_DT: Add sdio_overclock parameter to sdio + overlay + +The sdio_overclock parameter is like the overclock_50 parameter, i.e. +it sets an alternate frequency (in MHz) to use when the MMC framework +requests 50MHz, except that it applies to the SDIO bus. + +Be aware that the actual frequencies achievable are limited to even integer +divisions of 250MHz, and that the driver will round up to include fractions +(e.g. 62 will include 62.5) but then round down to the nearest frequency. +In other words, the chosen frequency is the highest possible that is less than +the parameter value + 1. In practise this means that 62 is the only sensible +value. + +Examples: + 250MHz/4 = 62.5MHz (sdio_overclock=62) + 250MHz/2 = 125MHz (sdio_overclock=125) # Too fast +--- + arch/arm/boot/dts/overlays/README | 9 ++++++--- + arch/arm/boot/dts/overlays/sdio-overlay.dts | 2 ++ + 2 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 34a1b7f..709d3e4 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -53,8 +53,8 @@ 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 ++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: +@@ -621,9 +621,12 @@ Name: sdio + Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, + and enables SDIO via GPIOs 22-27. + Load: dtoverlay=sdio,= +-Params: overclock_50 Clock (in MHz) to use when the MMC framework ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework + requests 50MHz + ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ + force_pio Disable DMA support (default off) + + pio_limit Number of blocks above which to use DMA +diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts +index 7935e7a..398bd81 100644 +--- a/arch/arm/boot/dts/overlays/sdio-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts +@@ -12,6 +12,7 @@ + pinctrl-0 = <&sdio_pins>; + non-removable; + bus-width = <4>; ++ brcm,overclock-50 = <0>; + status = "okay"; + }; + }; +@@ -30,5 +31,6 @@ + __overrides__ { + poll_once = <&sdio_mmc>,"non-removable?"; + bus_width = <&sdio_mmc>,"bus-width:0"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; + }; + }; + +From 49ff16d7af98e6191d6dd60ba75b711612e948ab Mon Sep 17 00:00:00 2001 +From: Michael Lange +Date: Thu, 21 Jan 2016 18:10:16 +0100 +Subject: [PATCH 139/170] rtc: ds1307: add support for the DT property + 'wakeup-source' + +For RTC chips with no IRQ directly connected to the SoC, the RTC chip +can be forced as a wakeup source by stating that explicitly in +the device's .dts file using the "wakeup-source" boolean property. +This will guarantee the 'wakealarm' sysfs entry is available on the +device, if supported by the RTC. + +With these changes to the driver rtc-ds1307 and the necessary entries +in the .dts file, I get an working ds1337 RTC on the Witty Pi extension +board by UUGear for the Raspberry Pi. + +An example for the entry in the .dts file: + + rtc: ds1337@68 { + compatible = "dallas,ds1337"; + reg = <0x68>; + wakeup-source; + +If the "wakeup-source" property is set, do not request an IRQ. +Set also UIE mode to unsupported, to get a working 'hwclock' binary. + +Signed-off-by: Michael Lange +Signed-off-by: Alexandre Belloni +--- + drivers/rtc/rtc-ds1307.c | 29 +++++++++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index 1cb13fee..28ca4bf 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -860,6 +860,7 @@ static int ds1307_probe(struct i2c_client *client, + struct chip_desc *chip = &chips[id->driver_data]; + struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); + bool want_irq = false; ++ bool ds1307_can_wakeup_device = false; + unsigned char *buf; + struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev); + irq_handler_t irq_handler = ds1307_irq; +@@ -907,6 +908,20 @@ static int ds1307_probe(struct i2c_client *client, + ds1307->write_block_data = ds1307_write_block_data; + } + ++#ifdef CONFIG_OF ++/* ++ * For devices with no IRQ directly connected to the SoC, the RTC chip ++ * can be forced as a wakeup source by stating that explicitly in ++ * the device's .dts file using the "wakeup-source" boolean property. ++ * If the "wakeup-source" property is set, don't request an IRQ. ++ * This will guarantee the 'wakealarm' sysfs entry is available on the device, ++ * if supported by the RTC. ++ */ ++ if (of_property_read_bool(client->dev.of_node, "wakeup-source")) { ++ ds1307_can_wakeup_device = true; ++ } ++#endif ++ + switch (ds1307->type) { + case ds_1337: + case ds_1339: +@@ -925,11 +940,13 @@ static int ds1307_probe(struct i2c_client *client, + ds1307->regs[0] &= ~DS1337_BIT_nEOSC; + + /* +- * Using IRQ? Disable the square wave and both alarms. ++ * Using IRQ or defined as wakeup-source? ++ * Disable the square wave and both alarms. + * For some variants, be sure alarms can trigger when we're + * running on Vbackup (BBSQI/BBSQW) + */ +- if (ds1307->client->irq > 0 && chip->alarm) { ++ if (chip->alarm && (ds1307->client->irq > 0 || ++ ds1307_can_wakeup_device)) { + ds1307->regs[0] |= DS1337_BIT_INTCN + | bbsqi_bitpos[ds1307->type]; + ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE); +@@ -1144,6 +1161,14 @@ static int ds1307_probe(struct i2c_client *client, + return PTR_ERR(ds1307->rtc); + } + ++ if (ds1307_can_wakeup_device) { ++ /* Disable request for an IRQ */ ++ want_irq = false; ++ dev_info(&client->dev, "'wakeup-source' is set, request for an IRQ is disabled!\n"); ++ /* We cannot support UIE mode if we do not have an IRQ line */ ++ ds1307->rtc->uie_unsupported = 1; ++ } ++ + if (want_irq) { + err = devm_request_threaded_irq(&client->dev, + client->irq, NULL, irq_handler, + +From e382e888be3f59b0ba3645809ae686947313e0c1 Mon Sep 17 00:00:00 2001 +From: vitalogy +Date: Tue, 19 Jan 2016 07:02:02 +0100 +Subject: [PATCH 140/170] dt-overlay: add wittypi-overlay.dts + +--- + arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 ++++++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +new file mode 100644 +index 0000000..be5987d +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +@@ -0,0 +1,44 @@ ++/* ++ * Device Tree overlay for Witty Pi extension board by UUGear ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ compatible = "gpio-leds"; ++ wittypi_led: wittypi_led { ++ label = "wittypi_led"; ++ linux,default-trigger = "default-on"; ++ gpios = <&gpio 17 0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rtc: ds1337@68 { ++ compatible = "dallas,ds1337"; ++ reg = <0x68>; ++ wakeup-source; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ led_gpio = <&wittypi_led>,"gpios:4"; ++ led_trigger = <&wittypi_led>,"linux,default-trigger"; ++ }; ++ ++}; + +From 6dcfc3daab7c1c459b36261163b4e1dc15a6e965 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 3 Feb 2016 16:12:54 +0000 +Subject: [PATCH 141/170] BCM270X_DT: Disable DMA for bcm2835-sdhost on Pi2 + +This is an interim patch to verify that problems seen with +some cards can be worked around at the expense of an increased +CPU load by forcing PIO mode. + +Although this could have used the brcm,force-pio attribute, that +is a boolean (true if present, false if absent) and attributes +can't be deleted by overlays. Instead, make brcm,pio-limit +unfeasibly high instead to allow DMA to be re-enabled using the +pio_limit parameter of the sdhost or sdtweak overlays. +--- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 5206ba2..0b68db5 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -43,6 +43,7 @@ + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_pins>; + bus-width = <4>; ++ brcm,pio-limit = <0x7fffffff>; + status = "okay"; + }; + + +From 7519a79f61a67792e238a118db58600fb5f60ec8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 19 Jan 2016 16:28:05 +0000 +Subject: [PATCH 142/170] FIXUP i2c_bcm2708: Don't change module baudrate + parameter + +Overwriting the baudrate module parameter creates an apparent +forced baudrate for i2c busses after the first. Not only does this +override the baudrate from DT it also prevents the bus ID from +being initialised. + +Also fix whitespace errors. +--- + drivers/i2c/busses/i2c-bcm2708.c | 48 +++++++++++++++++++++------------------- + 1 file changed, 25 insertions(+), 23 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c +index b152639..c9b8e5c 100644 +--- a/drivers/i2c/busses/i2c-bcm2708.c ++++ b/drivers/i2c/busses/i2c-bcm2708.c +@@ -71,7 +71,6 @@ + + #define DRV_NAME "bcm2708_i2c" + +-static unsigned int baudrate_default = CONFIG_I2C_BCM2708_BAUDRATE; + static unsigned int baudrate; + module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); + MODULE_PARM_DESC(baudrate, "The I2C baudrate"); +@@ -317,25 +316,28 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + struct i2c_adapter *adap; + unsigned long bus_hz; + u32 cdiv, clk_tout; +- +- if (!baudrate) { +- baudrate = baudrate_default; +- if (pdev->dev.of_node) { +- u32 bus_clk_rate; +- pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); +- if (pdev->id < 0) { +- dev_err(&pdev->dev, "alias is missing\n"); +- return -EINVAL; +- } +- if (!of_property_read_u32(pdev->dev.of_node, +- "clock-frequency", &bus_clk_rate)) +- baudrate = bus_clk_rate; +- else +- dev_warn(&pdev->dev, +- "Could not read clock-frequency property\n"); ++ u32 baud; ++ ++ baud = CONFIG_I2C_BCM2708_BAUDRATE; ++ ++ if (pdev->dev.of_node) { ++ u32 bus_clk_rate; ++ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); ++ if (pdev->id < 0) { ++ dev_err(&pdev->dev, "alias is missing\n"); ++ return -EINVAL; + } ++ if (!of_property_read_u32(pdev->dev.of_node, ++ "clock-frequency", &bus_clk_rate)) ++ baud = bus_clk_rate; ++ else ++ dev_warn(&pdev->dev, ++ "Could not read clock-frequency property\n"); + } + ++ if (baudrate) ++ baud = baudrate; ++ + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!regs) { + dev_err(&pdev->dev, "could not get IO memory\n"); +@@ -419,21 +421,21 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + } + + bus_hz = clk_get_rate(bi->clk); +- cdiv = bus_hz / baudrate; ++ cdiv = bus_hz / baud; + if (cdiv > 0xffff) { + cdiv = 0xffff; +- baudrate = bus_hz / cdiv; ++ baud = bus_hz / cdiv; + } +- +- clk_tout = 35/1000*baudrate; //35ms timeout as per SMBus specs. +- if (clk_tout > 0xffff) ++ ++ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. ++ if (clk_tout > 0xffff) + clk_tout = 0xffff; + + bi->cdiv = cdiv; + bi->clk_tout = clk_tout; + + dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", +- pdev->id, (unsigned long)regs->start, irq, baudrate); ++ pdev->id, (unsigned long)regs->start, irq, baud); + + return 0; + + +From f2d36d57d7e17b9f44ff914824df5b150eb9e3bd Mon Sep 17 00:00:00 2001 +From: Digital Dreamtime +Date: Thu, 4 Feb 2016 14:14:44 +0000 +Subject: [PATCH 143/170] Allow up to 24dB digital gain to be applied when + using IQAudIO DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. +--- + arch/arm/boot/dts/overlays/README | 17 +++++++++++++++-- + .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 6 +++++- + sound/soc/bcm/iqaudio-dac.c | 20 ++++++++++++++------ + 3 files changed, 34 insertions(+), 9 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 709d3e4..3c8436e 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -362,8 +362,21 @@ Params: + + Name: iqaudio-dacplus + Info: Configures the IQaudio DAC+ audio card +-Load: dtoverlay=iqaudio-dacplus +-Params: ++Load: dtoverlay=iqaudio-dacplus,= ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + + + Name: lirc-rpi +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +index 735d8ab..e0aaf8f 100644 +--- a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts ++++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +@@ -7,7 +7,7 @@ + + fragment@0 { + target = <&sound>; +- __overlay__ { ++ frag0: __overlay__ { + compatible = "iqaudio,iqaudio-dac"; + i2s-controller = <&i2s>; + status = "okay"; +@@ -36,4 +36,8 @@ + }; + }; + }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag0>,"iqaudio,24db_digital_gain?"; ++ }; + }; +diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c +index 37038d4..124d7a9 100644 +--- a/sound/soc/bcm/iqaudio-dac.c ++++ b/sound/soc/bcm/iqaudio-dac.c +@@ -23,14 +23,19 @@ + #include + #include + ++static bool digital_gain_0db_limit = true; ++ + static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) + { +- int ret; +- struct snd_soc_card *card = rtd->card; +- +- ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } + + return 0; + } +@@ -94,6 +99,9 @@ static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) + dai->platform_name = NULL; + dai->platform_of_node = i2s_node; + } ++ ++ digital_gain_0db_limit = !of_property_read_bool(pdev->dev.of_node, ++ "iqaudio,24db_digital_gain"); + } + + ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); + +From 8a189f18de820c6facd00ba2db97ba7c4a75156f Mon Sep 17 00:00:00 2001 +From: Digital Dreamtime +Date: Thu, 4 Feb 2016 20:04:00 +0000 +Subject: [PATCH 144/170] Limit PCM512x "Digital" gain to 0dB by default with + HiFiBerry DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. +--- + arch/arm/boot/dts/overlays/README | 17 +++++++++++++++-- + .../arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts | 6 +++++- + sound/soc/bcm/hifiberry_dacplus.c | 14 ++++++++++++++ + 3 files changed, 34 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 3c8436e..296184f 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -273,8 +273,21 @@ Params: + + Name: hifiberry-dacplus + Info: Configures the HifiBerry DAC+ audio card +-Load: dtoverlay=hifiberry-dacplus +-Params: ++Load: dtoverlay=hifiberry-dacplus,= ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=hifiberry-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + + + Name: hifiberry-digi +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +index f923a48..42a0194 100644 +--- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +@@ -17,7 +17,7 @@ + + fragment@1 { + target = <&sound>; +- __overlay__ { ++ frag1: __overlay__ { + compatible = "hifiberry,hifiberry-dacplus"; + i2s-controller = <&i2s>; + status = "okay"; +@@ -47,4 +47,8 @@ + }; + }; + }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag1>,"hifiberry,24db_digital_gain?"; ++ }; + }; +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c +index a6b651c..153dbcd 100644 +--- a/sound/soc/bcm/hifiberry_dacplus.c ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -48,6 +48,7 @@ struct pcm512x_priv { + #define CLK_48EN_RATE 24576000UL + + static bool snd_rpi_hifiberry_is_dacpro; ++static bool digital_gain_0db_limit = true; + + static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, + int clk_id) +@@ -167,6 +168,16 @@ static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) + snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); + snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); + ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } ++ + return 0; + } + +@@ -299,6 +310,9 @@ static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) + dai->platform_name = NULL; + dai->platform_of_node = i2s_node; + } ++ ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "hifiberry,24db_digital_gain"); + } + + ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); + +From 14ba431031afa218c0db43a7c20fe54916f8d357 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 8 Feb 2016 09:46:33 +0000 +Subject: [PATCH 145/170] BCM270X_DT: Adjust overlay README formatting + +--- + arch/arm/boot/dts/overlays/README | 420 +++++++++++++++++++------------------- + 1 file changed, 210 insertions(+), 210 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 296184f..ec1ae91 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -83,58 +83,58 @@ Name: + Info: Configures the base Raspberry Pi hardware + Load: + Params: +- audio Set to "on" to enable the onboard ALSA audio +- interface (default "off") ++ audio Set to "on" to enable the onboard ALSA audio ++ interface (default "off") + +- i2c_arm Set to "on" to enable the ARM's i2c interface +- (default "off") ++ 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_vc Set to "on" to enable the i2c interface ++ usually reserved for the VideoCore processor ++ (default "off") + +- i2c An alias for i2c_arm ++ i2c An alias for i2c_arm + +- i2c_arm_baudrate Set the baudrate of the ARM's i2c interface +- (default "100000") ++ 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_vc_baudrate Set the baudrate of the VideoCore i2c interface ++ (default "100000") + +- i2c_baudrate An alias for i2c_arm_baudrate ++ i2c_baudrate An alias for i2c_arm_baudrate + +- i2s Set to "on" to enable the i2s interface +- (default "off") ++ i2s Set to "on" to enable the i2s interface ++ (default "off") + +- spi Set to "on" to enable the spi interfaces +- (default "off") ++ spi Set to "on" to enable the spi interfaces ++ (default "off") + +- random Set to "on" to enable the hardware random +- number generator (default "on") ++ random Set to "on" to enable the hardware random ++ number generator (default "on") + +- uart0 Set to "off" to disable uart0 (default "on") ++ uart0 Set to "off" to disable uart0 (default "on") + +- watchdog Set to "on" to enable the hardware watchdog +- (default "off") ++ watchdog Set to "on" to enable the hardware watchdog ++ (default "off") + +- act_led_trigger Choose which activity the LED tracks. +- Use "heartbeat" for a nice load indicator. +- (default "mmc") ++ 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_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) ++ 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. ++ 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 +@@ -149,19 +149,19 @@ Params: + 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) ++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. +@@ -175,12 +175,12 @@ Name: at86rf233 + Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, + connected to spi0.0 + Load: dtoverlay=at86rf233,= +-Params: interrupt GPIO used for INT (default 23) +- reset GPIO used for Reset (default 24) +- sleep GPIO used for Sleep (default 25) +- speed SPI bus speed in Hz (default 6000000) +- trim Fine tuning of the internal capacitance +- arrays (0=+0pF, 15=+4.5pF, default 15) ++Params: interrupt GPIO used for INT (default 23) ++ reset GPIO used for Reset (default 24) ++ sleep GPIO used for Sleep (default 25) ++ speed SPI bus speed in Hz (default 6000000) ++ trim Fine tuning of the internal capacitance ++ arrays (0=+0pF, 15=+4.5pF, default 15) + + + Name: bmp085_i2c-sensor +@@ -194,8 +194,8 @@ Name: dht11 + Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors + Also sometimes found with the part number(s) AM230x. + Load: dtoverlay=dht11,= +-Params: gpiopin GPIO connected to the sensor's DATA output. +- (default 4) ++Params: gpiopin GPIO connected to the sensor's DATA output. ++ (default 4) + + + Name: dwc-otg +@@ -208,15 +208,15 @@ Params: + Name: dwc2 + Info: Selects the dwc2 USB controller driver + Load: dtoverlay=dwc2,= +-Params: dr_mode Dual role mode: "host", "peripheral" or "otg" ++Params: dr_mode Dual role mode: "host", "peripheral" or "otg" + +- g-rx-fifo-size Size of rx fifo size in gadget mode ++ g-rx-fifo-size Size of rx fifo size in gadget mode + +- g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget +- mode ++ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget ++ mode + +- g-tx-fifo-size Size of periodic tx fifo per endpoint +- (except ep0) in gadget mode ++ g-tx-fifo-size Size of periodic tx fifo per endpoint ++ (except ep0) in gadget mode + + + [ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] +@@ -225,9 +225,9 @@ Params: dr_mode Dual role mode: "host", "peripheral" or "otg" + Name: enc28j60 + Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) + Load: dtoverlay=enc28j60,= +-Params: int_pin GPIO used for INT (default 25) ++Params: int_pin GPIO used for INT (default 25) + +- speed SPI bus speed (default 12000000) ++ speed SPI bus speed (default 12000000) + + + Name: gpio-ir +@@ -237,26 +237,26 @@ Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- + not required! The key mapping and other decoding parameters can be + configured by "ir-keytable" tool. + Load: dtoverlay=gpio-ir,= +-Params: gpio_pin Input pin number. Default is 18. ++Params: gpio_pin Input pin number. Default is 18. + +- gpio_pull Desired pull-up/down state (off, down, up) +- Default is "down". ++ gpio_pull Desired pull-up/down state (off, down, up) ++ Default is "down". + +- rc-map-name Default rc keymap (can also be changed by +- ir-keytable), defaults to "rc-rc6-mce" ++ rc-map-name Default rc keymap (can also be changed by ++ ir-keytable), defaults to "rc-rc6-mce" + + + Name: gpio-poweroff + Info: Drives a GPIO high or low on reboot + Load: dtoverlay=gpio-poweroff,= +-Params: gpiopin GPIO for signalling (default 26) ++Params: gpiopin GPIO for signalling (default 26) + +- active_low Set if the power control device requires a +- high->low transition to trigger a power-down. +- Note that this will require the support of a +- custom dt-blob.bin to prevent a power-down +- during the boot process, and that a reboot +- will also cause the pin to go low. ++ active_low Set if the power control device requires a ++ high->low transition to trigger a power-down. ++ Note that this will require the support of a ++ custom dt-blob.bin to prevent a power-down ++ during the boot process, and that a reboot ++ will also cause the pin to go low. + + + Name: hifiberry-amp +@@ -300,65 +300,65 @@ 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 ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + +- resetgpio GPIO used to reset controller ++ resetgpio GPIO used to reset controller + +- ledgpio GPIO used to control backlight ++ 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 ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + +- resetgpio GPIO used to reset controller ++ resetgpio GPIO used to reset controller + +- ledgpio GPIO used to control backlight ++ ledgpio GPIO used to control backlight + + + Name: i2c-gpio + Info: Adds support for software i2c controller on gpio pins + Load: dtoverlay=i2c-gpio,= +-Params: i2c_gpio_sda GPIO used for I2C data (default "23") ++Params: i2c_gpio_sda GPIO used for I2C data (default "23") + +- i2c_gpio_scl GPIO used for I2C clock (default "24") ++ i2c_gpio_scl GPIO used for I2C clock (default "24") + +- i2c_gpio_delay_us Clock delay in microseconds +- (default "2" = ~100kHz) ++ i2c_gpio_delay_us Clock delay in microseconds ++ (default "2" = ~100kHz) + + + 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 ++Params: ds1307 Select the DS1307 device + +- ds3231 Select the DS3231 device ++ ds3231 Select the DS3231 device + +- mcp7941x Select the MCP7941x device ++ mcp7941x Select the MCP7941x device + +- pcf2127 Select the PCF2127 device ++ pcf2127 Select the PCF2127 device + +- pcf8523 Select the PCF8523 device ++ pcf8523 Select the PCF8523 device + +- pcf8563 Select the PCF8563 device ++ pcf8563 Select the PCF8563 device + + + Name: i2s-mmap +@@ -396,70 +396,70 @@ 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") ++Params: gpio_out_pin GPIO for output (default "17") + +- gpio_in_pin GPIO for input (default "18") ++ gpio_in_pin GPIO for input (default "18") + +- gpio_in_pull Pull up/down/off on the input pin +- (default "down") ++ gpio_in_pull Pull up/down/off on the input pin ++ (default "down") + +- sense Override the IR receive auto-detection logic: +- "0" = force active-high +- "1" = force active-low +- "-1" = use auto-detection +- (default "-1") ++ sense Override the IR receive auto-detection logic: ++ "0" = force active-high ++ "1" = force active-low ++ "-1" = use auto-detection ++ (default "-1") + +- softcarrier Turn the software carrier "on" or "off" +- (default "on") ++ softcarrier Turn the software carrier "on" or "off" ++ (default "on") + +- invert "on" = invert the output pin (default "off") ++ invert "on" = invert the output pin (default "off") + +- debug "on" = enable additional debug messages +- (default "off") ++ debug "on" = enable additional debug messages ++ (default "off") + + + Name: mcp2515-can0 + Info: Configures the MCP2515 CAN controller on spi0.0 + Load: dtoverlay=mcp2515-can0,= +-Params: oscillator Clock frequency for the CAN controller (Hz) ++Params: oscillator Clock frequency for the CAN controller (Hz) + +- spimaxfrequency Maximum SPI frequence (Hz) ++ spimaxfrequency Maximum SPI frequence (Hz) + +- interrupt GPIO for interrupt signal ++ interrupt GPIO for interrupt signal + + + Name: mcp2515-can1 + Info: Configures the MCP2515 CAN controller on spi0.1 + Load: dtoverlay=mcp2515-can1,= +-Params: oscillator Clock frequency for the CAN controller (Hz) ++Params: oscillator Clock frequency for the CAN controller (Hz) + +- spimaxfrequency Maximum SPI frequence (Hz) ++ spimaxfrequency Maximum SPI frequence (Hz) + +- interrupt GPIO for interrupt signal ++ interrupt GPIO for interrupt signal + + + 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 ++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 ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- txbuflen Transmit buffer length (default 32768) ++ txbuflen Transmit buffer length (default 32768) + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + + + [ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] +@@ -474,69 +474,69 @@ Params: speed Display SPI bus speed + Name: piscreen + Info: PiScreen display by OzzMaker.com + Load: dtoverlay=piscreen,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + + + Name: piscreen2r + Info: PiScreen 2 with resistive TP display by OzzMaker.com + Load: dtoverlay=piscreen2r,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + + + Name: pitft28-capacitive + Info: Adafruit PiTFT 2.8" capacitive touch screen + Load: dtoverlay=pitft28-capacitive,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- touch-sizex Touchscreen size x (default 240) ++ touch-sizex Touchscreen size x (default 240) + +- touch-sizey Touchscreen size y (default 320) ++ touch-sizey Touchscreen size y (default 320) + +- touch-invx Touchscreen inverted x axis ++ touch-invx Touchscreen inverted x axis + +- touch-invy Touchscreen inverted y axis ++ touch-invy Touchscreen inverted y axis + +- touch-swapxy Touchscreen swapped x y axis ++ touch-swapxy Touchscreen swapped x y axis + + + Name: pitft28-resistive + Info: Adafruit PiTFT 2.8" resistive touch screen + Load: dtoverlay=pitft28-resistive,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ 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") ++Params: gpiopin Input GPIO (default "18") + + + Name: pwm +@@ -550,12 +550,12 @@ Info: Configures a single PWM channel + Pins 12 and 13 might be better choices on an A+, B+ or Pi2. + 2) The onboard analogue audio output uses both PWM channels. + 3) So be careful mixing audio and PWM. +- 4) Currently the clock must have been enabled and configured ++ 4) Currently the clockmust have been enabled and configured + by other means. + Load: dtoverlay=pwm,= +-Params: pin Output pin (default 18) - see table +- func Pin function (default 2 = Alt5) - see above +- clock PWM clock frequency (informational) ++Params: pin Output pin (default 18) - see table ++ func Pin function (default 2 = Alt5) - see above ++ clock PWM clock frequency (informational) + + + Name: pwm-2chan +@@ -569,14 +569,14 @@ Info: Configures both PWM channels + Pins 12 and 13 might be better choices on an A+, B+ or Pi2. + 2) The onboard analogue audio output uses both PWM channels. + 3) So be careful mixing audio and PWM. +- 4) Currently the clock must have been enabled and configured ++ 4) Currently the clockmust have been enabled and configured + by other means. + Load: dtoverlay=pwm-2chan,= +-Params: pin Output pin (default 18) - see table +- pin2 Output pin for other channel (default 19) +- func Pin function (default 2 = Alt5) - see above +- func2 Function for pin2 (default 2 = Alt5) +- clock PWM clock frequency (informational) ++Params: pin Output pin (default 18) - see table ++ pin2 Output pin for other channel (default 19) ++ func Pin function (default 2 = Alt5) - see above ++ func2 Function for pin2 (default 2 = Alt5) ++ clock PWM clock frequency (informational) + + + Name: raspidac3 +@@ -600,15 +600,15 @@ Params: + Name: rpi-display + Info: RPi-Display - 2.8" Touch Display by Watterott + Load: dtoverlay=rpi-display,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + + + Name: rpi-ft5406 +@@ -632,52 +632,52 @@ 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 ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz + +- force_pio Disable DMA support (default off) ++ force_pio Disable DMA support (default off) + +- pio_limit Number of blocks above which to use DMA +- (default 1) ++ pio_limit Number of blocks above which to use DMA ++ (default 1) + +- debug Enable debug output (default off) ++ debug Enable debug output (default off) + + + Name: sdio + Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, + and enables SDIO via GPIOs 22-27. + Load: dtoverlay=sdio,= +-Params: overclock_50 SD Clock (in MHz) to use when the MMC framework +- requests 50MHz ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz + +- sdio_overclock SDIO Clock (in MHz) to use when the MMC +- framework requests 50MHz ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz + +- force_pio Disable DMA support (default off) ++ force_pio Disable DMA support (default off) + +- pio_limit Number of blocks above which to use DMA +- (default 1) ++ pio_limit Number of blocks above which to use DMA ++ (default 1) + +- debug Enable debug output (default off) ++ debug Enable debug output (default off) + +- poll_once Disable SDIO-device polling every second +- (default on: polling once at boot-time) ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) + +- bus_width Set the SDIO host bus width (default 4 bits) ++ bus_width Set the SDIO host bus width (default 4 bits) + + + Name: sdtweak + Info: Tunes the bcm2835-sdhost SD/MMC driver + Load: dtoverlay=sdtweak,= +-Params: overclock_50 Clock (in MHz) to use when the MMC framework +- requests 50MHz ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz + +- force_pio Disable DMA support (default off) ++ force_pio Disable DMA support (default off) + +- pio_limit Number of blocks above which to use DMA +- (default 1) ++ pio_limit Number of blocks above which to use DMA ++ (default 1) + +- debug Enable debug output (default off) ++ debug Enable debug output (default off) + + + Name: smi +@@ -708,25 +708,25 @@ Name: tinylcd35 + Info: 3.5" Color TFT Display by www.tinylcd.com + Options: Touch, RTC, keypad + Load: dtoverlay=tinylcd35,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- touch Enable touch panel ++ touch Enable touch panel + +- touchgpio Touch controller IRQ GPIO ++ touchgpio Touch controller IRQ GPIO + +- xohms Touchpanel: Resistance of X-plate in ohms ++ xohms Touchpanel: Resistance of X-plate in ohms + +- rtc-pcf PCF8563 Real Time Clock ++ rtc-pcf PCF8563 Real Time Clock + +- rtc-ds DS1307 Real Time Clock ++ rtc-ds DS1307 Real Time Clock + +- keypad Enable keypad ++ keypad Enable keypad + + Examples: + Display with touchpanel, PCF8563 RTC and keypad: +@@ -738,9 +738,9 @@ Params: speed Display SPI bus speed + Name: uart1 + Info: Enable uart1 in place of uart0 + Load: dtoverlay=uart1,= +-Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) ++Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) + +- rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) ++ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) + + + Name: vc4-kms-v3d +@@ -753,7 +753,7 @@ Params: + + Name: vga666 + Info: Overlay for the Fen Logic VGA666 board +- This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds ++ This uses GPIOs 2-21 (sono I2C), and activates the output 2-3 seconds + after the kernel has started. + Load: dtoverlay=vga666 + Params: +@@ -763,22 +763,22 @@ 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") ++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 ++ 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") ++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 ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature + +- extpullup GPIO for external pullup (default "5") ++ extpullup GPIO for external pullup (default "5") + + + Troubleshooting + +From d32795d2be55748552ddacd9b1e47efc61264a98 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 8 Feb 2016 12:53:44 +0000 +Subject: [PATCH 146/170] FIXUP: Overlay README - Restore spaces deleted in + error + +--- + arch/arm/boot/dts/overlays/README | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index ec1ae91..f987565 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -550,7 +550,7 @@ Info: Configures a single PWM channel + Pins 12 and 13 might be better choices on an A+, B+ or Pi2. + 2) The onboard analogue audio output uses both PWM channels. + 3) So be careful mixing audio and PWM. +- 4) Currently the clockmust have been enabled and configured ++ 4) Currently the clock must have been enabled and configured + by other means. + Load: dtoverlay=pwm,= + Params: pin Output pin (default 18) - see table +@@ -569,7 +569,7 @@ Info: Configures both PWM channels + Pins 12 and 13 might be better choices on an A+, B+ or Pi2. + 2) The onboard analogue audio output uses both PWM channels. + 3) So be careful mixing audio and PWM. +- 4) Currently the clockmust have been enabled and configured ++ 4) Currently the clock must have been enabled and configured + by other means. + Load: dtoverlay=pwm-2chan,= + Params: pin Output pin (default 18) - see table +@@ -753,7 +753,7 @@ Params: + + Name: vga666 + Info: Overlay for the Fen Logic VGA666 board +- This uses GPIOs 2-21 (sono I2C), and activates the output 2-3 seconds ++ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds + after the kernel has started. + Load: dtoverlay=vga666 + Params: + +From be4e718cccf6909072eeab1032b1d9fb6dd92b43 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 9 Feb 2016 09:52:13 +0000 +Subject: [PATCH 147/170] pinctrl-bcm2835: Fix cut-and-paste error in "pull" + parsing + +The DT bindings for pinctrl-bcm2835 allow both the function and pull +to contain either one entry or one per pin. However, an error in the +DT parsing can cause failures if the number of pulls differs from the +number of functions. +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 640e3b0..32f779e 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -802,7 +802,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, + } + if (num_pulls) { + err = of_property_read_u32_index(np, "brcm,pull", +- (num_funcs > 1) ? i : 0, &pull); ++ (num_pulls > 1) ? i : 0, &pull); + if (err) + goto out; + err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, + +From 14e35b8cca5bf1f6223ebc6cc4d527645076a3a3 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 11 Feb 2016 17:30:49 +0000 +Subject: [PATCH 148/170] Revert "BCM270X_DT: Disable DMA for bcm2835-sdhost on + Pi2" + +This reverts commit 9c1adcc07a40f762fd4ac580f07646784de135e1. +--- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 0b68db5..5206ba2 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -43,7 +43,6 @@ + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_pins>; + bus-width = <4>; +- brcm,pio-limit = <0x7fffffff>; + status = "okay"; + }; + + +From 5a117bd925d13a305d94eeb28919dedeaa9be17d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 11 Feb 2016 16:51:01 +0000 +Subject: [PATCH 149/170] bcm2835-sdhost: Major revision + +This is a significant revision of the bcm2835-sdhost driver. It +improves on the original in a number of ways: + +1) Through the use of CMD23 for reads it appears to avoid problems + reading some sectors on certain high speed cards. +2) Better atomicity to prevent crashes. +3) Higher performance. +4) Activity logging included, for easier diagnosis in the event + of a problem. + +Signed-off-by: Phil Elwell +--- + drivers/mmc/host/bcm2835-sdhost.c | 1284 ++++++++++++++++++++----------------- + 1 file changed, 686 insertions(+), 598 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index ef9b1e6..262180b 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -2,7 +2,7 @@ + * BCM2835 SD host driver. + * + * Author: Phil Elwell +- * Copyright 2015 ++ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. + * + * Based on + * mmc-bcm2835.c by Gellert Weisz +@@ -24,12 +24,13 @@ + * along with this program. If not, see . + */ + +-#define SAFE_READ_THRESHOLD 4 +-#define SAFE_WRITE_THRESHOLD 4 +-#define ALLOW_DMA 1 +-#define ALLOW_CMD23 0 +-#define ALLOW_FAST 1 +-#define USE_BLOCK_IRQ 1 ++#define FIFO_READ_THRESHOLD 4 ++#define FIFO_WRITE_THRESHOLD 4 ++#define ALLOW_CMD23_READ 1 ++#define ALLOW_CMD23_WRITE 0 ++#define ENABLE_LOG 1 ++#define SDDATA_FIFO_PIO_BURST 8 ++#define CMD_DALLY_US 1 + + #include + #include +@@ -48,6 +49,7 @@ + #include + #include + #include ++#include + + #define DRIVER_NAME "sdhost-bcm2835" + +@@ -110,6 +112,28 @@ + #define SDEDM_READ_THRESHOLD_SHIFT 14 + #define SDEDM_THRESHOLD_MASK 0x1f + ++#define SDEDM_FSM_MASK 0xf ++#define SDEDM_FSM_IDENTMODE 0x0 ++#define SDEDM_FSM_DATAMODE 0x1 ++#define SDEDM_FSM_READDATA 0x2 ++#define SDEDM_FSM_WRITEDATA 0x3 ++#define SDEDM_FSM_READWAIT 0x4 ++#define SDEDM_FSM_READCRC 0x5 ++#define SDEDM_FSM_WRITECRC 0x6 ++#define SDEDM_FSM_WRITEWAIT1 0x7 ++#define SDEDM_FSM_POWERDOWN 0x8 ++#define SDEDM_FSM_POWERUP 0x9 ++#define SDEDM_FSM_WRITESTART1 0xa ++#define SDEDM_FSM_WRITESTART2 0xb ++#define SDEDM_FSM_GENPULSES 0xc ++#define SDEDM_FSM_WRITEWAIT2 0xd ++#define SDEDM_FSM_STARTPOWDOWN 0xf ++ ++#define SDDATA_FIFO_WORDS 16 ++ ++#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ ++ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) ++ + #define MHZ 1000000 + + +@@ -131,15 +155,17 @@ struct bcm2835_host { + + struct tasklet_struct finish_tasklet; /* Tasklet structures */ + +- struct timer_list timer; /* Timer for timeouts */ ++ struct work_struct cmd_wait_wq; /* Workqueue function */ + +- struct timer_list pio_timer; /* PIO error detection timer */ ++ struct timer_list timer; /* Timer for timeouts */ + + struct sg_mapping_iter sg_miter; /* SG state for PIO */ + unsigned int blocks; /* remaining PIO blocks */ + + int irq; /* Device IRQ */ + ++ u32 cmd_quick_poll_retries; ++ u32 ns_per_fifo_word; + + /* cached registers */ + u32 hcfg; +@@ -154,16 +180,21 @@ struct bcm2835_host { + + unsigned int use_busy:1; /* Wait for busy interrupt */ + +- unsigned int debug:1; /* Enable debug output */ ++ unsigned int use_sbc:1; /* Send CMD23 */ + +- u32 thread_isr; ++ unsigned int debug:1; /* Enable debug output */ + + /*DMA part*/ + struct dma_chan *dma_chan_rx; /* DMA channel for reads */ + struct dma_chan *dma_chan_tx; /* DMA channel for writes */ ++ struct dma_chan *dma_chan; /* Channel in used */ ++ struct dma_async_tx_descriptor *dma_desc; ++ u32 dma_dir; ++ u32 drain_words; ++ struct page *drain_page; ++ u32 drain_offset; + + bool allow_dma; +- bool have_dma; + bool use_dma; + /*end of DMA part*/ + +@@ -173,13 +204,98 @@ struct bcm2835_host { + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + u32 overclock; /* Current frequency if overclocked, else zero */ + u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ ++}; + +- u32 debug_flags; ++#if ENABLE_LOG + +- u32 sectors; /* Cached card size in sectors */ +- u32 single_read_sectors[8]; ++struct log_entry_struct { ++ char event[4]; ++ u32 timestamp; ++ u32 param1; ++ u32 param2; + }; + ++typedef struct log_entry_struct LOG_ENTRY_T; ++ ++LOG_ENTRY_T *sdhost_log_buf; ++dma_addr_t sdhost_log_addr; ++static u32 sdhost_log_idx; ++static spinlock_t log_lock; ++static void __iomem *timer_base; ++ ++#define LOG_ENTRIES (256*1) ++#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) ++ ++static void log_init(u32 bus_to_phys) ++{ ++ spin_lock_init(&log_lock); ++ sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, ++ GFP_KERNEL); ++ if (sdhost_log_buf) { ++ pr_err("sdhost: log_buf @ %p (%x)\n", ++ sdhost_log_buf, sdhost_log_addr); ++ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); ++ if (!timer_base) ++ pr_err("sdhost: failed to remap timer\n"); ++ } ++ else ++ pr_err("sdhost: failed to allocate log buf\n"); ++} ++ ++static void log_event_impl(const char *event, u32 param1, u32 param2) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ entry = sdhost_log_buf + sdhost_log_idx; ++ memcpy(entry->event, event, 4); ++ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + ++ (smp_processor_id()<<30); ++ entry->param1 = param1; ++ entry->param2 = param2; ++ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++static void log_dump(void) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ int idx; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ idx = sdhost_log_idx; ++ do { ++ entry = sdhost_log_buf + idx; ++ if (entry->event[0] != '\0') ++ pr_err("[%08x] %.4s %x %x\n", ++ entry->timestamp, ++ entry->event, ++ entry->param1, ++ entry->param2); ++ idx = (idx + 1) % LOG_ENTRIES; ++ } while (idx != sdhost_log_idx); ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++#define log_event(event, param1, param2) log_event_impl(event, param1, param2) ++ ++#else ++ ++#define log_init(x) (void)0 ++#define log_event(event, param1, param2) (void)0 ++#define log_dump() (void)0 ++ ++#endif + + static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) + { +@@ -201,7 +317,7 @@ static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, + const char *label) + { + if (cmd) +- pr_info("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", ++ pr_err("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", + mmc_hostname(host->mmc), + (cmd == host->cmd) ? '>' : ' ', + label, cmd->opcode, cmd->arg, cmd->flags, +@@ -211,73 +327,74 @@ static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, + + static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) + { +- bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); +- bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); +- if (host->mrq->data) +- pr_err("%s: data blocks %x blksz %x - err %d\n", +- mmc_hostname(host->mmc), +- host->mrq->data->blocks, +- host->mrq->data->blksz, +- host->mrq->data->error); +- bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ if (host->mrq) ++ { ++ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); ++ if (host->mrq->data) ++ pr_err("%s: data blocks %x blksz %x - err %d\n", ++ mmc_hostname(host->mmc), ++ host->mrq->data->blocks, ++ host->mrq->data->blksz, ++ host->mrq->data->error); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ } + +- pr_info("%s: =========== REGISTER DUMP ===========\n", ++ pr_err("%s: =========== REGISTER DUMP ===========\n", + mmc_hostname(host->mmc)); + +- pr_info("%s: SDCMD 0x%08x\n", ++ pr_err("%s: SDCMD 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDCMD)); +- pr_info("%s: SDARG 0x%08x\n", ++ pr_err("%s: SDARG 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDARG)); +- pr_info("%s: SDTOUT 0x%08x\n", ++ pr_err("%s: SDTOUT 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDTOUT)); +- pr_info("%s: SDCDIV 0x%08x\n", ++ pr_err("%s: SDCDIV 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDCDIV)); +- pr_info("%s: SDRSP0 0x%08x\n", ++ pr_err("%s: SDRSP0 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP0)); +- pr_info("%s: SDRSP1 0x%08x\n", ++ pr_err("%s: SDRSP1 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP1)); +- pr_info("%s: SDRSP2 0x%08x\n", ++ pr_err("%s: SDRSP2 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP2)); +- pr_info("%s: SDRSP3 0x%08x\n", ++ pr_err("%s: SDRSP3 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP3)); +- pr_info("%s: SDHSTS 0x%08x\n", ++ pr_err("%s: SDHSTS 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHSTS)); +- pr_info("%s: SDVDD 0x%08x\n", ++ pr_err("%s: SDVDD 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDVDD)); +- pr_info("%s: SDEDM 0x%08x\n", ++ pr_err("%s: SDEDM 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDEDM)); +- pr_info("%s: SDHCFG 0x%08x\n", ++ pr_err("%s: SDHCFG 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHCFG)); +- pr_info("%s: SDHBCT 0x%08x\n", ++ pr_err("%s: SDHBCT 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHBCT)); +- pr_info("%s: SDHBLC 0x%08x\n", ++ pr_err("%s: SDHBLC 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHBLC)); + +- pr_info("%s: ===========================================\n", ++ pr_err("%s: ===========================================\n", + mmc_hostname(host->mmc)); + } + +- + static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) + { + bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); + } + +- + static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) + { + u32 temp; +@@ -300,26 +417,24 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) + temp = bcm2835_sdhost_read(host, SDEDM); + temp &= ~((SDEDM_THRESHOLD_MASK<clock = 0; +- host->sectors = 0; +- host->single_read_sectors[0] = ~0; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + mmiowb(); + } + +- + static void bcm2835_sdhost_reset(struct mmc_host *mmc) + { + struct bcm2835_host *host = mmc_priv(mmc); + unsigned long flags; + spin_lock_irqsave(&host->lock, flags); ++ log_event("RST<", 0, 0); + + bcm2835_sdhost_reset_internal(host); + +@@ -344,82 +459,48 @@ static void bcm2835_sdhost_init(struct bcm2835_host *host, int soft) + } + } + +-static bool bcm2835_sdhost_is_write_complete(struct bcm2835_host *host) ++static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) + { +- bool write_complete = ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1); +- +- if (!write_complete) { +- /* Request an IRQ for the last block */ +- host->hcfg |= SDHCFG_BLOCK_IRPT_EN; +- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); +- if ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1) { +- /* The write has now completed. Disable the interrupt +- and clear the status flag */ +- host->hcfg &= ~SDHCFG_BLOCK_IRPT_EN; +- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); +- bcm2835_sdhost_write(host, SDHSTS_BLOCK_IRPT, SDHSTS); +- write_complete = true; +- } +- } ++ int timediff; ++ u32 alternate_idle; ++ u32 edm; + +- return write_complete; +-} ++ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? ++ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; + +-static void bcm2835_sdhost_wait_write_complete(struct bcm2835_host *host) +-{ +- int timediff; +-#ifdef DEBUG +- static struct timeval start_time; +- static int max_stall_time = 0; +- static int total_stall_time = 0; +- struct timeval before, after; ++ edm = bcm2835_sdhost_read(host, SDEDM); + +- do_gettimeofday(&before); +- if (max_stall_time == 0) +- start_time = before; +-#endif ++ log_event("WTC<", edm, 0); + + timediff = 0; + + while (1) { +- u32 edm = bcm2835_sdhost_read(host, SDEDM); +- if ((edm & 0xf) == 1) ++ u32 fsm = edm & SDEDM_FSM_MASK; ++ if ((fsm == SDEDM_FSM_IDENTMODE) || ++ (fsm == SDEDM_FSM_DATAMODE)) + break; +- timediff++; +- if (timediff > 5000000) { +-#ifdef DEBUG +- do_gettimeofday(&after); +- timediff = (after.tv_sec - before.tv_sec)*1000000 + +- (after.tv_usec - before.tv_usec); ++ if (fsm == alternate_idle) { ++ bcm2835_sdhost_write(host, ++ edm | SDEDM_FORCE_DATA_MODE, ++ SDEDM); ++ break; ++ } + +- pr_err(" wait_write_complete - still waiting after %dus\n", +- timediff); +-#else +- pr_err(" wait_write_complete - still waiting after %d retries\n", ++ timediff++; ++ if (timediff == 100000) { ++ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", ++ mmc_hostname(host->mmc), + timediff); +-#endif ++ log_dump(); + bcm2835_sdhost_dumpregs(host); +- host->data->error = -ETIMEDOUT; ++ host->mrq->data->error = -ETIMEDOUT; ++ log_event("WTC!", edm, 0); + return; + } ++ cpu_relax(); ++ edm = bcm2835_sdhost_read(host, SDEDM); + } +- +-#ifdef DEBUG +- do_gettimeofday(&after); +- timediff = (after.tv_sec - before.tv_sec)*1000000 + (after.tv_usec - before.tv_usec); +- +- total_stall_time += timediff; +- if (timediff > max_stall_time) +- max_stall_time = timediff; +- +- if ((after.tv_sec - start_time.tv_sec) > 10) { +- pr_debug(" wait_write_complete - max wait %dus, total %dus\n", +- max_stall_time, total_stall_time); +- start_time = after; +- max_stall_time = 0; +- total_stall_time = 0; +- } +-#endif ++ log_event("WTC>", edm, 0); + } + + static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); +@@ -427,65 +508,44 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); + static void bcm2835_sdhost_dma_complete(void *param) + { + struct bcm2835_host *host = param; +- struct dma_chan *dma_chan; ++ struct mmc_data *data = host->data; + unsigned long flags; +- u32 dir_data; + + spin_lock_irqsave(&host->lock, flags); ++ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); ++ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), ++ bcm2835_sdhost_read(host, SDEDM)); + +- if (host->data) { +- bool write_complete; +- if (USE_BLOCK_IRQ) +- write_complete = bcm2835_sdhost_is_write_complete(host); +- else { +- bcm2835_sdhost_wait_write_complete(host); +- write_complete = true; +- } +- pr_debug("dma_complete() - write_complete=%d\n", +- write_complete); +- +- if (write_complete || (host->data->flags & MMC_DATA_READ)) +- { +- if (write_complete) { +- dma_chan = host->dma_chan_tx; +- dir_data = DMA_TO_DEVICE; +- } else { +- dma_chan = host->dma_chan_rx; +- dir_data = DMA_FROM_DEVICE; +- } +- +- dma_unmap_sg(dma_chan->device->dev, +- host->data->sg, host->data->sg_len, +- dir_data); ++ if (host->dma_chan) { ++ dma_unmap_sg(host->dma_chan->device->dev, ++ data->sg, data->sg_len, ++ host->dma_dir); + +- bcm2835_sdhost_finish_data(host); +- } ++ host->dma_chan = NULL; + } + +- spin_unlock_irqrestore(&host->lock, flags); +-} ++ if (host->drain_words) { ++ void *page; ++ u32 *buf; + +-static bool data_transfer_wait(struct bcm2835_host *host) +-{ +- unsigned long timeout = 1000000; +- while (timeout) +- { +- u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); +- if (sdhsts & SDHSTS_DATA_FLAG) { +- bcm2835_sdhost_write(host, SDHSTS_DATA_FLAG, SDHSTS); +- break; ++ page = kmap_atomic(host->drain_page); ++ buf = page + host->drain_offset; ++ ++ while (host->drain_words) { ++ u32 edm = bcm2835_sdhost_read(host, SDEDM); ++ if ((edm >> 4) & 0x1f) ++ *(buf++) = bcm2835_sdhost_read(host, ++ SDDATA); ++ host->drain_words--; + } +- timeout--; +- } +- if (timeout == 0) { +- pr_err("%s: Data %s timeout\n", +- mmc_hostname(host->mmc), +- (host->data->flags & MMC_DATA_READ) ? "read" : "write"); +- bcm2835_sdhost_dumpregs(host); +- host->data->error = -ETIMEDOUT; +- return false; ++ ++ kunmap_atomic(page); + } +- return true; ++ ++ bcm2835_sdhost_finish_data(host); ++ ++ log_event("DMA>", (u32)host->data, 0); ++ spin_unlock_irqrestore(&host->lock, flags); + } + + static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) +@@ -493,32 +553,83 @@ static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) + unsigned long flags; + size_t blksize, len; + u32 *buf; ++ unsigned long wait_max; + + blksize = host->data->blksz; + ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ + local_irq_save(flags); + + while (blksize) { +- if (!sg_miter_next(&host->sg_miter)) +- BUG(); ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } + + len = min(host->sg_miter.length, blksize); +- BUG_ON(len % 4); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } + + blksize -= len; + host->sg_miter.consumed = len; + + buf = (u32 *)host->sg_miter.addr; + +- while (len) { +- if (!data_transfer_wait(host)) +- break; ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_READDATA) && ++ (fsm_state != SDEDM_FSM_READWAIT) && ++ (fsm_state != SDEDM_FSM_READCRC)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO read timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; + +- *(buf++) = bcm2835_sdhost_read(host, SDDATA); +- len -= 4; ++ while (words) { ++ *(buf++) = bcm2835_sdhost_read(host, SDDATA); ++ words--; ++ } + } + +- if (host->data->error) ++ if (hsts & SDHSTS_ERROR_MASK) + break; + } + +@@ -532,32 +643,83 @@ static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) + unsigned long flags; + size_t blksize, len; + u32 *buf; ++ unsigned long wait_max; + + blksize = host->data->blksz; + ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ + local_irq_save(flags); + + while (blksize) { +- if (!sg_miter_next(&host->sg_miter)) +- BUG(); ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } + + len = min(host->sg_miter.length, blksize); +- BUG_ON(len % 4); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } + + blksize -= len; + host->sg_miter.consumed = len; + +- buf = host->sg_miter.addr; ++ buf = (u32 *)host->sg_miter.addr; + +- while (len) { +- if (!data_transfer_wait(host)) +- break; ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_WRITEDATA) && ++ (fsm_state != SDEDM_FSM_WRITESTART1) && ++ (fsm_state != SDEDM_FSM_WRITESTART2)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO write timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; + +- bcm2835_sdhost_write(host, *(buf++), SDDATA); +- len -= 4; ++ while (words) { ++ bcm2835_sdhost_write(host, *(buf++), SDDATA); ++ words--; ++ } + } + +- if (host->data->error) ++ if (hsts & SDHSTS_ERROR_MASK) + break; + } + +@@ -566,12 +728,12 @@ static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) + local_irq_restore(flags); + } + +- + static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) + { + u32 sdhsts; + bool is_read; + BUG_ON(!host->data); ++ log_event("XFP<", (u32)host->data, host->blocks); + + is_read = (host->data->flags & MMC_DATA_READ) != 0; + if (is_read) +@@ -595,28 +757,21 @@ static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) + is_read ? "read" : "write", + sdhsts); + host->data->error = -ETIMEDOUT; +- } else if (!is_read && !host->data->error) { +- /* Start a timer in case a transfer error occurs because +- there is no error interrupt */ +- mod_timer(&host->pio_timer, jiffies + host->pio_timeout); + } ++ log_event("XFP>", (u32)host->data, host->blocks); + } + +- +-static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) ++static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, ++ struct mmc_data *data) + { +- u32 len, dir_data, dir_slave; ++ int len, dir_data, dir_slave; + struct dma_async_tx_descriptor *desc = NULL; + struct dma_chan *dma_chan; + +- pr_debug("bcm2835_sdhost_transfer_dma()\n"); +- +- WARN_ON(!host->data); +- +- if (!host->data) +- return; ++ log_event("PRD<", (u32)data, 0); ++ pr_debug("bcm2835_sdhost_prepare_dma()\n"); + +- if (host->data->flags & MMC_DATA_READ) { ++ if (data->flags & MMC_DATA_READ) { + dma_chan = host->dma_chan_rx; + dir_data = DMA_FROM_DEVICE; + dir_slave = DMA_DEV_TO_MEM; +@@ -625,35 +780,71 @@ static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) + dir_data = DMA_TO_DEVICE; + dir_slave = DMA_MEM_TO_DEV; + } ++ log_event("PRD1", (u32)dma_chan, 0); + + BUG_ON(!dma_chan->device); + BUG_ON(!dma_chan->device->dev); +- BUG_ON(!host->data->sg); ++ BUG_ON(!data->sg); ++ ++ /* The block doesn't manage the FIFO DREQs properly for multi-block ++ transfers, so don't attempt to DMA the final few words. ++ Unfortunately this requires the final sg entry to be trimmed. ++ N.B. This code demands that the overspill is contained in ++ a single sg entry. ++ */ ++ ++ host->drain_words = 0; ++ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { ++ struct scatterlist *sg; ++ u32 len; ++ int i; ++ ++ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, ++ (u32)data->blocks * data->blksz); + +- len = dma_map_sg(dma_chan->device->dev, host->data->sg, +- host->data->sg_len, dir_data); +- if (len > 0) { +- desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, ++ for_each_sg(data->sg, sg, data->sg_len, i) { ++ if (sg_is_last(sg)) { ++ BUG_ON(sg->length < len); ++ sg->length -= len; ++ host->drain_page = (struct page *)sg->page_link; ++ host->drain_offset = sg->offset + sg->length; ++ } ++ } ++ host->drain_words = len/4; ++ } ++ ++ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, ++ dir_data); ++ ++ log_event("PRD2", len, 0); ++ if (len > 0) ++ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, + len, dir_slave, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); +- } else { +- dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); +- } ++ log_event("PRD3", (u32)desc, 0); ++ + if (desc) { + desc->callback = bcm2835_sdhost_dma_complete; + desc->callback_param = host; +- dmaengine_submit(desc); +- dma_async_issue_pending(dma_chan); ++ host->dma_desc = desc; ++ host->dma_chan = dma_chan; ++ host->dma_dir = dir_data; + } +- ++ log_event("PDM>", (u32)data, 0); + } + ++static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) ++{ ++ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); ++ dmaengine_submit(host->dma_desc); ++ dma_async_issue_pending(host->dma_chan); ++} + + static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) + { + u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | + SDHCFG_BUSY_IRPT_EN; +- if (host->use_dma) ++ if (host->dma_desc) + host->hcfg = (host->hcfg & ~all_irqs) | + SDHCFG_BUSY_IRPT_EN; + else +@@ -664,13 +855,13 @@ static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + } + +- + static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) + { + struct mmc_data *data = cmd->data; + + WARN_ON(host->data); + ++ host->data = data; + if (!data) + return; + +@@ -679,46 +870,19 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co + BUG_ON(data->blksz > host->mmc->max_blk_size); + BUG_ON(data->blocks > 65535); + +- host->data = data; + host->data_complete = 0; + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + +- if (!host->sectors && host->mmc->card && !(host->debug_flags & 1)) +- { +- struct mmc_card *card = host->mmc->card; +- if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { +- /* +- * The EXT_CSD sector count is in number of 512 byte +- * sectors. +- */ +- host->sectors = card->ext_csd.sectors; +- pr_err("%s: using ext_csd!\n", mmc_hostname(host->mmc)); +- } else { +- /* +- * The CSD capacity field is in units of read_blkbits. +- * set_capacity takes units of 512 bytes. +- */ +- host->sectors = card->csd.capacity << +- (card->csd.read_blkbits - 9); +- } +- host->single_read_sectors[0] = host->sectors - 65; +- host->single_read_sectors[1] = host->sectors - 64; +- host->single_read_sectors[2] = host->sectors - 33; +- host->single_read_sectors[3] = host->sectors - 32; +- host->single_read_sectors[4] = host->sectors - 1; +- host->single_read_sectors[5] = ~0; /* Safety net */ +- } + +- host->use_dma = host->have_dma && (data->blocks > host->pio_limit); +- if (!host->use_dma) { ++ if (!host->dma_desc) { ++ /* Use PIO */ + int flags; + +- flags = SG_MITER_ATOMIC; + if (data->flags & MMC_DATA_READ) +- flags |= SG_MITER_TO_SG; ++ flags = SG_MITER_TO_SG; + else +- flags |= SG_MITER_FROM_SG; ++ flags = SG_MITER_FROM_SG; + sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); + host->blocks = data->blocks; + } +@@ -726,19 +890,20 @@ 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, host->use_dma ? data->blocks : 0, SDHBLC); ++ bcm2835_sdhost_write(host, data->blocks, SDHBLC); + + BUG_ON(!host->data); + } + +- +-void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command *cmd) ++bool bcm2835_sdhost_send_command(struct bcm2835_host *host, ++ struct mmc_command *cmd) + { + u32 sdcmd, sdhsts; + unsigned long timeout; + int delay; + + WARN_ON(host->cmd); ++ log_event("CMD<", cmd->opcode, cmd->arg); + + if (cmd->data) + pr_debug("%s: send_command %d 0x%x " +@@ -761,9 +926,9 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * + pr_err("%s: previous command never completed.\n", + mmc_hostname(host->mmc)); + bcm2835_sdhost_dumpregs(host); +- cmd->error = -EIO; ++ cmd->error = -EILSEQ; + tasklet_schedule(&host->finish_tasklet); +- return; ++ return false; + } + timeout--; + udelay(10); +@@ -791,23 +956,24 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * + if (sdhsts & SDHSTS_ERROR_MASK) + bcm2835_sdhost_write(host, sdhsts, SDHSTS); + +- bcm2835_sdhost_prepare_data(host, cmd); +- +- bcm2835_sdhost_write(host, cmd->arg, SDARG); +- + if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { + pr_err("%s: unsupported response type!\n", + mmc_hostname(host->mmc)); + cmd->error = -EINVAL; + tasklet_schedule(&host->finish_tasklet); +- return; ++ return false; + } + ++ bcm2835_sdhost_prepare_data(host, cmd); ++ ++ bcm2835_sdhost_write(host, cmd->arg, SDARG); ++ + sdcmd = cmd->opcode & SDCMD_CMD_MASK; + +- if (!(cmd->flags & MMC_RSP_PRESENT)) ++ host->use_busy = 0; ++ if (!(cmd->flags & MMC_RSP_PRESENT)) { + sdcmd |= SDCMD_NO_RESPONSE; +- else { ++ } else { + if (cmd->flags & MMC_RSP_136) + sdcmd |= SDCMD_LONG_RESPONSE; + if (cmd->flags & MMC_RSP_BUSY) { +@@ -817,6 +983,7 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * + } + + if (cmd->data) { ++ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); + if (host->delay_after_stop) { + struct timeval now; + int time_since_stop; +@@ -839,10 +1006,12 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * + } + + bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); +-} + ++ return true; ++} + +-static void bcm2835_sdhost_finish_command(struct bcm2835_host *host); ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags); + static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); + + static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) +@@ -852,6 +1021,7 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) + data = host->data; + BUG_ON(!data); + ++ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); + pr_debug("finish_data(error %d, stop %d, sbc %d)\n", + data->error, data->stop ? 1 : 0, + host->mrq->sbc ? 1 : 0); +@@ -859,10 +1029,7 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) + host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + +- if (data->error) { +- data->bytes_xfered = 0; +- } else +- data->bytes_xfered = data->blksz * data->blocks; ++ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); + + host->data_complete = 1; + +@@ -877,9 +1044,9 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) + } + else + bcm2835_sdhost_transfer_complete(host); ++ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); + } + +- + static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) + { + struct mmc_data *data; +@@ -891,6 +1058,7 @@ static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) + data = host->data; + host->data = NULL; + ++ log_event("TCM<", (u32)data, data->error); + pr_debug("transfer_complete(error %d, stop %d)\n", + data->error, data->stop ? 1 : 0); + +@@ -899,88 +1067,114 @@ static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) + * a) open-ended multiblock transfer (no CMD23) + * b) error in multiblock transfer + */ +- if (data->stop && +- (data->error || +- !host->mrq->sbc)) { +- host->flush_fifo = 1; +- bcm2835_sdhost_send_command(host, data->stop); +- if (host->delay_after_stop) +- do_gettimeofday(&host->stop_time); +- if (!host->use_busy) +- bcm2835_sdhost_finish_command(host); ++ if (host->mrq->stop && (data->error || !host->use_sbc)) { ++ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { ++ /* No busy, so poll for completion */ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ ++ if (host->delay_after_stop) ++ do_gettimeofday(&host->stop_time); ++ } + } else { ++ bcm2835_sdhost_wait_transfer_complete(host); + tasklet_schedule(&host->finish_tasklet); + } ++ log_event("TCM>", (u32)data, 0); + } + +-static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) ++/* If irq_flags is valid, the caller is in a thread context and is allowed ++ to sleep */ ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags) + { + u32 sdcmd; +- unsigned long timeout; ++ u32 retries; + #ifdef DEBUG + struct timeval before, after; + int timediff = 0; + #endif + ++ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); + pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); + + BUG_ON(!host->cmd || !host->mrq); + +-#ifdef DEBUG +- do_gettimeofday(&before); +-#endif +- /* Wait max 100 ms */ +- timeout = 10000; ++ /* Poll quickly at first */ ++ ++ retries = host->cmd_quick_poll_retries; ++ if (!retries) { ++ /* Work out how many polls take 1us by timing 10us */ ++ struct timeval start, now; ++ int us_diff; ++ ++ retries = 1; ++ do { ++ int i; ++ ++ retries *= 2; ++ ++ do_gettimeofday(&start); ++ ++ for (i = 0; i < retries; i++) { ++ cpu_relax(); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ } ++ ++ do_gettimeofday(&now); ++ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + ++ (now.tv_usec - start.tv_usec); ++ } while (us_diff < 10); ++ ++ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; ++ retries = 1; // We've already waited long enough this time ++ } ++ ++ retries = host->cmd_quick_poll_retries; + for (sdcmd = bcm2835_sdhost_read(host, SDCMD); +- (sdcmd & SDCMD_NEW_FLAG) && timeout; +- timeout--) { +- if (host->flush_fifo) { +- while (bcm2835_sdhost_read(host, SDHSTS) & +- SDHSTS_DATA_FLAG) +- (void)bcm2835_sdhost_read(host, SDDATA); +- } +- udelay(10); ++ (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries; ++ retries--) { ++ cpu_relax(); + sdcmd = bcm2835_sdhost_read(host, SDCMD); + } +-#ifdef DEBUG +- do_gettimeofday(&after); +- timediff = (after.tv_sec - before.tv_sec)*1000000 + +- (after.tv_usec - before.tv_usec); + +- pr_debug(" finish_command - waited %dus\n", timediff); +-#endif ++ if (!retries) { ++ unsigned long wait_max; ++ ++ if (!irq_flags) { ++ /* Schedule the work */ ++ log_event("CWWQ", 0, 0); ++ schedule_work(&host->cmd_wait_wq); ++ return; ++ } ++ ++ /* Wait max 100 ms */ ++ wait_max = jiffies + msecs_to_jiffies(100); ++ while (time_before(jiffies, wait_max)) { ++ spin_unlock_irqrestore(&host->lock, *irq_flags); ++ usleep_range(1, 10); ++ spin_lock_irqsave(&host->lock, *irq_flags); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ if (!(sdcmd & SDCMD_NEW_FLAG) || ++ (sdcmd & SDCMD_FAIL_FLAG)) ++ break; ++ } ++ } + +- if (timeout == 0) { ++ /* Check for errors */ ++ if (sdcmd & SDCMD_NEW_FLAG) { + pr_err("%s: command never completed.\n", + mmc_hostname(host->mmc)); + bcm2835_sdhost_dumpregs(host); + host->cmd->error = -EIO; + tasklet_schedule(&host->finish_tasklet); + return; +- } +- +- if (host->flush_fifo) { +- for (timeout = 100; +- (bcm2835_sdhost_read(host, SDHSTS) & SDHSTS_DATA_FLAG) && timeout; +- timeout--) { +- (void)bcm2835_sdhost_read(host, SDDATA); +- } +- host->flush_fifo = 0; +- if (timeout == 0) { +- pr_err("%s: FIFO never drained.\n", +- mmc_hostname(host->mmc)); +- bcm2835_sdhost_dumpregs(host); +- host->cmd->error = -EIO; +- tasklet_schedule(&host->finish_tasklet); +- return; +- } +- } +- +- /* Check for errors */ +- if (sdcmd & SDCMD_FAIL_FLAG) +- { ++ } else if (sdcmd & SDCMD_FAIL_FLAG) { + u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); + ++ /* Clear the errors */ ++ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); ++ + if (host->debug) + pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", + mmc_hostname(host->mmc), sdcmd, sdhsts, +@@ -1003,7 +1197,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + mmc_hostname(host->mmc), + host->cmd->opcode); + bcm2835_sdhost_dumpregs(host); +- host->cmd->error = -EIO; ++ host->cmd->error = -EILSEQ; + } + tasklet_schedule(&host->finish_tasklet); + return; +@@ -1018,31 +1212,31 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + pr_debug("%s: finish_command %08x %08x %08x %08x\n", + mmc_hostname(host->mmc), + host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); ++ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); + } else { + host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); + pr_debug("%s: finish_command %08x\n", + mmc_hostname(host->mmc), + host->cmd->resp[0]); ++ log_event("RSP ", host->cmd->resp[0], 0); + } + } + +- host->cmd->error = 0; +- + if (host->cmd == host->mrq->sbc) { + /* Finished CMD23, now send actual command. */ + host->cmd = NULL; +- bcm2835_sdhost_send_command(host, host->mrq->cmd); +- +- if (host->cmd->data && host->use_dma) +- /* DMA transfer starts now, PIO starts after irq */ +- bcm2835_sdhost_transfer_dma(host); ++ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); + +- if (!host->use_busy) +- bcm2835_sdhost_finish_command(host); +- } else if (host->cmd == host->mrq->stop) ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ } ++ } else if (host->cmd == host->mrq->stop) { + /* Finished CMD12 */ + tasklet_schedule(&host->finish_tasklet); +- else { ++ } else { + /* Processed actual command. */ + host->cmd = NULL; + if (!host->data) +@@ -1050,6 +1244,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + else if (host->data_complete) + bcm2835_sdhost_transfer_complete(host); + } ++ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); + } + + static void bcm2835_sdhost_timeout(unsigned long data) +@@ -1060,10 +1255,12 @@ static void bcm2835_sdhost_timeout(unsigned long data) + host = (struct bcm2835_host *)data; + + spin_lock_irqsave(&host->lock, flags); ++ log_event("TIM<", 0, 0); + + if (host->mrq) { + pr_err("%s: timeout waiting for hardware interrupt.\n", + mmc_hostname(host->mmc)); ++ log_dump(); + bcm2835_sdhost_dumpregs(host); + + if (host->data) { +@@ -1084,74 +1281,15 @@ static void bcm2835_sdhost_timeout(unsigned long data) + spin_unlock_irqrestore(&host->lock, flags); + } + +-static void bcm2835_sdhost_pio_timeout(unsigned long data) ++static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) + { +- struct bcm2835_host *host; +- unsigned long flags; +- +- host = (struct bcm2835_host *)data; +- +- spin_lock_irqsave(&host->lock, flags); +- +- if (host->data) { +- u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); +- +- if (sdhsts & SDHSTS_REW_TIME_OUT) { +- pr_err("%s: transfer timeout\n", +- mmc_hostname(host->mmc)); +- if (host->debug) +- bcm2835_sdhost_dumpregs(host); +- } else { +- pr_err("%s: unexpected transfer timeout\n", +- mmc_hostname(host->mmc)); +- bcm2835_sdhost_dumpregs(host); +- } +- +- bcm2835_sdhost_write(host, SDHSTS_TRANSFER_ERROR_MASK, +- SDHSTS); +- +- host->data->error = -ETIMEDOUT; +- +- bcm2835_sdhost_finish_data(host); +- } +- +- mmiowb(); +- spin_unlock_irqrestore(&host->lock, flags); +-} +- +-static void bcm2835_sdhost_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) +-{ +- if (enable) +- host->hcfg |= SDHCFG_SDIO_IRPT_EN; +- else +- host->hcfg &= ~SDHCFG_SDIO_IRPT_EN; +- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); +- mmiowb(); +-} +- +-static void bcm2835_sdhost_enable_sdio_irq(struct mmc_host *mmc, int enable) +-{ +- struct bcm2835_host *host = mmc_priv(mmc); +- unsigned long flags; +- +- pr_debug("%s: enable_sdio_irq(%d)\n", mmc_hostname(mmc), enable); +- spin_lock_irqsave(&host->lock, flags); +- bcm2835_sdhost_enable_sdio_irq_nolock(host, enable); +- spin_unlock_irqrestore(&host->lock, flags); +-} +- +-static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) +-{ +- const u32 handled = (SDHSTS_REW_TIME_OUT | SDHSTS_CMD_TIME_OUT | +- SDHSTS_CRC16_ERROR | SDHSTS_CRC7_ERROR | +- SDHSTS_FIFO_ERROR); +- ++ log_event("IRQB", (u32)host->cmd, intmask); + if (!host->cmd) { + pr_err("%s: got command busy interrupt 0x%08x even " + "though no command operation was in progress.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); +- return 0; ++ return; + } + + if (!host->use_busy) { +@@ -1159,7 +1297,7 @@ static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) + "though not expecting one.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); +- return 0; ++ return; + } + host->use_busy = 0; + +@@ -1182,28 +1320,23 @@ static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) + } else if (intmask & SDHSTS_CMD_TIME_OUT) + host->cmd->error = -ETIMEDOUT; + ++ log_dump(); + bcm2835_sdhost_dumpregs(host); +- tasklet_schedule(&host->finish_tasklet); + } + else +- bcm2835_sdhost_finish_command(host); +- +- return handled; ++ bcm2835_sdhost_finish_command(host, NULL); + } + +-static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) + { +- const u32 handled = (SDHSTS_REW_TIME_OUT | +- SDHSTS_CRC16_ERROR | +- SDHSTS_FIFO_ERROR); +- + /* There are no dedicated data/space available interrupt + status bits, so it is necessary to use the single shared + data/space available FIFO status bits. It is therefore not + an error to get here when there is no data transfer in + progress. */ ++ log_event("IRQD", (u32)host->data, intmask); + if (!host->data) +- return 0; ++ return; + + if (intmask & (SDHSTS_CRC16_ERROR | + SDHSTS_FIFO_ERROR | +@@ -1214,46 +1347,37 @@ static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) + else + host->data->error = -ETIMEDOUT; + +- bcm2835_sdhost_dumpregs(host); +- tasklet_schedule(&host->finish_tasklet); +- return handled; ++ if (host->debug) { ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } + } + +- /* Use the block interrupt for writes after the first block */ +- if (host->data->flags & MMC_DATA_WRITE) { ++ if (host->data->error) { ++ bcm2835_sdhost_finish_data(host); ++ } else if (host->data->flags & MMC_DATA_WRITE) { ++ /* Use the block interrupt for writes after the first block */ + 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); +- else +- bcm2835_sdhost_transfer_pio(host); ++ bcm2835_sdhost_transfer_pio(host); + } else { +- if (!host->data->error) { +- bcm2835_sdhost_transfer_pio(host); +- host->blocks--; +- } ++ bcm2835_sdhost_transfer_pio(host); ++ host->blocks--; + if ((host->blocks == 0) || host->data->error) + bcm2835_sdhost_finish_data(host); + } +- +- return handled; + } + +-static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) + { +- struct dma_chan *dma_chan; +- u32 dir_data; +- const u32 handled = (SDHSTS_REW_TIME_OUT | +- SDHSTS_CRC16_ERROR | +- SDHSTS_FIFO_ERROR); +- ++ log_event("IRQK", (u32)host->data, intmask); + if (!host->data) { + pr_err("%s: got block interrupt 0x%08x even " + "though no data operation was in progress.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); +- return handled; ++ return; + } + + if (intmask & (SDHSTS_CRC16_ERROR | +@@ -1265,149 +1389,69 @@ static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) + else + host->data->error = -ETIMEDOUT; + +- if (host->debug) ++ if (host->debug) { ++ log_dump(); + bcm2835_sdhost_dumpregs(host); +- tasklet_schedule(&host->finish_tasklet); +- return handled; ++ } + } + +- if (!host->use_dma) { ++ if (!host->dma_desc) { + BUG_ON(!host->blocks); +- host->blocks--; +- if ((host->blocks == 0) || host->data->error) { +- /* Cancel the timer */ +- del_timer(&host->pio_timer); +- ++ if (host->data->error || (--host->blocks == 0)) { + bcm2835_sdhost_finish_data(host); + } else { +- /* Reset the timer */ +- mod_timer(&host->pio_timer, +- jiffies + host->pio_timeout); +- + bcm2835_sdhost_transfer_pio(host); +- +- /* Reset the timer */ +- mod_timer(&host->pio_timer, +- jiffies + host->pio_timeout); + } + } else if (host->data->flags & MMC_DATA_WRITE) { +- dma_chan = host->dma_chan_tx; +- dir_data = DMA_TO_DEVICE; +- dma_unmap_sg(dma_chan->device->dev, +- host->data->sg, host->data->sg_len, +- dir_data); +- + bcm2835_sdhost_finish_data(host); + } +- +- return handled; + } + +- + static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) + { + irqreturn_t result = IRQ_NONE; + struct bcm2835_host *host = dev_id; +- u32 unexpected = 0, early = 0; +- int loops = 0; ++ u32 intmask; + + spin_lock(&host->lock); + +- for (loops = 0; loops < 1; loops++) { +- u32 intmask, handled; +- +- intmask = bcm2835_sdhost_read(host, SDHSTS); +- handled = intmask & (SDHSTS_BUSY_IRPT | +- SDHSTS_BLOCK_IRPT | +- SDHSTS_SDIO_IRPT | +- SDHSTS_DATA_FLAG); +- if ((handled == SDHSTS_DATA_FLAG) && +- (loops == 0) && !host->data) { +- pr_err("%s: sdhost_irq data interrupt 0x%08x even " +- "though no data operation was in progress.\n", +- mmc_hostname(host->mmc), +- (unsigned)intmask); +- +- bcm2835_sdhost_dumpregs(host); +- } +- +- if (!handled) +- break; ++ intmask = bcm2835_sdhost_read(host, SDHSTS); ++ log_event("IRQ<", intmask, 0); + +- if (loops) +- early |= handled; ++ bcm2835_sdhost_write(host, ++ SDHSTS_BUSY_IRPT | ++ SDHSTS_BLOCK_IRPT | ++ SDHSTS_SDIO_IRPT | ++ SDHSTS_DATA_FLAG, ++ SDHSTS); + ++ if (intmask & SDHSTS_BLOCK_IRPT) { ++ bcm2835_sdhost_block_irq(host, intmask); + result = IRQ_HANDLED; ++ } + +- /* Clear all interrupts and notifications */ +- bcm2835_sdhost_write(host, intmask, SDHSTS); +- +- if (intmask & SDHSTS_BUSY_IRPT) +- handled |= bcm2835_sdhost_busy_irq(host, intmask); +- +- /* There is no true data interrupt status bit, so it is +- necessary to qualify the data flag with the interrupt +- enable bit */ +- if ((intmask & SDHSTS_DATA_FLAG) && +- (host->hcfg & SDHCFG_DATA_IRPT_EN)) +- handled |= bcm2835_sdhost_data_irq(host, intmask); +- +- if (intmask & SDHSTS_BLOCK_IRPT) +- handled |= bcm2835_sdhost_block_irq(host, intmask); +- +- if (intmask & SDHSTS_SDIO_IRPT) { +- bcm2835_sdhost_enable_sdio_irq_nolock(host, false); +- host->thread_isr |= SDHSTS_SDIO_IRPT; +- result = IRQ_WAKE_THREAD; +- } ++ if (intmask & SDHSTS_BUSY_IRPT) { ++ bcm2835_sdhost_busy_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } + +- unexpected |= (intmask & ~handled); ++ /* There is no true data interrupt status bit, so it is ++ necessary to qualify the data flag with the interrupt ++ enable bit */ ++ if ((intmask & SDHSTS_DATA_FLAG) && ++ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { ++ bcm2835_sdhost_data_irq(host, intmask); ++ result = IRQ_HANDLED; + } + + mmiowb(); + ++ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); + spin_unlock(&host->lock); + +- if (early) +- pr_debug("%s: early %x (loops %d)\n", +- mmc_hostname(host->mmc), early, loops); +- +- if (unexpected) { +- pr_err("%s: unexpected interrupt 0x%08x.\n", +- mmc_hostname(host->mmc), unexpected); +- bcm2835_sdhost_dumpregs(host); +- } +- + return result; + } + +-static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id) +-{ +- struct bcm2835_host *host = dev_id; +- unsigned long flags; +- u32 isr; +- +- spin_lock_irqsave(&host->lock, flags); +- isr = host->thread_isr; +- host->thread_isr = 0; +- spin_unlock_irqrestore(&host->lock, flags); +- +- if (isr & SDHSTS_SDIO_IRPT) { +- sdio_run_irqs(host->mmc); +- +-/* Is this necessary? Why re-enable an interrupt which is enabled? +- spin_lock_irqsave(&host->lock, flags); +- if (host->flags & SDHSTS_SDIO_IRPT_ENABLED) +- bcm2835_sdhost_enable_sdio_irq_nolock(host, true); +- spin_unlock_irqrestore(&host->lock, flags); +-*/ +- } +- +- return isr ? IRQ_HANDLED : IRQ_NONE; +-} +- +- +- + void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + { + int div = 0; /* Initialized for compiler warning */ +@@ -1417,9 +1461,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); + + if ((host->overclock_50 > 50) && +- (clock == 50*MHZ)) { ++ (clock == 50*MHZ)) + clock = host->overclock_50 * MHZ + (MHZ - 1); +- } + + /* The SDCDIV register has 11 bits, and holds (div - 2). + But in data mode the max is 50MHz wihout a minimum, and only the +@@ -1466,6 +1509,11 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + clock = host->max_clk / (div + 2); + host->mmc->actual_clock = clock; + ++ /* Calibrate some delays */ ++ ++ host->ns_per_fifo_word = (1000000000/clock) * ++ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); ++ + if (clock > input_clock) { + /* Save the closest value, to make it easier + to reduce in the event of error */ +@@ -1501,6 +1549,7 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq + { + struct bcm2835_host *host; + unsigned long flags; ++ u32 edm, fsm; + + host = mmc_priv(mmc); + +@@ -1521,6 +1570,8 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq + } + + /* Reset the error statuses in case this is a retry */ ++ if (mrq->sbc) ++ mrq->sbc->error = 0; + if (mrq->cmd) + mrq->cmd->error = 0; + if (mrq->data) +@@ -1536,28 +1587,58 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq + return; + } + ++ if (host->use_dma && mrq->data && ++ (mrq->data->blocks > host->pio_limit)) ++ bcm2835_sdhost_prepare_dma(host, mrq->data); ++ + spin_lock_irqsave(&host->lock, flags); + + WARN_ON(host->mrq != NULL); +- + host->mrq = mrq; + +- if (mrq->sbc) +- bcm2835_sdhost_send_command(host, mrq->sbc); +- else +- bcm2835_sdhost_send_command(host, mrq->cmd); ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ fsm = edm & SDEDM_FSM_MASK; + +- mmiowb(); +- spin_unlock_irqrestore(&host->lock, flags); ++ log_event("REQ<", (u32)mrq, edm); ++ if ((fsm != SDEDM_FSM_IDENTMODE) && ++ (fsm != SDEDM_FSM_DATAMODE)) { ++ pr_err("%s: previous command (%d) not complete (EDM %x)\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, ++ edm); ++ log_event("REQ!", (u32)mrq, edm); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ mrq->cmd->error = -EILSEQ; ++ tasklet_schedule(&host->finish_tasklet); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } + +- if (!mrq->sbc && mrq->cmd->data && host->use_dma) +- /* DMA transfer starts now, PIO starts after irq */ +- bcm2835_sdhost_transfer_dma(host); ++ host->use_sbc = !!mrq->sbc && ++ (host->mrq->data->flags & USE_CMD23_FLAGS); ++ if (host->use_sbc) { ++ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } ++ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); + +- if (!host->use_busy) +- bcm2835_sdhost_finish_command(host); +-} ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } + ++ log_event("CMD ", (u32)mrq->cmd->opcode, ++ mrq->data ? (u32)mrq->data->blksz : 0); ++ mmiowb(); ++ ++ log_event("REQ>", (u32)mrq, 0); ++ spin_unlock_irqrestore(&host->lock, flags); ++} + + static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + { +@@ -1574,6 +1655,8 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + + spin_lock_irqsave(&host->lock, flags); + ++ log_event("IOS<", ios->clock, 0); ++ + if (!ios->clock || ios->clock != host->clock) { + bcm2835_sdhost_set_clock(host, ios->clock); + host->clock = ios->clock; +@@ -1596,59 +1679,53 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + spin_unlock_irqrestore(&host->lock, flags); + } + +-static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, int blk_size) ++static struct mmc_host_ops bcm2835_sdhost_ops = { ++ .request = bcm2835_sdhost_request, ++ .set_ios = bcm2835_sdhost_set_ios, ++ .hw_reset = bcm2835_sdhost_reset, ++}; ++ ++static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) + { +- /* There is a bug in the host controller hardware that makes +- reading the final sector of the card as part of a multiple read +- problematic. Detect that case and shorten the read accordingly. +- */ + struct bcm2835_host *host; ++ unsigned long flags; + +- host = mmc_priv(card->host); ++ host = container_of(work, struct bcm2835_host, cmd_wait_wq); + +- if (!host->sectors) { +- /* csd.capacity is in weird units - convert to sectors */ +- u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); +- if ((direction == MMC_DATA_READ) && +- ((blk_pos + blk_size) == card_sectors)) +- blk_size--; +- return blk_size; +- } ++ spin_lock_irqsave(&host->lock, flags); + +- if (direction == MMC_DATA_READ) { +- int i; +- int sector; +- for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) +- continue; ++ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); + +- if ((blk_pos + blk_size) > sector) +- blk_size = (blk_pos == sector) ? 1 : (sector - blk_pos); ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; + } +- return blk_size; +-} + ++ bcm2835_sdhost_finish_command(host, &flags); + +-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, +- .hw_reset = bcm2835_sdhost_reset, +- .multi_io_quirk = bcm2835_sdhost_multi_io_quirk, +-}; ++ mmiowb(); ++ ++ log_event("CWK>", (u32)host->cmd, 0); + ++ spin_unlock_irqrestore(&host->lock, flags); ++} + + static void bcm2835_sdhost_tasklet_finish(unsigned long param) + { + struct bcm2835_host *host; + unsigned long flags; + struct mmc_request *mrq; ++ struct dma_chan *terminate_chan = NULL; + + host = (struct bcm2835_host *)param; + + spin_lock_irqsave(&host->lock, flags); + ++ log_event("TSK<", (u32)host->mrq, 0); + /* + * If this tasklet gets rescheduled while running, it will + * be run again afterwards but without any active request. +@@ -1683,11 +1760,23 @@ static void bcm2835_sdhost_tasklet_finish(unsigned long param) + + mmiowb(); + ++ host->dma_desc = NULL; ++ terminate_chan = host->dma_chan; ++ host->dma_chan = NULL; ++ + spin_unlock_irqrestore(&host->lock, flags); +- mmc_request_done(host->mmc, mrq); +-} + ++ if (terminate_chan) ++ { ++ int err = dmaengine_terminate_all(terminate_chan); ++ if (err) ++ pr_err("%s: failed to terminate DMA (%d)\n", ++ mmc_hostname(host->mmc), err); ++ } + ++ mmc_request_done(host->mmc, mrq); ++ log_event("TSK>", (u32)mrq, 0); ++} + + int bcm2835_sdhost_add_host(struct bcm2835_host *host) + { +@@ -1709,10 +1798,10 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + mmc->f_max, mmc->f_min, mmc->max_busy_timeout); + + /* host controller capabilities */ +- mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | ++ mmc->caps |= + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | + MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | +- (ALLOW_CMD23 * MMC_CAP_CMD23); ++ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + +@@ -1722,9 +1811,9 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + pr_err("%s: unable to initialise DMA channels. " + "Falling back to PIO\n", + mmc_hostname(mmc)); +- host->have_dma = false; ++ host->use_dma = false; + } else { +- host->have_dma = true; ++ host->use_dma = true; + + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; +@@ -1741,7 +1830,7 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); + } + } else { +- host->have_dma = false; ++ host->use_dma = false; + } + + mmc->max_segs = 128; +@@ -1756,16 +1845,15 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + tasklet_init(&host->finish_tasklet, + bcm2835_sdhost_tasklet_finish, (unsigned long)host); + +- setup_timer(&host->timer, bcm2835_sdhost_timeout, +- (unsigned long)host); ++ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); + +- setup_timer(&host->pio_timer, bcm2835_sdhost_pio_timeout, ++ setup_timer(&host->timer, bcm2835_sdhost_timeout, + (unsigned long)host); + + bcm2835_sdhost_init(host, 0); +- ret = request_threaded_irq(host->irq, bcm2835_sdhost_irq, +- bcm2835_sdhost_thread_irq, +- IRQF_SHARED, mmc_hostname(mmc), host); ++ ++ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, ++ mmc_hostname(mmc), host); + if (ret) { + pr_err("%s: failed to request IRQ %d: %d\n", + mmc_hostname(mmc), host->irq, ret); +@@ -1776,11 +1864,11 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + mmc_add_host(mmc); + + pio_limit_string[0] = '\0'; +- if (host->have_dma && (host->pio_limit > 0)) ++ if (host->use_dma && (host->pio_limit > 0)) + sprintf(pio_limit_string, " (>%d)", host->pio_limit); + pr_info("%s: %s loaded - DMA %s%s\n", + mmc_hostname(mmc), DRIVER_NAME, +- host->have_dma ? "enabled" : "disabled", ++ host->use_dma ? "enabled" : "disabled", + pio_limit_string); + + return 0; +@@ -1810,8 +1898,11 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + mmc->ops = &bcm2835_sdhost_ops; + host = mmc_priv(mmc); + host->mmc = mmc; ++ host->cmd_quick_poll_retries = 0; + host->pio_timeout = msecs_to_jiffies(500); ++ host->pio_limit = 1; + host->max_delay = 1; /* Warn if over 1ms */ ++ host->allow_dma = 1; + spin_lock_init(&host->lock); + + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); +@@ -1827,13 +1918,12 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + return -ENODEV; + } + host->bus_addr = be32_to_cpup(addr); ++ log_init(iomem->start - host->bus_addr); + pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", + (unsigned long)host->ioaddr, + (unsigned long)iomem->start, + (unsigned long)host->bus_addr); + +- host->allow_dma = ALLOW_DMA; +- + if (node) { + /* Read any custom properties */ + of_property_read_u32(node, +@@ -1845,16 +1935,17 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + of_property_read_u32(node, + "brcm,pio-limit", + &host->pio_limit); +- host->allow_dma = ALLOW_DMA && ++ host->allow_dma = + !of_property_read_bool(node, "brcm,force-pio"); + host->debug = of_property_read_bool(node, "brcm,debug"); +- of_property_read_u32(node, +- "brcm,debug-flags", +- &host->debug_flags); + } + +- if (host->debug_flags) +- dev_err(dev, "debug_flags=%x\n", host->debug_flags); ++ host->dma_chan = NULL; ++ host->dma_desc = NULL; ++ ++ /* Formally recognise the other way of disabling DMA */ ++ if (host->pio_limit == 0x7fffffff) ++ host->allow_dma = false; + + if (host->allow_dma) { + if (node) { +@@ -1940,15 +2031,12 @@ static int bcm2835_sdhost_remove(struct platform_device *pdev) + return 0; + } + +- + static const struct of_device_id bcm2835_sdhost_match[] = { + { .compatible = "brcm,bcm2835-sdhost" }, + { } + }; + MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); + +- +- + static struct platform_driver bcm2835_sdhost_driver = { + .probe = bcm2835_sdhost_probe, + .remove = bcm2835_sdhost_remove, + +From d15e041e838bd735a7ed3eaa5dbff785213baf6d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 12 Feb 2016 15:38:00 +0000 +Subject: [PATCH 150/170] BCM270X_DT: Add dtparams for the SD interface + +Add new base dtparams sd_overclock, sd_force_pio, sd_pio_limit +and sd_debug. +--- + 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.dts | 1 - + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 13 +++++++++++++ + arch/arm/boot/dts/bcm2708_common.dtsi | 2 ++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++++ + arch/arm/boot/dts/overlays/README | 11 ++++++++++- + arch/arm/boot/dts/overlays/mmc-overlay.dts | 1 - + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 27 +++++++++++++------------- + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 14 ++++++------- + 10 files changed, 58 insertions(+), 23 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 2e4df17..d2d6fa0 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -141,5 +141,9 @@ + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 0445b46..d033ee4 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -131,5 +131,9 @@ + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 87c1a54..8bcafb41 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -97,6 +97,5 @@ + i2c0_baudrate = <&i2c0>,"clock-frequency:0"; + i2c1_baudrate = <&i2c1>,"clock-frequency:0"; + i2c2_baudrate = <&i2c2>,"clock-frequency:0"; +- core_freq = <&clk_core>,"clock-frequency:0"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 3c8bdde..e09e499 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -7,6 +7,13 @@ + }; + }; + ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ + &leds { + act_led: act { + label = "led0"; +@@ -29,6 +36,8 @@ + + / { + __overrides__ { ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ + act_led_gpio = <&act_led>,"gpios:4"; + act_led_activelow = <&act_led>,"gpios:8"; + act_led_trigger = <&act_led>,"linux,default-trigger"; +@@ -36,5 +45,9 @@ + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 75fb4ce..18d3c45 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -135,6 +135,7 @@ + dmas = <&dma 13>, + <&dma 13>; + dma-names = "tx", "rx"; ++ brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; + status = "disabled"; + }; +@@ -203,6 +204,7 @@ + dmas = <&dma 11>, + <&dma 11>; + dma-names = "tx", "rx"; ++ brcm,overclock-50 = <0>; + status = "disabled"; + }; + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 5206ba2..aca253f 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -141,5 +141,9 @@ + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index f987565..0a2df01 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -112,6 +112,16 @@ Params: + random Set to "on" to enable the hardware random + number generator (default "on") + ++ sd_overclock Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sd_force_pio Disable DMA support for SD driver (default off) ++ ++ sd_pio_limit Number of blocks above which to use DMA for ++ SD card (default 1) ++ ++ sd_debug Enable debug output from SD driver (default off) ++ + uart0 Set to "off" to disable uart0 (default "on") + + watchdog Set to "on" to enable the hardware watchdog +@@ -443,7 +453,6 @@ 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 +diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts +index 00a22be..d32b02c 100644 +--- a/arch/arm/boot/dts/overlays/mmc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts +@@ -34,6 +34,5 @@ + + __overrides__ { + overclock_50 = <&frag0>,"brcm,overclock-50:0"; +- force_pio = <&frag0>,"brcm,force-pio?"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +index dbe6574..a431177 100644 +--- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -1,19 +1,14 @@ + /dts-v1/; + /plugin/; + ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ + /{ + compatible = "brcm,bcm2708"; + + fragment@0 { +- target = <&mmc>; +- __overlay__ { +- status = "disabled"; +- }; +- }; +- +- fragment@1 { + target = <&sdhost>; +- frag1: __overlay__ { ++ frag0: __overlay__ { + brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; + brcm,debug-flags = <0>; +@@ -21,11 +16,17 @@ + }; + }; + ++ fragment@1 { ++ target = <&mmc>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ + __overrides__ { +- overclock_50 = <&frag1>,"brcm,overclock-50:0"; +- force_pio = <&frag1>,"brcm,force-pio?"; +- pio_limit = <&frag1>,"brcm,pio-limit:0"; +- debug = <&frag1>,"brcm,debug?"; +- debug_flags = <&frag1>,"brcm,debug-flags:0"; ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +index b0b208c..e4a4677 100644 +--- a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -1,23 +1,23 @@ + /dts-v1/; + /plugin/; + ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ + /{ + compatible = "brcm,bcm2708"; + + fragment@0 { + target = <&sdhost>; +- frag1: __overlay__ { ++ frag0: __overlay__ { + brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; +- brcm,debug-flags = <0>; + }; + }; + + __overrides__ { +- overclock_50 = <&frag1>,"brcm,overclock-50:0"; +- force_pio = <&frag1>,"brcm,force-pio?"; +- pio_limit = <&frag1>,"brcm,pio-limit:0"; +- debug = <&frag1>,"brcm,debug?"; +- debug_flags = <&frag1>,"brcm,debug-flags:0"; ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; + }; + }; + +From bc7400cadff6bf33451b124eac2e8bf80ebb0197 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 12 Feb 2016 14:50:25 +0000 +Subject: [PATCH 151/170] dcw_otg: trim xfer length when buffer larger than + allocated size is received + +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index 8db3dfc..d672a76 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -737,6 +737,11 @@ static int update_urb_state_xfer_comp(dwc_hc_t * hc, + DWC_OTG_HC_XFER_COMPLETE, + &short_read); + ++ if (urb->actual_length + xfer_length > urb->length) { ++ DWC_WARN("%s(): trimming xfer length\n", __func__); ++ xfer_length = urb->length - urb->actual_length; ++ } ++ + /* non DWORD-aligned buffer case handling. */ + if (hc->align_buff && xfer_length && hc->ep_is_in) { + dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, +@@ -1423,6 +1428,12 @@ static void update_urb_state_xfer_intr(dwc_hc_t * hc, + { + uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, + halt_status, NULL); ++ ++ if (urb->actual_length + bytes_transferred > urb->length) { ++ DWC_WARN("%s(): trimming xfer length\n", __func__); ++ bytes_transferred = urb->length - urb->actual_length; ++ } ++ + /* non DWORD-aligned buffer case handling. */ + if (hc->align_buff && bytes_transferred && hc->ep_is_in) { + dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, + +From f395ff998f2bde846499b1a0ef84519989dc2d4e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 15 Feb 2016 10:00:27 +0000 +Subject: [PATCH 152/170] bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping + +Allocation problems have been seen in a wireless driver, and +this is the only change which might have been responsible. +--- + drivers/mmc/host/bcm2835-sdhost.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 262180b..d66385c 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -874,15 +874,14 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + +- + if (!host->dma_desc) { + /* Use PIO */ +- int flags; ++ int flags = SG_MITER_ATOMIC; + + if (data->flags & MMC_DATA_READ) +- flags = SG_MITER_TO_SG; ++ flags |= SG_MITER_TO_SG; + else +- flags = SG_MITER_FROM_SG; ++ flags |= SG_MITER_FROM_SG; + sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); + host->blocks = data->blocks; + } + +From d2943c4ee1c52cb2c9802be194ca90442e4fe34f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Feb 2016 08:47:56 +0000 +Subject: [PATCH 153/170] Revert "Add blk_pos parameter to mmc multi_io_quirk + callback" + +This reverts commit aab95f9b10e8c3d32de2bf163b86f220c88214fe. + +The bcm2835-sdhost driver no longer needs this patch. +--- + drivers/mmc/card/block.c | 1 - + drivers/mmc/host/omap_hsmmc.c | 4 +--- + drivers/mmc/host/sh_mobile_sdhi.c | 4 +--- + drivers/mmc/host/tmio_mmc_pio.c | 4 +--- + include/linux/mmc/host.h | 4 +--- + 5 files changed, 4 insertions(+), 13 deletions(-) + +diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c +index b35f0c4..d848616 100644 +--- a/drivers/mmc/card/block.c ++++ b/drivers/mmc/card/block.c +@@ -1510,7 +1510,6 @@ 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, +- blk_rq_pos(req), + brq->data.blocks); + } + +diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c +index 708d0fa..7fb0753 100644 +--- a/drivers/mmc/host/omap_hsmmc.c ++++ b/drivers/mmc/host/omap_hsmmc.c +@@ -1832,9 +1832,7 @@ static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host) + } + + static int omap_hsmmc_multi_io_quirk(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, +- int blk_size) ++ unsigned int direction, int blk_size) + { + /* This controller can't do multiblock reads due to hw bugs */ + if (direction == MMC_DATA_READ) +diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c +index 4f1ccf3..354f4f3 100644 +--- a/drivers/mmc/host/sh_mobile_sdhi.c ++++ b/drivers/mmc/host/sh_mobile_sdhi.c +@@ -170,9 +170,7 @@ static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr) + } + + static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, +- int blk_size) ++ unsigned int direction, int blk_size) + { + /* + * 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 7b730d8..a10fde4 100644 +--- a/drivers/mmc/host/tmio_mmc_pio.c ++++ b/drivers/mmc/host/tmio_mmc_pio.c +@@ -1003,9 +1003,7 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) + } + + static int tmio_multi_io_quirk(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, +- int blk_size) ++ unsigned int direction, int blk_size) + { + struct tmio_mmc_host *host = mmc_priv(card->host); + +diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h +index 105b3e6..ad22ebb 100644 +--- a/include/linux/mmc/host.h ++++ b/include/linux/mmc/host.h +@@ -143,9 +143,7 @@ struct mmc_host_ops { + * I/O. Returns the number of supported blocks for the request. + */ + int (*multi_io_quirk)(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, +- int blk_size); ++ unsigned int direction, int blk_size); + }; + + struct mmc_card; + +From ee83592659ae5dc5ceee63790a8cba57ebfa57b3 Mon Sep 17 00:00:00 2001 +From: Craig Roberts +Date: Tue, 16 Feb 2016 10:03:42 +0000 +Subject: [PATCH 154/170] Updated smsc95xx driver to check for a valid MAC + address in eeprom before using smsc95xx.macaddr parameter passed on command + line. + +The built-in RPi adaptor will still get a MAC address based on the parameter passed on the command line as the RPi hardware does not have an eeprom, +however usb->ethernet adaptors using the same driver should have an eeprom with MAC address as part of their hardware and therefore will use this +meaning they don't end up with the same MAC address as the built-in RPi adaptor. +--- + drivers/net/usb/smsc95xx.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 3244a90..7483222 100755 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -817,10 +817,6 @@ static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) + + static void smsc95xx_init_mac_address(struct usbnet *dev) + { +- /* Check module parameters */ +- if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) +- return; +- + /* try reading mac address from EEPROM */ + if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, + dev->net->dev_addr) == 0) { +@@ -831,7 +827,11 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) + } + } + +- /* no eeprom, or eeprom values are invalid. generate random MAC */ ++ /* Check module parameters */ ++ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) ++ return; ++ ++ /* no eeprom, or eeprom values are invalid, and no module parameter specified to set MAC. Generate random MAC */ + eth_hw_addr_random(dev->net); + netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); + } + +From 1c43ff69763f4537b76b3248850256da2bda211b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 17 Feb 2016 19:02:31 +0000 +Subject: [PATCH 155/170] dcw_otg: Make trimming messages less noisy + +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index d672a76..e6b38ac3 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -738,7 +738,8 @@ static int update_urb_state_xfer_comp(dwc_hc_t * hc, + &short_read); + + if (urb->actual_length + xfer_length > urb->length) { +- DWC_WARN("%s(): trimming xfer length\n", __func__); ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); + xfer_length = urb->length - urb->actual_length; + } + +@@ -1430,7 +1431,8 @@ static void update_urb_state_xfer_intr(dwc_hc_t * hc, + halt_status, NULL); + + if (urb->actual_length + bytes_transferred > urb->length) { +- DWC_WARN("%s(): trimming xfer length\n", __func__); ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); + bytes_transferred = urb->length - urb->actual_length; + } + + +From 7f9781f9875f2aa638d5afdaa9709fa1ef9bda8d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 18 Feb 2016 15:28:14 +0000 +Subject: [PATCH 156/170] BCM270X_DT: at86rf233 overlay - drop to 3MHz + +The consensus is that 6MHz is too fast, but that 3MHz is OK. + +See: https://github.com/raspberrypi/linux/issues/1294 + https://github.com/raspberrypi/linux/issues/1151 +--- + arch/arm/boot/dts/overlays/README | 2 +- + arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 0a2df01..4de0b6f 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -188,7 +188,7 @@ Load: dtoverlay=at86rf233,= + Params: interrupt GPIO used for INT (default 23) + reset GPIO used for Reset (default 24) + sleep GPIO used for Sleep (default 25) +- speed SPI bus speed in Hz (default 6000000) ++ speed SPI bus speed in Hz (default 3000000) + trim Fine tuning of the internal capacitance + arrays (0=+0pF, 15=+4.5pF, default 15) + +diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +index 0460269..eab4052 100644 +--- a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts ++++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +@@ -25,7 +25,7 @@ + interrupts = <23 4>; /* active high */ + reset-gpio = <&gpio 24 1>; + sleep-gpio = <&gpio 25 1>; +- spi-max-frequency = <6000000>; ++ spi-max-frequency = <3000000>; + xtal-trim = /bits/ 8 <0xf>; + }; + }; + +From 5af831a3f879c89c8c0b39c8f88e7600bdc3a765 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 19 Feb 2016 12:04:48 +0000 +Subject: [PATCH 157/170] bcm2835-sdhost: Downgrade log message status + +--- + drivers/mmc/host/bcm2835-sdhost.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index d66385c..4f6cab5 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -232,8 +232,8 @@ static void log_init(u32 bus_to_phys) + sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, + GFP_KERNEL); + if (sdhost_log_buf) { +- pr_err("sdhost: log_buf @ %p (%x)\n", +- sdhost_log_buf, sdhost_log_addr); ++ pr_info("sdhost: log_buf @ %p (%x)\n", ++ sdhost_log_buf, sdhost_log_addr); + timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); + if (!timer_base) + pr_err("sdhost: failed to remap timer\n"); + +From e08f6b3aad073d8130d2ec0f8398f55983c0eac8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 15 Jan 2016 16:48:27 +0000 +Subject: [PATCH 158/170] config: Enable HCI over UARTs + +--- + arch/arm/configs/bcm2709_defconfig | 3 +++ + arch/arm/configs/bcmrpi_defconfig | 2 ++ + 2 files changed, 5 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index fc35254..48ecb2e 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -376,6 +376,9 @@ CONFIG_BT_BNEP_PROTO_FILTER=y + CONFIG_BT_HIDP=m + CONFIG_BT_6LOWPAN=m + CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y + CONFIG_BT_HCIBCM203X=m + CONFIG_BT_HCIBPA10X=m + CONFIG_BT_HCIBFUSB=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 51dc019..4368f0d 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -370,6 +370,8 @@ CONFIG_BT_HIDP=m + CONFIG_BT_6LOWPAN=m + CONFIG_BT_HCIBTUSB=m + CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y + CONFIG_BT_HCIBCM203X=m + CONFIG_BT_HCIBPA10X=m + CONFIG_BT_HCIBFUSB=m + +From 20c4c47bca3674d746518b1cca1e066e46b52900 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 17 Dec 2015 13:37:07 +0000 +Subject: [PATCH 159/170] hci_h5: Don't send conf_req when ACTIVE + +Without this patch, a modem and kernel can continuously bombard each +other with conf_req and conf_rsp messages, in a demented game of tag. +--- + drivers/bluetooth/hci_h5.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c +index abee221..2825833 100644 +--- a/drivers/bluetooth/hci_h5.c ++++ b/drivers/bluetooth/hci_h5.c +@@ -314,7 +314,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) + h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_req, 2) == 0) { + h5_link_control(hu, conf_rsp, 2); +- h5_link_control(hu, conf_req, 3); ++ if (h5->state != H5_ACTIVE) ++ h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_rsp, 2) == 0) { + if (H5_HDR_LEN(hdr) > 2) + h5->tx_win = (data[2] & 7); + +From 00dba6ec2ac004fc17075febd4504646eb3dc543 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 23 Feb 2016 17:26:48 +0000 +Subject: [PATCH 160/170] amba_pl011: Don't use DT aliases for numbering + +The pl011 driver looks for DT aliases of the form "serial", +and if found uses as the device ID. This can cause +/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the +other serial port is provided by the 8250 driver which doesn't +use the same logic. +--- + drivers/tty/serial/amba-pl011.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 899a771..68b3353 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2313,7 +2313,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, + if (IS_ERR(base)) + return PTR_ERR(base); + ++ /* Don't use DT serial aliases - it causes the device to ++ be renumbered to ttyAMA1 if it is the second serial port in the ++ system, even though the other one is ttyS0. The 8250 driver ++ doesn't use this logic, so always remains ttyS0. + index = pl011_probe_dt_alias(index, dev); ++ */ + + uap->old_cr = 0; + uap->port.dev = dev; + +From 95136c932ac4433a6a50d394817812f8eb2cc914 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 15 Dec 2015 15:35:57 -0800 +Subject: [PATCH 161/170] clk: bcm2835: Add bindings for the auxiliary + peripheral clock gates. + +These will be used for enabling UART1, SPI1, and SPI2. + +Signed-off-by: Eric Anholt +Acked-by: Rob Herring +Signed-off-by: Michael Turquette +--- + .../bindings/clock/brcm,bcm2835-aux-clock.txt | 31 ++++++++++++++++++++++ + include/dt-bindings/clock/bcm2835-aux.h | 17 ++++++++++++ + 2 files changed, 48 insertions(+) + create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt + create mode 100644 include/dt-bindings/clock/bcm2835-aux.h + +diff --git a/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt +new file mode 100644 +index 0000000..7a837d2 +--- /dev/null ++++ b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt +@@ -0,0 +1,31 @@ ++Broadcom BCM2835 auxiliary peripheral support ++ ++This binding uses the common clock binding: ++ Documentation/devicetree/bindings/clock/clock-bindings.txt ++ ++The auxiliary peripherals (UART, SPI1, and SPI2) have a small register ++area controlling clock gating to the peripherals, and providing an IRQ ++status register. ++ ++Required properties: ++- compatible: Should be "brcm,bcm2835-aux" ++- #clock-cells: Should be <1>. The permitted clock-specifier values can be ++ found in include/dt-bindings/clock/bcm2835-aux.h ++- reg: Specifies base physical address and size of the registers ++- clocks: The parent clock phandle ++ ++Example: ++ ++ clocks: cprman@7e101000 { ++ compatible = "brcm,bcm2835-cprman"; ++ #clock-cells = <1>; ++ reg = <0x7e101000 0x2000>; ++ clocks = <&clk_osc>; ++ }; ++ ++ aux: aux@0x7e215004 { ++ compatible = "brcm,bcm2835-aux"; ++ #clock-cells = <1>; ++ reg = <0x7e215000 0x8>; ++ clocks = <&clocks BCM2835_CLOCK_VPU>; ++ }; +diff --git a/include/dt-bindings/clock/bcm2835-aux.h b/include/dt-bindings/clock/bcm2835-aux.h +new file mode 100644 +index 0000000..d91156e +--- /dev/null ++++ b/include/dt-bindings/clock/bcm2835-aux.h +@@ -0,0 +1,17 @@ ++/* ++ * Copyright (C) 2015 Broadcom Corporation ++ * ++ * 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 version 2. ++ * ++ * This program is distributed "as is" WITHOUT ANY WARRANTY of any ++ * kind, whether express or implied; without even the implied warranty ++ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#define BCM2835_AUX_CLOCK_UART 0 ++#define BCM2835_AUX_CLOCK_SPI1 1 ++#define BCM2835_AUX_CLOCK_SPI2 2 ++#define BCM2835_AUX_CLOCK_COUNT 3 + +From 924276b92ff47f0e778a9405d00637be4ca88736 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 15 Dec 2015 15:35:58 -0800 +Subject: [PATCH 162/170] clk: bcm2835: Add a driver for the auxiliary + peripheral clock gates. + +There are a pair of SPI masters and a mini UART that were last minute +additions. As a result, they didn't get integrated in the same way as +the other gates off of the VPU clock in CPRMAN. + +Signed-off-by: Eric Anholt +Signed-off-by: Michael Turquette + +updated Makefile to preserve the rasoberry pi architectures +--- + drivers/clk/bcm/Makefile | 1 + + drivers/clk/bcm/clk-bcm2835-aux.c | 85 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 86 insertions(+) + create mode 100644 drivers/clk/bcm/clk-bcm2835-aux.c + +diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile +index a1b4cbc..84070d51 100644 +--- a/drivers/clk/bcm/Makefile ++++ b/drivers/clk/bcm/Makefile +@@ -4,6 +4,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o + obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o + obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o + obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o +diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c +new file mode 100644 +index 0000000..e4f89e2 +--- /dev/null ++++ b/drivers/clk/bcm/clk-bcm2835-aux.c +@@ -0,0 +1,85 @@ ++/* ++ * Copyright (C) 2015 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define BCM2835_AUXIRQ 0x00 ++#define BCM2835_AUXENB 0x04 ++ ++static int bcm2835_aux_clk_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct clk_onecell_data *onecell; ++ const char *parent; ++ struct clk *parent_clk; ++ struct resource *res; ++ void __iomem *reg, *gate; ++ ++ parent_clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(parent_clk)) ++ return PTR_ERR(parent_clk); ++ parent = __clk_get_name(parent_clk); ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ reg = devm_ioremap_resource(dev, res); ++ if (!reg) ++ return -ENODEV; ++ ++ onecell = devm_kmalloc(dev, sizeof(*onecell), GFP_KERNEL); ++ if (!onecell) ++ return -ENOMEM; ++ onecell->clk_num = BCM2835_AUX_CLOCK_COUNT; ++ onecell->clks = devm_kcalloc(dev, BCM2835_AUX_CLOCK_COUNT, ++ sizeof(*onecell->clks), GFP_KERNEL); ++ if (!onecell->clks) ++ return -ENOMEM; ++ ++ gate = reg + BCM2835_AUXENB; ++ onecell->clks[BCM2835_AUX_CLOCK_UART] = ++ clk_register_gate(dev, "aux_uart", parent, 0, gate, 0, 0, NULL); ++ ++ onecell->clks[BCM2835_AUX_CLOCK_SPI1] = ++ clk_register_gate(dev, "aux_spi1", parent, 0, gate, 1, 0, NULL); ++ ++ onecell->clks[BCM2835_AUX_CLOCK_SPI2] = ++ clk_register_gate(dev, "aux_spi2", parent, 0, gate, 2, 0, NULL); ++ ++ of_clk_add_provider(pdev->dev.of_node, of_clk_src_onecell_get, onecell); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_aux_clk_of_match[] = { ++ { .compatible = "brcm,bcm2835-aux", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_aux_clk_of_match); ++ ++static struct platform_driver bcm2835_aux_clk_driver = { ++ .driver = { ++ .name = "bcm2835-aux-clk", ++ .of_match_table = bcm2835_aux_clk_of_match, ++ }, ++ .probe = bcm2835_aux_clk_probe, ++}; ++builtin_platform_driver(bcm2835_aux_clk_driver); ++ ++MODULE_AUTHOR("Eric Anholt "); ++MODULE_DESCRIPTION("BCM2835 auxiliary peripheral clock driver"); ++MODULE_LICENSE("GPL v2"); + +From 43477e669f736f6da34afbd8a96683b239b1fd1f Mon Sep 17 00:00:00 2001 +From: Fraser +Date: Tue, 23 Feb 2016 10:04:37 +1100 +Subject: [PATCH 163/170] Aux SPI 1&2 implementation + +Adds aux spi 1 & 2 devices to compatible raspberry PIs. +* Minor config of the driver build environment to ensure they get built +for CONFIG_ARCH_BCM2708 & CONFIG_ARCH_BCM2709 devices. +* Adds the aux spi driver into the defconfigs as a module. +* Adds the auxiliary and spi1/2 devices into the device tree in a +disabled state +* Provides decide tree overlays which enables the devices and gives +users a degree of control over how they are setup. +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 34 ++++++++- + arch/arm/boot/dts/overlays/Makefile | 6 ++ + arch/arm/boot/dts/overlays/README | 99 +++++++++++++++++++++++++ + arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 ++++++++++++++ + arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 +++++++++++++++++ + arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++++++++++++++++++++ + arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 ++++++++++++++ + arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 +++++++++++++++++ + arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++++++++++++++++++++ + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + drivers/clk/bcm/Makefile | 2 +- + drivers/spi/Kconfig | 2 +- + 13 files changed, 556 insertions(+), 3 deletions(-) + create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 18d3c45..4f65203 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -1,3 +1,4 @@ ++#include + #include "skeleton.dtsi" + + / { +@@ -5,6 +6,7 @@ + + aliases { + audio = &audio; ++ aux = &aux; + sound = &sound; + soc = &soc; + dma = &dma; +@@ -19,6 +21,8 @@ + spi0 = &spi0; + i2c0 = &i2c0; + uart1 = &uart1; ++ spi1 = &spi1; ++ spi2 = &spi2; + mmc = &mmc; + i2c1 = &i2c1; + i2c2 = &i2c2; +@@ -186,6 +190,14 @@ + status = "disabled"; + }; + ++ aux: aux@0x7e215004 { ++ compatible = "brcm,bcm2835-aux"; ++ #clock-cells = <1>; ++ reg = <0x7e215000 0x8>; ++ clocks = <&clk_core>; ++ status = "disabled"; ++ }; ++ + uart1: uart@7e215040 { + compatible = "brcm,bcm2835-aux-uart", "ns16550"; + reg = <0x7e215040 0x40>; +@@ -194,7 +206,27 @@ + reg-shift = <2>; + no-loopback-test; + status = "disabled"; +- }; ++ }; ++ ++ spi1: spi@7e215080 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e215080 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ spi2: spi@7e2150C0 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e2150C0 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI2>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + + mmc: mmc@7e300000 { + compatible = "brcm,bcm2835-mmc"; +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 4d9d640..a787d66 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -57,6 +57,12 @@ dtb-$(RPI_DT_OVERLAYS) += sdtweak-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi1-1cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi1-2cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi1-3cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi2-1cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi2-2cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi2-3cs-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-gpio35-39-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 4de0b6f..cf5f5be 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -713,6 +713,105 @@ Load: dtoverlay=spi-gpio35-39 + Params: + + ++Name: spi1-1cs ++Info: Enables spi1 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-1cs,= ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-2cs ++Info: Enables spi1 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-2cs,= ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-3cs ++Info: Enables spi1 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-3cs,= ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-1cs ++Info: Enables spi2 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-1cs,= ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-2cs ++Info: Enables spi2 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-2cs,= ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-3cs ++Info: Enables spi2 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-3cs,= ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.2 (default ++ is 'okay' or enabled). ++ ++ + Name: tinylcd35 + Info: 3.5" Color TFT Display by www.tinylcd.com + Options: Touch, RTC, keypad +diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +new file mode 100644 +index 0000000..71c2439 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +new file mode 100644 +index 0000000..2ae0885 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +new file mode 100644 +index 0000000..8f79044 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17 16>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ cs2_spidev = <&spidev1_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +new file mode 100644 +index 0000000..6f57bc7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +new file mode 100644 +index 0000000..d090631 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +new file mode 100644 +index 0000000..e258672 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44 45>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ cs2_spidev = <&spidev2_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 48ecb2e..76b3a88 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -601,6 +601,7 @@ CONFIG_I2C_BCM2708=m + CONFIG_I2C_GPIO=m + CONFIG_SPI=y + CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m + CONFIG_SPI_SPIDEV=y + CONFIG_PPS=m + CONFIG_PPS_CLIENT_LDISC=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 4368f0d..1ca1695 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -593,6 +593,7 @@ CONFIG_I2C_BCM2708=m + CONFIG_I2C_GPIO=m + CONFIG_SPI=y + CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m + CONFIG_SPI_SPIDEV=y + CONFIG_PPS=m + CONFIG_PPS_CLIENT_LDISC=m +diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile +index 84070d51..d60fd3f 100644 +--- a/drivers/clk/bcm/Makefile ++++ b/drivers/clk/bcm/Makefile +@@ -4,7 +4,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o + obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835-aux.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o + obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o + obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o +diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig +index e842e86..c9d1558 100644 +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -90,7 +90,7 @@ config SPI_BCM2835 + + config SPI_BCM2835AUX + tristate "BCM2835 SPI auxiliary controller" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on GPIOLIB + help + This selects a driver for the Broadcom BCM2835 SPI aux master. + +From 84c2e063885bb0ae3d5d2ad2e24e7a2bdb5729ae Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Tue, 23 Feb 2016 17:28:23 +0100 +Subject: [PATCH 164/170] ASoC: bcm: add missing .owner fields in sound card + drivers + +If snd_soc_card.owner is not set the kernel won't do usage refcounting +and one can remove the card driver module while it's in use (eg playback +active) - which leads to a kernel crash. + +The missing owner field also prevents ALSA slot ordering +(options snd slots=module-name1,module-name-2,...) from working with +the I2S cards as it has no module name to match against. + +Fix these issues by setting the .owner field in the snd_soc_card structs. + +Signed-off-by: Matthias Reichl +--- + sound/soc/bcm/hifiberry_amp.c | 1 + + sound/soc/bcm/hifiberry_dac.c | 1 + + sound/soc/bcm/hifiberry_dacplus.c | 1 + + sound/soc/bcm/hifiberry_digi.c | 1 + + sound/soc/bcm/iqaudio-dac.c | 1 + + sound/soc/bcm/raspidac3.c | 1 + + sound/soc/bcm/rpi-dac.c | 1 + + sound/soc/bcm/rpi-proto.c | 1 + + 8 files changed, 8 insertions(+) + +diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c +index 5903915..0bb12e4 100644 +--- a/sound/soc/bcm/hifiberry_amp.c ++++ b/sound/soc/bcm/hifiberry_amp.c +@@ -61,6 +61,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { + + static struct snd_soc_card snd_rpi_hifiberry_amp = { + .name = "snd_rpi_hifiberry_amp", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_hifiberry_amp_dai, + .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), + }; +diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c +index 3ab0f47..29ecc08 100644 +--- a/sound/soc/bcm/hifiberry_dac.c ++++ b/sound/soc/bcm/hifiberry_dac.c +@@ -63,6 +63,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_hifiberry_dac = { + .name = "snd_rpi_hifiberry_dac", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_hifiberry_dac_dai, + .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), + }; +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c +index 153dbcd..03d8d2a 100644 +--- a/sound/soc/bcm/hifiberry_dacplus.c ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -287,6 +287,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_hifiberry_dacplus = { + .name = "snd_rpi_hifiberry_dacplus", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_hifiberry_dacplus_dai, + .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), + }; +diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c +index 80732b8..9840e15 100644 +--- a/sound/soc/bcm/hifiberry_digi.c ++++ b/sound/soc/bcm/hifiberry_digi.c +@@ -164,6 +164,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_hifiberry_digi = { + .name = "snd_rpi_hifiberry_digi", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_hifiberry_digi_dai, + .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), + }; +diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c +index 124d7a9..a5eaa9e 100644 +--- a/sound/soc/bcm/iqaudio-dac.c ++++ b/sound/soc/bcm/iqaudio-dac.c +@@ -77,6 +77,7 @@ static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_iqaudio_dac = { + .name = "IQaudIODAC", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_iqaudio_dac_dai, + .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), + }; +diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c +index 3cabf5b..e7422e2 100644 +--- a/sound/soc/bcm/raspidac3.c ++++ b/sound/soc/bcm/raspidac3.c +@@ -128,6 +128,7 @@ static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_raspidac3 = { + .name = "RaspiDAC Rev.3x HiFi Audio Card", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_raspidac3_dai, + .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), + }; +diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c +index d5fac1b..59dc89e 100644 +--- a/sound/soc/bcm/rpi-dac.c ++++ b/sound/soc/bcm/rpi-dac.c +@@ -60,6 +60,7 @@ static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_rpi_dac = { + .name = "snd_rpi_rpi_dac", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_rpi_dac_dai, + .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), + }; +diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c +index c6e45a0..9db678e 100644 +--- a/sound/soc/bcm/rpi-proto.c ++++ b/sound/soc/bcm/rpi-proto.c +@@ -91,6 +91,7 @@ static struct snd_soc_dai_link snd_rpi_proto_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_proto = { + .name = "snd_rpi_proto", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_proto_dai, + .num_links = ARRAY_SIZE(snd_rpi_proto_dai), + }; + +From 18674a7da1c3d50d9c957a8f88aaea2aa653d223 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 20 Jan 2016 17:50:09 +0000 +Subject: [PATCH 165/170] smsx95xx: Add option to disable the crimes against + truesize fix + +It may improve iperf numbers on Pi 1, but may generate dmesg warnings and possibly cause network issues +See issue 1248. +--- + drivers/net/usb/smsc95xx.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + mode change 100755 => 100644 drivers/net/usb/smsc95xx.c + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +old mode 100755 +new mode 100644 +index 7483222..a61bd08 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -75,6 +75,10 @@ static bool turbo_mode = false; + module_param(turbo_mode, bool, 0644); + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); + ++static bool truesize_mode = false; ++module_param(truesize_mode, bool, 0644); ++MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); ++ + static char *macaddr = ":"; + module_param(macaddr, charp, 0); + MODULE_PARM_DESC(macaddr, "MAC address"); +@@ -1841,6 +1845,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + if (dev->net->features & NETIF_F_RXCSUM) + smsc95xx_rx_csum_offload(skb); + skb_trim(skb, skb->len - 4); /* remove fcs */ ++ if (truesize_mode) ++ skb->truesize = size + sizeof(struct sk_buff); + + return 1; + } +@@ -1858,6 +1864,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + if (dev->net->features & NETIF_F_RXCSUM) + smsc95xx_rx_csum_offload(ax_skb); + skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ ++ if (truesize_mode) ++ ax_skb->truesize = size + sizeof(struct sk_buff); + + usbnet_skb_return(dev, ax_skb); + } + +From 5e3c3e845f998f86c2f22017576cb19e5d7fe9bb Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 23 Feb 2016 19:56:04 +0000 +Subject: [PATCH 166/170] bcm2835-virtgpio: Virtual GPIO driver + +Add a virtual GPIO driver that uses the firmware mailbox interface to +request that the VPU toggles LEDs. +--- + arch/arm/configs/bcm2709_defconfig | 1 + + drivers/gpio/Kconfig | 6 + + drivers/gpio/Makefile | 1 + + drivers/gpio/gpio-bcm-virt.c | 180 +++++++++++++++++++++++++++++ + include/soc/bcm2835/raspberrypi-firmware.h | 1 + + 5 files changed, 189 insertions(+) + create mode 100644 drivers/gpio/gpio-bcm-virt.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 76b3a88..6d6b519 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -607,6 +607,7 @@ CONFIG_PPS=m + CONFIG_PPS_CLIENT_LDISC=m + CONFIG_PPS_CLIENT_GPIO=m + CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_BCM_VIRT=y + CONFIG_GPIO_ARIZONA=m + CONFIG_GPIO_STMPE=y + CONFIG_W1=m +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig +index b18bea0..a1f4ccee 100644 +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -132,6 +132,12 @@ config GPIO_BCM_KONA + help + Turn on GPIO support for Broadcom "Kona" chips. + ++config GPIO_BCM_VIRT ++ bool "Broadcom Virt GPIO" ++ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST) ++ help ++ Turn on virtual GPIO support for Broadcom BCM283X chips. ++ + config GPIO_BRCMSTB + tristate "BRCMSTB GPIO support" + default y if ARCH_BRCMSTB +diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile +index 986dbd8..b2ccc9f 100644 +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -24,6 +24,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o + obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o + obj-$(CONFIG_ATH79) += gpio-ath79.o + obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o ++obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o + obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o + obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o + obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o +diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c +new file mode 100644 +index 0000000..53edcb4 +--- /dev/null ++++ b/drivers/gpio/gpio-bcm-virt.c +@@ -0,0 +1,180 @@ ++/* ++ * brcmvirt GPIO driver ++ * ++ * Copyright (C) 2012,2013 Dom Cobley ++ * Based on gpio-clps711x.c by Alexander Shiyan ++ * ++ * 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MODULE_NAME "brcmvirt-gpio" ++#define NUM_GPIO 2 ++ ++struct brcmvirt_gpio { ++ struct gpio_chip gc; ++ u32 __iomem *ts_base; ++ /* two packed 16-bit counts of enabled and disables ++ Allows host to detect a brief enable that was missed */ ++ u32 enables_disables[NUM_GPIO]; ++}; ++ ++static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return -EINVAL; ++} ++ ++static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return 0; ++} ++ ++static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ unsigned v; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ v = readl(gpio->ts_base + off); ++ return (v >> off) & 1; ++} ++ ++static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ u16 enables, disables; ++ s16 diff; ++ bool lit; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ enables = gpio->enables_disables[off] >> 16; ++ disables = gpio->enables_disables[off] >> 0; ++ diff = (s16)(enables - disables); ++ lit = diff > 0; ++ if ((val && lit) || (!val && !lit)) ++ return; ++ if (val) ++ enables++; ++ else ++ disables++; ++ diff = (s16)(enables - disables); ++ BUG_ON(diff != 0 && diff != 1); ++ gpio->enables_disables[off] = (enables << 16) | (disables << 0); ++ writel(gpio->enables_disables[off], gpio->ts_base + off); ++} ++ ++static int brcmvirt_gpio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ struct brcmvirt_gpio *ucb; ++ u32 gpiovirtbuf; ++ int err = 0; ++ ++ fw_node = of_parse_phandle(np, "firmware", 0); ++ if (!fw_node) { ++ dev_err(dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, ++ &gpiovirtbuf, sizeof(gpiovirtbuf)); ++ ++ if (err) { ++ dev_err(dev, "Failed to get gpiovirtbuf\n"); ++ goto err; ++ } ++ ++ if (!gpiovirtbuf) { ++ dev_err(dev, "No virtgpio buffer\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); ++ if (!ucb) { ++ err = -EINVAL; ++ goto err; ++ } ++ ++ // mmap the physical memory ++ gpiovirtbuf &= ~0xc0000000; ++ ucb->ts_base = ioremap(gpiovirtbuf, 4096); ++ if (ucb->ts_base == NULL) { ++ dev_err(dev, "Failed to map physical address\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb->gc.label = MODULE_NAME; ++ ucb->gc.owner = THIS_MODULE; ++ ucb->gc.dev = dev; ++ ucb->gc.of_node = np; ++ ucb->gc.base = 100; ++ ucb->gc.ngpio = NUM_GPIO; ++ ++ ucb->gc.direction_input = brcmvirt_gpio_dir_in; ++ ucb->gc.direction_output = brcmvirt_gpio_dir_out; ++ ucb->gc.get = brcmvirt_gpio_get; ++ ucb->gc.set = brcmvirt_gpio_set; ++ ucb->gc.can_sleep = true; ++ ++ err = gpiochip_add(&ucb->gc); ++ if (err) ++ goto err; ++ ++ platform_set_drvdata(pdev, ucb); ++ ++err: ++ return err; ++ ++} ++ ++static int brcmvirt_gpio_remove(struct platform_device *pdev) ++{ ++ int err = 0; ++ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); ++ ++ gpiochip_remove(&ucb->gc); ++ iounmap(ucb->ts_base); ++ return err; ++} ++ ++static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { ++ { .compatible = "brcm,bcm2835-virtgpio" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); ++ ++static struct platform_driver brcmvirt_gpio_driver = { ++ .driver = { ++ .name = MODULE_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), ++ }, ++ .probe = brcmvirt_gpio_probe, ++ .remove = brcmvirt_gpio_remove, ++}; ++module_platform_driver(brcmvirt_gpio_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Dom Cobley "); ++MODULE_DESCRIPTION("brcmvirt GPIO driver"); ++MODULE_ALIAS("platform:brcmvirt-gpio"); +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index b011489..c844968 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -93,6 +93,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, + RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, + RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, + RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, + +From 6aa2c847f76f21c830544e8c79f9030a170ef475 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 21 Jan 2016 17:57:49 +0000 +Subject: [PATCH 167/170] BCM270X_DT: Add Pi3 support + +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 174 ++++++++++++++++++++++++++++++++++ + arch/arm/boot/dts/bcm2710.dtsi | 102 ++++++++++++++++++++ + 3 files changed, 277 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts + create mode 100644 arch/arm/boot/dts/bcm2710.dtsi + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index d583e67..fdc450f4 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -5,6 +5,7 @@ dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb + dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb + dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb + dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb + + # Raspberry Pi + ifeq ($(CONFIG_ARCH_BCM2708),y) +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +new file mode 100644 +index 0000000..a6ecb51 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -0,0 +1,174 @@ ++/dts-v1/; ++ ++#include "bcm2710.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "Raspberry Pi 3 Model B"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ sdio_pins: sdio_pins { ++ brcm,pins = <34 35 36 37 38 39>; ++ brcm,function = <7>; // alt3 = SD1 ++ brcm,pull = <0 2 2 2 2 2>; ++ }; ++ ++ bt_pins: bt_pins { ++ brcm,pins = <28 29 30 31 14 15 43>; ++ brcm,function = <6 6 6 6 2 2 4>; ++ // alt2:PCM alt5:UART1 alt0:GPCLK2 ++ brcm,pull = <0 0 0 0 0 2 0>; ++ }; ++ ++ uart1_pins: uart1_pins { ++ brcm,pins = <32 33>; ++ brcm,function = <7>; /* alt3=UART0 */ ++ brcm,pull = <0>; ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&mmc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins &bt_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ 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 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; ++ ++/ { ++ chosen { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ 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"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi +new file mode 100644 +index 0000000..1a48686 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "BCM2710"; ++ ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; ++ ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; ++ ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; ++ ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; ++ ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; ++ ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; ++ ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x000>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x001>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x002>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x003>; ++ clock-frequency = <800000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; ++ ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; + +From 52015bd5f0bb4d64ca51c5f8539cf2552dfb8a42 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 21 Jan 2016 17:57:49 +0000 +Subject: [PATCH 168/170] FIXUP: BCM270X_DT: Update to latest Pi3 DTS + +--- + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 34 ++++++++++++++++++++++++++-------- + 1 file changed, 26 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +index a6ecb51..cc060898 100644 +--- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -45,16 +45,21 @@ + }; + + bt_pins: bt_pins { +- brcm,pins = <28 29 30 31 14 15 43>; +- brcm,function = <6 6 6 6 2 2 4>; +- // alt2:PCM alt5:UART1 alt0:GPCLK2 +- brcm,pull = <0 0 0 0 0 2 0>; ++ brcm,pins = <28 29 30 31 43>; ++ brcm,function = <6 6 6 6 4>; /* alt2:PCM alt0:GPCLK2 */ ++ brcm,pull = <0 0 0 0 0>; + }; + +- uart1_pins: uart1_pins { ++ uart0_pins: uart0_pins { + brcm,pins = <32 33>; + brcm,function = <7>; /* alt3=UART0 */ +- brcm,pull = <0>; ++ brcm,pull = <0 0>; ++ }; ++ ++ uart1_pins: uart1_pins { ++ brcm,pins = <14 15>; ++ brcm,function = <2>; /* alt5=UART1 */ ++ brcm,pull = <0 0>; + }; + }; + +@@ -71,6 +76,17 @@ + non-removable; + bus-width = <4>; + status = "okay"; ++ brcm,overclock-50 = <0>; ++}; ++ ++&soc { ++ virtgpio: virtgpio { ++ compatible = "brcm,bcm2835-virtgpio"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; + }; + + &fb { +@@ -78,12 +94,14 @@ + }; + + &uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins &bt_pins>; + status = "okay"; + }; + + &uart1 { + pinctrl-names = "default"; +- pinctrl-0 = <&uart1_pins &bt_pins>; ++ pinctrl-0 = <&uart1_pins>; + status = "okay"; + }; + +@@ -139,7 +157,7 @@ + act_led: act { + label = "led0"; + linux,default-trigger = "mmc0"; +- gpios = <&gpio 47 0>; ++ gpios = <&virtgpio 0 0>; + }; + }; + + +From 310f5af54ca26b68795f0376c67b41e2bb18a0e0 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <6by9@users.noreply.github.com> +Date: Mon, 8 Feb 2016 23:49:41 +0000 +Subject: [PATCH 169/170] DT: Add overlays to configure I2C pins + +Lifted from +https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=120938&p=825883 +so not claiming this to be my own work. +Adds overlays i2c0-bcm2708 and i2c1-bcm2708 that allow the pin +allocations for i2c-0 and i2c-1 to be changed. +--- + arch/arm/boot/dts/overlays/Makefile | 2 ++ + arch/arm/boot/dts/overlays/README | 16 ++++++++++ + .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 36 +++++++++++++++++++++ + .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 ++++++++++++++++++++++ + 4 files changed, 91 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index a787d66..f2bc3ce 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -29,6 +29,8 @@ 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) += i2c-gpio-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += i2c0-bcm2708-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += i2c1-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index cf5f5be..7d7bbb8 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -371,6 +371,22 @@ Params: ds1307 Select the DS1307 device + pcf8563 Select the PCF8563 device + + ++Name: i2c0-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c0 bus ++Load: dtoverlay=i2c0-bcm2708,= ++Params: sda0_pin GPIO pin for SDA0 (0, 28 [or 44] - default 0) ++ scl0_pin GPIO pin for SCL0 (1, 29 [or 45] - default 1) ++ ++ ++Name: i2c1-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c1 bus ++Load: dtoverlay=i2c1-bcm2708,= ++Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) ++ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) ++ pin_func Alternative pin function (4 (alt0), 6 (alt2) - ++ default 4) ++ ++ + Name: i2s-mmap + Info: Enables mmap support in the bcm2708-i2s driver + Load: dtoverlay=i2s-mmap +diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +new file mode 100644 +index 0000000..5c0e55b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +@@ -0,0 +1,36 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c0 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c0>; ++ __overlay__ { ++ pinctrl-0 = <&i2c0_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ sda0_pin = <&i2c0_pins>,"brcm,pins:0"; ++ scl0_pin = <&i2c0_pins>,"brcm,pins:4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e303b9c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +@@ -0,0 +1,37 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c1 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ pinctrl-0 = <&i2c1_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; ++ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; ++ pin_func = <&i2c1_pins>,"brcm,function:0"; ++ }; ++}; + +From c5cbb66686e7e289e8a7aff49a954f86893e628d Mon Sep 17 00:00:00 2001 +From: Dhiraj Goel +Date: Thu, 3 Mar 2016 21:10:50 -0800 +Subject: [PATCH 170/170] bcm2835-camera: fix a bug in computation of frame + timestamp + +Fixes #1318 +--- + drivers/media/platform/bcm2835/bcm2835-camera.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +index e83334c..98a892e 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.c ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -360,8 +360,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, + div = + div_u64_rem(runtime_us, USEC_PER_SEC, &rem); + buf->vb.timestamp.tv_sec = +- dev->capture.kernel_start_ts.tv_sec - 1 + +- div; ++ dev->capture.kernel_start_ts.tv_sec + div; + buf->vb.timestamp.tv_usec = + dev->capture.kernel_start_ts.tv_usec + rem; + diff --git a/projects/RPi2/patches/linux/linux-01-RPi_support.patch b/projects/RPi2/patches/linux/linux-01-RPi_support.patch index 30518b9487..863e39ebca 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 7845b06e18af196528ad650eccd152e7989bc69c Mon Sep 17 00:00:00 2001 +From b6cc28abbbf710379772d3da9227ce66926c46a3 Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 01/54] smsx95xx: fix crimes against truesize +Subject: [PATCH 001/170] 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. @@ -35,14 +35,11 @@ index 66b3ab9..b544181 usbnet_skb_return(dev, ax_skb); } --- -2.5.0 - -From 1c4ee85b4d9361be8b58687db4acdb43e7a79c14 Mon Sep 17 00:00:00 2001 +From 37e24d2f0af32632a17692076dddcf176d1af1f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 02/54] smsc95xx: Disable turbo mode by default +Subject: [PATCH 002/170] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- @@ -61,14 +58,11 @@ index b544181..9c0da18 100755 module_param(turbo_mode, bool, 0644); MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); --- -2.5.0 - -From 38a1c0f17082b195b17ee390270377e661d2243b Mon Sep 17 00:00:00 2001 +From d5cb475205138f9df1fdbb74d8810ab1928696ea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 03/54] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 003/170] vmstat: Workaround for issue where dirty page count goes negative See: @@ -79,7 +73,7 @@ http://www.spinics.net/lists/linux-mm/msg72236.html 1 file changed, 4 insertions(+) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h -index 5dbc8b0..3a18061 100644 +index 3e5d907..2539068 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -219,7 +219,11 @@ static inline void __inc_zone_state(struct zone *zone, enum zone_stat_item item) @@ -94,14 +88,11 @@ index 5dbc8b0..3a18061 100644 } static inline void __inc_zone_page_state(struct page *page, --- -2.5.0 - -From 7d76a16073ba70458e82edb4db8254a7a3dced6b Mon Sep 17 00:00:00 2001 +From 249a499b1d4b6f8a57b3377d4f505841e99f60c8 Mon Sep 17 00:00:00 2001 From: Robert Tiemann Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 04/54] BCM2835_DT: Fix I2S register map +Subject: [PATCH 004/170] BCM2835_DT: Fix I2S register map --- Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- @@ -154,15 +145,12 @@ index aef64de..864a3ef 100644 dmas = <&dma 2>, <&dma 3>; --- -2.5.0 - -From 688a5f2ada4fbd16547b574a17e6d359ab2364d0 Mon Sep 17 00:00:00 2001 +From c24657505a2aac71d0409b0ef703fc21ecab4b2e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 05/54] irq-bcm2836: Prevent spurious interrupts, and trap them - early +Subject: [PATCH 005/170] irq-bcm2836: Prevent spurious interrupts, and trap + them early The old arch-specific IRQ macros included a dsb to ensure the write to clear the mailbox interrupt completed before returning @@ -191,14 +179,11 @@ index f687082..4cd8ebe 100644 u32 hwirq = ffs(stat) - 1; handle_IRQ(irq_linear_revmap(intc.domain, hwirq), regs); --- -2.5.0 - -From 6edc4f10cd957d1b3cb705fe06003b965f24fd71 Mon Sep 17 00:00:00 2001 +From 229bcf2e73ce37e8a18d68773471024c848d84bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 12 Jun 2015 19:01:05 +0200 -Subject: [PATCH 06/54] irqchip: bcm2835: Add FIQ support +Subject: [PATCH 006/170] irqchip: bcm2835: Add FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -216,7 +201,7 @@ Acked-by: Stephen Warren 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig -index 8c53c55..c943747 100644 +index 8c53c55..c943747b 100644 --- a/arch/arm/mach-bcm/Kconfig +++ b/arch/arm/mach-bcm/Kconfig @@ -128,6 +128,7 @@ config ARCH_BCM2835 @@ -326,14 +311,11 @@ index bf9cc5f..3f601f9 100644 return 0; } --- -2.5.0 - -From e24db33d028844ac535e9e8d72a0c77e6dc7cb95 Mon Sep 17 00:00:00 2001 +From 6780f0a5c6af19f2b9850e961a0f81fbfdfa48fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Oct 2015 16:26:55 +0200 -Subject: [PATCH 07/54] irqchip: irq-bcm2835: Add 2836 FIQ support +Subject: [PATCH 007/170] irqchip: irq-bcm2835: Add 2836 FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -428,14 +410,11 @@ index 3f601f9..20deb28 100644 /* Make a duplicate irq range which is used to enable FIQ */ for (b = 0; b < NR_BANKS; b++) { for (i = 0; i < bank_irqs[b]; i++) { --- -2.5.0 - -From a628f89696a423d8be5e4f6afacd1b2164dc72c0 Mon Sep 17 00:00:00 2001 +From 4b9529b98c01569dff06f4e67ba28a47318e5ea5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 08/54] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 008/170] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ @@ -454,14 +433,11 @@ index 3912646..b51a59c 100644 for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; --- -2.5.0 - -From 05998ad69409fe1312ea7070e5ad3394b1a27712 Mon Sep 17 00:00:00 2001 +From 5fd6ab82b1027504faa66cf4fc8b999fafaacd12 Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 09/54] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 009/170] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -482,15 +458,12 @@ index 2e6ca69..62cc363 100644 .ngpio = BCM2835_NUM_GPIOS, .can_sleep = false, }; --- -2.5.0 - -From 511ab7e5940ce9cc535fed78408df6ccea648a5a Mon Sep 17 00:00:00 2001 +From 4254ef2647e89061427836443eac60351b3306a7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 10/54] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 - and 46-53 +Subject: [PATCH 010/170] pinctrl-bcm2835: Fix interrupt handling for GPIOs + 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has four interrupt lines - one each for the three IRQ groups and one common. Rather @@ -634,15 +607,12 @@ index 62cc363..ab345f4 100644 .of_match_table = bcm2835_pinctrl_match, }, }; --- -2.5.0 - -From b02654723367da6ef4be37fc63aadde1d273337a Mon Sep 17 00:00:00 2001 +From 93b12e64d0e2a8a65189dedd667e00b0a0fab60a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 11/54] pinctrl-bcm2835: Only request the interrupts listed in - the DTB +Subject: [PATCH 011/170] pinctrl-bcm2835: Only request the interrupts listed + in the DTB Although the GPIO controller can generate three interrupts (four counting the common one), the device tree files currently only specify two. In the @@ -667,14 +637,11 @@ index ab345f4..640e3b0 100644 pc->irq_data[i].pc = pc; pc->irq_data[i].irqgroup = i; --- -2.5.0 - -From c28b4b938880483817ec763cc8cea8b1b3fa7713 Mon Sep 17 00:00:00 2001 +From bb8ff388ad26721eebb7249afb6f6f57bc196de4 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 12/54] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 012/170] spi-bcm2835: Support pin groups other than 7-11 The spi-bcm2835 driver automatically uses GPIO chip-selects due to some unreliability of the native ones. In doing so it chooses the @@ -754,14 +721,11 @@ index cf04960..a2b1f45 100644 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", --- -2.5.0 - -From 1cb2f8fda15ef921c9d1f51e010ac0073bd54a57 Mon Sep 17 00:00:00 2001 +From bfcfed788d152e828747ea889a88f8b179217ddb 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 13/54] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 013/170] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -786,7 +750,7 @@ Signed-off-by: Noralf Trønnes 1 file changed, 9 insertions(+) diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 0f7b9ea..1e6f1cf 100644 +index 0f7b9ea..1e6f1cf9 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -17,12 +17,16 @@ @@ -818,14 +782,11 @@ index 0f7b9ea..1e6f1cf 100644 } static const char * const bcm2835_compat[] = { --- -2.5.0 - -From 43a75f20eb793a2c528280faab8248b226fe38de Mon Sep 17 00:00:00 2001 +From fb968a02c00e2722df2dcfec6f54b7524ff5a155 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 16:44:05 +0200 -Subject: [PATCH 14/54] bcm2835-i2s: get base address for DMA from devicetree +Subject: [PATCH 014/170] bcm2835-i2s: get base address for DMA from devicetree Code copied from spi-bcm2835. Get physical address from devicetree instead of using hardcoded constant. @@ -889,14 +850,11 @@ index 8c435be..0bc4f47 100644 /* Set the bus width */ dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr_width = --- -2.5.0 - -From e68b70e6087fd6fc8466eeac8db67b3f49813058 Mon Sep 17 00:00:00 2001 +From abbe565abfe075b76e01b9671c6fc4cf42cc0328 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:21:16 +0200 -Subject: [PATCH 15/54] bcm2835-i2s: add 24bit support, update bclk_ratio to +Subject: [PATCH 015/170] bcm2835-i2s: add 24bit support, update bclk_ratio to more correct values Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -974,14 +932,11 @@ index 0bc4f47..cf60390 100644 | SNDRV_PCM_FMTBIT_S32_LE }, .ops = &bcm2835_i2s_dai_ops, --- -2.5.0 - -From 18ecb409ca4b62265dc8638c4feddc74b169e757 Mon Sep 17 00:00:00 2001 +From b2cc62cd13099d6d2f21b9927df248aa3bdd8d5b Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:25:51 +0200 -Subject: [PATCH 16/54] bcm2835-i2s: setup clock only if CPU is clock master +Subject: [PATCH 016/170] bcm2835-i2s: setup clock only if CPU is clock master Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -1035,14 +990,11 @@ index cf60390..4ac4e92 100644 /* Setup the frame format */ format = BCM2835_I2S_CHEN; --- -2.5.0 - -From 34be3cc516c8e1bc9543bb1b1472b916cde0e3d4 Mon Sep 17 00:00:00 2001 +From 71b2c93cd332be280b9ca7f293e463f30d5fb108 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:49:51 +0200 -Subject: [PATCH 17/54] bcm2835-i2s: Eliminate debugfs directory error +Subject: [PATCH 017/170] bcm2835-i2s: Eliminate debugfs directory error Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -1077,14 +1029,11 @@ index 4ac4e92..aab3df9 100644 }, }; --- -2.5.0 - -From 3b910b1bea6daf50ce4a22298d4512178d109fe7 Mon Sep 17 00:00:00 2001 +From fae43fcaa20df1d39c09c98372100bb1dedd6090 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:35:20 +0200 -Subject: [PATCH 18/54] bcm2835-i2s: Register PCM device +Subject: [PATCH 018/170] bcm2835-i2s: Register PCM device Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -1146,14 +1095,11 @@ index aab3df9..0e5c787 100644 if (ret) { dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); return ret; --- -2.5.0 - -From cb2f46fb84024303f11a9da1f949e0092222b537 Mon Sep 17 00:00:00 2001 +From c9e2eeee4889f965a29744718bbff2de409ac649 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 15:55:21 +0200 -Subject: [PATCH 19/54] bcm2835-i2s: Enable MMAP support via a DT property +Subject: [PATCH 019/170] bcm2835-i2s: Enable MMAP support via a DT property Code ported from bcm2708-i2s driver in Raspberry Pi tree. @@ -1196,14 +1142,11 @@ index 0e5c787..04c1d13 100644 /* Request both ioareas */ for (i = 0; i <= 1; i++) { void __iomem *base; --- -2.5.0 - -From 5d8da2ced7537ced468f4ec0da0392d31ec59402 Mon Sep 17 00:00:00 2001 +From dc5b926436bccc4efbb1695ec3696b5db6746d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 9 Apr 2015 12:34:11 +0200 -Subject: [PATCH 20/54] dmaengine: bcm2835: Add slave dma support +Subject: [PATCH 020/170] dmaengine: bcm2835: Add slave dma support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1522,14 +1465,11 @@ index 996c4b0..b278c66 100644 MODULE_AUTHOR("Florian Meier "); +MODULE_AUTHOR("Gellert Weisz "); MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 47c823519828f01517803ca5507ce9f942ffa4a7 Mon Sep 17 00:00:00 2001 +From 9c6955f3fbfbb46242c63b4640886b9a0d87910a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 3 Oct 2015 15:58:59 +0200 -Subject: [PATCH 21/54] dmaengine: bcm2835: set residue_granularity field +Subject: [PATCH 021/170] dmaengine: bcm2835: set residue_granularity field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1557,14 +1497,11 @@ index b278c66..696fb30 100644 od->ddev.dev = &pdev->dev; INIT_LIST_HEAD(&od->ddev.channels); spin_lock_init(&od->lock); --- -2.5.0 - -From 8ed5d9cb36862e28d36b17c509321c7496c499b6 Mon Sep 17 00:00:00 2001 +From 8da7ee8d9b714dbbac842fb5ae0471b52e0393ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 3 Oct 2015 22:22:55 +0200 -Subject: [PATCH 22/54] dmaengine: bcm2835: Load driver early and support +Subject: [PATCH 022/170] dmaengine: bcm2835: Load driver early and support legacy API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -1663,14 +1600,11 @@ index 696fb30..5db0a95 100644 MODULE_ALIAS("platform:bcm2835-dma"); MODULE_DESCRIPTION("BCM2835 DMA engine driver"); --- -2.5.0 - -From cc8e848852566125466b1c7f8969193b3bd09952 Mon Sep 17 00:00:00 2001 +From 0f3a30eb7ad7e709fdc6447c70bc3f1d5704eb63 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sat, 10 Oct 2015 12:29:18 +0200 -Subject: [PATCH 23/54] bcm2835-dma: Fix dreq not set for slave transfers +Subject: [PATCH 023/170] bcm2835-dma: Fix dreq not set for slave transfers Set dreq to slave_id if it is not set like in bcm2708-dmaengine. --- @@ -1690,15 +1624,12 @@ index 5db0a95..fe1fd60 100644 return 0; } --- -2.5.0 - -From b4b8964bdad3f33abb3b688832b326372c4e1d41 Mon Sep 17 00:00:00 2001 +From 305370f7caaecafbabb77b630380dbc0c436bb4c Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 11 Oct 2015 12:28:30 +0200 -Subject: [PATCH 24/54] bcm2835-dma: Limit cyclic transfers on lite channels to - 32k +Subject: [PATCH 024/170] bcm2835-dma: Limit cyclic transfers on lite channels + to 32k Transfers larger than 32k cause repeated clicking with I2S soundcards. The exact reason is yet unknown, so limit to 32k as bcm2708-dmaengine @@ -1733,14 +1664,11 @@ index fe1fd60..0adc347 100644 else max_size = MAX_NORMAL_TRANSFER; period_len = min(period_len, max_size); --- -2.5.0 - -From 94acbda110b4bed72b2799550c86aa628abebf02 Mon Sep 17 00:00:00 2001 +From d801c33b7e2fb0d02ac11b95ea92b7d692286ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 15 Aug 2015 20:50:02 +0200 -Subject: [PATCH 25/54] bcm2835: Add support for uart1 +Subject: [PATCH 025/170] bcm2835: Add support for uart1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1754,7 +1682,7 @@ Signed-off-by: Noralf Trønnes 1 file changed, 25 insertions(+) diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c -index 1e6f1cf..ea36eec 100644 +index 1e6f1cf9..ea36eec 100644 --- a/arch/arm/mach-bcm/board_bcm2835.c +++ b/arch/arm/mach-bcm/board_bcm2835.c @@ -22,6 +22,29 @@ @@ -1796,14 +1724,11 @@ index 1e6f1cf..ea36eec 100644 } static const char * const bcm2835_compat[] = { --- -2.5.0 - -From 1646baa74c32dc7efe9f1cdc9a38cf55b771cfdd Mon Sep 17 00:00:00 2001 +From 5e90e32b539720ad8c6c8d7ec462378685924f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:21:20 +0200 -Subject: [PATCH 26/54] firmware: bcm2835: Add missing property tags +Subject: [PATCH 026/170] firmware: bcm2835: Add missing property tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1864,14 +1789,11 @@ index c07d74a..525816d 100644 RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, --- -2.5.0 - -From 831c4f4aa0247bf72b21cd38787890fd50cbf766 Mon Sep 17 00:00:00 2001 +From 894f124497e95c9af506af2ed7335857f2e71358 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 27/54] Main bcm2708/bcm2709 linux port +Subject: [PATCH 027/170] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -2011,10 +1933,10 @@ index 34e1569..8f06ea8 100644 source "arch/arm/mach-alpine/Kconfig" diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug -index 259c0ca..097d928 100644 +index ddbb361..340b759 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug -@@ -1241,6 +1241,14 @@ choice +@@ -1240,6 +1240,14 @@ choice options; the platform specific options are deprecated and will be soon removed. @@ -2771,7 +2693,7 @@ index 0000000..502c617 +#define VMALLOC_END (0xe8000000) diff --git a/arch/arm/mach-bcm2709/Kconfig b/arch/arm/mach-bcm2709/Kconfig new file mode 100644 -index 0000000..643b4b9 +index 0000000..643b4b98 --- /dev/null +++ b/arch/arm/mach-bcm2709/Kconfig @@ -0,0 +1,16 @@ @@ -4385,14 +4307,11 @@ index 8673ffe..ad22ebb 100644 mmc_pm_flag_t pm_caps; /* supported pm features */ --- -2.5.0 - -From 4f7a784e0256c10f6200438aa74e385e151c2241 Mon Sep 17 00:00:00 2001 +From 74b2c26348d94949561979a9a3ad61adcac74398 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 11 Nov 2015 21:01:15 +0000 -Subject: [PATCH 28/54] squash: include ARCH_BCM2708 / ARCH_BCM2709 +Subject: [PATCH 028/170] squash: include ARCH_BCM2708 / ARCH_BCM2709 --- drivers/char/hw_random/Kconfig | 2 +- @@ -4481,7 +4400,7 @@ index cfb4b44..d9c6c21 100644 MODULE_AUTHOR("Lubomir Rintel "); MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile -index 738cb49..4fd086f 100644 +index 738cb492..4fd086f 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile @@ -40,6 +40,7 @@ obj-$(CONFIG_PINCTRL_TB10X) += pinctrl-tb10x.o @@ -4543,14 +4462,11 @@ index 6a834e1..c5070ae 100644 select SND_SOC_GENERIC_DMAENGINE_PCM select REGMAP_MMIO help --- -2.5.0 - -From 43a51c6dbdb406826da11b1101cc6511d1185d67 Mon Sep 17 00:00:00 2001 +From a03df8d0f93365689c718f3d1fb62695e9fffe31 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 29/54] Add dwc_otg driver +Subject: [PATCH 029/170] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -5191,7 +5107,7 @@ index 8dd26e1..eef4847 100644 + mov pc, r8 +ENDPROC(__FIQ_Branch) diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile -index d5c57f1..0e15a22 100644 +index d5c57f1e..0e15a22 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile @@ -7,6 +7,7 @@ @@ -5215,10 +5131,10 @@ index 358ca8d..abaac7c 100644 return i; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index ddbf32d..12166e2 100644 +index 1560f3f..dd4dd69 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -4946,7 +4946,7 @@ static void port_event(struct usb_hub *hub, int port1) +@@ -4967,7 +4967,7 @@ static void port_event(struct usb_hub *hub, int port1) if (portchange & USB_PORT_STAT_C_OVERCURRENT) { u16 status = 0, unused; @@ -5231,7 +5147,7 @@ diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 8e641b5..de3ed7d 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c -@@ -1909,6 +1909,85 @@ free_interfaces: +@@ -1909,6 +1909,85 @@ int usb_set_configuration(struct usb_device *dev, int configuration) if (cp->string == NULL && !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) cp->string = usb_cache_string(dev, cp->desc.iConfiguration); @@ -5476,7 +5392,7 @@ index a95b0c9..17b605f 100644 diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c new file mode 100644 -index 0000000..a896d73 +index 0000000..a896d73f --- /dev/null +++ b/drivers/usb/gadget/file_storage.c @@ -0,0 +1,3676 @@ @@ -13314,7 +13230,7 @@ index 0000000..4664684 +#endif /* DWC_LIBMODULE */ diff --git a/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c new file mode 100644 -index 0000000..49b07e1 +index 0000000..49b07e17 --- /dev/null +++ b/drivers/usb/host/dwc_common_port/dwc_common_nbsd.c @@ -0,0 +1,1275 @@ @@ -25841,7 +25757,7 @@ index 0000000..bbb3d32 +#endif //DWC_UTE_CFI diff --git a/drivers/usb/host/dwc_otg/dwc_otg_cfi.h b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h new file mode 100644 -index 0000000..55fd337 +index 0000000..55fd337a --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_cfi.h @@ -0,0 +1,320 @@ @@ -55832,7 +55748,7 @@ index 0000000..c8d2e0e +#endif /* DWC_HOST_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c new file mode 100644 -index 0000000..c8590b5 +index 0000000..c8590b52 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c @@ -0,0 +1,5147 @@ @@ -65528,14 +65444,11 @@ index 0000000..cdc9963 + +test_main(); +0; --- -2.5.0 - -From e84cab190a51bb9d04b38e76ce90a47c0f93da5e Mon Sep 17 00:00:00 2001 +From 845f985818d3d9ba162ab1102da78b0e39eaedba Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 30/54] bcm2708 framebuffer driver +Subject: [PATCH 030/170] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -66507,7 +66420,7 @@ index 0000000..a20539a +MODULE_PARM_DESC(fbdepth, "Bit depth of ARM Framebuffer"); +MODULE_PARM_DESC(fbswap, "Swap order of red and blue in 24 and 32 bit modes"); diff --git a/drivers/video/logo/logo_linux_clut224.ppm b/drivers/video/logo/logo_linux_clut224.ppm -index 3c14e43..7626beb 100644 +index 3c14e43..7626beb6a 100644 --- a/drivers/video/logo/logo_linux_clut224.ppm +++ b/drivers/video/logo/logo_linux_clut224.ppm @@ -1,1604 +1,883 @@ @@ -68996,14 +68909,11 @@ index 3c14e43..7626beb 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 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 --- -2.5.0 - -From 227880a04368c2840eb27d8d25aaee1cfd7e5c3a Mon Sep 17 00:00:00 2001 +From a35139d316b78606bfdeb0f10656ba6f1729c83f Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 31/54] dmaengine: Add support for BCM2708 +Subject: [PATCH 031/170] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69622,14 +69532,11 @@ index 0000000..99cc7fd +#endif /* CONFIG_DMA_BCM2708 */ + +#endif /* _PLAT_BCM2708_DMA_H */ --- -2.5.0 - -From 68dc1707b0e75ca092319956776e656bc3b42315 Mon Sep 17 00:00:00 2001 +From 462591cf98f15614620667e93b7f8bc0da6e86da Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 32/54] Add blk_pos parameter to mmc multi_io_quirk callback +Subject: [PATCH 032/170] Add blk_pos parameter to mmc multi_io_quirk callback --- drivers/mmc/card/block.c | 1 + @@ -69711,14 +69618,11 @@ index ad22ebb..105b3e6 100644 }; struct mmc_card; --- -2.5.0 - -From c9c3712517791991bc66744c3931cee457a70018 Mon Sep 17 00:00:00 2001 +From 3d0ca77d187abbbde572f4a73b1f864ffb8b5d8a Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 33/54] MMC: added alternative MMC driver +Subject: [PATCH 033/170] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -71415,15 +71319,12 @@ index 0000000..43aed6e +MODULE_DESCRIPTION("BCM2835 SDHCI driver"); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); --- -2.5.0 - -From e43ccd0115b085c56aa7396bdb973d244379222d Mon Sep 17 00:00:00 2001 +From 756bf8b8f081be45e16d4d58d3fbe2ca073df298 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 34/54] Adding bcm2835-sdhost driver, and an overlay to enable - it +Subject: [PATCH 034/170] Adding bcm2835-sdhost driver, and an overlay to + enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -73448,14 +73349,11 @@ index 0000000..da089985 +MODULE_DESCRIPTION("BCM2835 SDHost driver"); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); --- -2.5.0 - -From a1c91b2e27db42a9d753a2d752a4db2339971786 Mon Sep 17 00:00:00 2001 +From 8dbb0430386b772f636f474ed45496076d135428 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 35/54] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 035/170] cma: Add vc_cma driver to enable use of CMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -74797,14 +74695,11 @@ index 0000000..be2819d +#endif + +#endif /* VC_CMA_H */ --- -2.5.0 - -From 288825203141275ee6ce0054b7c19b93468f6ea7 Mon Sep 17 00:00:00 2001 +From 1e8eb30b259278ea7ab9d14c66d2fab5f580f73c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 36/54] bcm2708: alsa sound driver +Subject: [PATCH 036/170] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -77501,14 +77396,11 @@ index 0000000..af3e6eb +} VC_AUDIO_MSG_T; + +#endif // _VC_AUDIO_DEFS_H_ --- -2.5.0 - -From 10bbede5e3a5cda000722a6710342a49c7a66a97 Mon Sep 17 00:00:00 2001 +From 20c0f57db9cca65943519bd404b3e346958f4544 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 37/54] bcm2708 vchiq driver +Subject: [PATCH 037/170] bcm2708 vchiq driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -78766,7 +78658,7 @@ index 0000000..1b17e98 +/****************************** End of file **********************************/ diff --git a/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h new file mode 100644 -index 0000000..26bc2d3 +index 0000000..26bc2d38 --- /dev/null +++ b/drivers/misc/vc04_services/interface/vchi/vchi_cfg.h @@ -0,0 +1,224 @@ @@ -90812,14 +90704,11 @@ index 0000000..b6bfa21 +{ + return vchiq_build_time; +} --- -2.5.0 - -From 39ea0d34e648bca5995ae2f578a2a151761e32bb Mon Sep 17 00:00:00 2001 +From 2cabfc660c80dd79f24a8323b3913b5060ebf750 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 16:07:06 +0100 -Subject: [PATCH 38/54] vc_mem: Add vc_mem driver +Subject: [PATCH 038/170] vc_mem: Add vc_mem driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -91823,14 +91712,11 @@ index 0000000..20a4753 +#endif + +#endif /* _VC_MEM_H */ --- -2.5.0 - -From 482bc90fdaa1d40622db38100a193d00948ae585 Mon Sep 17 00:00:00 2001 +From 01574b9e0f1086399e7f796cc1dc8fcadabf4a46 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 39/54] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 039/170] vcsm: VideoCore shared memory service for BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -96245,14 +96131,11 @@ index 0000000..334f36d +/* ---- Function Prototypes ---------------------------------------------- */ + +#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ --- -2.5.0 - -From ffef0c9f7166a243aae23b1bc094d222e4cfecaf Mon Sep 17 00:00:00 2001 +From 832077a0f61e44a9259b153f60eb233fa723c2a9 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 40/54] Add /dev/gpiomem device for rootless user GPIO access +Subject: [PATCH 040/170] Add /dev/gpiomem device for rootless user GPIO access Signed-off-by: Luke Wren @@ -96562,14 +96445,11 @@ index 0000000..911f5b7 +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); +MODULE_AUTHOR("Luke Wren "); --- -2.5.0 - -From fafb1e07bcbf595a3412748fe1243a38f3393757 Mon Sep 17 00:00:00 2001 +From 6609b15c34f26f34b4b49e7726693a1de321078c Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 41/54] Add SMI driver +Subject: [PATCH 041/170] Add SMI driver Signed-off-by: Luke Wren --- @@ -98519,14 +98399,11 @@ index 0000000..ee3a75e +#endif /* BCM2835_SMI_IMPLEMENTATION */ + +#endif /* BCM2835_SMI_H */ --- -2.5.0 - -From a368a4010e0b463a0518eb4dbf1cf8a893727596 Mon Sep 17 00:00:00 2001 +From f4d44b2c447c401791645627e88d0ef9830c1239 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 42/54] Add SMI NAND driver +Subject: [PATCH 042/170] Add SMI NAND driver Signed-off-by: Luke Wren --- @@ -98606,7 +98483,7 @@ index 2896640..56ff00b 100644 tristate diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile -index 2c7f014..30e22f0 100644 +index 2c7f014b..30e22f0 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_MTD_NAND_DENALI) += denali.o @@ -98891,14 +98768,11 @@ index 0000000..b747326 +MODULE_DESCRIPTION + ("Driver for NAND chips using Broadcom Secondary Memory Interface"); +MODULE_AUTHOR("Luke Wren "); --- -2.5.0 - -From 14f0b2203b2204c057d7db441e1a292b6a0eb6f3 Mon Sep 17 00:00:00 2001 +From 2faad8f6644fa53418c5a7b80da8d5400b72df3f Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 43/54] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 043/170] 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 @@ -99746,14 +99620,11 @@ index 0000000..fb69624 + bcm2708_gpio_pull_t value); + +#endif --- -2.5.0 - -From 20fd592d940f46939e89d194f0392c0fe00d1e4f Mon Sep 17 00:00:00 2001 +From 3c7ea37319a4974cbf6b89a84c109a53f4d6b408 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 44/54] Add cpufreq driver +Subject: [PATCH 044/170] Add cpufreq driver Signed-off-by: popcornmix --- @@ -100014,14 +99885,11 @@ index 0000000..3eb9e93 + +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); --- -2.5.0 - -From de097ce1fa4d97e711469c8e5ddc0ab0e4e84943 Mon Sep 17 00:00:00 2001 +From 776e87ffc8b137ea465e7b0076e56cd71d9c56d1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 45/54] Added hwmon/thermal driver for reporting core +Subject: [PATCH 045/170] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -100218,14 +100086,11 @@ index 0000000..08d8dc7 +MODULE_AUTHOR("Noralf Trønnes"); +MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); +MODULE_LICENSE("GPL"); --- -2.5.0 - -From 3283ff477bed6a5f3d67e405f7df7b456a864567 Mon Sep 17 00:00:00 2001 +From 72181304010d3aa74cd2b98db592554a541ce4c2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 46/54] Add Chris Boot's i2c driver +Subject: [PATCH 046/170] Add Chris Boot's i2c driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -100864,14 +100729,11 @@ index 0000000..85f411c +MODULE_AUTHOR("Chris Boot "); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); --- -2.5.0 - -From 7c0ed22b9161086cd3e7c3b7175c8e66538dc058 Mon Sep 17 00:00:00 2001 +From abcf04d54ccb3d0897b1f7a95ddf9d9ccf63dc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:27:06 +0200 -Subject: [PATCH 47/54] char: broadcom: Add vcio module +Subject: [PATCH 047/170] char: broadcom: Add vcio module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -101096,14 +100958,11 @@ index 0000000..c19bc20 +MODULE_AUTHOR("Noralf Trønnes"); +MODULE_DESCRIPTION("Mailbox userspace access"); +MODULE_LICENSE("GPL"); --- -2.5.0 - -From 386d9ed9fc8601e4919d29d24161ffcffeed4078 Mon Sep 17 00:00:00 2001 +From a205e934b63b6bf3f5f74bc39974ec6ff09df596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:25:01 +0200 -Subject: [PATCH 48/54] firmware: bcm2835: Support ARCH_BCM270x +Subject: [PATCH 048/170] firmware: bcm2835: Support ARCH_BCM270x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -101208,14 +101067,11 @@ index dd506cd3..b980d53 100644 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("Raspberry Pi firmware driver"); --- -2.5.0 - -From d052c7efe3ebc65ce4c262607028a21a163a755b Mon Sep 17 00:00:00 2001 +From 4d74ee3d433df319ae3fc36bd16fd96b4bbff865 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 49/54] bcm2835: add v4l2 camera device +Subject: [PATCH 049/170] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -104975,7 +104831,7 @@ index 0000000..f9f903f +} diff --git a/drivers/media/platform/bcm2835/mmal-common.h b/drivers/media/platform/bcm2835/mmal-common.h new file mode 100644 -index 0000000..840fd13 +index 0000000..840fd139 --- /dev/null +++ b/drivers/media/platform/bcm2835/mmal-common.h @@ -0,0 +1,53 @@ @@ -106495,7 +106351,7 @@ index 0000000..aa0fd18 +}; diff --git a/drivers/media/platform/bcm2835/mmal-vchiq.c b/drivers/media/platform/bcm2835/mmal-vchiq.c new file mode 100644 -index 0000000..7813225 +index 0000000..78132254 --- /dev/null +++ b/drivers/media/platform/bcm2835/mmal-vchiq.c @@ -0,0 +1,1916 @@ @@ -108599,14 +108455,11 @@ index 0000000..9d1d11e + struct mmal_buffer *buf); + +#endif /* MMAL_VCHIQ_H */ --- -2.5.0 - -From 88f17ab49dec26cef89f7382763e0aea94e380cd Mon Sep 17 00:00:00 2001 +From 03435989bbadbd333a810644c8246dd7eb0bad07 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 50/54] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 050/170] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -109070,21 +108923,18 @@ index 0000000..3998d43 + my $val = $configs->{$wanted} || 'n'; + return (($val eq 'y') || ($val eq '1')); +} --- -2.5.0 - -From 546668ae1382b20c6e80ef49bad762045fc4e1c4 Mon Sep 17 00:00:00 2001 +From a251bf4a37d8fd468bc3ff853bcebe8ee452a31e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 51/54] fdt: Add support for the CONFIG_CMDLINE_EXTEND option +Subject: [PATCH 051/170] fdt: Add support for the CONFIG_CMDLINE_EXTEND option --- drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c -index 655f79d..0508152 100644 +index 655f79d..fdc4501 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -954,19 +954,38 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, @@ -109126,19 +108976,16 @@ index 655f79d..0508152 100644 - strlcpy(data, CONFIG_CMDLINE, COMMAND_LINE_SIZE); + } +#else /* CONFIG_CMDLINE */ -+ if (p != NULL && l > 0) { ++ if (p != NULL && l > 0) + strlcpy(data, p, min((int)l, COMMAND_LINE_SIZE)); #endif /* CONFIG_CMDLINE */ pr_debug("Command line is: %s\n", (char*)data); --- -2.5.0 - -From 1a604dcf0461ad1a5422f6618686d7ce5beb0a2f Mon Sep 17 00:00:00 2001 +From 0112c4ce9db6cdc53af67dc7634966c3594de7ff Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 52/54] BCM2708: Add core Device Tree support +Subject: [PATCH 052/170] BCM2708: Add core Device Tree support Add the bare minimum needed to boot BCM2708 from a Device Tree. @@ -110472,7 +110319,7 @@ index 0000000..a8cfd7c +}; diff --git a/arch/arm/boot/dts/bcm2835-rpi-cm.dts b/arch/arm/boot/dts/bcm2835-rpi-cm.dts new file mode 100644 -index 0000000..c6e6860 +index 0000000..c6e6860a --- /dev/null +++ b/arch/arm/boot/dts/bcm2835-rpi-cm.dts @@ -0,0 +1,93 @@ @@ -111640,7 +111487,7 @@ index 0000000..2c81448 +}; 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 +index 0000000..5e7633ae --- /dev/null +++ b/arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts @@ -0,0 +1,34 @@ @@ -111680,7 +111527,7 @@ index 0000000..5e7633a +}; 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..deb9c62 +index 0000000..deb9c625 --- /dev/null +++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts @@ -0,0 +1,39 @@ @@ -112970,7 +112817,7 @@ index 0000000..1bd8054 +}; 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 +index 0000000..7fc6ac99 --- /dev/null +++ b/arch/arm/boot/dts/overlays/rpi-dac-overlay.dts @@ -0,0 +1,34 @@ @@ -113863,14 +113710,11 @@ index 0000000..66a98f6 + pullup = <&w1>,"rpi,parasitic-power:0"; + }; +}; --- -2.5.0 - -From a9f4427a230b1ca6e77418330a42042e2b703a10 Mon Sep 17 00:00:00 2001 +From 23eabf2220f0f748df3e88a35e55a82c53242b4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 15 Aug 2015 20:47:07 +0200 -Subject: [PATCH 53/54] bcm2835: Match with BCM2708 Device Trees +Subject: [PATCH 053/170] bcm2835: Match with BCM2708 Device Trees MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -114387,14 +114231,11 @@ index 864a3ef..3256bff 100644 +&watchdog { + status = "okay"; +}; --- -2.5.0 - -From 88ef042c414856132deba83d6ff8e9001c71e8d3 Mon Sep 17 00:00:00 2001 +From f978fb3b816681159b6cc97104954dea31488add Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 54/54] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 054/170] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -114471,7 +114312,7 @@ index 0705d88..771992a 100644 case FBIOBLANK: ret = do_fb_ioctl(info, cmd, arg); diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h -index fb795c3..fa72af0 100644 +index fb795c3..fa72af0c 100644 --- a/include/uapi/linux/fb.h +++ b/include/uapi/linux/fb.h @@ -34,6 +34,11 @@ @@ -114486,13 +114327,11 @@ index fb795c3..fa72af0 100644 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ --- -2.5.0 -From 3dd0886d76a33878bfdc67c44f29c9a782f88419 Mon Sep 17 00:00:00 2001 +From 53bcd6e5a43a353508c7aff48abcdcaae1b35ca8 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 1/3] Speed up console framebuffer imageblit function +Subject: [PATCH 058/170] 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 @@ -114700,14 +114539,11 @@ index a2bb276..436494f 100644 slow_imageblit(image, p, dst1, fgcolor, bgcolor, start_index, pitch_index); } else --- -2.5.0 - -From 4641cd894690a65893287ce27e9b98a0e554ac1a Mon Sep 17 00:00:00 2001 +From 6c0a9150827dc58fac38c8e787c050626325842e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 2/3] Allow mac address to be set in smsc95xx +Subject: [PATCH 059/170] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -114797,15 +114633,12 @@ index 9c0da18..3244a90 100755 /* try reading mac address from EEPROM */ if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { --- -2.5.0 - -From 4252d61d6bf3c32b2042de2a0633472e65044bcd Mon Sep 17 00:00:00 2001 +From e172d31b8402f13aed5679cd7023f0c0935aab05 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 3/3] enabling the realtime clock 1-wire chip DS1307 and 1-wire - on GPIO4 (as a module) +Subject: [PATCH 060/170] 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 See: https://github.com/raspberrypi/linux/pull/457 @@ -115053,24 +114886,22 @@ index d58594a..feae942 100644 void (*enable_external_pullup)(int enable); unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; --- -2.5.0 -From 0d2c4c9480b96a2c0a92044f11d59e1893bd5d61 Mon Sep 17 00:00:00 2001 +From d0f48fe7aab3e4036fd55b491a9be94ea24f377d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 01/59] config: Enable CONFIG_MEMCG, but leave it disabled (due - to memory cost). Enable with cgroup_enable=memory. +Subject: [PATCH 062/170] config: Enable CONFIG_MEMCG, but leave it disabled + (due to memory cost). Enable with cgroup_enable=memory. --- kernel/cgroup.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/kernel/cgroup.c b/kernel/cgroup.c -index 470f653..5ecf873 100644 +index fb1ecfd..888d308 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c -@@ -5273,7 +5273,7 @@ int __init cgroup_init_early(void) +@@ -5286,7 +5286,7 @@ int __init cgroup_init_early(void) return 0; } @@ -115079,7 +114910,7 @@ index 470f653..5ecf873 100644 /** * cgroup_init - cgroup initialization -@@ -5769,6 +5769,27 @@ static int __init cgroup_disable(char *str) +@@ -5782,6 +5782,27 @@ static int __init cgroup_disable(char *str) } __setup("cgroup_disable=", cgroup_disable); @@ -115107,14 +114938,11 @@ index 470f653..5ecf873 100644 /** * css_tryget_online_from_dir - get corresponding css from a cgroup dentry * @dentry: directory dentry of interest --- -2.5.0 - -From b29192a8be711b20a5bd623b363a9672df79d762 Mon Sep 17 00:00:00 2001 +From 8d35b3a72d3580ad6f5bc5835bfe13b00cce6086 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 02/59] ASoC: Add support for PCM5102A codec +Subject: [PATCH 063/170] ASoC: Add support for PCM5102A codec Some definitions to support the PCM5102A codec by Texas Instruments. @@ -115246,14 +115074,11 @@ index 0000000..7c6598e +MODULE_DESCRIPTION("ASoC PCM5102A codec driver"); +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 0dedabda0e45bd54adeb39ee435367e4429dfbb6 Mon Sep 17 00:00:00 2001 +From 9ced0e86593de2214ff8a81f71c802d7e7301b05 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 03/59] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 064/170] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -115422,14 +115247,11 @@ index 0000000..3ab0f47 +MODULE_AUTHOR("Florian Meier "); +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From e44fe13cdf2e0857f445870d895a1c8c6b6741e3 Mon Sep 17 00:00:00 2001 +From f16a654f57b024d44fe58d62b660e01de6a7811a Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 04/59] ASoC: Add support for Rpi-DAC +Subject: [PATCH 065/170] ASoC: Add support for Rpi-DAC --- sound/soc/bcm/Kconfig | 7 +++ @@ -115715,17 +115537,14 @@ index 0000000..afe1b41 +MODULE_DESCRIPTION("ASoC PCM1794A codec driver"); +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 5eef515f93059e16a1644ad37a17a624e3038425 Mon Sep 17 00:00:00 2001 +From dbdeca565b0850da182d3bd0b3ed41f667ca8a45 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 05/59] 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 +Subject: [PATCH 066/170] 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 additional mclk_div divider, it is now possible to control the behaviour. This allows using 256xfs PLL frequency on all sample rates up to 96kHz. It should allow lower jitter and better signal quality. The behavior has to be @@ -115761,14 +115580,11 @@ index 8d91470..5795fb1 100644 #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ --- -2.5.0 - -From e73dd7a2fba7ab58c64aa30b785c56d6ee9c213f Mon Sep 17 00:00:00 2001 +From 0c2e64d3eda229c2f52ce6ed9d0b1c1572dd9b19 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 06/59] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 067/170] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -116054,15 +115870,12 @@ index 0000000..80732b8 +MODULE_AUTHOR("Daniel Matuschek "); +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 73edf3a97c839ddf6684271f5485d7c147b80f92 Mon Sep 17 00:00:00 2001 +From f2789622ff7c1297e28f38bb198f5fd24b4602ef Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 07/59] ASoC: wm8804: Set idle_bias_off to false Idle bias has - been change to remove warning on driver startup +Subject: [PATCH 068/170] ASoC: wm8804: Set idle_bias_off to false Idle bias + has been change to remove warning on driver startup Signed-off-by: Daniel Matuschek --- @@ -116082,14 +115895,11 @@ index 5795fb1..c846716 100644 .dapm_widgets = wm8804_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), --- -2.5.0 - -From 1f1e820c63d8385fed2ae1df075a747702756d44 Mon Sep 17 00:00:00 2001 +From 80fa31f923b4967bc86be20c5af780ef284fc972 Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 08/59] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 069/170] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -116271,14 +116081,11 @@ index 0000000..37038d4 +MODULE_AUTHOR("Florian Meier "); +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From 26b545d1b78dba5e4a88b3ad38d129b5217c526a Mon Sep 17 00:00:00 2001 +From b15f112ddaf2cd20a8f999ac823ddb51d7d513b9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 09/59] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 070/170] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -116286,7 +116093,7 @@ Reduces overhead when using X 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index 36712e9..910fa89 100644 +index 5dd426f..9ae0cd5 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -49,7 +49,7 @@ @@ -116313,14 +116120,11 @@ index 36712e9..910fa89 100644 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { --- -2.5.0 - -From d00a6d6ab0ad83338de8360fb0c895dc3b780caa Mon Sep 17 00:00:00 2001 +From debd3d30b1127328b5a1e444bd1550cb45c50362 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 10/59] Added support for HiFiBerry DAC+ +Subject: [PATCH 071/170] 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. @@ -116514,14 +116318,11 @@ index 0000000..11e4f39 +MODULE_AUTHOR("Daniel Matuschek "); +MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From e1a0219eddb9732580155b2cb1f8d0e24421b9c3 Mon Sep 17 00:00:00 2001 +From 9c6f0b1812313d39afeefd700b7f9df9a82a47cd Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 11/59] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 072/170] 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. @@ -117351,14 +117152,11 @@ index 0000000..8f019e0 + + +#endif /* _TAS5713_H */ --- -2.5.0 - -From 9491a7d6109f4ad61e1db014d5611c13232bfd65 Mon Sep 17 00:00:00 2001 +From 21d08f232ffc350b2930f761f3da26f9867b1d4d Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 12/59] Update ds1307 driver for device-tree support +Subject: [PATCH 073/170] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -117384,14 +117182,11 @@ index aa705bb..1cb13fee 100644 static struct i2c_driver ds1307_driver = { .driver = { .name = "rtc-ds1307", --- -2.5.0 - -From f7704ed8c0ebb3eb5d4efc203afc58aab6642a2f Mon Sep 17 00:00:00 2001 +From a2b52a3af1314e2b691d9518afb3051193758671 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 13/59] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 074/170] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -117569,14 +117364,11 @@ index fa359c7..4b25a1a 100644 /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ --- -2.5.0 - -From 8a1b126dd7b96658a58c6fcb448599a329b0c681 Mon Sep 17 00:00:00 2001 +From 12ad9b7c670220b1b8b80ebf507651d106cb28c0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 14/59] enc28j60: Add device tree compatible string and an +Subject: [PATCH 075/170] enc28j60: Add device tree compatible string and an overlay --- @@ -117604,14 +117396,11 @@ index 86ea17e..a1b20c1 100644 }, .probe = enc28j60_probe, .remove = enc28j60_remove, --- -2.5.0 - -From dad0f756f15b857a690cd400a57967f1ea17ec51 Mon Sep 17 00:00:00 2001 +From 660d2fba0483aafc4a1ce678016620c0871bb759 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 15/59] Add driver for rpi-proto +Subject: [PATCH 076/170] 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 @@ -117825,28 +117614,25 @@ index 0000000..c6e45a0 +MODULE_AUTHOR("Florian Meier"); +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); --- -2.5.0 - -From f83d2eae29ba396b02e1d1db4f7641c63a22e1ad Mon Sep 17 00:00:00 2001 +From e2af169e60b4ebd710e733996d57ad86264bae27 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 16/59] config: Add default configs +Subject: [PATCH 077/170] config: Add default configs --- - arch/arm/configs/bcm2709_defconfig | 1255 ++++++++++++++++++++++++++++++++++++ - arch/arm/configs/bcmrpi_defconfig | 1251 +++++++++++++++++++++++++++++++++++ - 2 files changed, 2506 insertions(+) + arch/arm/configs/bcm2709_defconfig | 1254 +++++++++++++++++++++++++++++++++++ + arch/arm/configs/bcmrpi_defconfig | 1265 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 2519 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..f5c5e87 +index 0000000..16062bf --- /dev/null +++ b/arch/arm/configs/bcm2709_defconfig -@@ -0,0 +1,1255 @@ +@@ -0,0 +1,1254 @@ +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +CONFIG_PHYS_OFFSET=0 +CONFIG_LOCALVERSION="-v7" @@ -117892,7 +117678,7 @@ index 0000000..f5c5e87 +CONFIG_SMP=y +CONFIG_HAVE_ARM_ARCH_TIMER=y +CONFIG_VMSPLIT_2G=y -+CONFIG_PREEMPT=y ++CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_AEABI=y +CONFIG_OABI_COMPAT=y +# CONFIG_CPU_SW_DOMAIN_PAN is not set @@ -119076,7 +118862,6 @@ index 0000000..f5c5e87 +CONFIG_DEBUG_MEMORY_INIT=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_TIMER_STATS=y -+# CONFIG_DEBUG_PREEMPT is not set +CONFIG_IRQSOFF_TRACER=y +CONFIG_SCHED_TRACER=y +CONFIG_STACK_TRACER=y @@ -119104,10 +118889,10 @@ index 0000000..f5c5e87 +CONFIG_LIBCRC32C=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig new file mode 100644 -index 0000000..c7d31e8 +index 0000000..1d1b799 --- /dev/null +++ b/arch/arm/configs/bcmrpi_defconfig -@@ -0,0 +1,1251 @@ +@@ -0,0 +1,1265 @@ +# CONFIG_ARM_PATCH_PHYS_VIRT is not set +CONFIG_PHYS_OFFSET=0 +# CONFIG_LOCALVERSION_AUTO is not set @@ -119148,7 +118933,7 @@ index 0000000..c7d31e8 +CONFIG_MAC_PARTITION=y +CONFIG_CFQ_GROUP_IOSCHED=y +CONFIG_ARCH_BCM2708=y -+CONFIG_PREEMPT=y ++CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_AEABI=y +CONFIG_OABI_COMPAT=y +# CONFIG_CPU_SW_DOMAIN_PAN is not set @@ -119479,6 +119264,7 @@ index 0000000..c7d31e8 +CONFIG_BT_HIDP=m +CONFIG_BT_6LOWPAN=m +CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m +CONFIG_BT_HCIBCM203X=m +CONFIG_BT_HCIBPA10X=m +CONFIG_BT_HCIBFUSB=m @@ -119693,7 +119479,6 @@ index 0000000..c7d31e8 +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_TTY_PRINTK=y +CONFIG_HW_RANDOM=y -+CONFIG_HW_RANDOM_BCM2835=y +CONFIG_RAW_DRIVER=y +CONFIG_I2C=y +CONFIG_I2C_CHARDEV=m @@ -120024,6 +119809,7 @@ index 0000000..c7d31e8 +CONFIG_USBIP_CORE=m +CONFIG_USBIP_VHCI_HCD=m +CONFIG_USBIP_HOST=m ++CONFIG_USB_DWC2=m +CONFIG_USB_SERIAL=m +CONFIG_USB_SERIAL_GENERIC=y +CONFIG_USB_SERIAL_AIRCABLE=m @@ -120097,6 +119883,20 @@ index 0000000..c7d31e8 +CONFIG_USB_CXACRU=m +CONFIG_USB_UEAGLEATM=m +CONFIG_USB_XUSBATM=m ++CONFIG_USB_GADGET=m ++CONFIG_USB_ZERO=m ++CONFIG_USB_AUDIO=m ++CONFIG_USB_ETH=m ++CONFIG_USB_GADGETFS=m ++CONFIG_USB_MASS_STORAGE=m ++CONFIG_USB_G_SERIAL=m ++CONFIG_USB_MIDI_GADGET=m ++CONFIG_USB_G_PRINTER=m ++CONFIG_USB_CDC_COMPOSITE=m ++CONFIG_USB_G_ACM_MS=m ++CONFIG_USB_G_MULTI=m ++CONFIG_USB_G_HID=m ++CONFIG_USB_G_WEBCAM=m +CONFIG_MMC=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_BCM2835=y @@ -120206,7 +120006,7 @@ index 0000000..c7d31e8 +CONFIG_EXTCON_ARIZONA=m +CONFIG_IIO=m +CONFIG_IIO_BUFFER=y -+CONFIG_IIO_BUFFER_CB=y ++CONFIG_IIO_BUFFER_CB=m +CONFIG_IIO_KFIFO_BUF=m +CONFIG_MCP320X=m +CONFIG_DHT11=m @@ -120330,7 +120130,6 @@ index 0000000..c7d31e8 +CONFIG_DEBUG_MEMORY_INIT=y +CONFIG_DETECT_HUNG_TASK=y +CONFIG_TIMER_STATS=y -+# CONFIG_DEBUG_PREEMPT is not set +CONFIG_LATENCYTOP=y +CONFIG_IRQSOFF_TRACER=y +CONFIG_SCHED_TRACER=y @@ -120359,14 +120158,11 @@ index 0000000..c7d31e8 +CONFIG_CRYPTO_AES_ARM=m +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y --- -2.5.0 - -From 4a03e3e11c4576e0b94a0e6c8e4dd676140d6120 Mon Sep 17 00:00:00 2001 +From e5292198fc83805a9f4751fddeb802f69c0270f0 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 17/59] bcm2835: bcm2835_defconfig +Subject: [PATCH 078/170] bcm2835: bcm2835_defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -120508,7 +120304,7 @@ Signed-off-by: Noralf Trønnes 1 file changed, 1140 insertions(+), 26 deletions(-) diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig -index 31cb073..fdb2e2a 100644 +index 31cb073..fdb2e2a8 100644 --- a/arch/arm/configs/bcm2835_defconfig +++ b/arch/arm/configs/bcm2835_defconfig @@ -1,105 +1,1103 @@ @@ -121791,14 +121587,11 @@ index 31cb073..fdb2e2a 100644 +CONFIG_LIBCRC32C=y # CONFIG_XZ_DEC_ARM is not set # CONFIG_XZ_DEC_ARMTHUMB is not set --- -2.5.0 - -From 9a3fd91c18be1eda26a0637ce6b905c75d6f67e2 Mon Sep 17 00:00:00 2001 +From 6fb12ee15eb9b0f5b6fea66c861a9db8ec6671ed Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 18/59] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 079/170] rpi-ft5406: Add touchscreen driver for pi LCD display Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected @@ -122092,14 +121885,12 @@ index 0000000..b27dbee +MODULE_AUTHOR("Gordon Hollingworth"); +MODULE_DESCRIPTION("Touchscreen driver for memory based FT5406"); +MODULE_LICENSE("GPL"); --- -2.5.0 - -From 1fb6da46a439a109415dea3ae8967e5b55186303 Mon Sep 17 00:00:00 2001 +From b57a6269e03fe055f78ab50add6e2c68d43254e2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Oct 2014 11:47:53 +0100 -Subject: [PATCH 19/59] Improve __copy_to_user and __copy_from_user performance +Subject: [PATCH 080/170] 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. @@ -123550,7 +123341,7 @@ index 588bbc2..c29df92 100644 __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) { unsigned long ua_flags; -@@ -138,6 +183,54 @@ out: +@@ -138,6 +183,54 @@ __copy_to_user_memcpy(void __user *to, const void *from, unsigned long n) return n; } @@ -123636,14 +123427,11 @@ index 588bbc2..c29df92 100644 static unsigned long noinline __clear_user_memset(void __user *addr, unsigned long n) --- -2.5.0 - -From e8f7622b797353eb01277b988f5dcb01d4281762 Mon Sep 17 00:00:00 2001 +From 44d43099a94c8b2db818c80c67789ef5f9857b81 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 20/59] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 081/170] gpio-poweroff: Allow it to work on Raspberry Pi The Raspberry Pi firmware manages the power-down and reboot process. To do this it installs a pm_power_off handler, causing @@ -123677,14 +123465,11 @@ index be3d81f..a030ae9 100644 dev_err(&pdev->dev, "%s: pm_power_off function already registered", __func__); --- -2.5.0 - -From 8c8f50a7ed38607026f7d987f9ca2b589d2f0187 Mon Sep 17 00:00:00 2001 +From 5b2d8bca046bd6f1a426e9205f194ece5b95e300 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 21/59] spidev: Add "spidev" compatible string to silence +Subject: [PATCH 082/170] spidev: Add "spidev" compatible string to silence warning See: https://github.com/raspberrypi/linux/issues/1054 @@ -123704,14 +123489,11 @@ index d0e7dfc..57b0760 100644 {}, }; MODULE_DEVICE_TABLE(of, spidev_dt_ids); --- -2.5.0 - -From 3f7779b380bd473670d38dd4ff3d6513ec1a89c2 Mon Sep 17 00:00:00 2001 +From 534c337ea28bee34f886a1d1e00d281365c94efa Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 17:00:18 +0100 -Subject: [PATCH 22/59] scripts/dtc: Add overlay support +Subject: [PATCH 083/170] scripts/dtc: Add overlay support --- scripts/dtc/checks.c | 119 ++- @@ -123882,7 +123664,7 @@ index e81a8c74..efd1bc6 100644 }; diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l -index 0ee1caf..dd44ba2 100644 +index 0ee1caf0..dd44ba2 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l @@ -113,6 +113,11 @@ static void lexical_error(const char *fmt, ...); @@ -128115,16 +127897,12 @@ index 5b8c7d5..86b7338 100644 @@ -1 +1 @@ -#define DTC_VERSION "DTC 1.4.1-g9d3649bd" +#define DTC_VERSION "DTC 1.4.1-g9d3649bd-dirty" --- -2.5.0 - -From 74fb644989dfc1101e5ddca287ce58b8b5f41c79 Mon Sep 17 00:00:00 2001 +From b065c580329ecb7c7e77bb7019c6059d7db83398 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 23/59] Merge pull request #1043 from XECDesign/sense-4.0 +Subject: [PATCH 084/170] mfd: Add Raspberry Pi Sense HAT core driver -mfd: Add Raspberry Pi Sense HAT core driver --- drivers/input/joystick/Kconfig | 8 + drivers/input/joystick/Makefile | 1 + @@ -128147,7 +127925,7 @@ mfd: Add Raspberry Pi Sense HAT core driver create mode 100644 include/linux/mfd/rpisense/joystick.h diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig -index 4215b53..4364d7c 100644 +index 4215b53..4364d7c8 100644 --- a/drivers/input/joystick/Kconfig +++ b/drivers/input/joystick/Kconfig @@ -330,4 +330,12 @@ config JOYSTICK_MAPLE @@ -128175,7 +127953,7 @@ index 92dc0de..1758160 100644 diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c new file mode 100644 -index 0000000..9eca897 +index 0000000..6a41676 --- /dev/null +++ b/drivers/input/joystick/rpisense-js.c @@ -0,0 +1,153 @@ @@ -128199,8 +127977,8 @@ index 0000000..9eca897 +#include +#include + -+struct rpisense *rpisense; -+unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++static struct rpisense *rpisense; ++static unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; + +static void keys_work_fn(struct work_struct *work) +{ @@ -128363,7 +128141,7 @@ index a8b76b8..e6339d2 100644 +obj-$(CONFIG_MFD_RPISENSE_CORE) += rpisense-core.o diff --git a/drivers/mfd/rpisense-core.c b/drivers/mfd/rpisense-core.c new file mode 100644 -index 0000000..7539547 +index 0000000..eea9312 --- /dev/null +++ b/drivers/mfd/rpisense-core.c @@ -0,0 +1,157 @@ @@ -128392,7 +128170,7 @@ index 0000000..7539547 +#include +#include + -+struct rpisense *rpisense; ++static struct rpisense *rpisense; + +static void rpisense_client_dev_register(struct rpisense *rpisense, + const char *name, @@ -128559,7 +128337,7 @@ index 9b086ac..7101277 100644 obj-$(CONFIG_FB_VIRTUAL) += vfb.o diff --git a/drivers/video/fbdev/rpisense-fb.c b/drivers/video/fbdev/rpisense-fb.c new file mode 100644 -index 0000000..90553fa +index 0000000..26432a5 --- /dev/null +++ b/drivers/video/fbdev/rpisense-fb.c @@ -0,0 +1,293 @@ @@ -128596,7 +128374,7 @@ index 0000000..90553fa +module_param(lowlight, bool, 0); +MODULE_PARM_DESC(lowlight, "Reduce LED matrix brightness to one third"); + -+struct rpisense *rpisense; ++static struct rpisense *rpisense; + +struct rpisense_fb_param { + char __iomem *vmem; @@ -128988,14 +128766,11 @@ index 0000000..56196dc + + +#endif --- -2.5.0 - -From c403980d1dddcb1c9eb149e6bda2a8057f4f859c Mon Sep 17 00:00:00 2001 +From c86a74aaff9bc42b3cb04881b3aaf7f822edda04 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 24/59] RaspiDAC3 support +Subject: [PATCH 085/170] RaspiDAC3 support Signed-off-by: Jan Grulich @@ -129242,14 +129017,11 @@ index 0000000..3cabf5b +MODULE_AUTHOR("Jan Grulich "); +MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); +MODULE_LICENSE("GPL v2"); --- -2.5.0 - -From f1244f1b3c28e2bbf6fcb7887cd2353c19be1ece Mon Sep 17 00:00:00 2001 +From 2d340e2fbbc9f4735b798601a43ae9f0f4cc5742 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 24 Aug 2015 16:02:34 +0100 -Subject: [PATCH 25/59] tpa6130a2: Add headphone switch control +Subject: [PATCH 086/170] tpa6130a2: Add headphone switch control Signed-off-by: Jan Grulich --- @@ -129277,7 +129049,7 @@ index 11d85c5..3caaa17 100644 static int tpa6130a2_i2c_read(int reg) { struct tpa6130a2_data *data; -@@ -189,7 +192,7 @@ exit: +@@ -189,7 +192,7 @@ static int tpa6130a2_power(u8 power) } static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol, @@ -129339,14 +129111,11 @@ index 11d85c5..3caaa17 100644 }; /* --- -2.5.0 - -From 4e237ee42e13fd4c1c2b1dd65d8f0ad58f4d601c Mon Sep 17 00:00:00 2001 +From 6fc9d40bec5dbcf3ae8b52ab6850ed0b18193c82 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 28 Sep 2015 23:38:59 +0100 -Subject: [PATCH 26/59] irq-bcm2835: Fix building with 2708 +Subject: [PATCH 087/170] irq-bcm2835: Fix building with 2708 --- drivers/irqchip/irq-bcm2835.c | 3 ++- @@ -129373,14 +129142,11 @@ index 20deb28..c02bf8a 100644 } } init_FIQ(FIQ_START); --- -2.5.0 - -From 256a8a32c69b5eeede30f5eb6674e7e2f4d5d50b Mon Sep 17 00:00:00 2001 +From 0e7ec1e61b149567d5af63169cd4d701c133356f Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 27/59] rpi_display: add backlight driver and overlay +Subject: [PATCH 088/170] rpi_display: add backlight driver and overlay Add a mailbox-driven backlight controller for the Raspberry Pi DSI touchscreen display. Requires updated GPU firmware to recognise the @@ -129458,7 +129224,7 @@ index 0000000..c021d02 + }; +}; diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index f5c5e87..38e46ac 100644 +index 16062bf..13999af 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig @@ -808,6 +808,7 @@ CONFIG_FB_UDL=m @@ -129470,7 +129236,7 @@ index f5c5e87..38e46ac 100644 CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_LOGO=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index c7d31e8..436da55 100644 +index 1d1b799..146add9 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -801,6 +801,7 @@ CONFIG_FB_UDL=m @@ -129647,14 +129413,11 @@ index 525816d..b011489 100644 RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, --- -2.5.0 - -From 4597458b3521c98d3260ed9a4eb739e6a6b5713c Mon Sep 17 00:00:00 2001 +From 0459ca97c1f2753ce805ab58ff17847cb4c142e0 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Mon, 16 Nov 2015 14:05:35 +0000 -Subject: [PATCH 28/59] bcm2835-dma: Fix up convert to DMA pool +Subject: [PATCH 089/170] bcm2835-dma: Fix up convert to DMA pool --- drivers/dma/bcm2835-dma.c | 36 ++++++++++++++++++++++++++---------- @@ -129738,14 +129501,11 @@ index 0adc347..985019b 100644 } else { /* Next block is empty. */ control_block->next = 0; --- -2.5.0 - -From a6a43f492a980a33e31d3960f1709defd6f1bd7b Mon Sep 17 00:00:00 2001 +From f6dd60426dc7970ef4e9e3d9e00d374f80a6abd2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 11 Nov 2015 11:38:59 +0000 -Subject: [PATCH 29/59] scripts: Multi-platform support for mkknlimg and +Subject: [PATCH 090/170] scripts: Multi-platform support for mkknlimg and knlinfo The firmware uses tags in the kernel trailer to choose which dtb file @@ -129993,14 +129753,11 @@ index 3998d43..005f404 100755 - my $val = $configs->{$wanted} || 'n'; - return (($val eq 'y') || ($val eq '1')); -} --- -2.5.0 - -From f95a3c1052bb61d28cc6a4a5ba5dfe691c1e5321 Mon Sep 17 00:00:00 2001 +From 6d38553e5ce7fb70dd1f89665caf58064a7e97d7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 2 Mar 2015 13:01:12 -0800 -Subject: [PATCH 30/59] drm/vc4: Add suport for 3D rendering using the V3D +Subject: [PATCH 091/170] drm/vc4: Add suport for 3D rendering using the V3D engine. This is a squash of the out-of-tree development series. Since that @@ -130837,7 +130594,7 @@ index d5db9e0..3baf1fc 100644 ret = drm_dev_register(drm, 0); if (ret < 0) -@@ -200,8 +229,11 @@ unregister: +@@ -200,8 +229,11 @@ static int vc4_drm_bind(struct device *dev) drm_dev_unregister(drm); unbind_all: component_unbind_all(dev, drm); @@ -135371,7 +135128,7 @@ index 0000000..0aab9d7 +} diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h new file mode 100644 -index 0000000..499daae +index 0000000..499daae5 --- /dev/null +++ b/include/uapi/drm/vc4_drm.h @@ -0,0 +1,229 @@ @@ -135604,14 +135361,11 @@ index 0000000..499daae +}; + +#endif /* _UAPI_VC4_DRM_H_ */ --- -2.5.0 - -From f7c5c235d8ec8dad653d2ba5ddeed98c11ee3dc0 Mon Sep 17 00:00:00 2001 +From aa579c7485e1bae681c50b223e89cd658dd0b2c1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Oct 2015 11:32:14 -0700 -Subject: [PATCH 31/59] drm/vc4: Force HDMI to connected. +Subject: [PATCH 092/170] drm/vc4: Force HDMI to connected. For some reason on the downstream tree, the HPD GPIO isn't working. @@ -135633,14 +135387,11 @@ index da9a36d..d15c529 100644 if (vc4->hdmi->hpd_gpio) { if (gpio_get_value(vc4->hdmi->hpd_gpio)) return connector_status_connected; --- -2.5.0 - -From 77b1bdbe5ff38d999a3c45b4ce34dcf3bb1a59a5 Mon Sep 17 00:00:00 2001 +From edb828d91374e8fa4f05d68be008c40d4f9a158d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:23:18 -0700 -Subject: [PATCH 32/59] drm/vc4: bo cache locking fixes. +Subject: [PATCH 093/170] drm/vc4: bo cache locking fixes. Signed-off-by: Eric Anholt --- @@ -135788,14 +135539,11 @@ index 8cc89d1..c079b82 100644 /* Sequence number for the last job queued in job_list. * Starts at 0 (no jobs emitted). --- -2.5.0 - -From ada48bc2dcabe8dabce74f2700bde6186fc00366 Mon Sep 17 00:00:00 2001 +From eafd7a031a15fb0d51a86b89e42ccde4f23434b4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:29:41 -0700 -Subject: [PATCH 33/59] drm/vc4: bo cache locking cleanup. +Subject: [PATCH 094/170] drm/vc4: bo cache locking cleanup. Signed-off-by: Eric Anholt --- @@ -135886,14 +135634,11 @@ index af0fde6..acd360c 100644 } static void vc4_bo_cache_time_timer(unsigned long data) --- -2.5.0 - -From 7ff769a1ebaa17c37d4a698af37ab71ff38ff5b8 Mon Sep 17 00:00:00 2001 +From 482f2b3e97e919ac0ebc55a6040747495563b9a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:32:24 -0700 -Subject: [PATCH 34/59] drm/vc4: Use job_lock to protect seqno_cb_list. +Subject: [PATCH 095/170] drm/vc4: Use job_lock to protect seqno_cb_list. We're (mostly) not supposed to be using struct_mutex in drivers these days. @@ -135946,14 +135691,11 @@ index 361390b..b1853b2 100644 return ret; } --- -2.5.0 - -From 3f5a87a8113d0026a92a48376dc63e1d3834ca90 Mon Sep 17 00:00:00 2001 +From 4dc15a296586679d5b014011e44a093cf962123e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:44:35 -0700 -Subject: [PATCH 35/59] drm/vc4: Drop struct_mutex around CL validation. +Subject: [PATCH 096/170] drm/vc4: Drop struct_mutex around CL validation. We were using it so that we could make sure that shader validation state didn't change while we were validating, but now shader @@ -136015,14 +135757,11 @@ index b1853b2..32f375a 100644 return ret; } --- -2.5.0 - -From 96ff83b46b899239914c4f82583694b220abf12a Mon Sep 17 00:00:00 2001 +From f1924e632d16f98eee1fe1be636249b8cee4ee6e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2015 08:44:35 -0700 -Subject: [PATCH 36/59] drm/vc4: Drop struct_mutex around CL validation. +Subject: [PATCH 097/170] drm/vc4: Drop struct_mutex around CL validation. We were using it so that we could make sure that shader validation state didn't change while we were validating, but now shader @@ -136042,7 +135781,7 @@ diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 32f375a..55551ea 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c -@@ -439,10 +439,12 @@ fail: +@@ -439,10 +439,12 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) } static void @@ -136095,14 +135834,11 @@ index 32f375a..55551ea 100644 return ret; } --- -2.5.0 - -From 5132c04865bb90f75210e68e2b134a8a81a600a0 Mon Sep 17 00:00:00 2001 +From 0193a1e5b931c7363279282b4169c2152af1a621 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Oct 2015 13:59:15 +0100 -Subject: [PATCH 37/59] drm/vc4: Add support for more display plane formats. +Subject: [PATCH 098/170] drm/vc4: Add support for more display plane formats. Signed-off-by: Eric Anholt --- @@ -136136,14 +135872,11 @@ index 65e5455..0f85eb5 100644 }; static const struct hvs_format *vc4_get_hvs_format(u32 drm_format) --- -2.5.0 - -From aef868d034a4288d82a6c54422a6f995cb406d3b Mon Sep 17 00:00:00 2001 +From 8faa3b83201819d56f997a2b2ecaf8c690080852 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 23 Oct 2015 12:31:56 +0100 -Subject: [PATCH 38/59] drm/vc4: No need to stop the stopped threads. +Subject: [PATCH 099/170] drm/vc4: No need to stop the stopped threads. This was leftover debug code from the hackdriver. We never submit unless the thread is already idle. @@ -136168,14 +135901,11 @@ index 55551ea..eeb0925 100644 V3D_WRITE(V3D_CTNCA(thread), start); barrier(); --- -2.5.0 - -From 977b27a2302f3e2317b4fa28f7aba9c73c77e7ef Mon Sep 17 00:00:00 2001 +From d102d0e145b58bccbea52e89bbe52dcefc044aaa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 23 Oct 2015 12:33:43 +0100 -Subject: [PATCH 39/59] drm/vc4: Remove extra barrier()s aroudn CTnCA/CTnEA +Subject: [PATCH 100/170] drm/vc4: Remove extra barrier()s aroudn CTnCA/CTnEA setup. The writel() that these expand to already does barriers. @@ -136207,14 +135937,11 @@ index eeb0925..0cea723 100644 } int --- -2.5.0 - -From 45832cd341f53f157ae1e679c06faef3d498db37 Mon Sep 17 00:00:00 2001 +From 0f099b4b1354b0377376b91ae60c6c16d82683a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 23 Oct 2015 14:57:22 +0100 -Subject: [PATCH 40/59] drm/vc4: Fix a typo in a V3D debug register. +Subject: [PATCH 101/170] drm/vc4: Fix a typo in a V3D debug register. Signed-off-by: Eric Anholt --- @@ -136248,15 +135975,12 @@ index b9cb7cf..cf35f58 100644 REGDEF(V3D_FDBGO), REGDEF(V3D_FDBGB), REGDEF(V3D_FDBGR), --- -2.5.0 - -From e44474f1a0149abb2608e57d7ad70f6eb160d18b Mon Sep 17 00:00:00 2001 +From 22182768add611b53e33c5dd2e8901acc3d08181 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 2 Nov 2015 17:07:33 +0000 -Subject: [PATCH 41/59] drm/vc4: Enable VC4 modules, and increase CMA size with - overlay +Subject: [PATCH 102/170] drm/vc4: Enable VC4 modules, and increase CMA size + with overlay If using the overlay, be careful not to boot to GUI or run startx, or the Pi will almost hang, reporting stalls in kernel threads. @@ -136389,7 +136113,7 @@ index 0000000..cf5d5c9 + }; +}; diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 38e46ac..49317b9 100644 +index 13999af..4e474c7 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig @@ -802,6 +802,8 @@ CONFIG_VIDEO_TW9903=m @@ -136402,7 +136126,7 @@ index 38e46ac..49317b9 100644 CONFIG_FB_BCM2708=y CONFIG_FB_UDL=m diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 436da55..202dd4b 100644 +index 146add9..d6aa058 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -795,6 +795,8 @@ CONFIG_VIDEO_TW9903=m @@ -136414,14 +136138,11 @@ index 436da55..202dd4b 100644 CONFIG_FB=y CONFIG_FB_BCM2708=y CONFIG_FB_UDL=m --- -2.5.0 - -From 64f336d46a8b61002efa54b58f1612cf03ab9930 Mon Sep 17 00:00:00 2001 +From 88315025318218ac04fcc66614083bb1a51f662f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Nov 2015 18:29:58 +0000 -Subject: [PATCH 42/59] squash: fixups +Subject: [PATCH 103/170] squash: fixups --- drivers/gpu/drm/vc4/Kconfig | 2 +- @@ -136467,14 +136188,12 @@ index c83287a..2082713 100644 drm_atomic_helper_commit_modeset_enables(dev, state); --- -2.5.0 - -From 5b553943a83156a46b864cca4ee0fdb0f2fc6882 Mon Sep 17 00:00:00 2001 +From 3fc233b798ac8498b4e24b42ad67fb3499a30f07 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Nov 2015 20:26:03 +0000 -Subject: [PATCH 43/59] squash: add missing vc4-kms-v3d-overlay.dtb to makefile +Subject: [PATCH 104/170] squash: add missing vc4-kms-v3d-overlay.dtb to + makefile --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -136492,14 +136211,11 @@ index fb7ac49..fc09bfb 100644 dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb --- -2.5.0 - -From 5ac43b46f57d2cbe94c4d8a34e050eec9a625ce5 Mon Sep 17 00:00:00 2001 +From d9888c76bcee2a7c118ab8ba93a1204fb5ff4e44 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Oct 2015 11:23:34 -0700 -Subject: [PATCH 44/59] clk: bcm2835: Also build the driver for downstream +Subject: [PATCH 105/170] clk: bcm2835: Also build the driver for downstream kernels. Signed-off-by: Eric Anholt @@ -136520,14 +136236,11 @@ index 3fc9506..a1b4cbc 100644 obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o --- -2.5.0 - -From c0ba37a2a85130b7a0f88730eba2783c6dcd6951 Mon Sep 17 00:00:00 2001 +From 0dbc0fe760a54bbcff587657062df49dc0eaf2b9 Mon Sep 17 00:00:00 2001 From: Holger Steinhaus Date: Sat, 14 Nov 2015 18:37:43 +0100 -Subject: [PATCH 45/59] dts: Added overlay for gpio_ir_recv driver +Subject: [PATCH 106/170] dts: Added overlay for gpio_ir_recv driver --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -136635,15 +136348,12 @@ index 0000000..a2d6bc7 + rc-map-name = <&gpio_ir>,"linux,rc-map-name"; // default rc map + }; +}; --- -2.5.0 - -From 26e029b1b51f165e9cf74ea5ab311adaa1bf2e01 Mon Sep 17 00:00:00 2001 +From 938b09ce6c6736d0861c2c9eec3a7e739585b589 Mon Sep 17 00:00:00 2001 From: Alistair Buxton Date: Sun, 1 Nov 2015 22:27:56 +0000 -Subject: [PATCH 46/59] Build i2c_gpio module and add a device tree overlay to - configure it. +Subject: [PATCH 107/170] Build i2c_gpio module and add a device tree overlay + to configure it. --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -136727,7 +136437,7 @@ index 0000000..2a2dc98 +}; + diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 49317b9..1f47fb7 100644 +index 4e474c7..fc35254 100644 --- a/arch/arm/configs/bcm2709_defconfig +++ b/arch/arm/configs/bcm2709_defconfig @@ -595,6 +595,7 @@ CONFIG_RAW_DRIVER=y @@ -136739,7 +136449,7 @@ index 49317b9..1f47fb7 100644 CONFIG_SPI_BCM2835=m CONFIG_SPI_SPIDEV=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 202dd4b..015a2b3 100644 +index d6aa058..51dc019 100644 --- a/arch/arm/configs/bcmrpi_defconfig +++ b/arch/arm/configs/bcmrpi_defconfig @@ -588,6 +588,7 @@ CONFIG_RAW_DRIVER=y @@ -136750,14 +136460,11 @@ index 202dd4b..015a2b3 100644 CONFIG_SPI=y CONFIG_SPI_BCM2835=m CONFIG_SPI_SPIDEV=y --- -2.5.0 - -From fd5bec91d5ce5bf001f8147a73c79bbf9d50d581 Mon Sep 17 00:00:00 2001 +From a4b5aa412585674d4a4f2ba7c0d818fd796f51c3 Mon Sep 17 00:00:00 2001 From: mwilliams03 Date: Sun, 18 Oct 2015 17:07:24 -0700 -Subject: [PATCH 47/59] New overlay for PiScreen2r +Subject: [PATCH 108/170] New overlay for PiScreen2r --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -136909,14 +136616,11 @@ index 0000000..7c018e0 + }; +}; + --- -2.5.0 - -From 9b04ba6644143db182164e74e06563b9064fca7f Mon Sep 17 00:00:00 2001 +From 1a4fac1ea6bb33a963b06406f6f44b527daa3a90 Mon Sep 17 00:00:00 2001 From: Ondrej Wisniewski Date: Fri, 6 Nov 2015 15:01:28 +0100 -Subject: [PATCH 48/59] dts: Added overlay for Adafruit PiTFT 2.8" capacitive +Subject: [PATCH 109/170] dts: Added overlay for Adafruit PiTFT 2.8" capacitive touch screen --- @@ -137065,14 +136769,11 @@ index 0000000..48920e9 + touch-swapxy = <&ft6236>,"touchscreen-swapped-x-y?"; + }; +}; --- -2.5.0 - -From 22cc43d30298abcdac34ef08074d87104be8edeb Mon Sep 17 00:00:00 2001 +From 660ba9173ca14b48d7cd2f69ff45e67ebe4d947a Mon Sep 17 00:00:00 2001 From: Stuart MacLean Date: Fri, 2 Oct 2015 15:12:59 +0100 -Subject: [PATCH 49/59] Add support for the HiFiBerry DAC+ Pro. +Subject: [PATCH 110/170] Add support for the HiFiBerry DAC+ Pro. The HiFiBerry DAC+ and DAC+ Pro products both use the existing bcm sound driver with the DAC+ Pro having a special clock device driver representing the two high precision oscillators. @@ -137087,7 +136788,7 @@ An addition bug fix is included for the PCM512x codec where by the physical size create mode 100644 drivers/clk/clk-hifiberry-dacpro.c diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts -index deb9c62..f923a48 100644 +index deb9c625..f923a48 100644 --- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts @@ -6,6 +6,16 @@ @@ -137606,7 +137307,7 @@ index 11e4f39..a6b651c 100644 ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c -index 047c489..090fe0e 100644 +index 047c489..090fe0ee 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c @@ -854,7 +854,8 @@ static int pcm512x_set_dividers(struct snd_soc_dai *dai, @@ -137619,14 +137320,11 @@ index 047c489..090fe0e 100644 if (lrclk_div == 0) { dev_err(dev, "No LRCLK?\n"); return -EINVAL; --- -2.5.0 - -From 855f9adc802916fa951051daf6ee6af440888688 Mon Sep 17 00:00:00 2001 +From 14b6c7013e62b3917ce73841dc8e379d011d37a5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 5 Oct 2015 10:47:45 +0100 -Subject: [PATCH 50/59] BCM270X_DT: Add at86rf233 overlay +Subject: [PATCH 111/170] BCM270X_DT: Add at86rf233 overlay Add an overlay to support the Atmel AT86RF233 WPAN transceiver on spi0.0. @@ -137760,14 +137458,11 @@ index 0000000..0460269 + trim = <&lowpan0>, "xtal-trim.0"; + }; +}; --- -2.5.0 - -From cb447e6fe0a7f42f915c46362aad4944da91518f Mon Sep 17 00:00:00 2001 +From d33b3717e86cd6aa28c58d465a22e6c11a66bc13 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 51/59] mm: Remove the PFN busy warning +Subject: [PATCH 112/170] mm: Remove the PFN busy warning See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is expected sometimes when using CMA. However, that commit still spams @@ -137791,15 +137486,12 @@ index 9d666df..b682acc 100644 ret = -EBUSY; goto done; } --- -2.5.0 - -From d3ab193e2ccff0b434de0606b3c99802efb6c7b4 Mon Sep 17 00:00:00 2001 +From a71d6ebfcbc401e520fa4a5aa185d027dfbe5ce1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 Nov 2014 12:06:38 -0800 -Subject: [PATCH 52/59] drm: Put an optional field in the driver struct for GEM - obj struct size. +Subject: [PATCH 113/170] drm: Put an optional field in the driver struct for + GEM obj struct size. This allows a driver to derive from the CMA object without copying all of the code. @@ -137839,14 +137531,11 @@ index 0a271ca..54f5469 100644 const struct drm_ioctl_desc *ioctls; int num_ioctls; const struct file_operations *fops; --- -2.5.0 - -From 4eaaf2ad0c84b80573e15529570380a95b6cbfdf Mon Sep 17 00:00:00 2001 +From 1c343ed1f86866d2625518774536bbef77f7a20a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Oct 2015 10:09:02 -0700 -Subject: [PATCH 53/59] drm/vc4: Add an interface for capturing the GPU state +Subject: [PATCH 114/170] drm/vc4: Add an interface for capturing the GPU state after a hang. This can be parsed with vc4-gpu-tools tools for trying to figure out @@ -138119,7 +137808,7 @@ index 0cea723..d90c664 100644 + vc4_free_hang_state(dev, vc4->hang_state); } diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h -index 499daae..4a8d19f 100644 +index 499daae5..4a8d19f 100644 --- a/include/uapi/drm/vc4_drm.h +++ b/include/uapi/drm/vc4_drm.h @@ -32,6 +32,7 @@ @@ -138186,14 +137875,11 @@ index 499daae..4a8d19f 100644 +}; + #endif /* _UAPI_VC4_DRM_H_ */ --- -2.5.0 - -From 5f726bd15729062dd4cf89c22d9f15d4c2979d3d Mon Sep 17 00:00:00 2001 +From 431be9af0aa88da94986effdff649330cfde1f5a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 4 Dec 2015 11:35:34 -0800 -Subject: [PATCH 54/59] drm/vc4: Update a bunch of code to match upstream +Subject: [PATCH 115/170] drm/vc4: Update a bunch of code to match upstream submission. This gets almost everything matching, except for the MSAA support and @@ -138745,7 +138431,7 @@ index e8192b4..22061ae 100644 .desc = DRIVER_DESC, .date = DRIVER_DATE, diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 24845c1..53dfa8d 100644 +index 24845c1..53dfa8df 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -72,6 +72,9 @@ struct vc4_dev { @@ -138947,7 +138633,7 @@ index 2082713..f95f2df 100644 } } diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h -index 9757bc8..cee38aa 100644 +index 9757bc8..cee38aad 100644 --- a/drivers/gpu/drm/vc4/vc4_packet.h +++ b/drivers/gpu/drm/vc4/vc4_packet.h @@ -27,60 +27,60 @@ @@ -139654,7 +139340,7 @@ index cf35f58..29a222f 100644 struct drm_device *drm = dev_get_drvdata(master); struct vc4_dev *vc4 = to_vc4_dev(drm); diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index ff3b62f..e44e355 100644 +index ff3b62f..e44e35539 100644 --- a/drivers/gpu/drm/vc4/vc4_validate.c +++ b/drivers/gpu/drm/vc4/vc4_validate.c @@ -48,7 +48,6 @@ @@ -140112,15 +139798,12 @@ index 54f5469..987c25a 100644 const struct drm_ioctl_desc *ioctls; int num_ioctls; const struct file_operations *fops; --- -2.5.0 - -From a8812101ce0faa865c1b75e461d5f05d8a43b9e3 Mon Sep 17 00:00:00 2001 +From 7d4ed9f40e9484ded3965b13fbb7914a1daf85d7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 11 Dec 2015 19:45:03 -0800 -Subject: [PATCH 55/59] drm: Use the driver's gem_object_free function from CMA - helpers. +Subject: [PATCH 116/170] drm: Use the driver's gem_object_free function from + CMA helpers. VC4 wraps the CMA objects in its own structures, so it needs to do its own teardown (waiting for GPU to finish, updating bo_stats tracking). @@ -140179,14 +139862,11 @@ index 0f7b00b..e5df53b 100644 return ERR_PTR(ret); } --- -2.5.0 - -From 7c236c874ffa28be6d8b1b07366bc7821a844db0 Mon Sep 17 00:00:00 2001 +From 522e6f9cc4376fe49e8b41b40e7ddb98cf385a9e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 17 Jul 2015 13:15:50 -0700 -Subject: [PATCH 56/59] drm/vc4: Add support for MSAA rendering. +Subject: [PATCH 117/170] drm/vc4: Add support for MSAA rendering. For MSAA, you set a bit in the binner that halves the size of tiles in each direction, so you can pack 4 samples per pixel in the tile @@ -140205,7 +139885,7 @@ Signed-off-by: Eric Anholt 4 files changed, 258 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_packet.h b/drivers/gpu/drm/vc4/vc4_packet.h -index cee38aa..0f31cc0 100644 +index cee38aad..0f31cc0 100644 --- a/drivers/gpu/drm/vc4/vc4_packet.h +++ b/drivers/gpu/drm/vc4/vc4_packet.h @@ -123,6 +123,11 @@ enum vc4_packet { @@ -140661,7 +140341,7 @@ index 3516354..8f2ec57 100644 return -EINVAL; } diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c -index e44e355..2f22f19 100644 +index e44e35539..2f22f19 100644 --- a/drivers/gpu/drm/vc4/vc4_validate.c +++ b/drivers/gpu/drm/vc4/vc4_validate.c @@ -400,9 +400,8 @@ validate_tile_binning_config(VALIDATE_ARGS) @@ -140709,14 +140389,11 @@ index 4a8d19f..49cd992 100644 uint32_t clear_color[2]; uint32_t clear_z; uint8_t clear_s; --- -2.5.0 - -From c5f0c816c8fb2dc259d2ffe1ec6ea143658c3731 Mon Sep 17 00:00:00 2001 +From 50a1843ffd2e6f408dcb6a64ca0a2ef3b062fd5a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 8 Dec 2015 14:00:43 -0800 -Subject: [PATCH 57/59] drm/vc4: A few more non-functional changes to sync to +Subject: [PATCH 118/170] drm/vc4: A few more non-functional changes to sync to upstream. At this point all that's left is the force-enable of HDMI connector, @@ -140730,7 +140407,7 @@ Signed-off-by: Eric Anholt 2 files changed, 92 insertions(+), 92 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c -index 29a222f..4d103f7 100644 +index 29a222f..4d103f7f 100644 --- a/drivers/gpu/drm/vc4/vc4_v3d.c +++ b/drivers/gpu/drm/vc4/vc4_v3d.c @@ -109,7 +109,7 @@ static const struct { @@ -141059,14 +140736,11 @@ index 49cd992..eeb37e3 100644 }; #endif /* _UAPI_VC4_DRM_H_ */ --- -2.5.0 - -From a28a42a7faea43197392a90984f5354168494f14 Mon Sep 17 00:00:00 2001 +From 0a373a81664b9e9b8994512fb3d15ed296526e89 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 15 Dec 2015 23:46:32 +0000 -Subject: [PATCH 58/59] drm/vc4: Use "hpd-gpios" for HDMI GPIO, like what +Subject: [PATCH 119/170] drm/vc4: Use "hpd-gpios" for HDMI GPIO, like what landed upstream. Signed-off-by: Eric Anholt @@ -141087,15 +140761,12 @@ index cf5d5c9..da37483 100644 clocks = <&cprman BCM2835_PLLH_PIX>, <&cprman BCM2835_CLOCK_HSM>; clock-names = "pixel", "hdmi"; --- -2.5.0 - -From 8353706bc1d231c15c7113e678cfeeefe03e9eaf Mon Sep 17 00:00:00 2001 +From f8453aacbe60712c31c57580a126017b798bd339 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 7 Dec 2015 12:35:01 -0800 -Subject: [PATCH 59/59] drm/vc4: Synchronize validation code for v2 submission - upstream. +Subject: [PATCH 120/170] drm/vc4: Synchronize validation code for v2 + submission upstream. Signed-off-by: Eric Anholt --- @@ -141106,7 +140777,7 @@ Signed-off-by: Eric Anholt 4 files changed, 135 insertions(+), 196 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h -index 53dfa8d..ed93fa7 100644 +index 53dfa8df..ed93fa78 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -189,17 +189,6 @@ to_vc4_encoder(struct drm_encoder *encoder) @@ -141710,6 +141381,7975 @@ index 2f22f19..0fb5b99 100644 if (ret) return ret; } --- -2.5.0 +From 280bea89916813978b81811c2769411d438eb52f Mon Sep 17 00:00:00 2001 +From: janluca +Date: Sun, 27 Dec 2015 14:34:04 +0100 +Subject: [PATCH 121/170] MMC: Do not use mmc_debug if CONFIG_MMC_BCM2835 is + not set + +If CONFIG_MMC_BCM2835 was not set the compiling of the kernel failed +since mmc_debug was not defined but used in drivers/mmc/core/quirks.c. + +This patch add a ifdef-check for CONFIG_MMC_BCM2835 to the change of +commit 64d395457f793250d2e582eeb38cc3403b1db98c +--- + drivers/mmc/core/quirks.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/mmc/core/quirks.c b/drivers/mmc/core/quirks.c +index 87ae2e9..b79fe14 100644 +--- a/drivers/mmc/core/quirks.c ++++ b/drivers/mmc/core/quirks.c +@@ -53,7 +53,9 @@ static const struct mmc_fixup mmc_fixup_methods[] = { + + void mmc_fixup_device(struct mmc_card *card, const struct mmc_fixup *table) + { ++#ifdef CONFIG_MMC_BCM2835 + extern unsigned mmc_debug; ++#endif + const struct mmc_fixup *f; + u64 rev = cid_rev_card(card); + +@@ -81,7 +83,9 @@ 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). + */ ++#ifdef CONFIG_MMC_BCM2835 + if (mmc_debug & (1<<13)) + card->quirks |= MMC_QUIRK_BLK_NO_CMD23; ++#endif + } + EXPORT_SYMBOL(mmc_fixup_device); + +From d0390ae0ff774d8e7b5b4d5f38c33726354996bc Mon Sep 17 00:00:00 2001 +From: Devon Fyson +Date: Wed, 30 Dec 2015 16:40:47 -0500 +Subject: [PATCH 122/170] Extend clock timeout, fix modprobe baudrate + parameter. + +Set the BSC_CLKT clock streching timeout to 35ms as per SMBus specs.\n- Increase priority of baudrate parameter passed to modprobe (in /etc/modprobe.d/*.conf or command line). Currently custom baudrates don't work because they are overridden by clock-frequency in the platform_device passed to the function. +--- + drivers/i2c/busses/i2c-bcm2708.c | 45 ++++++++++++++++++++++++++-------------- + 1 file changed, 29 insertions(+), 16 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c +index 85f411c..b152639 100644 +--- a/drivers/i2c/busses/i2c-bcm2708.c ++++ b/drivers/i2c/busses/i2c-bcm2708.c +@@ -71,7 +71,8 @@ + + #define DRV_NAME "bcm2708_i2c" + +-static unsigned int baudrate = CONFIG_I2C_BCM2708_BAUDRATE; ++static unsigned int baudrate_default = CONFIG_I2C_BCM2708_BAUDRATE; ++static unsigned int baudrate; + module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); + MODULE_PARM_DESC(baudrate, "The I2C baudrate"); + +@@ -87,6 +88,7 @@ struct bcm2708_i2c { + int irq; + struct clk *clk; + u32 cdiv; ++ u32 clk_tout; + + struct completion done; + +@@ -126,7 +128,7 @@ static inline void bcm2708_bsc_fifo_fill(struct bcm2708_i2c *bi) + + static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) + { +- u32 cdiv, s; ++ u32 cdiv, s, clk_tout; + u32 c = BSC_C_I2CEN | BSC_C_INTD | BSC_C_ST | BSC_C_CLEAR_1; + int wait_loops = I2C_WAIT_LOOP_COUNT; + +@@ -134,12 +136,14 @@ static inline int bcm2708_bsc_setup(struct bcm2708_i2c *bi) + * Use the value that we cached in the probe. + */ + cdiv = bi->cdiv; ++ clk_tout = bi->clk_tout; + + if (bi->msg->flags & I2C_M_RD) + c |= BSC_C_INTR | BSC_C_READ; + else + c |= BSC_C_INTT; + ++ bcm2708_wr(bi, BSC_CLKT, clk_tout); + bcm2708_wr(bi, BSC_DIV, cdiv); + bcm2708_wr(bi, BSC_A, bi->msg->addr); + bcm2708_wr(bi, BSC_DLEN, bi->msg->len); +@@ -312,21 +316,24 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + struct bcm2708_i2c *bi; + struct i2c_adapter *adap; + unsigned long bus_hz; +- u32 cdiv; +- +- if (pdev->dev.of_node) { +- u32 bus_clk_rate; +- pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); +- if (pdev->id < 0) { +- dev_err(&pdev->dev, "alias is missing\n"); +- return -EINVAL; ++ u32 cdiv, clk_tout; ++ ++ if (!baudrate) { ++ baudrate = baudrate_default; ++ if (pdev->dev.of_node) { ++ u32 bus_clk_rate; ++ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); ++ if (pdev->id < 0) { ++ dev_err(&pdev->dev, "alias is missing\n"); ++ return -EINVAL; ++ } ++ if (!of_property_read_u32(pdev->dev.of_node, ++ "clock-frequency", &bus_clk_rate)) ++ baudrate = bus_clk_rate; ++ else ++ dev_warn(&pdev->dev, ++ "Could not read clock-frequency property\n"); + } +- if (!of_property_read_u32(pdev->dev.of_node, +- "clock-frequency", &bus_clk_rate)) +- baudrate = bus_clk_rate; +- else +- dev_warn(&pdev->dev, +- "Could not read clock-frequency property\n"); + } + + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); +@@ -417,7 +424,13 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + cdiv = 0xffff; + baudrate = bus_hz / cdiv; + } ++ ++ clk_tout = 35/1000*baudrate; //35ms timeout as per SMBus specs. ++ if (clk_tout > 0xffff) ++ clk_tout = 0xffff; ++ + bi->cdiv = cdiv; ++ bi->clk_tout = clk_tout; + + dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", + pdev->id, (unsigned long)regs->start, irq, baudrate); + +From 62dca1937fc3acfe4b6471607b7a4d58c34e73b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Thu, 31 Dec 2015 16:44:58 +0100 +Subject: [PATCH 123/170] bcm270x_dt: Add dwc2 and dwc-otg overlays + +--- + arch/arm/boot/dts/overlays/Makefile | 2 ++ + arch/arm/boot/dts/overlays/README | 21 +++++++++++++++++++ + arch/arm/boot/dts/overlays/dwc-otg-overlay.dts | 20 ++++++++++++++++++ + arch/arm/boot/dts/overlays/dwc2-overlay.dts | 29 ++++++++++++++++++++++++++ + 4 files changed, 72 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/dwc-otg-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/dwc2-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index be9dead..aaa8976 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -15,6 +15,8 @@ endif + dtb-$(RPI_DT_OVERLAYS) += ads7846-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += at86rf233-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += bmp085_i2c-sensor-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += dwc2-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += dwc-otg-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += dht11-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += enc28j60-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += gpio-ir-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 04e55ce..c70c1e59 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -198,6 +198,27 @@ Params: gpiopin GPIO connected to the sensor's DATA output. + (default 4) + + ++Name: dwc-otg ++Info: Selects the dwc_otg USB controller driver which has fiq support. This ++ is the default on all except the Pi Zero which defaults to dwc2. ++Load: dtoverlay=dwc-otg ++Params: ++ ++ ++Name: dwc2 ++Info: Selects the dwc2 USB controller driver ++Load: dtoverlay=dwc2,= ++Params: dr_mode Dual role mode: "host", "peripheral" or "otg" ++ ++ g-rx-fifo-size Size of rx fifo size in gadget mode ++ ++ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget ++ mode ++ ++ g-tx-fifo-size Size of periodic tx fifo per endpoint ++ (except ep0) in gadget mode ++ ++ + [ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] + + +diff --git a/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +new file mode 100644 +index 0000000..fc48bd1 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dwc-otg-overlay.dts +@@ -0,0 +1,20 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ __overlay__ { ++ compatible = "brcm,bcm2708-usb"; ++ reg = <0x7e980000 0x10000>, ++ <0x7e006000 0x1000>; ++ interrupts = <2 0>, ++ <1 9>; ++ status = "okay"; ++ }; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/dwc2-overlay.dts b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +new file mode 100644 +index 0000000..90c9811 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/dwc2-overlay.dts +@@ -0,0 +1,29 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&usb>; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ __overlay__ { ++ compatible = "brcm,bcm2835-usb"; ++ reg = <0x7e980000 0x10000>; ++ interrupts = <1 9>; ++ dr_mode = "otg"; ++ g-np-tx-fifo-size = <32>; ++ g-rx-fifo-size = <256>; ++ g-tx-fifo-size = <256 128 128 64 64 64 32>; ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ dr_mode = <&usb>, "dr_mode"; ++ g-np-tx-fifo-size = <&usb>,"g-np-tx-fifo-size:0"; ++ g-rx-fifo-size = <&usb>,"g-rx-fifo-size:0"; ++ g-tx-fifo-size = <&usb>,"g-tx-fifo-size:0"; ++ }; ++}; + +From 162dd00041afb2995f90a928ea80aeaa0d141ce5 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 4 Jan 2016 14:42:17 +0000 +Subject: [PATCH 124/170] BCM270X_DT: Add the sdtweak overlay, for tuning + sdhost + +The sdhost overlay declares the sdhost interface and allows parameters +to be set. This is overkill for situations where the user just wants to +tweak the parameters of a pre-declared sdhost interface, so create an +sdtweak overlay that does just that. +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 14 ++++++++++++++ + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 21 +++++++++++++++++++++ + 3 files changed, 36 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/sdtweak-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index aaa8976..4d9d640 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -53,6 +53,7 @@ dtb-$(RPI_DT_OVERLAYS) += rpi-proto-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-sense-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += sdhost-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += sdio-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += sdtweak-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index c70c1e59..00f03fc 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -635,6 +635,20 @@ Params: overclock_50 Clock (in MHz) to use when the MMC framework + (default on: polling once at boot-time) + + ++Name: sdtweak ++Info: Tunes the bcm2835-sdhost SD/MMC driver ++Load: dtoverlay=sdtweak,= ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ force_pio Disable DMA support (default off) ++ ++ pio_limit Number of blocks above which to use DMA ++ (default 1) ++ ++ debug Enable debug output (default off) ++ ++ + Name: smi + Info: Enables the Secondary Memory Interface peripheral. Uses GPIOs 2-25! + Load: dtoverlay=smi +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +new file mode 100644 +index 0000000..74c168d +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -0,0 +1,21 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&sdhost>; ++ frag1: __overlay__ { ++ brcm,overclock-50 = <0>; ++ brcm,pio-limit = <1>; ++ }; ++ }; ++ ++ __overrides__ { ++ overclock_50 = <&frag1>,"brcm,overclock-50:0"; ++ force_pio = <&frag1>,"brcm,force-pio?"; ++ pio_limit = <&frag1>,"brcm,pio-limit:0"; ++ debug = <&frag1>,"brcm,debug?"; ++ }; ++}; + +From b07c427a7732a0fabcf521085e0fd61b0ef9047c Mon Sep 17 00:00:00 2001 +From: Andrew Litt +Date: Mon, 11 Jan 2016 07:54:21 +0000 +Subject: [PATCH 125/170] bcm2835-mmc: Don't override bus width capabilities + from devicetree + +Take out the force setting of the MMC_CAP_4_BIT_DATA host capability +so that the result read from devicetree via mmc_of_parse() is +preserved. +--- + drivers/mmc/host/bcm2835-mmc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c +index 43aed6e..104f93e 100644 +--- a/drivers/mmc/host/bcm2835-mmc.c ++++ b/drivers/mmc/host/bcm2835-mmc.c +@@ -1305,7 +1305,7 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host) + /* host controller capabilities */ + mmc->caps |= MMC_CAP_CMD23 | MMC_CAP_ERASE | MMC_CAP_NEEDS_POLL | + MMC_CAP_SDIO_IRQ | MMC_CAP_SD_HIGHSPEED | +- MMC_CAP_MMC_HIGHSPEED | MMC_CAP_4_BIT_DATA; ++ MMC_CAP_MMC_HIGHSPEED; + + mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; + + +From f74652d026105ecc4a87b581a9c1c89a6e504d2c Mon Sep 17 00:00:00 2001 +From: Andrew Litt +Date: Mon, 11 Jan 2016 07:55:54 +0000 +Subject: [PATCH 126/170] SDIO-overlay: add bus_width parameter + +Allow setting of the SDIO bus width capability of the bcm2835-mmc +host. This is helpful when only a 1 bit wide bus is connected +between host and device but both host and device advertise 4 bit +mode. +--- + arch/arm/boot/dts/overlays/README | 2 ++ + arch/arm/boot/dts/overlays/sdio-overlay.dts | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 00f03fc..aa57078 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -634,6 +634,8 @@ Params: overclock_50 Clock (in MHz) to use when the MMC framework + poll_once Disable SDIO-device polling every second + (default on: polling once at boot-time) + ++ bus_width Set the SDIO host bus width (default 4 bits) ++ + + Name: sdtweak + Info: Tunes the bcm2835-sdhost SD/MMC driver +diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts +index afc8742..7935e7a 100644 +--- a/arch/arm/boot/dts/overlays/sdio-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts +@@ -11,6 +11,7 @@ + pinctrl-names = "default"; + pinctrl-0 = <&sdio_pins>; + non-removable; ++ bus-width = <4>; + status = "okay"; + }; + }; +@@ -28,5 +29,6 @@ + + __overrides__ { + poll_once = <&sdio_mmc>,"non-removable?"; ++ bus_width = <&sdio_mmc>,"bus-width:0"; + }; + }; + +From 232754cb0ecd1967a8b72d6bd05467843d65a441 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 8 Jan 2016 13:42:06 +0000 +Subject: [PATCH 127/170] FIXUP BCM270X_DT: "random" (HWRNG) dtparam default is + on + +--- + arch/arm/boot/dts/overlays/README | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index aa57078..34a1b7f 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -110,7 +110,7 @@ Params: + (default "off") + + random Set to "on" to enable the hardware random +- number generator (default "off") ++ number generator (default "on") + + uart0 Set to "off" to disable uart0 (default "on") + + +From 320bdec200197f074541e3999fa4b87889c5eb18 Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:41:45 +0100 +Subject: [PATCH 128/170] bcm2835: extend allowed range of channels and + samplerates + +Allow everything the videocore accepts. +--- + sound/arm/bcm2835-pcm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index 8c86375..31e3131 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -26,9 +26,9 @@ static struct snd_pcm_hardware snd_bcm2835_playback_hw = { + .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, + .rate_min = 8000, +- .rate_max = 48000, ++ .rate_max = 192000, + .channels_min = 1, +- .channels_max = 2, ++ .channels_max = 8, + .buffer_bytes_max = 128 * 1024, + .period_bytes_min = 1 * 1024, + .period_bytes_max = 128 * 1024, +@@ -43,9 +43,9 @@ static struct snd_pcm_hardware snd_bcm2835_playback_spdif_hw = { + .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_44100 | + SNDRV_PCM_RATE_48000, + .rate_min = 44100, +- .rate_max = 48000, ++ .rate_max = 192000, + .channels_min = 2, +- .channels_max = 2, ++ .channels_max = 8, + .buffer_bytes_max = 128 * 1024, + .period_bytes_min = 1 * 1024, + .period_bytes_max = 128 * 1024, + +From 7e634c8f8fe70286e0b8b404494d3143aa7bc3fc Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:42:18 +0100 +Subject: [PATCH 129/170] bcm2835: restrict channels*rate to 8*960000 + +This is required at least for SPDIF. If the bitrate goes above, +videocore will either resample the audio or corrupt it due to +underruns. Supposedly the hardware isn't designed to output +higher rates, but it can still resample it down to supported +rates. + +Some code is based on ac97_pcm.c. +--- + sound/arm/bcm2835-pcm.c | 41 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 41 insertions(+) + +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index 31e3131..b17ed32 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -19,6 +19,9 @@ + + #include "bcm2835.h" + ++/* The hardware can not do much more num_channels*samplerate then this value */ ++#define MAX_COMBINED_RATE 768000 ++ + /* hardware definition */ + static struct snd_pcm_hardware snd_bcm2835_playback_hw = { + .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | +@@ -107,6 +110,31 @@ static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) + return IRQ_HANDLED; + } + ++ ++static int rate_hw_constraint_rate(struct snd_pcm_hw_params *params, ++ struct snd_pcm_hw_rule *rule) ++{ ++ struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); ++ struct snd_interval rates = { ++ .min = 8000, ++ .max = min(192000u, MAX_COMBINED_RATE / max(channels->min, 1u)), ++ }; ++ struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); ++ return snd_interval_refine(rate, &rates); ++} ++ ++static int rate_hw_constraint_channels(struct snd_pcm_hw_params *params, ++ struct snd_pcm_hw_rule *rule) ++{ ++ struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); ++ struct snd_interval channels_interval = { ++ .min = 1, ++ .max = min(8u, MAX_COMBINED_RATE / max(rate->min, 1u)), ++ }; ++ struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); ++ return snd_interval_refine(channels, &channels_interval); ++} ++ + /* open callback */ + static int snd_bcm2835_playback_open_generic( + struct snd_pcm_substream *substream, int spdif) +@@ -188,6 +216,19 @@ static int snd_bcm2835_playback_open_generic( + snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, + 16); + ++ /* When playing PCM, pretend that we support the full range of channels ++ * and sample rates. The GPU can't output it, but is able to resample ++ * the data to a rate the hardware can handle it. This won't work with ++ * compressed data; the resampler would just destroy it. */ ++ if (spdif) { ++ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, ++ rate_hw_constraint_rate, NULL, ++ SNDRV_PCM_HW_PARAM_CHANNELS, -1); ++ err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, ++ rate_hw_constraint_channels, NULL, ++ SNDRV_PCM_HW_PARAM_RATE, -1); ++ } ++ + chip->alsa_stream[idx] = alsa_stream; + + chip->opened |= (1 << idx); + +From dcead34f063fc8c37ebfcfc9ab6696060c336bad Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:42:48 +0100 +Subject: [PATCH 130/170] rpi: update vc_vchi_audioserv_defs.h + +Add audioserv 3 extensions. The changes were taken from the paste +linked here: + +https://github.com/raspberrypi/linux/pull/1166#issuecomment-151917067 +--- + sound/arm/vc_vchi_audioserv_defs.h | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h +index af3e6eb..5f4409f 100644 +--- a/sound/arm/vc_vchi_audioserv_defs.h ++++ b/sound/arm/vc_vchi_audioserv_defs.h +@@ -16,7 +16,7 @@ + #define _VC_AUDIO_DEFS_H_ + + #define VC_AUDIOSERV_MIN_VER 1 +-#define VC_AUDIOSERV_VER 2 ++#define VC_AUDIOSERV_VER 3 + + // FourCC code used for VCHI connection + #define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") +@@ -36,6 +36,7 @@ typedef enum { + VC_AUDIO_MSG_TYPE_START, // Configure audio + VC_AUDIO_MSG_TYPE_STOP, // Configure audio + VC_AUDIO_MSG_TYPE_WRITE, // Configure audio ++ VC_AUDIO_MSG_TYPE_LATENCY, // request latency in cycles + VC_AUDIO_MSG_TYPE_MAX + } VC_AUDIO_MSG_TYPE; + +@@ -44,6 +45,7 @@ typedef struct { + uint32_t channels; + uint32_t samplerate; + uint32_t bps; ++ uint32_t channelmap; + + } VC_AUDIO_CONFIG_T; + +@@ -84,6 +86,12 @@ typedef struct { + uint16_t max_packet; + } VC_AUDIO_WRITE_T; + ++// query latency in samples of sink ++typedef struct ++{ ++ uint32_t dummy; ++} VC_AUDIO_LATENCY_T; ++ + // Generic result for a request (VC->HOST) + typedef struct { + int32_t success; // Success value +@@ -108,9 +116,10 @@ typedef struct { + VC_AUDIO_START_T start; + VC_AUDIO_STOP_T stop; + VC_AUDIO_WRITE_T write; ++ VC_AUDIO_LATENCY_T latency; + VC_AUDIO_RESULT_T result; + VC_AUDIO_COMPLETE_T complete; + } u; + } VC_AUDIO_MSG_T; + +-#endif // _VC_AUDIO_DEFS_H_ ++#endif // _VC_AUDIO_DEFS_H_ +\ No newline at end of file + +From 7c7d2db494fbf1fd0b014dab0bb4c5c740f90442 Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:43:12 +0100 +Subject: [PATCH 131/170] bcm2835: implement channel map API + +Report all layouts supported by the HDMI protocol to userspace. +Make the videocore set the correct layout according to the +userspace request. + +Some code taken from patch_hdmi.c. In particular, the HDMI channel +layout table was copied without changes - with the idea in mind that +hopefully it can be shared one day. Or at least updating it will be +simpler. + +In my tests, everything appears to work, except when outputting +FL FR RL RR. Then my receiver outputs RL on both the RL and RR +speakers, while RR is never heard. +--- + sound/arm/bcm2835-ctl.c | 276 ++++++++++++++++++++++++++++++++++++++++++++++ + sound/arm/bcm2835-pcm.c | 22 +++- + sound/arm/bcm2835-vchiq.c | 13 +++ + sound/arm/bcm2835.h | 4 + + 4 files changed, 311 insertions(+), 4 deletions(-) + +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +index aad905f..92d3f76 100755 +--- a/sound/arm/bcm2835-ctl.c ++++ b/sound/arm/bcm2835-ctl.c +@@ -300,6 +300,281 @@ static struct snd_kcontrol_new snd_bcm2835_spdif[] = { + }, + }; + ++struct cea_channel_speaker_allocation { ++ int ca_index; ++ int speakers[8]; ++}; ++ ++#define FL SNDRV_CHMAP_FL ++#define FR SNDRV_CHMAP_FR ++#define RL SNDRV_CHMAP_RL ++#define RR SNDRV_CHMAP_RR ++#define LFE SNDRV_CHMAP_LFE ++#define FC SNDRV_CHMAP_FC ++#define RLC SNDRV_CHMAP_RLC ++#define RRC SNDRV_CHMAP_RRC ++#define RC SNDRV_CHMAP_RC ++#define FLC SNDRV_CHMAP_FLC ++#define FRC SNDRV_CHMAP_FRC ++#define FLH SNDRV_CHMAP_TFL ++#define FRH SNDRV_CHMAP_TFR ++#define FLW SNDRV_CHMAP_FLW ++#define FRW SNDRV_CHMAP_FRW ++#define TC SNDRV_CHMAP_TC ++#define FCH SNDRV_CHMAP_TFC ++ ++/* ++ * CEA-861 channel maps ++ * ++ * Stolen from sound/pci/hda/patch_hdmi.c ++ * (unlike the source, this uses SNDRV_* constants directly, as by the ++ * map_tables array in patch_hdmi.c) ++ * Unknown entries use 0, which unfortunately is SNDRV_CHMAP_UNKNOWN instead ++ * of SNDRV_CHMAP_NA. ++ */ ++static struct cea_channel_speaker_allocation channel_allocations[] = { ++/* channel: 7 6 5 4 3 2 1 0 */ ++{ .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, ++ /* 2.1 */ ++{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, ++ /* Dolby Surround */ ++{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, ++ /* surround40 */ ++{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, ++ /* surround41 */ ++{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, ++ /* surround50 */ ++{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, ++ /* surround51 */ ++{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, ++ /* 6.1 */ ++{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, ++ /* surround71 */ ++{ .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, ++ ++{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, ++{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, ++{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, ++{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, ++{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, ++{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, ++{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, ++{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, ++{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, ++{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, ++{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, ++{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, ++{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, ++{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, ++}; ++ ++static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, ++ unsigned int size, unsigned int __user *tlv) ++{ ++ unsigned int __user *dst; ++ int count = 0; ++ int i; ++ ++ if (size < 8) ++ return -ENOMEM; ++ if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv)) ++ return -EFAULT; ++ size -= 8; ++ dst = tlv + 2; ++ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { ++ struct cea_channel_speaker_allocation *ch = &channel_allocations[i]; ++ int num_chs = 0; ++ int chs_bytes; ++ int c; ++ ++ for (c = 0; c < 8; c++) { ++ if (ch->speakers[c]) ++ num_chs++; ++ } ++ ++ chs_bytes = num_chs * 4; ++ if (size < 8) ++ return -ENOMEM; ++ if (put_user(SNDRV_CTL_TLVT_CHMAP_FIXED, dst) || ++ put_user(chs_bytes, dst + 1)) ++ return -EFAULT; ++ dst += 2; ++ size -= 8; ++ count += 8; ++ if (size < chs_bytes) ++ return -ENOMEM; ++ size -= chs_bytes; ++ count += chs_bytes; ++ for (c = 0; c < 8; c++) { ++ int sp = ch->speakers[7 - c]; ++ if (sp) { ++ if (put_user(sp, dst)) ++ return -EFAULT; ++ dst++; ++ } ++ } ++ } ++ if (put_user(count, tlv + 1)) ++ return -EFAULT; ++ return 0; ++} ++ ++static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); ++ bcm2835_chip_t *chip = info->private_data; ++ unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); ++ struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); ++ struct cea_channel_speaker_allocation *ch = NULL; ++ int cur = 0; ++ int i; ++ ++ if (!substream || !substream->runtime) ++ return -ENODEV; ++ ++ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { ++ if (channel_allocations[i].ca_index == chip->cea_chmap) ++ ch = &channel_allocations[i]; ++ } ++ ++ /* If no layout was set yet, return a dummy. Apparently the userspace ++ * API will be confused if we don't. */ ++ if (!ch) ++ ch = &channel_allocations[0]; ++ ++ for (i = 0; i < 8; i++) { ++ if (ch->speakers[7 - i]) ++ ucontrol->value.integer.value[cur++] = ch->speakers[7 - i]; ++ } ++ while (cur < 8) ++ ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA; ++ return 0; ++} ++ ++static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); ++ bcm2835_chip_t *chip = info->private_data; ++ unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); ++ struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); ++ int i, prepared = 0, cea_chmap = -1; ++ int remap[8]; ++ ++ if (!substream || !substream->runtime) ++ return -ENODEV; ++ ++ switch (substream->runtime->status->state) { ++ case SNDRV_PCM_STATE_OPEN: ++ case SNDRV_PCM_STATE_SETUP: ++ break; ++ case SNDRV_PCM_STATE_PREPARED: ++ prepared = 1; ++ break; ++ default: ++ return -EBUSY; ++ } ++ ++ for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { ++ struct cea_channel_speaker_allocation *ch = &channel_allocations[i]; ++ int matches = 1; ++ int cur = 0; ++ int x; ++ memset(remap, 0, sizeof(remap)); ++ for (x = 0; x < substream->runtime->channels; x++) { ++ int sp = ucontrol->value.integer.value[x]; ++ while (cur < 8 && !ch->speakers[7 - cur]) ++ cur++; ++ if (cur >= 8) { ++ /* user has more channels than ch */ ++ matches = 0; ++ break; ++ } ++ if (ch->speakers[7 - cur] != sp) { ++ matches = 0; ++ break; ++ } ++ remap[x] = cur; ++ cur++; ++ } ++ for (x = cur; x < 8; x++) { ++ if (ch->speakers[7 - x]) { ++ /* ch has more channels than user */ ++ matches = 0; ++ break; ++ } ++ } ++ if (matches) { ++ cea_chmap = ch->ca_index; ++ break; ++ } ++ } ++ ++ if (cea_chmap < 0) ++ return -EINVAL; ++ ++ /* don't change the layout if another substream is active */ ++ if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) ++ return -EBUSY; /* unsure whether this is a good error code */ ++ ++ chip->cea_chmap = cea_chmap; ++ for (i = 0; i < 8; i++) ++ chip->map_channels[i] = remap[i]; ++ if (prepared) ++ snd_bcm2835_pcm_prepare_again(substream); ++ return 0; ++} ++ ++static int snd_bcm2835_add_chmap_ctl(bcm2835_chip_t * chip) ++{ ++ struct snd_pcm_chmap *chmap; ++ struct snd_kcontrol *kctl; ++ int err, i; ++ ++ err = snd_pcm_add_chmap_ctls(chip->pcm, ++ SNDRV_PCM_STREAM_PLAYBACK, ++ NULL, 8, 0, &chmap); ++ if (err < 0) ++ return err; ++ /* override handlers */ ++ chmap->private_data = chip; ++ kctl = chmap->kctl; ++ for (i = 0; i < kctl->count; i++) ++ kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_WRITE; ++ kctl->get = snd_bcm2835_chmap_ctl_get; ++ kctl->put = snd_bcm2835_chmap_ctl_put; ++ kctl->tlv.c = snd_bcm2835_chmap_ctl_tlv; ++ return 0; ++} ++ + int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) + { + int err; +@@ -313,6 +588,7 @@ int snd_bcm2835_new_ctl(bcm2835_chip_t * chip) + if (err < 0) + return err; + } ++ snd_bcm2835_add_chmap_ctl(chip); + for (idx = 0; idx < ARRAY_SIZE(snd_bcm2835_spdif); idx++) { + err = snd_ctl_add(chip->card, + snd_ctl_new1(&snd_bcm2835_spdif[idx], chip)); +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index b17ed32..1067460 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -231,6 +231,9 @@ static int snd_bcm2835_playback_open_generic( + + chip->alsa_stream[idx] = alsa_stream; + ++ if (!chip->opened) ++ chip->cea_chmap = -1; ++ + chip->opened |= (1 << idx); + alsa_stream->open = 1; + alsa_stream->draining = 1; +@@ -341,8 +344,7 @@ static int snd_bcm2835_pcm_hw_free(struct snd_pcm_substream *substream) + return snd_pcm_lib_free_pages(substream); + } + +-/* prepare callback */ +-static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) ++int snd_bcm2835_pcm_prepare_again(struct snd_pcm_substream *substream) + { + bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; +@@ -350,8 +352,6 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + int channels; + int err; + +- audio_info(" .. IN\n"); +- + /* notify the vchiq that it should enter spdif passthrough mode by + * setting channels=0 (see + * https://github.com/raspberrypi/linux/issues/528) */ +@@ -367,6 +367,20 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + audio_error(" error setting hw params\n"); + } + ++ return err; ++} ++ ++/* prepare callback */ ++static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) ++{ ++ bcm2835_chip_t *chip = snd_pcm_substream_chip(substream); ++ struct snd_pcm_runtime *runtime = substream->runtime; ++ bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ ++ audio_info(" .. IN\n"); ++ ++ snd_bcm2835_pcm_prepare_again(substream); ++ + bcm2835_audio_setup(alsa_stream); + + /* in preparation of the stream, set the controls (volume level) of the stream */ +diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c +index 3de3094..8ecd2d73 100755 +--- a/sound/arm/bcm2835-vchiq.c ++++ b/sound/arm/bcm2835-vchiq.c +@@ -570,6 +570,8 @@ int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, + VC_AUDIO_MSG_T m; + AUDIO_INSTANCE_T *instance = alsa_stream->instance; + int32_t success; ++ uint32_t chmap_value; ++ int i; + int ret; + LOG_DBG(" .. IN\n"); + +@@ -593,10 +595,21 @@ int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, + + instance->result = -1; + ++ if (alsa_stream->chip->cea_chmap >= 0) { ++ chmap_value = (unsigned)alsa_stream->chip->cea_chmap << 24; ++ } else { ++ chmap_value = 0; /* force stereo */ ++ for (i = 0; i < 8; i++) ++ alsa_stream->chip->map_channels[i] = i; ++ } ++ for (i = 0; i < 8; i++) ++ chmap_value |= alsa_stream->chip->map_channels[i] << (i * 3); ++ + m.type = VC_AUDIO_MSG_TYPE_CONFIG; + m.u.config.channels = channels; + m.u.config.samplerate = samplerate; + m.u.config.bps = bps; ++ m.u.config.channelmap = chmap_value; + + /* Create the message available completion */ + init_completion(&instance->msg_avail_comp); +diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h +index 0f71c5d..997fb69 100755 +--- a/sound/arm/bcm2835.h ++++ b/sound/arm/bcm2835.h +@@ -107,6 +107,8 @@ typedef struct bcm2835_chip { + int old_volume; /* stores the volume value whist muted */ + int dest; + int mute; ++ int cea_chmap; /* currently requested Audio InfoFrame Data Byte 4 */ ++ int map_channels[8]; + + unsigned int opened; + unsigned int spdif_status; +@@ -149,6 +151,8 @@ int snd_bcm2835_new_ctl(bcm2835_chip_t * chip); + int snd_bcm2835_new_pcm(bcm2835_chip_t * chip); + int snd_bcm2835_new_spdif_pcm(bcm2835_chip_t * chip); + ++int snd_bcm2835_pcm_prepare_again(struct snd_pcm_substream *substream); ++ + int bcm2835_audio_open(bcm2835_alsa_stream_t * alsa_stream); + int bcm2835_audio_close(bcm2835_alsa_stream_t * alsa_stream); + int bcm2835_audio_set_params(bcm2835_alsa_stream_t * alsa_stream, + +From 2a64337156d0f84537e04338b2ebd89eb6ec1f09 Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:43:35 +0100 +Subject: [PATCH 132/170] bcm2835: access controls under the audio mutex + +I don't think the ALSA framework provides any kind of automatic +synchronization within the control callbacks. We most likely need +to ensure this manually, so add locking around all access to shared +mutable data. In particular, bcm2835_audio_set_ctls() should +probably always be called under our own audio lock. +--- + sound/arm/bcm2835-ctl.c | 74 +++++++++++++++++++++++++++++++++++++++++-------- + sound/arm/bcm2835-pcm.c | 4 +++ + 2 files changed, 66 insertions(+), 12 deletions(-) + +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +index 92d3f76..5b8e6bd2 100755 +--- a/sound/arm/bcm2835-ctl.c ++++ b/sound/arm/bcm2835-ctl.c +@@ -94,6 +94,9 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, + { + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK)); + + if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) +@@ -103,6 +106,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol, + else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE) + ucontrol->value.integer.value[0] = chip->dest; + ++ mutex_unlock(&chip->audio_mutex); + return 0; + } + +@@ -112,11 +116,15 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int changed = 0; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + if (kcontrol->private_value == PCM_PLAYBACK_VOLUME) { + audio_info("Volume change attempted.. volume = %d new_volume = %d\n", chip->volume, (int)ucontrol->value.integer.value[0]); + if (chip->mute == CTRL_VOL_MUTE) { + /* changed = toggle_mute(chip, CTRL_VOL_UNMUTE); */ +- return 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ changed = 1; /* should return 0 to signify no change but the mixer takes this as the opposite sign (no idea why) */ ++ goto unlock; + } + if (changed + || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) { +@@ -142,6 +150,8 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol, + printk(KERN_ERR "Failed to set ALSA controls..\n"); + } + ++unlock: ++ mutex_unlock(&chip->audio_mutex); + return changed; + } + +@@ -198,10 +208,14 @@ static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol, + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int i; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + ucontrol->value.iec958.status[i] = + (chip->spdif_status >> (i * 8)) && 0xff; + ++ mutex_unlock(&chip->audio_mutex); + return 0; + } + +@@ -212,12 +226,16 @@ static int snd_bcm2835_spdif_default_put(struct snd_kcontrol *kcontrol, + unsigned int val = 0; + int i, change; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); + + change = val != chip->spdif_status; + chip->spdif_status = val; + ++ mutex_unlock(&chip->audio_mutex); + return change; + } + +@@ -253,9 +271,14 @@ static int snd_bcm2835_spdif_stream_get(struct snd_kcontrol *kcontrol, + struct bcm2835_chip *chip = snd_kcontrol_chip(kcontrol); + int i; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + ucontrol->value.iec958.status[i] = + (chip->spdif_status >> (i * 8)) & 0xff; ++ ++ mutex_unlock(&chip->audio_mutex); + return 0; + } + +@@ -266,11 +289,15 @@ static int snd_bcm2835_spdif_stream_put(struct snd_kcontrol *kcontrol, + unsigned int val = 0; + int i, change; + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + for (i = 0; i < 4; i++) + val |= (unsigned int)ucontrol->value.iec958.status[i] << (i * 8); + change = val != chip->spdif_status; + chip->spdif_status = val; + ++ mutex_unlock(&chip->audio_mutex); + return change; + } + +@@ -454,11 +481,17 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, + unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); + struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); + struct cea_channel_speaker_allocation *ch = NULL; ++ int res = 0; + int cur = 0; + int i; + +- if (!substream || !substream->runtime) +- return -ENODEV; ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ if (!substream || !substream->runtime) { ++ res = -ENODEV; ++ goto unlock; ++ } + + for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { + if (channel_allocations[i].ca_index == chip->cea_chmap) +@@ -476,7 +509,10 @@ static int snd_bcm2835_chmap_ctl_get(struct snd_kcontrol *kcontrol, + } + while (cur < 8) + ucontrol->value.integer.value[cur++] = SNDRV_CHMAP_NA; +- return 0; ++ ++unlock: ++ mutex_unlock(&chip->audio_mutex); ++ return res; + } + + static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, +@@ -487,10 +523,16 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, + unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); + struct snd_pcm_substream *substream = snd_pcm_chmap_substream(info, idx); + int i, prepared = 0, cea_chmap = -1; ++ int res = 0; + int remap[8]; + +- if (!substream || !substream->runtime) +- return -ENODEV; ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ ++ if (!substream || !substream->runtime) { ++ res = -ENODEV; ++ goto unlock; ++ } + + switch (substream->runtime->status->state) { + case SNDRV_PCM_STATE_OPEN: +@@ -500,7 +542,8 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, + prepared = 1; + break; + default: +- return -EBUSY; ++ res = -EBUSY; ++ goto unlock; + } + + for (i = 0; i < ARRAY_SIZE(channel_allocations); i++) { +@@ -538,19 +581,26 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, + } + } + +- if (cea_chmap < 0) +- return -EINVAL; ++ if (cea_chmap < 0) { ++ res = -EINVAL; ++ goto unlock; ++ } + + /* don't change the layout if another substream is active */ +- if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) +- return -EBUSY; /* unsure whether this is a good error code */ ++ if (chip->opened != (1 << substream->number) && chip->cea_chmap != cea_chmap) { ++ res = -EBUSY; /* unsure whether this is a good error code */ ++ goto unlock; ++ } + + chip->cea_chmap = cea_chmap; + for (i = 0; i < 8; i++) + chip->map_channels[i] = remap[i]; + if (prepared) + snd_bcm2835_pcm_prepare_again(substream); +- return 0; ++ ++unlock: ++ mutex_unlock(&chip->audio_mutex); ++ return res; + } + + static int snd_bcm2835_add_chmap_ctl(bcm2835_chip_t * chip) +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index 1067460..48da3bb 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -379,6 +379,9 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + + audio_info(" .. IN\n"); + ++ if (mutex_lock_interruptible(&chip->audio_mutex)) ++ return -EINTR; ++ + snd_bcm2835_pcm_prepare_again(substream); + + bcm2835_audio_setup(alsa_stream); +@@ -401,6 +404,7 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + alsa_stream->buffer_size, alsa_stream->period_size, + alsa_stream->pos, runtime->frame_bits); + ++ mutex_unlock(&chip->audio_mutex); + audio_info(" .. OUT\n"); + return 0; + } + +From 6e781f631f7e23f7d88256d020d83950c9bf213a Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:44:03 +0100 +Subject: [PATCH 133/170] bcm2835: always use 2/4/8 channels for multichannel + layouts + +Pad the unused channels with NA. This means userspace needs to write +additional, silent padding channels, which is not ideal, but better +than noise. + +Works around noise at the following channel counts: 3, 5, 6, 7 +--- + sound/arm/bcm2835-ctl.c | 89 +++++++++++++++++++++++++------------------------ + 1 file changed, 45 insertions(+), 44 deletions(-) + +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +index 5b8e6bd2..dec052b 100755 +--- a/sound/arm/bcm2835-ctl.c ++++ b/sound/arm/bcm2835-ctl.c +@@ -349,6 +349,7 @@ struct cea_channel_speaker_allocation { + #define FRW SNDRV_CHMAP_FRW + #define TC SNDRV_CHMAP_TC + #define FCH SNDRV_CHMAP_TFC ++#define NA SNDRV_CHMAP_NA + + /* + * CEA-861 channel maps +@@ -356,69 +357,69 @@ struct cea_channel_speaker_allocation { + * Stolen from sound/pci/hda/patch_hdmi.c + * (unlike the source, this uses SNDRV_* constants directly, as by the + * map_tables array in patch_hdmi.c) +- * Unknown entries use 0, which unfortunately is SNDRV_CHMAP_UNKNOWN instead +- * of SNDRV_CHMAP_NA. ++ * Entries which do not have a physical output channel use 0. Entries which ++ * require userspace to output silence use NA (SNDRV_CHMAP_NA). + */ + static struct cea_channel_speaker_allocation channel_allocations[] = { + /* channel: 7 6 5 4 3 2 1 0 */ + { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } }, + /* 2.1 */ +-{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } }, ++{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, NA, LFE, FR, FL } }, + /* Dolby Surround */ +-{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } }, ++{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, NA, FR, FL } }, + /* surround40 */ +-{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } }, ++{ .ca_index = 0x08, .speakers = { NA, NA, RR, RL, NA, NA, FR, FL } }, + /* surround41 */ +-{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } }, ++{ .ca_index = 0x09, .speakers = { NA, NA, RR, RL, NA, LFE, FR, FL } }, + /* surround50 */ +-{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x0a, .speakers = { NA, NA, RR, RL, FC, NA, FR, FL } }, + /* surround51 */ +-{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x0b, .speakers = { NA, NA, RR, RL, FC, LFE, FR, FL } }, + /* 6.1 */ +-{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x0f, .speakers = { NA, RC, RR, RL, FC, LFE, FR, FL } }, + /* surround71 */ + { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } }, + +-{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } }, +-{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } }, +-{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } }, +-{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } }, +-{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } }, +-{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } }, +-{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } }, +-{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } }, +-{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } }, +-{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } }, +-{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } }, +-{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } }, +-{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } }, +-{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } }, +-{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } }, +-{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x03, .speakers = { NA, NA, NA, NA, FC, LFE, FR, FL } }, ++{ .ca_index = 0x04, .speakers = { NA, NA, NA, RC, NA, NA, FR, FL } }, ++{ .ca_index = 0x05, .speakers = { NA, NA, NA, RC, NA, LFE, FR, FL } }, ++{ .ca_index = 0x06, .speakers = { NA, NA, NA, RC, FC, NA, FR, FL } }, ++{ .ca_index = 0x07, .speakers = { NA, NA, NA, RC, FC, LFE, FR, FL } }, ++{ .ca_index = 0x0c, .speakers = { NA, RC, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x0d, .speakers = { NA, RC, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x0e, .speakers = { NA, RC, RR, RL, FC, NA, FR, FL } }, ++{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, NA, FR, FL } }, ++{ .ca_index = 0x14, .speakers = { FRC, FLC, NA, NA, NA, NA, FR, FL } }, ++{ .ca_index = 0x15, .speakers = { FRC, FLC, NA, NA, NA, LFE, FR, FL } }, ++{ .ca_index = 0x16, .speakers = { FRC, FLC, NA, NA, FC, NA, FR, FL } }, ++{ .ca_index = 0x17, .speakers = { FRC, FLC, NA, NA, FC, LFE, FR, FL } }, ++{ .ca_index = 0x18, .speakers = { FRC, FLC, NA, RC, NA, NA, FR, FL } }, ++{ .ca_index = 0x19, .speakers = { FRC, FLC, NA, RC, NA, LFE, FR, FL } }, ++{ .ca_index = 0x1a, .speakers = { FRC, FLC, NA, RC, FC, NA, FR, FL } }, ++{ .ca_index = 0x1b, .speakers = { FRC, FLC, NA, RC, FC, LFE, FR, FL } }, ++{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } }, +-{ .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } }, +-{ .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } }, +-{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } }, +-{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x20, .speakers = { NA, FCH, RR, RL, FC, NA, FR, FL } }, ++{ .ca_index = 0x21, .speakers = { NA, FCH, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x22, .speakers = { TC, NA, RR, RL, FC, NA, FR, FL } }, ++{ .ca_index = 0x23, .speakers = { TC, NA, RR, RL, FC, LFE, FR, FL } }, ++{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, NA, NA, FR, FL } }, ++{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, NA, LFE, FR, FL } }, ++{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } }, +-{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } }, ++{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, NA, FR, FL } }, + { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, + }; + + +From aaa2a41f44a0fc141b9a983a5f9f30bb8b6dbc8b Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:44:24 +0100 +Subject: [PATCH 134/170] bcm2835: only allow stereo if analogue jack is + selected + +Sending more than 2 channels to videocore while outputting to analogue +mysteriously outputs heavy artifacts. So just paint it over with a +hack: if analogue is explicitly selected as destination, do not +reporting support for anything other than stereo. + +I'm not sure how to deal with the auto case (destination 0). There's +probably way to retrieve this and even to listen to plug events, but +I didn't find one yet, and it's probably not worth the trouble. Just +don't use this setting, I guess. Unless you like noise. + +Changing the setting while an audio stream is active also doesn't +work properly. We could probably interrupt running streams by +returning ENODEV or using kernel hotplug stuff (maybe), but that +also doesn't seem worth the trouble. +--- + sound/arm/bcm2835-ctl.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c +index dec052b..e930718 100755 +--- a/sound/arm/bcm2835-ctl.c ++++ b/sound/arm/bcm2835-ctl.c +@@ -423,9 +423,16 @@ static struct cea_channel_speaker_allocation channel_allocations[] = { + { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } }, + }; + ++static int uses_analogue(bcm2835_chip_t *chip) ++{ ++ return chip->dest == 1; ++} ++ + static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, + unsigned int size, unsigned int __user *tlv) + { ++ struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); ++ bcm2835_chip_t *chip = info->private_data; + unsigned int __user *dst; + int count = 0; + int i; +@@ -442,6 +449,9 @@ static int snd_bcm2835_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag, + int chs_bytes; + int c; + ++ if (i > 0 && uses_analogue(chip)) ++ break; ++ + for (c = 0; c < 8; c++) { + if (ch->speakers[c]) + num_chs++; +@@ -552,6 +562,8 @@ static int snd_bcm2835_chmap_ctl_put(struct snd_kcontrol *kcontrol, + int matches = 1; + int cur = 0; + int x; ++ if (i > 0 && uses_analogue(chip)) ++ break; + memset(remap, 0, sizeof(remap)); + for (x = 0; x < substream->runtime->channels; x++) { + int sp = ucontrol->value.integer.value[x]; + +From 2c967fa0f5b0d10c86c796098574ba09ffe66cd5 Mon Sep 17 00:00:00 2001 +From: wm4 +Date: Wed, 13 Jan 2016 19:44:47 +0100 +Subject: [PATCH 135/170] bcm2835: interpolate audio delay + +It appears the GPU only sends us a message all 10ms to update +the playback progress. Other than this, the playback position +(what SNDRV_PCM_IOCTL_DELAY will return) is not updated at all. +Userspace will see jitter up to 10ms in the audio position. + +Make this a bit nicer for userspace by interpolating the +position using the CPU clock. + +I'm not sure if setting snd_pcm_runtime.delay is the right +approach for this. Or if there is maybe an already existing +mechanism for position interpolation in the ALSA core. + +I only set SNDRV_PCM_INFO_BATCH because this appears to remove +at least one situation snd_pcm_runtime.delay is used, so I have +to worry less in which place I have to update this field, or +how it interacts with the rest of ALSA. + +In the future, it might be nice to use VC_AUDIO_MSG_TYPE_LATENCY. +One problem is that it requires sending a videocore message, and +waiting for a reply, which could make the implementation much +harder due to locking and synchronization requirements. +--- + sound/arm/bcm2835-pcm.c | 12 +++++++++++- + sound/arm/bcm2835.h | 1 + + 2 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/sound/arm/bcm2835-pcm.c b/sound/arm/bcm2835-pcm.c +index 48da3bb..f3a4c6d 100755 +--- a/sound/arm/bcm2835-pcm.c ++++ b/sound/arm/bcm2835-pcm.c +@@ -25,7 +25,7 @@ + /* hardware definition */ + static struct snd_pcm_hardware snd_bcm2835_playback_hw = { + .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | +- SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID), ++ SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BATCH), + .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, + .rate_min = 8000, +@@ -99,6 +99,8 @@ static irqreturn_t bcm2835_playback_fifo_irq(int irq, void *dev_id) + alsa_stream->pos %= alsa_stream->buffer_size; + } + ++ alsa_stream->interpolate_start = ktime_get_ns(); ++ + if (alsa_stream->substream) { + if (new_period) + snd_pcm_period_elapsed(alsa_stream->substream); +@@ -399,6 +401,7 @@ static int snd_bcm2835_pcm_prepare(struct snd_pcm_substream *substream) + alsa_stream->buffer_size = snd_pcm_lib_buffer_bytes(substream); + alsa_stream->period_size = snd_pcm_lib_period_bytes(substream); + alsa_stream->pos = 0; ++ alsa_stream->interpolate_start = ktime_get_ns(); + + audio_debug("buffer_size=%d, period_size=%d pos=%d frame_bits=%d\n", + alsa_stream->buffer_size, alsa_stream->period_size, +@@ -495,6 +498,7 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) + { + struct snd_pcm_runtime *runtime = substream->runtime; + bcm2835_alsa_stream_t *alsa_stream = runtime->private_data; ++ u64 now = ktime_get_ns(); + + audio_info(" .. IN\n"); + +@@ -503,6 +507,12 @@ snd_bcm2835_pcm_pointer(struct snd_pcm_substream *substream) + frames_to_bytes(runtime, runtime->control->appl_ptr), + alsa_stream->pos); + ++ /* Give userspace better delay reporting by interpolating between GPU ++ * notifications, assuming audio speed is close enough to the clock ++ * used for ktime */ ++ if (alsa_stream->interpolate_start && alsa_stream->interpolate_start < now) ++ runtime->delay = -(int)div_u64((now - alsa_stream->interpolate_start) * runtime->rate, 1000000000); ++ + audio_info(" .. OUT\n"); + return snd_pcm_indirect_playback_pointer(substream, + &alsa_stream->pcm_indirect, +diff --git a/sound/arm/bcm2835.h b/sound/arm/bcm2835.h +index 997fb69..20ef108 100755 +--- a/sound/arm/bcm2835.h ++++ b/sound/arm/bcm2835.h +@@ -137,6 +137,7 @@ typedef struct bcm2835_alsa_stream { + unsigned int pos; + unsigned int buffer_size; + unsigned int period_size; ++ u64 interpolate_start; + + uint32_t enable_fifo_irq; + irq_handler_t fifo_irq_handler; + +From 205e27a7f94a5531764cc517ce43623361ca466c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 19 Jan 2016 17:16:38 +0000 +Subject: [PATCH 136/170] bcm2835-sdhost: Add workaround for odd behaviour on + some cards + +For reasons not understood, the sdhost driver fails when reading +sectors very near the end of some SD cards. The problem could +be related to the similar issue that reading the final sector +of any card as part of a multiple read never completes, and the +workaround is an extension of the mechanism introduced to solve +that problem which ensures those sectors are always read singly. +--- + drivers/mmc/host/bcm2835-sdhost.c | 61 +++++++++++++++++++++++++++++++++------ + 1 file changed, 52 insertions(+), 9 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index da089985..309633c 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -173,6 +173,9 @@ struct bcm2835_host { + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + u32 overclock; /* Current frequency if overclocked, else zero */ + u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ ++ ++ u32 sectors; /* Cached card size in sectors */ ++ u32 single_read_sectors[8]; + }; + + +@@ -277,6 +280,9 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) + { + u32 temp; + ++ if (host->debug) ++ pr_info("%s: reset\n", mmc_hostname(host->mmc)); ++ + bcm2835_sdhost_set_power(host, false); + + bcm2835_sdhost_write(host, 0, SDCMD); +@@ -299,6 +305,8 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) + bcm2835_sdhost_set_power(host, true); + mdelay(10); + host->clock = 0; ++ host->sectors = 0; ++ host->single_read_sectors[0] = ~0; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + mmiowb(); +@@ -309,8 +317,6 @@ static void bcm2835_sdhost_reset(struct mmc_host *mmc) + { + struct bcm2835_host *host = mmc_priv(mmc); + unsigned long flags; +- if (host->debug) +- pr_info("%s: reset\n", mmc_hostname(mmc)); + spin_lock_irqsave(&host->lock, flags); + + bcm2835_sdhost_reset_internal(host); +@@ -676,6 +682,32 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + ++ if (!host->sectors && host->mmc->card) ++ { ++ struct mmc_card *card = host->mmc->card; ++ if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { ++ /* ++ * The EXT_CSD sector count is in number of 512 byte ++ * sectors. ++ */ ++ host->sectors = card->ext_csd.sectors; ++ pr_err("%s: using ext_csd!\n", mmc_hostname(host->mmc)); ++ } else { ++ /* ++ * The CSD capacity field is in units of read_blkbits. ++ * set_capacity takes units of 512 bytes. ++ */ ++ host->sectors = card->csd.capacity << ++ (card->csd.read_blkbits - 9); ++ } ++ host->single_read_sectors[0] = host->sectors - 65; ++ host->single_read_sectors[1] = host->sectors - 64; ++ host->single_read_sectors[2] = host->sectors - 33; ++ host->single_read_sectors[3] = host->sectors - 32; ++ host->single_read_sectors[4] = host->sectors - 1; ++ host->single_read_sectors[5] = ~0; /* Safety net */ ++ } ++ + host->use_dma = host->have_dma && (data->blocks > host->pio_limit); + if (!host->use_dma) { + int flags; +@@ -1246,6 +1278,10 @@ static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) + + bcm2835_sdhost_finish_data(host); + } else { ++ /* Reset the timer */ ++ mod_timer(&host->pio_timer, ++ jiffies + host->pio_timeout); ++ + bcm2835_sdhost_transfer_pio(host); + + /* Reset the timer */ +@@ -1450,8 +1486,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + +- /* Set the timeout to 500ms */ +- bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); ++ /* Set the timeout to 250ms */ ++ bcm2835_sdhost_write(host, host->mmc->actual_clock/4, SDTOUT); + + if (host->debug) + pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", +@@ -1566,13 +1602,20 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, + reading the final sector of the card as part of a multiple read + problematic. Detect that case and shorten the read accordingly. + */ +- /* csd.capacity is in weird units - convert to sectors */ +- u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); ++ struct bcm2835_host *host; ++ ++ host = mmc_priv(card->host); + +- if ((direction == MMC_DATA_READ) && +- ((blk_pos + blk_size) == card_sectors)) +- blk_size--; ++ if (direction == MMC_DATA_READ) ++ { ++ int i; ++ int sector; ++ for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) ++ continue; + ++ if ((blk_pos + blk_size) > sector) ++ blk_size = (blk_pos == sector) ? 1 : (sector - blk_pos); ++ } + return blk_size; + } + + +From c5d24cba808118647d01a1869cf1c46d0658d78b Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 22 Jan 2016 16:03:24 +0000 +Subject: [PATCH 137/170] bcm2835-sdhost: Add debug_flags dtparam + +Bit zero disables the single-read-sectors map: + +If the default MMC driver is bcm2835-mmc: + dtoverlay=sdhost,debug_flags=1 +If the default MMC driver is bcm2835-sdhost: + dtoverlay=sdtweak,debug_flags=1 +(although the sdhost overlay may also work, sdtweak is +less invasive and will work in more circumstances). + +Also revert the timeout change, just in case. +--- + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 2 ++ + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 2 ++ + drivers/mmc/host/bcm2835-sdhost.c | 26 +++++++++++++++++++++----- + 3 files changed, 25 insertions(+), 5 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +index 85f0725..dbe6574 100644 +--- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -16,6 +16,7 @@ + frag1: __overlay__ { + brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; ++ brcm,debug-flags = <0>; + status = "okay"; + }; + }; +@@ -25,5 +26,6 @@ + force_pio = <&frag1>,"brcm,force-pio?"; + pio_limit = <&frag1>,"brcm,pio-limit:0"; + debug = <&frag1>,"brcm,debug?"; ++ debug_flags = <&frag1>,"brcm,debug-flags:0"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +index 74c168d..b0b208c 100644 +--- a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -9,6 +9,7 @@ + frag1: __overlay__ { + brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; ++ brcm,debug-flags = <0>; + }; + }; + +@@ -17,5 +18,6 @@ + force_pio = <&frag1>,"brcm,force-pio?"; + pio_limit = <&frag1>,"brcm,pio-limit:0"; + debug = <&frag1>,"brcm,debug?"; ++ debug_flags = <&frag1>,"brcm,debug-flags:0"; + }; + }; +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 309633c..ef9b1e6 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -174,6 +174,8 @@ struct bcm2835_host { + u32 overclock; /* Current frequency if overclocked, else zero */ + u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ + ++ u32 debug_flags; ++ + u32 sectors; /* Cached card size in sectors */ + u32 single_read_sectors[8]; + }; +@@ -682,7 +684,7 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + +- if (!host->sectors && host->mmc->card) ++ if (!host->sectors && host->mmc->card && !(host->debug_flags & 1)) + { + struct mmc_card *card = host->mmc->card; + if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { +@@ -1486,8 +1488,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + host->cdiv = div; + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + +- /* Set the timeout to 250ms */ +- bcm2835_sdhost_write(host, host->mmc->actual_clock/4, SDTOUT); ++ /* Set the timeout to 500ms */ ++ bcm2835_sdhost_write(host, host->mmc->actual_clock/2, SDTOUT); + + if (host->debug) + pr_info("%s: clock=%d -> max_clk=%d, cdiv=%x (actual clock %d)\n", +@@ -1606,8 +1608,16 @@ static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, + + host = mmc_priv(card->host); + +- if (direction == MMC_DATA_READ) +- { ++ if (!host->sectors) { ++ /* csd.capacity is in weird units - convert to sectors */ ++ u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); ++ if ((direction == MMC_DATA_READ) && ++ ((blk_pos + blk_size) == card_sectors)) ++ blk_size--; ++ return blk_size; ++ } ++ ++ if (direction == MMC_DATA_READ) { + int i; + int sector; + for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) +@@ -1838,8 +1848,14 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + host->allow_dma = ALLOW_DMA && + !of_property_read_bool(node, "brcm,force-pio"); + host->debug = of_property_read_bool(node, "brcm,debug"); ++ of_property_read_u32(node, ++ "brcm,debug-flags", ++ &host->debug_flags); + } + ++ if (host->debug_flags) ++ dev_err(dev, "debug_flags=%x\n", host->debug_flags); ++ + if (host->allow_dma) { + if (node) { + host->dma_chan_tx = + +From 1a451a35b70fa9ed32f23a4ba925e5b2c2c3af78 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 25 Jan 2016 09:12:06 +0000 +Subject: [PATCH 138/170] BCM270X_DT: Add sdio_overclock parameter to sdio + overlay + +The sdio_overclock parameter is like the overclock_50 parameter, i.e. +it sets an alternate frequency (in MHz) to use when the MMC framework +requests 50MHz, except that it applies to the SDIO bus. + +Be aware that the actual frequencies achievable are limited to even integer +divisions of 250MHz, and that the driver will round up to include fractions +(e.g. 62 will include 62.5) but then round down to the nearest frequency. +In other words, the chosen frequency is the highest possible that is less than +the parameter value + 1. In practise this means that 62 is the only sensible +value. + +Examples: + 250MHz/4 = 62.5MHz (sdio_overclock=62) + 250MHz/2 = 125MHz (sdio_overclock=125) # Too fast +--- + arch/arm/boot/dts/overlays/README | 9 ++++++--- + arch/arm/boot/dts/overlays/sdio-overlay.dts | 2 ++ + 2 files changed, 8 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 34a1b7f..709d3e4 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -53,8 +53,8 @@ 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 ++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: +@@ -621,9 +621,12 @@ Name: sdio + Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, + and enables SDIO via GPIOs 22-27. + Load: dtoverlay=sdio,= +-Params: overclock_50 Clock (in MHz) to use when the MMC framework ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework + requests 50MHz + ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz ++ + force_pio Disable DMA support (default off) + + pio_limit Number of blocks above which to use DMA +diff --git a/arch/arm/boot/dts/overlays/sdio-overlay.dts b/arch/arm/boot/dts/overlays/sdio-overlay.dts +index 7935e7a..398bd81 100644 +--- a/arch/arm/boot/dts/overlays/sdio-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdio-overlay.dts +@@ -12,6 +12,7 @@ + pinctrl-0 = <&sdio_pins>; + non-removable; + bus-width = <4>; ++ brcm,overclock-50 = <0>; + status = "okay"; + }; + }; +@@ -30,5 +31,6 @@ + __overrides__ { + poll_once = <&sdio_mmc>,"non-removable?"; + bus_width = <&sdio_mmc>,"bus-width:0"; ++ sdio_overclock = <&sdio_mmc>,"brcm,overclock-50:0"; + }; + }; + +From 49ff16d7af98e6191d6dd60ba75b711612e948ab Mon Sep 17 00:00:00 2001 +From: Michael Lange +Date: Thu, 21 Jan 2016 18:10:16 +0100 +Subject: [PATCH 139/170] rtc: ds1307: add support for the DT property + 'wakeup-source' + +For RTC chips with no IRQ directly connected to the SoC, the RTC chip +can be forced as a wakeup source by stating that explicitly in +the device's .dts file using the "wakeup-source" boolean property. +This will guarantee the 'wakealarm' sysfs entry is available on the +device, if supported by the RTC. + +With these changes to the driver rtc-ds1307 and the necessary entries +in the .dts file, I get an working ds1337 RTC on the Witty Pi extension +board by UUGear for the Raspberry Pi. + +An example for the entry in the .dts file: + + rtc: ds1337@68 { + compatible = "dallas,ds1337"; + reg = <0x68>; + wakeup-source; + +If the "wakeup-source" property is set, do not request an IRQ. +Set also UIE mode to unsupported, to get a working 'hwclock' binary. + +Signed-off-by: Michael Lange +Signed-off-by: Alexandre Belloni +--- + drivers/rtc/rtc-ds1307.c | 29 +++++++++++++++++++++++++++-- + 1 file changed, 27 insertions(+), 2 deletions(-) + +diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c +index 1cb13fee..28ca4bf 100644 +--- a/drivers/rtc/rtc-ds1307.c ++++ b/drivers/rtc/rtc-ds1307.c +@@ -860,6 +860,7 @@ static int ds1307_probe(struct i2c_client *client, + struct chip_desc *chip = &chips[id->driver_data]; + struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); + bool want_irq = false; ++ bool ds1307_can_wakeup_device = false; + unsigned char *buf; + struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev); + irq_handler_t irq_handler = ds1307_irq; +@@ -907,6 +908,20 @@ static int ds1307_probe(struct i2c_client *client, + ds1307->write_block_data = ds1307_write_block_data; + } + ++#ifdef CONFIG_OF ++/* ++ * For devices with no IRQ directly connected to the SoC, the RTC chip ++ * can be forced as a wakeup source by stating that explicitly in ++ * the device's .dts file using the "wakeup-source" boolean property. ++ * If the "wakeup-source" property is set, don't request an IRQ. ++ * This will guarantee the 'wakealarm' sysfs entry is available on the device, ++ * if supported by the RTC. ++ */ ++ if (of_property_read_bool(client->dev.of_node, "wakeup-source")) { ++ ds1307_can_wakeup_device = true; ++ } ++#endif ++ + switch (ds1307->type) { + case ds_1337: + case ds_1339: +@@ -925,11 +940,13 @@ static int ds1307_probe(struct i2c_client *client, + ds1307->regs[0] &= ~DS1337_BIT_nEOSC; + + /* +- * Using IRQ? Disable the square wave and both alarms. ++ * Using IRQ or defined as wakeup-source? ++ * Disable the square wave and both alarms. + * For some variants, be sure alarms can trigger when we're + * running on Vbackup (BBSQI/BBSQW) + */ +- if (ds1307->client->irq > 0 && chip->alarm) { ++ if (chip->alarm && (ds1307->client->irq > 0 || ++ ds1307_can_wakeup_device)) { + ds1307->regs[0] |= DS1337_BIT_INTCN + | bbsqi_bitpos[ds1307->type]; + ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE); +@@ -1144,6 +1161,14 @@ static int ds1307_probe(struct i2c_client *client, + return PTR_ERR(ds1307->rtc); + } + ++ if (ds1307_can_wakeup_device) { ++ /* Disable request for an IRQ */ ++ want_irq = false; ++ dev_info(&client->dev, "'wakeup-source' is set, request for an IRQ is disabled!\n"); ++ /* We cannot support UIE mode if we do not have an IRQ line */ ++ ds1307->rtc->uie_unsupported = 1; ++ } ++ + if (want_irq) { + err = devm_request_threaded_irq(&client->dev, + client->irq, NULL, irq_handler, + +From e382e888be3f59b0ba3645809ae686947313e0c1 Mon Sep 17 00:00:00 2001 +From: vitalogy +Date: Tue, 19 Jan 2016 07:02:02 +0100 +Subject: [PATCH 140/170] dt-overlay: add wittypi-overlay.dts + +--- + arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 ++++++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/wittypi-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/wittypi-overlay.dts b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +new file mode 100644 +index 0000000..be5987d +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/wittypi-overlay.dts +@@ -0,0 +1,44 @@ ++/* ++ * Device Tree overlay for Witty Pi extension board by UUGear ++ * ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ compatible = "gpio-leds"; ++ wittypi_led: wittypi_led { ++ label = "wittypi_led"; ++ linux,default-trigger = "default-on"; ++ gpios = <&gpio 17 0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ rtc: ds1337@68 { ++ compatible = "dallas,ds1337"; ++ reg = <0x68>; ++ wakeup-source; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ led_gpio = <&wittypi_led>,"gpios:4"; ++ led_trigger = <&wittypi_led>,"linux,default-trigger"; ++ }; ++ ++}; + +From 6dcfc3daab7c1c459b36261163b4e1dc15a6e965 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 3 Feb 2016 16:12:54 +0000 +Subject: [PATCH 141/170] BCM270X_DT: Disable DMA for bcm2835-sdhost on Pi2 + +This is an interim patch to verify that problems seen with +some cards can be worked around at the expense of an increased +CPU load by forcing PIO mode. + +Although this could have used the brcm,force-pio attribute, that +is a boolean (true if present, false if absent) and attributes +can't be deleted by overlays. Instead, make brcm,pio-limit +unfeasibly high instead to allow DMA to be re-enabled using the +pio_limit parameter of the sdhost or sdtweak overlays. +--- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 5206ba2..0b68db5 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -43,6 +43,7 @@ + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_pins>; + bus-width = <4>; ++ brcm,pio-limit = <0x7fffffff>; + status = "okay"; + }; + + +From 7519a79f61a67792e238a118db58600fb5f60ec8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 19 Jan 2016 16:28:05 +0000 +Subject: [PATCH 142/170] FIXUP i2c_bcm2708: Don't change module baudrate + parameter + +Overwriting the baudrate module parameter creates an apparent +forced baudrate for i2c busses after the first. Not only does this +override the baudrate from DT it also prevents the bus ID from +being initialised. + +Also fix whitespace errors. +--- + drivers/i2c/busses/i2c-bcm2708.c | 48 +++++++++++++++++++++------------------- + 1 file changed, 25 insertions(+), 23 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c +index b152639..c9b8e5c 100644 +--- a/drivers/i2c/busses/i2c-bcm2708.c ++++ b/drivers/i2c/busses/i2c-bcm2708.c +@@ -71,7 +71,6 @@ + + #define DRV_NAME "bcm2708_i2c" + +-static unsigned int baudrate_default = CONFIG_I2C_BCM2708_BAUDRATE; + static unsigned int baudrate; + module_param(baudrate, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); + MODULE_PARM_DESC(baudrate, "The I2C baudrate"); +@@ -317,25 +316,28 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + struct i2c_adapter *adap; + unsigned long bus_hz; + u32 cdiv, clk_tout; +- +- if (!baudrate) { +- baudrate = baudrate_default; +- if (pdev->dev.of_node) { +- u32 bus_clk_rate; +- pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); +- if (pdev->id < 0) { +- dev_err(&pdev->dev, "alias is missing\n"); +- return -EINVAL; +- } +- if (!of_property_read_u32(pdev->dev.of_node, +- "clock-frequency", &bus_clk_rate)) +- baudrate = bus_clk_rate; +- else +- dev_warn(&pdev->dev, +- "Could not read clock-frequency property\n"); ++ u32 baud; ++ ++ baud = CONFIG_I2C_BCM2708_BAUDRATE; ++ ++ if (pdev->dev.of_node) { ++ u32 bus_clk_rate; ++ pdev->id = of_alias_get_id(pdev->dev.of_node, "i2c"); ++ if (pdev->id < 0) { ++ dev_err(&pdev->dev, "alias is missing\n"); ++ return -EINVAL; + } ++ if (!of_property_read_u32(pdev->dev.of_node, ++ "clock-frequency", &bus_clk_rate)) ++ baud = bus_clk_rate; ++ else ++ dev_warn(&pdev->dev, ++ "Could not read clock-frequency property\n"); + } + ++ if (baudrate) ++ baud = baudrate; ++ + regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!regs) { + dev_err(&pdev->dev, "could not get IO memory\n"); +@@ -419,21 +421,21 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) + } + + bus_hz = clk_get_rate(bi->clk); +- cdiv = bus_hz / baudrate; ++ cdiv = bus_hz / baud; + if (cdiv > 0xffff) { + cdiv = 0xffff; +- baudrate = bus_hz / cdiv; ++ baud = bus_hz / cdiv; + } +- +- clk_tout = 35/1000*baudrate; //35ms timeout as per SMBus specs. +- if (clk_tout > 0xffff) ++ ++ clk_tout = 35/1000*baud; //35ms timeout as per SMBus specs. ++ if (clk_tout > 0xffff) + clk_tout = 0xffff; + + bi->cdiv = cdiv; + bi->clk_tout = clk_tout; + + dev_info(&pdev->dev, "BSC%d Controller at 0x%08lx (irq %d) (baudrate %d)\n", +- pdev->id, (unsigned long)regs->start, irq, baudrate); ++ pdev->id, (unsigned long)regs->start, irq, baud); + + return 0; + + +From f2d36d57d7e17b9f44ff914824df5b150eb9e3bd Mon Sep 17 00:00:00 2001 +From: Digital Dreamtime +Date: Thu, 4 Feb 2016 14:14:44 +0000 +Subject: [PATCH 143/170] Allow up to 24dB digital gain to be applied when + using IQAudIO DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. +--- + arch/arm/boot/dts/overlays/README | 17 +++++++++++++++-- + .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 6 +++++- + sound/soc/bcm/iqaudio-dac.c | 20 ++++++++++++++------ + 3 files changed, 34 insertions(+), 9 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 709d3e4..3c8436e 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -362,8 +362,21 @@ Params: + + Name: iqaudio-dacplus + Info: Configures the IQaudio DAC+ audio card +-Load: dtoverlay=iqaudio-dacplus +-Params: ++Load: dtoverlay=iqaudio-dacplus,= ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=iqaudio-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24db_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + + + Name: lirc-rpi +diff --git a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +index 735d8ab..e0aaf8f 100644 +--- a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts ++++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts +@@ -7,7 +7,7 @@ + + fragment@0 { + target = <&sound>; +- __overlay__ { ++ frag0: __overlay__ { + compatible = "iqaudio,iqaudio-dac"; + i2s-controller = <&i2s>; + status = "okay"; +@@ -36,4 +36,8 @@ + }; + }; + }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag0>,"iqaudio,24db_digital_gain?"; ++ }; + }; +diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c +index 37038d4..124d7a9 100644 +--- a/sound/soc/bcm/iqaudio-dac.c ++++ b/sound/soc/bcm/iqaudio-dac.c +@@ -23,14 +23,19 @@ + #include + #include + ++static bool digital_gain_0db_limit = true; ++ + static int snd_rpi_iqaudio_dac_init(struct snd_soc_pcm_runtime *rtd) + { +- int ret; +- struct snd_soc_card *card = rtd->card; +- +- ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } + + return 0; + } +@@ -94,6 +99,9 @@ static int snd_rpi_iqaudio_dac_probe(struct platform_device *pdev) + dai->platform_name = NULL; + dai->platform_of_node = i2s_node; + } ++ ++ digital_gain_0db_limit = !of_property_read_bool(pdev->dev.of_node, ++ "iqaudio,24db_digital_gain"); + } + + ret = snd_soc_register_card(&snd_rpi_iqaudio_dac); + +From 8a189f18de820c6facd00ba2db97ba7c4a75156f Mon Sep 17 00:00:00 2001 +From: Digital Dreamtime +Date: Thu, 4 Feb 2016 20:04:00 +0000 +Subject: [PATCH 144/170] Limit PCM512x "Digital" gain to 0dB by default with + HiFiBerry DAC+ + +24db_digital_gain DT param can be used to specify that PCM512x +codec "Digital" volume control should not be limited to 0dB gain, +and if specified will allow the full 24dB gain. +--- + arch/arm/boot/dts/overlays/README | 17 +++++++++++++++-- + .../arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts | 6 +++++- + sound/soc/bcm/hifiberry_dacplus.c | 14 ++++++++++++++ + 3 files changed, 34 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 3c8436e..296184f 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -273,8 +273,21 @@ Params: + + Name: hifiberry-dacplus + Info: Configures the HifiBerry DAC+ audio card +-Load: dtoverlay=hifiberry-dacplus +-Params: ++Load: dtoverlay=hifiberry-dacplus,= ++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec ++ Digital volume control. Enable with ++ "dtoverlay=hifiberry-dacplus,24db_digital_gain" ++ (The default behaviour is that the Digital ++ volume control is limited to a maximum of ++ 0dB. ie. it can attenuate but not provide ++ gain. For most users, this will be desired ++ as it will prevent clipping. By appending ++ the 24dB_digital_gain parameter, the Digital ++ volume control will allow up to 24dB of ++ gain. If this parameter is enabled, it is the ++ responsibility of the user to ensure that ++ the Digital volume control is set to a value ++ that does not result in clipping/distortion!) + + + Name: hifiberry-digi +diff --git a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +index f923a48..42a0194 100644 +--- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts ++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts +@@ -17,7 +17,7 @@ + + fragment@1 { + target = <&sound>; +- __overlay__ { ++ frag1: __overlay__ { + compatible = "hifiberry,hifiberry-dacplus"; + i2s-controller = <&i2s>; + status = "okay"; +@@ -47,4 +47,8 @@ + }; + }; + }; ++ ++ __overrides__ { ++ 24db_digital_gain = <&frag1>,"hifiberry,24db_digital_gain?"; ++ }; + }; +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c +index a6b651c..153dbcd 100644 +--- a/sound/soc/bcm/hifiberry_dacplus.c ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -48,6 +48,7 @@ struct pcm512x_priv { + #define CLK_48EN_RATE 24576000UL + + static bool snd_rpi_hifiberry_is_dacpro; ++static bool digital_gain_0db_limit = true; + + static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec, + int clk_id) +@@ -167,6 +168,16 @@ static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd) + snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02); + snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08); + ++ if (digital_gain_0db_limit) ++ { ++ int ret; ++ struct snd_soc_card *card = rtd->card; ++ ++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret); ++ } ++ + return 0; + } + +@@ -299,6 +310,9 @@ static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev) + dai->platform_name = NULL; + dai->platform_of_node = i2s_node; + } ++ ++ digital_gain_0db_limit = !of_property_read_bool( ++ pdev->dev.of_node, "hifiberry,24db_digital_gain"); + } + + ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus); + +From 14ba431031afa218c0db43a7c20fe54916f8d357 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 8 Feb 2016 09:46:33 +0000 +Subject: [PATCH 145/170] BCM270X_DT: Adjust overlay README formatting + +--- + arch/arm/boot/dts/overlays/README | 420 +++++++++++++++++++------------------- + 1 file changed, 210 insertions(+), 210 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 296184f..ec1ae91 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -83,58 +83,58 @@ Name: + Info: Configures the base Raspberry Pi hardware + Load: + Params: +- audio Set to "on" to enable the onboard ALSA audio +- interface (default "off") ++ audio Set to "on" to enable the onboard ALSA audio ++ interface (default "off") + +- i2c_arm Set to "on" to enable the ARM's i2c interface +- (default "off") ++ 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_vc Set to "on" to enable the i2c interface ++ usually reserved for the VideoCore processor ++ (default "off") + +- i2c An alias for i2c_arm ++ i2c An alias for i2c_arm + +- i2c_arm_baudrate Set the baudrate of the ARM's i2c interface +- (default "100000") ++ 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_vc_baudrate Set the baudrate of the VideoCore i2c interface ++ (default "100000") + +- i2c_baudrate An alias for i2c_arm_baudrate ++ i2c_baudrate An alias for i2c_arm_baudrate + +- i2s Set to "on" to enable the i2s interface +- (default "off") ++ i2s Set to "on" to enable the i2s interface ++ (default "off") + +- spi Set to "on" to enable the spi interfaces +- (default "off") ++ spi Set to "on" to enable the spi interfaces ++ (default "off") + +- random Set to "on" to enable the hardware random +- number generator (default "on") ++ random Set to "on" to enable the hardware random ++ number generator (default "on") + +- uart0 Set to "off" to disable uart0 (default "on") ++ uart0 Set to "off" to disable uart0 (default "on") + +- watchdog Set to "on" to enable the hardware watchdog +- (default "off") ++ watchdog Set to "on" to enable the hardware watchdog ++ (default "off") + +- act_led_trigger Choose which activity the LED tracks. +- Use "heartbeat" for a nice load indicator. +- (default "mmc") ++ 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_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) ++ 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. ++ 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 +@@ -149,19 +149,19 @@ Params: + 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) ++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. +@@ -175,12 +175,12 @@ Name: at86rf233 + Info: Configures the Atmel AT86RF233 802.15.4 low-power WPAN transceiver, + connected to spi0.0 + Load: dtoverlay=at86rf233,= +-Params: interrupt GPIO used for INT (default 23) +- reset GPIO used for Reset (default 24) +- sleep GPIO used for Sleep (default 25) +- speed SPI bus speed in Hz (default 6000000) +- trim Fine tuning of the internal capacitance +- arrays (0=+0pF, 15=+4.5pF, default 15) ++Params: interrupt GPIO used for INT (default 23) ++ reset GPIO used for Reset (default 24) ++ sleep GPIO used for Sleep (default 25) ++ speed SPI bus speed in Hz (default 6000000) ++ trim Fine tuning of the internal capacitance ++ arrays (0=+0pF, 15=+4.5pF, default 15) + + + Name: bmp085_i2c-sensor +@@ -194,8 +194,8 @@ Name: dht11 + Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors + Also sometimes found with the part number(s) AM230x. + Load: dtoverlay=dht11,= +-Params: gpiopin GPIO connected to the sensor's DATA output. +- (default 4) ++Params: gpiopin GPIO connected to the sensor's DATA output. ++ (default 4) + + + Name: dwc-otg +@@ -208,15 +208,15 @@ Params: + Name: dwc2 + Info: Selects the dwc2 USB controller driver + Load: dtoverlay=dwc2,= +-Params: dr_mode Dual role mode: "host", "peripheral" or "otg" ++Params: dr_mode Dual role mode: "host", "peripheral" or "otg" + +- g-rx-fifo-size Size of rx fifo size in gadget mode ++ g-rx-fifo-size Size of rx fifo size in gadget mode + +- g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget +- mode ++ g-np-tx-fifo-size Size of non-periodic tx fifo size in gadget ++ mode + +- g-tx-fifo-size Size of periodic tx fifo per endpoint +- (except ep0) in gadget mode ++ g-tx-fifo-size Size of periodic tx fifo per endpoint ++ (except ep0) in gadget mode + + + [ The ds1307-rtc overlay has been deleted. See i2c-rtc. ] +@@ -225,9 +225,9 @@ Params: dr_mode Dual role mode: "host", "peripheral" or "otg" + Name: enc28j60 + Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI) + Load: dtoverlay=enc28j60,= +-Params: int_pin GPIO used for INT (default 25) ++Params: int_pin GPIO used for INT (default 25) + +- speed SPI bus speed (default 12000000) ++ speed SPI bus speed (default 12000000) + + + Name: gpio-ir +@@ -237,26 +237,26 @@ Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core- + not required! The key mapping and other decoding parameters can be + configured by "ir-keytable" tool. + Load: dtoverlay=gpio-ir,= +-Params: gpio_pin Input pin number. Default is 18. ++Params: gpio_pin Input pin number. Default is 18. + +- gpio_pull Desired pull-up/down state (off, down, up) +- Default is "down". ++ gpio_pull Desired pull-up/down state (off, down, up) ++ Default is "down". + +- rc-map-name Default rc keymap (can also be changed by +- ir-keytable), defaults to "rc-rc6-mce" ++ rc-map-name Default rc keymap (can also be changed by ++ ir-keytable), defaults to "rc-rc6-mce" + + + Name: gpio-poweroff + Info: Drives a GPIO high or low on reboot + Load: dtoverlay=gpio-poweroff,= +-Params: gpiopin GPIO for signalling (default 26) ++Params: gpiopin GPIO for signalling (default 26) + +- active_low Set if the power control device requires a +- high->low transition to trigger a power-down. +- Note that this will require the support of a +- custom dt-blob.bin to prevent a power-down +- during the boot process, and that a reboot +- will also cause the pin to go low. ++ active_low Set if the power control device requires a ++ high->low transition to trigger a power-down. ++ Note that this will require the support of a ++ custom dt-blob.bin to prevent a power-down ++ during the boot process, and that a reboot ++ will also cause the pin to go low. + + + Name: hifiberry-amp +@@ -300,65 +300,65 @@ 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 ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + +- resetgpio GPIO used to reset controller ++ resetgpio GPIO used to reset controller + +- ledgpio GPIO used to control backlight ++ 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 ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + +- resetgpio GPIO used to reset controller ++ resetgpio GPIO used to reset controller + +- ledgpio GPIO used to control backlight ++ ledgpio GPIO used to control backlight + + + Name: i2c-gpio + Info: Adds support for software i2c controller on gpio pins + Load: dtoverlay=i2c-gpio,= +-Params: i2c_gpio_sda GPIO used for I2C data (default "23") ++Params: i2c_gpio_sda GPIO used for I2C data (default "23") + +- i2c_gpio_scl GPIO used for I2C clock (default "24") ++ i2c_gpio_scl GPIO used for I2C clock (default "24") + +- i2c_gpio_delay_us Clock delay in microseconds +- (default "2" = ~100kHz) ++ i2c_gpio_delay_us Clock delay in microseconds ++ (default "2" = ~100kHz) + + + 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 ++Params: ds1307 Select the DS1307 device + +- ds3231 Select the DS3231 device ++ ds3231 Select the DS3231 device + +- mcp7941x Select the MCP7941x device ++ mcp7941x Select the MCP7941x device + +- pcf2127 Select the PCF2127 device ++ pcf2127 Select the PCF2127 device + +- pcf8523 Select the PCF8523 device ++ pcf8523 Select the PCF8523 device + +- pcf8563 Select the PCF8563 device ++ pcf8563 Select the PCF8563 device + + + Name: i2s-mmap +@@ -396,70 +396,70 @@ 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") ++Params: gpio_out_pin GPIO for output (default "17") + +- gpio_in_pin GPIO for input (default "18") ++ gpio_in_pin GPIO for input (default "18") + +- gpio_in_pull Pull up/down/off on the input pin +- (default "down") ++ gpio_in_pull Pull up/down/off on the input pin ++ (default "down") + +- sense Override the IR receive auto-detection logic: +- "0" = force active-high +- "1" = force active-low +- "-1" = use auto-detection +- (default "-1") ++ sense Override the IR receive auto-detection logic: ++ "0" = force active-high ++ "1" = force active-low ++ "-1" = use auto-detection ++ (default "-1") + +- softcarrier Turn the software carrier "on" or "off" +- (default "on") ++ softcarrier Turn the software carrier "on" or "off" ++ (default "on") + +- invert "on" = invert the output pin (default "off") ++ invert "on" = invert the output pin (default "off") + +- debug "on" = enable additional debug messages +- (default "off") ++ debug "on" = enable additional debug messages ++ (default "off") + + + Name: mcp2515-can0 + Info: Configures the MCP2515 CAN controller on spi0.0 + Load: dtoverlay=mcp2515-can0,= +-Params: oscillator Clock frequency for the CAN controller (Hz) ++Params: oscillator Clock frequency for the CAN controller (Hz) + +- spimaxfrequency Maximum SPI frequence (Hz) ++ spimaxfrequency Maximum SPI frequence (Hz) + +- interrupt GPIO for interrupt signal ++ interrupt GPIO for interrupt signal + + + Name: mcp2515-can1 + Info: Configures the MCP2515 CAN controller on spi0.1 + Load: dtoverlay=mcp2515-can1,= +-Params: oscillator Clock frequency for the CAN controller (Hz) ++Params: oscillator Clock frequency for the CAN controller (Hz) + +- spimaxfrequency Maximum SPI frequence (Hz) ++ spimaxfrequency Maximum SPI frequence (Hz) + +- interrupt GPIO for interrupt signal ++ interrupt GPIO for interrupt signal + + + 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 ++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 ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- txbuflen Transmit buffer length (default 32768) ++ txbuflen Transmit buffer length (default 32768) + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + + + [ The pcf2127-rtc overlay has been deleted. See i2c-rtc. ] +@@ -474,69 +474,69 @@ Params: speed Display SPI bus speed + Name: piscreen + Info: PiScreen display by OzzMaker.com + Load: dtoverlay=piscreen,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + + + Name: piscreen2r + Info: PiScreen 2 with resistive TP display by OzzMaker.com + Load: dtoverlay=piscreen2r,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + + + Name: pitft28-capacitive + Info: Adafruit PiTFT 2.8" capacitive touch screen + Load: dtoverlay=pitft28-capacitive,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- touch-sizex Touchscreen size x (default 240) ++ touch-sizex Touchscreen size x (default 240) + +- touch-sizey Touchscreen size y (default 320) ++ touch-sizey Touchscreen size y (default 320) + +- touch-invx Touchscreen inverted x axis ++ touch-invx Touchscreen inverted x axis + +- touch-invy Touchscreen inverted y axis ++ touch-invy Touchscreen inverted y axis + +- touch-swapxy Touchscreen swapped x y axis ++ touch-swapxy Touchscreen swapped x y axis + + + Name: pitft28-resistive + Info: Adafruit PiTFT 2.8" resistive touch screen + Load: dtoverlay=pitft28-resistive,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ 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") ++Params: gpiopin Input GPIO (default "18") + + + Name: pwm +@@ -550,12 +550,12 @@ Info: Configures a single PWM channel + Pins 12 and 13 might be better choices on an A+, B+ or Pi2. + 2) The onboard analogue audio output uses both PWM channels. + 3) So be careful mixing audio and PWM. +- 4) Currently the clock must have been enabled and configured ++ 4) Currently the clockmust have been enabled and configured + by other means. + Load: dtoverlay=pwm,= +-Params: pin Output pin (default 18) - see table +- func Pin function (default 2 = Alt5) - see above +- clock PWM clock frequency (informational) ++Params: pin Output pin (default 18) - see table ++ func Pin function (default 2 = Alt5) - see above ++ clock PWM clock frequency (informational) + + + Name: pwm-2chan +@@ -569,14 +569,14 @@ Info: Configures both PWM channels + Pins 12 and 13 might be better choices on an A+, B+ or Pi2. + 2) The onboard analogue audio output uses both PWM channels. + 3) So be careful mixing audio and PWM. +- 4) Currently the clock must have been enabled and configured ++ 4) Currently the clockmust have been enabled and configured + by other means. + Load: dtoverlay=pwm-2chan,= +-Params: pin Output pin (default 18) - see table +- pin2 Output pin for other channel (default 19) +- func Pin function (default 2 = Alt5) - see above +- func2 Function for pin2 (default 2 = Alt5) +- clock PWM clock frequency (informational) ++Params: pin Output pin (default 18) - see table ++ pin2 Output pin for other channel (default 19) ++ func Pin function (default 2 = Alt5) - see above ++ func2 Function for pin2 (default 2 = Alt5) ++ clock PWM clock frequency (informational) + + + Name: raspidac3 +@@ -600,15 +600,15 @@ Params: + Name: rpi-display + Info: RPi-Display - 2.8" Touch Display by Watterott + Load: dtoverlay=rpi-display,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- xohms Touchpanel sensitivity (X-plate resistance) ++ xohms Touchpanel sensitivity (X-plate resistance) + + + Name: rpi-ft5406 +@@ -632,52 +632,52 @@ 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 ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz + +- force_pio Disable DMA support (default off) ++ force_pio Disable DMA support (default off) + +- pio_limit Number of blocks above which to use DMA +- (default 1) ++ pio_limit Number of blocks above which to use DMA ++ (default 1) + +- debug Enable debug output (default off) ++ debug Enable debug output (default off) + + + Name: sdio + Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, + and enables SDIO via GPIOs 22-27. + Load: dtoverlay=sdio,= +-Params: overclock_50 SD Clock (in MHz) to use when the MMC framework +- requests 50MHz ++Params: overclock_50 SD Clock (in MHz) to use when the MMC framework ++ requests 50MHz + +- sdio_overclock SDIO Clock (in MHz) to use when the MMC +- framework requests 50MHz ++ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++ framework requests 50MHz + +- force_pio Disable DMA support (default off) ++ force_pio Disable DMA support (default off) + +- pio_limit Number of blocks above which to use DMA +- (default 1) ++ pio_limit Number of blocks above which to use DMA ++ (default 1) + +- debug Enable debug output (default off) ++ debug Enable debug output (default off) + +- poll_once Disable SDIO-device polling every second +- (default on: polling once at boot-time) ++ poll_once Disable SDIO-device polling every second ++ (default on: polling once at boot-time) + +- bus_width Set the SDIO host bus width (default 4 bits) ++ bus_width Set the SDIO host bus width (default 4 bits) + + + Name: sdtweak + Info: Tunes the bcm2835-sdhost SD/MMC driver + Load: dtoverlay=sdtweak,= +-Params: overclock_50 Clock (in MHz) to use when the MMC framework +- requests 50MHz ++Params: overclock_50 Clock (in MHz) to use when the MMC framework ++ requests 50MHz + +- force_pio Disable DMA support (default off) ++ force_pio Disable DMA support (default off) + +- pio_limit Number of blocks above which to use DMA +- (default 1) ++ pio_limit Number of blocks above which to use DMA ++ (default 1) + +- debug Enable debug output (default off) ++ debug Enable debug output (default off) + + + Name: smi +@@ -708,25 +708,25 @@ Name: tinylcd35 + Info: 3.5" Color TFT Display by www.tinylcd.com + Options: Touch, RTC, keypad + Load: dtoverlay=tinylcd35,= +-Params: speed Display SPI bus speed ++Params: speed Display SPI bus speed + +- rotate Display rotation {0,90,180,270} ++ rotate Display rotation {0,90,180,270} + +- fps Delay between frame updates ++ fps Delay between frame updates + +- debug Debug output level {0-7} ++ debug Debug output level {0-7} + +- touch Enable touch panel ++ touch Enable touch panel + +- touchgpio Touch controller IRQ GPIO ++ touchgpio Touch controller IRQ GPIO + +- xohms Touchpanel: Resistance of X-plate in ohms ++ xohms Touchpanel: Resistance of X-plate in ohms + +- rtc-pcf PCF8563 Real Time Clock ++ rtc-pcf PCF8563 Real Time Clock + +- rtc-ds DS1307 Real Time Clock ++ rtc-ds DS1307 Real Time Clock + +- keypad Enable keypad ++ keypad Enable keypad + + Examples: + Display with touchpanel, PCF8563 RTC and keypad: +@@ -738,9 +738,9 @@ Params: speed Display SPI bus speed + Name: uart1 + Info: Enable uart1 in place of uart0 + Load: dtoverlay=uart1,= +-Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) ++Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) + +- rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) ++ rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) + + + Name: vc4-kms-v3d +@@ -753,7 +753,7 @@ Params: + + Name: vga666 + Info: Overlay for the Fen Logic VGA666 board +- This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds ++ This uses GPIOs 2-21 (sono I2C), and activates the output 2-3 seconds + after the kernel has started. + Load: dtoverlay=vga666 + Params: +@@ -763,22 +763,22 @@ 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") ++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 ++ 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") ++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 ++ pullup Non-zero, "on", or "y" to enable the parasitic ++ power (2-wire, power-on-data) feature + +- extpullup GPIO for external pullup (default "5") ++ extpullup GPIO for external pullup (default "5") + + + Troubleshooting + +From d32795d2be55748552ddacd9b1e47efc61264a98 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 8 Feb 2016 12:53:44 +0000 +Subject: [PATCH 146/170] FIXUP: Overlay README - Restore spaces deleted in + error + +--- + arch/arm/boot/dts/overlays/README | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index ec1ae91..f987565 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -550,7 +550,7 @@ Info: Configures a single PWM channel + Pins 12 and 13 might be better choices on an A+, B+ or Pi2. + 2) The onboard analogue audio output uses both PWM channels. + 3) So be careful mixing audio and PWM. +- 4) Currently the clockmust have been enabled and configured ++ 4) Currently the clock must have been enabled and configured + by other means. + Load: dtoverlay=pwm,= + Params: pin Output pin (default 18) - see table +@@ -569,7 +569,7 @@ Info: Configures both PWM channels + Pins 12 and 13 might be better choices on an A+, B+ or Pi2. + 2) The onboard analogue audio output uses both PWM channels. + 3) So be careful mixing audio and PWM. +- 4) Currently the clockmust have been enabled and configured ++ 4) Currently the clock must have been enabled and configured + by other means. + Load: dtoverlay=pwm-2chan,= + Params: pin Output pin (default 18) - see table +@@ -753,7 +753,7 @@ Params: + + Name: vga666 + Info: Overlay for the Fen Logic VGA666 board +- This uses GPIOs 2-21 (sono I2C), and activates the output 2-3 seconds ++ This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds + after the kernel has started. + Load: dtoverlay=vga666 + Params: + +From be4e718cccf6909072eeab1032b1d9fb6dd92b43 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 9 Feb 2016 09:52:13 +0000 +Subject: [PATCH 147/170] pinctrl-bcm2835: Fix cut-and-paste error in "pull" + parsing + +The DT bindings for pinctrl-bcm2835 allow both the function and pull +to contain either one entry or one per pin. However, an error in the +DT parsing can cause failures if the number of pulls differs from the +number of functions. +--- + drivers/pinctrl/bcm/pinctrl-bcm2835.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +index 640e3b0..32f779e 100644 +--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c ++++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c +@@ -802,7 +802,7 @@ static int bcm2835_pctl_dt_node_to_map(struct pinctrl_dev *pctldev, + } + if (num_pulls) { + err = of_property_read_u32_index(np, "brcm,pull", +- (num_funcs > 1) ? i : 0, &pull); ++ (num_pulls > 1) ? i : 0, &pull); + if (err) + goto out; + err = bcm2835_pctl_dt_node_to_map_pull(pc, np, pin, + +From 14e35b8cca5bf1f6223ebc6cc4d527645076a3a3 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Thu, 11 Feb 2016 17:30:49 +0000 +Subject: [PATCH 148/170] Revert "BCM270X_DT: Disable DMA for bcm2835-sdhost on + Pi2" + +This reverts commit 9c1adcc07a40f762fd4ac580f07646784de135e1. +--- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 0b68db5..5206ba2 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -43,7 +43,6 @@ + pinctrl-names = "default"; + pinctrl-0 = <&sdhost_pins>; + bus-width = <4>; +- brcm,pio-limit = <0x7fffffff>; + status = "okay"; + }; + + +From 5a117bd925d13a305d94eeb28919dedeaa9be17d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 11 Feb 2016 16:51:01 +0000 +Subject: [PATCH 149/170] bcm2835-sdhost: Major revision + +This is a significant revision of the bcm2835-sdhost driver. It +improves on the original in a number of ways: + +1) Through the use of CMD23 for reads it appears to avoid problems + reading some sectors on certain high speed cards. +2) Better atomicity to prevent crashes. +3) Higher performance. +4) Activity logging included, for easier diagnosis in the event + of a problem. + +Signed-off-by: Phil Elwell +--- + drivers/mmc/host/bcm2835-sdhost.c | 1284 ++++++++++++++++++++----------------- + 1 file changed, 686 insertions(+), 598 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index ef9b1e6..262180b 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -2,7 +2,7 @@ + * BCM2835 SD host driver. + * + * Author: Phil Elwell +- * Copyright 2015 ++ * Copyright (C) 2015-2016 Raspberry Pi (Trading) Ltd. + * + * Based on + * mmc-bcm2835.c by Gellert Weisz +@@ -24,12 +24,13 @@ + * along with this program. If not, see . + */ + +-#define SAFE_READ_THRESHOLD 4 +-#define SAFE_WRITE_THRESHOLD 4 +-#define ALLOW_DMA 1 +-#define ALLOW_CMD23 0 +-#define ALLOW_FAST 1 +-#define USE_BLOCK_IRQ 1 ++#define FIFO_READ_THRESHOLD 4 ++#define FIFO_WRITE_THRESHOLD 4 ++#define ALLOW_CMD23_READ 1 ++#define ALLOW_CMD23_WRITE 0 ++#define ENABLE_LOG 1 ++#define SDDATA_FIFO_PIO_BURST 8 ++#define CMD_DALLY_US 1 + + #include + #include +@@ -48,6 +49,7 @@ + #include + #include + #include ++#include + + #define DRIVER_NAME "sdhost-bcm2835" + +@@ -110,6 +112,28 @@ + #define SDEDM_READ_THRESHOLD_SHIFT 14 + #define SDEDM_THRESHOLD_MASK 0x1f + ++#define SDEDM_FSM_MASK 0xf ++#define SDEDM_FSM_IDENTMODE 0x0 ++#define SDEDM_FSM_DATAMODE 0x1 ++#define SDEDM_FSM_READDATA 0x2 ++#define SDEDM_FSM_WRITEDATA 0x3 ++#define SDEDM_FSM_READWAIT 0x4 ++#define SDEDM_FSM_READCRC 0x5 ++#define SDEDM_FSM_WRITECRC 0x6 ++#define SDEDM_FSM_WRITEWAIT1 0x7 ++#define SDEDM_FSM_POWERDOWN 0x8 ++#define SDEDM_FSM_POWERUP 0x9 ++#define SDEDM_FSM_WRITESTART1 0xa ++#define SDEDM_FSM_WRITESTART2 0xb ++#define SDEDM_FSM_GENPULSES 0xc ++#define SDEDM_FSM_WRITEWAIT2 0xd ++#define SDEDM_FSM_STARTPOWDOWN 0xf ++ ++#define SDDATA_FIFO_WORDS 16 ++ ++#define USE_CMD23_FLAGS ((ALLOW_CMD23_READ * MMC_DATA_READ) | \ ++ (ALLOW_CMD23_WRITE * MMC_DATA_WRITE)) ++ + #define MHZ 1000000 + + +@@ -131,15 +155,17 @@ struct bcm2835_host { + + struct tasklet_struct finish_tasklet; /* Tasklet structures */ + +- struct timer_list timer; /* Timer for timeouts */ ++ struct work_struct cmd_wait_wq; /* Workqueue function */ + +- struct timer_list pio_timer; /* PIO error detection timer */ ++ struct timer_list timer; /* Timer for timeouts */ + + struct sg_mapping_iter sg_miter; /* SG state for PIO */ + unsigned int blocks; /* remaining PIO blocks */ + + int irq; /* Device IRQ */ + ++ u32 cmd_quick_poll_retries; ++ u32 ns_per_fifo_word; + + /* cached registers */ + u32 hcfg; +@@ -154,16 +180,21 @@ struct bcm2835_host { + + unsigned int use_busy:1; /* Wait for busy interrupt */ + +- unsigned int debug:1; /* Enable debug output */ ++ unsigned int use_sbc:1; /* Send CMD23 */ + +- u32 thread_isr; ++ unsigned int debug:1; /* Enable debug output */ + + /*DMA part*/ + struct dma_chan *dma_chan_rx; /* DMA channel for reads */ + struct dma_chan *dma_chan_tx; /* DMA channel for writes */ ++ struct dma_chan *dma_chan; /* Channel in used */ ++ struct dma_async_tx_descriptor *dma_desc; ++ u32 dma_dir; ++ u32 drain_words; ++ struct page *drain_page; ++ u32 drain_offset; + + bool allow_dma; +- bool have_dma; + bool use_dma; + /*end of DMA part*/ + +@@ -173,13 +204,98 @@ struct bcm2835_host { + u32 overclock_50; /* frequency to use when 50MHz is requested (in MHz) */ + u32 overclock; /* Current frequency if overclocked, else zero */ + u32 pio_limit; /* Maximum block count for PIO (0 = always DMA) */ ++}; + +- u32 debug_flags; ++#if ENABLE_LOG + +- u32 sectors; /* Cached card size in sectors */ +- u32 single_read_sectors[8]; ++struct log_entry_struct { ++ char event[4]; ++ u32 timestamp; ++ u32 param1; ++ u32 param2; + }; + ++typedef struct log_entry_struct LOG_ENTRY_T; ++ ++LOG_ENTRY_T *sdhost_log_buf; ++dma_addr_t sdhost_log_addr; ++static u32 sdhost_log_idx; ++static spinlock_t log_lock; ++static void __iomem *timer_base; ++ ++#define LOG_ENTRIES (256*1) ++#define LOG_SIZE (sizeof(LOG_ENTRY_T)*LOG_ENTRIES) ++ ++static void log_init(u32 bus_to_phys) ++{ ++ spin_lock_init(&log_lock); ++ sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, ++ GFP_KERNEL); ++ if (sdhost_log_buf) { ++ pr_err("sdhost: log_buf @ %p (%x)\n", ++ sdhost_log_buf, sdhost_log_addr); ++ timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); ++ if (!timer_base) ++ pr_err("sdhost: failed to remap timer\n"); ++ } ++ else ++ pr_err("sdhost: failed to allocate log buf\n"); ++} ++ ++static void log_event_impl(const char *event, u32 param1, u32 param2) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ entry = sdhost_log_buf + sdhost_log_idx; ++ memcpy(entry->event, event, 4); ++ entry->timestamp = (readl(timer_base + 4) & 0x3fffffff) + ++ (smp_processor_id()<<30); ++ entry->param1 = param1; ++ entry->param2 = param2; ++ sdhost_log_idx = (sdhost_log_idx + 1) % LOG_ENTRIES; ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++static void log_dump(void) ++{ ++ if (sdhost_log_buf) { ++ LOG_ENTRY_T *entry; ++ unsigned long flags; ++ int idx; ++ ++ spin_lock_irqsave(&log_lock, flags); ++ ++ idx = sdhost_log_idx; ++ do { ++ entry = sdhost_log_buf + idx; ++ if (entry->event[0] != '\0') ++ pr_err("[%08x] %.4s %x %x\n", ++ entry->timestamp, ++ entry->event, ++ entry->param1, ++ entry->param2); ++ idx = (idx + 1) % LOG_ENTRIES; ++ } while (idx != sdhost_log_idx); ++ ++ spin_unlock_irqrestore(&log_lock, flags); ++ } ++} ++ ++#define log_event(event, param1, param2) log_event_impl(event, param1, param2) ++ ++#else ++ ++#define log_init(x) (void)0 ++#define log_event(event, param1, param2) (void)0 ++#define log_dump() (void)0 ++ ++#endif + + static inline void bcm2835_sdhost_write(struct bcm2835_host *host, u32 val, int reg) + { +@@ -201,7 +317,7 @@ static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, + const char *label) + { + if (cmd) +- pr_info("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", ++ pr_err("%s:%c%s op %d arg 0x%x flags 0x%x - resp %08x %08x %08x %08x, err %d\n", + mmc_hostname(host->mmc), + (cmd == host->cmd) ? '>' : ' ', + label, cmd->opcode, cmd->arg, cmd->flags, +@@ -211,73 +327,74 @@ static void bcm2835_sdhost_dumpcmd(struct bcm2835_host *host, + + static void bcm2835_sdhost_dumpregs(struct bcm2835_host *host) + { +- bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); +- bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); +- if (host->mrq->data) +- pr_err("%s: data blocks %x blksz %x - err %d\n", +- mmc_hostname(host->mmc), +- host->mrq->data->blocks, +- host->mrq->data->blksz, +- host->mrq->data->error); +- bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ if (host->mrq) ++ { ++ bcm2835_sdhost_dumpcmd(host, host->mrq->sbc, "sbc"); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->cmd, "cmd"); ++ if (host->mrq->data) ++ pr_err("%s: data blocks %x blksz %x - err %d\n", ++ mmc_hostname(host->mmc), ++ host->mrq->data->blocks, ++ host->mrq->data->blksz, ++ host->mrq->data->error); ++ bcm2835_sdhost_dumpcmd(host, host->mrq->stop, "stop"); ++ } + +- pr_info("%s: =========== REGISTER DUMP ===========\n", ++ pr_err("%s: =========== REGISTER DUMP ===========\n", + mmc_hostname(host->mmc)); + +- pr_info("%s: SDCMD 0x%08x\n", ++ pr_err("%s: SDCMD 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDCMD)); +- pr_info("%s: SDARG 0x%08x\n", ++ pr_err("%s: SDARG 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDARG)); +- pr_info("%s: SDTOUT 0x%08x\n", ++ pr_err("%s: SDTOUT 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDTOUT)); +- pr_info("%s: SDCDIV 0x%08x\n", ++ pr_err("%s: SDCDIV 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDCDIV)); +- pr_info("%s: SDRSP0 0x%08x\n", ++ pr_err("%s: SDRSP0 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP0)); +- pr_info("%s: SDRSP1 0x%08x\n", ++ pr_err("%s: SDRSP1 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP1)); +- pr_info("%s: SDRSP2 0x%08x\n", ++ pr_err("%s: SDRSP2 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP2)); +- pr_info("%s: SDRSP3 0x%08x\n", ++ pr_err("%s: SDRSP3 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDRSP3)); +- pr_info("%s: SDHSTS 0x%08x\n", ++ pr_err("%s: SDHSTS 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHSTS)); +- pr_info("%s: SDVDD 0x%08x\n", ++ pr_err("%s: SDVDD 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDVDD)); +- pr_info("%s: SDEDM 0x%08x\n", ++ pr_err("%s: SDEDM 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDEDM)); +- pr_info("%s: SDHCFG 0x%08x\n", ++ pr_err("%s: SDHCFG 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHCFG)); +- pr_info("%s: SDHBCT 0x%08x\n", ++ pr_err("%s: SDHBCT 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHBCT)); +- pr_info("%s: SDHBLC 0x%08x\n", ++ pr_err("%s: SDHBLC 0x%08x\n", + mmc_hostname(host->mmc), + bcm2835_sdhost_read(host, SDHBLC)); + +- pr_info("%s: ===========================================\n", ++ pr_err("%s: ===========================================\n", + mmc_hostname(host->mmc)); + } + +- + static void bcm2835_sdhost_set_power(struct bcm2835_host *host, bool on) + { + bcm2835_sdhost_write(host, on ? 1 : 0, SDVDD); + } + +- + static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) + { + u32 temp; +@@ -300,26 +417,24 @@ static void bcm2835_sdhost_reset_internal(struct bcm2835_host *host) + temp = bcm2835_sdhost_read(host, SDEDM); + temp &= ~((SDEDM_THRESHOLD_MASK<clock = 0; +- host->sectors = 0; +- host->single_read_sectors[0] = ~0; + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + bcm2835_sdhost_write(host, host->cdiv, SDCDIV); + mmiowb(); + } + +- + static void bcm2835_sdhost_reset(struct mmc_host *mmc) + { + struct bcm2835_host *host = mmc_priv(mmc); + unsigned long flags; + spin_lock_irqsave(&host->lock, flags); ++ log_event("RST<", 0, 0); + + bcm2835_sdhost_reset_internal(host); + +@@ -344,82 +459,48 @@ static void bcm2835_sdhost_init(struct bcm2835_host *host, int soft) + } + } + +-static bool bcm2835_sdhost_is_write_complete(struct bcm2835_host *host) ++static void bcm2835_sdhost_wait_transfer_complete(struct bcm2835_host *host) + { +- bool write_complete = ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1); +- +- if (!write_complete) { +- /* Request an IRQ for the last block */ +- host->hcfg |= SDHCFG_BLOCK_IRPT_EN; +- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); +- if ((bcm2835_sdhost_read(host, SDEDM) & 0xf) == 1) { +- /* The write has now completed. Disable the interrupt +- and clear the status flag */ +- host->hcfg &= ~SDHCFG_BLOCK_IRPT_EN; +- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); +- bcm2835_sdhost_write(host, SDHSTS_BLOCK_IRPT, SDHSTS); +- write_complete = true; +- } +- } ++ int timediff; ++ u32 alternate_idle; ++ u32 edm; + +- return write_complete; +-} ++ alternate_idle = (host->mrq->data->flags & MMC_DATA_READ) ? ++ SDEDM_FSM_READWAIT : SDEDM_FSM_WRITESTART1; + +-static void bcm2835_sdhost_wait_write_complete(struct bcm2835_host *host) +-{ +- int timediff; +-#ifdef DEBUG +- static struct timeval start_time; +- static int max_stall_time = 0; +- static int total_stall_time = 0; +- struct timeval before, after; ++ edm = bcm2835_sdhost_read(host, SDEDM); + +- do_gettimeofday(&before); +- if (max_stall_time == 0) +- start_time = before; +-#endif ++ log_event("WTC<", edm, 0); + + timediff = 0; + + while (1) { +- u32 edm = bcm2835_sdhost_read(host, SDEDM); +- if ((edm & 0xf) == 1) ++ u32 fsm = edm & SDEDM_FSM_MASK; ++ if ((fsm == SDEDM_FSM_IDENTMODE) || ++ (fsm == SDEDM_FSM_DATAMODE)) + break; +- timediff++; +- if (timediff > 5000000) { +-#ifdef DEBUG +- do_gettimeofday(&after); +- timediff = (after.tv_sec - before.tv_sec)*1000000 + +- (after.tv_usec - before.tv_usec); ++ if (fsm == alternate_idle) { ++ bcm2835_sdhost_write(host, ++ edm | SDEDM_FORCE_DATA_MODE, ++ SDEDM); ++ break; ++ } + +- pr_err(" wait_write_complete - still waiting after %dus\n", +- timediff); +-#else +- pr_err(" wait_write_complete - still waiting after %d retries\n", ++ timediff++; ++ if (timediff == 100000) { ++ pr_err("%s: wait_transfer_complete - still waiting after %d retries\n", ++ mmc_hostname(host->mmc), + timediff); +-#endif ++ log_dump(); + bcm2835_sdhost_dumpregs(host); +- host->data->error = -ETIMEDOUT; ++ host->mrq->data->error = -ETIMEDOUT; ++ log_event("WTC!", edm, 0); + return; + } ++ cpu_relax(); ++ edm = bcm2835_sdhost_read(host, SDEDM); + } +- +-#ifdef DEBUG +- do_gettimeofday(&after); +- timediff = (after.tv_sec - before.tv_sec)*1000000 + (after.tv_usec - before.tv_usec); +- +- total_stall_time += timediff; +- if (timediff > max_stall_time) +- max_stall_time = timediff; +- +- if ((after.tv_sec - start_time.tv_sec) > 10) { +- pr_debug(" wait_write_complete - max wait %dus, total %dus\n", +- max_stall_time, total_stall_time); +- start_time = after; +- max_stall_time = 0; +- total_stall_time = 0; +- } +-#endif ++ log_event("WTC>", edm, 0); + } + + static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); +@@ -427,65 +508,44 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host); + static void bcm2835_sdhost_dma_complete(void *param) + { + struct bcm2835_host *host = param; +- struct dma_chan *dma_chan; ++ struct mmc_data *data = host->data; + unsigned long flags; +- u32 dir_data; + + spin_lock_irqsave(&host->lock, flags); ++ log_event("DMA<", (u32)host->data, bcm2835_sdhost_read(host, SDHSTS)); ++ log_event("DMA ", bcm2835_sdhost_read(host, SDCMD), ++ bcm2835_sdhost_read(host, SDEDM)); + +- if (host->data) { +- bool write_complete; +- if (USE_BLOCK_IRQ) +- write_complete = bcm2835_sdhost_is_write_complete(host); +- else { +- bcm2835_sdhost_wait_write_complete(host); +- write_complete = true; +- } +- pr_debug("dma_complete() - write_complete=%d\n", +- write_complete); +- +- if (write_complete || (host->data->flags & MMC_DATA_READ)) +- { +- if (write_complete) { +- dma_chan = host->dma_chan_tx; +- dir_data = DMA_TO_DEVICE; +- } else { +- dma_chan = host->dma_chan_rx; +- dir_data = DMA_FROM_DEVICE; +- } +- +- dma_unmap_sg(dma_chan->device->dev, +- host->data->sg, host->data->sg_len, +- dir_data); ++ if (host->dma_chan) { ++ dma_unmap_sg(host->dma_chan->device->dev, ++ data->sg, data->sg_len, ++ host->dma_dir); + +- bcm2835_sdhost_finish_data(host); +- } ++ host->dma_chan = NULL; + } + +- spin_unlock_irqrestore(&host->lock, flags); +-} ++ if (host->drain_words) { ++ void *page; ++ u32 *buf; + +-static bool data_transfer_wait(struct bcm2835_host *host) +-{ +- unsigned long timeout = 1000000; +- while (timeout) +- { +- u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); +- if (sdhsts & SDHSTS_DATA_FLAG) { +- bcm2835_sdhost_write(host, SDHSTS_DATA_FLAG, SDHSTS); +- break; ++ page = kmap_atomic(host->drain_page); ++ buf = page + host->drain_offset; ++ ++ while (host->drain_words) { ++ u32 edm = bcm2835_sdhost_read(host, SDEDM); ++ if ((edm >> 4) & 0x1f) ++ *(buf++) = bcm2835_sdhost_read(host, ++ SDDATA); ++ host->drain_words--; + } +- timeout--; +- } +- if (timeout == 0) { +- pr_err("%s: Data %s timeout\n", +- mmc_hostname(host->mmc), +- (host->data->flags & MMC_DATA_READ) ? "read" : "write"); +- bcm2835_sdhost_dumpregs(host); +- host->data->error = -ETIMEDOUT; +- return false; ++ ++ kunmap_atomic(page); + } +- return true; ++ ++ bcm2835_sdhost_finish_data(host); ++ ++ log_event("DMA>", (u32)host->data, 0); ++ spin_unlock_irqrestore(&host->lock, flags); + } + + static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) +@@ -493,32 +553,83 @@ static void bcm2835_sdhost_read_block_pio(struct bcm2835_host *host) + unsigned long flags; + size_t blksize, len; + u32 *buf; ++ unsigned long wait_max; + + blksize = host->data->blksz; + ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ + local_irq_save(flags); + + while (blksize) { +- if (!sg_miter_next(&host->sg_miter)) +- BUG(); ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } + + len = min(host->sg_miter.length, blksize); +- BUG_ON(len % 4); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } + + blksize -= len; + host->sg_miter.consumed = len; + + buf = (u32 *)host->sg_miter.addr; + +- while (len) { +- if (!data_transfer_wait(host)) +- break; ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_READDATA) && ++ (fsm_state != SDEDM_FSM_READWAIT) && ++ (fsm_state != SDEDM_FSM_READCRC)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO read timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; + +- *(buf++) = bcm2835_sdhost_read(host, SDDATA); +- len -= 4; ++ while (words) { ++ *(buf++) = bcm2835_sdhost_read(host, SDDATA); ++ words--; ++ } + } + +- if (host->data->error) ++ if (hsts & SDHSTS_ERROR_MASK) + break; + } + +@@ -532,32 +643,83 @@ static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) + unsigned long flags; + size_t blksize, len; + u32 *buf; ++ unsigned long wait_max; + + blksize = host->data->blksz; + ++ wait_max = jiffies + msecs_to_jiffies(host->pio_timeout); ++ + local_irq_save(flags); + + while (blksize) { +- if (!sg_miter_next(&host->sg_miter)) +- BUG(); ++ int copy_words; ++ u32 hsts = 0; ++ ++ if (!sg_miter_next(&host->sg_miter)) { ++ host->data->error = -EINVAL; ++ break; ++ } + + len = min(host->sg_miter.length, blksize); +- BUG_ON(len % 4); ++ if (len % 4) { ++ host->data->error = -EINVAL; ++ break; ++ } + + blksize -= len; + host->sg_miter.consumed = len; + +- buf = host->sg_miter.addr; ++ buf = (u32 *)host->sg_miter.addr; + +- while (len) { +- if (!data_transfer_wait(host)) +- break; ++ copy_words = len/4; ++ ++ while (copy_words) { ++ int burst_words, words; ++ u32 edm; ++ ++ burst_words = SDDATA_FIFO_PIO_BURST; ++ if (burst_words > copy_words) ++ burst_words = copy_words; ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ words = SDDATA_FIFO_WORDS - ((edm >> 4) & 0x1f); ++ ++ if (words < burst_words) { ++ int fsm_state = (edm & SDEDM_FSM_MASK); ++ if ((fsm_state != SDEDM_FSM_WRITEDATA) && ++ (fsm_state != SDEDM_FSM_WRITESTART1) && ++ (fsm_state != SDEDM_FSM_WRITESTART2)) { ++ hsts = bcm2835_sdhost_read(host, ++ SDHSTS); ++ pr_err("%s: fsm %x, hsts %x\n", ++ mmc_hostname(host->mmc), ++ fsm_state, hsts); ++ if (hsts & SDHSTS_ERROR_MASK) ++ break; ++ } ++ ++ if (time_after(jiffies, wait_max)) { ++ pr_err("%s: PIO write timeout - EDM %x\n", ++ mmc_hostname(host->mmc), ++ edm); ++ hsts = SDHSTS_REW_TIME_OUT; ++ break; ++ } ++ ndelay((burst_words - words) * ++ host->ns_per_fifo_word); ++ continue; ++ } else if (words > copy_words) { ++ words = copy_words; ++ } ++ ++ copy_words -= words; + +- bcm2835_sdhost_write(host, *(buf++), SDDATA); +- len -= 4; ++ while (words) { ++ bcm2835_sdhost_write(host, *(buf++), SDDATA); ++ words--; ++ } + } + +- if (host->data->error) ++ if (hsts & SDHSTS_ERROR_MASK) + break; + } + +@@ -566,12 +728,12 @@ static void bcm2835_sdhost_write_block_pio(struct bcm2835_host *host) + local_irq_restore(flags); + } + +- + static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) + { + u32 sdhsts; + bool is_read; + BUG_ON(!host->data); ++ log_event("XFP<", (u32)host->data, host->blocks); + + is_read = (host->data->flags & MMC_DATA_READ) != 0; + if (is_read) +@@ -595,28 +757,21 @@ static void bcm2835_sdhost_transfer_pio(struct bcm2835_host *host) + is_read ? "read" : "write", + sdhsts); + host->data->error = -ETIMEDOUT; +- } else if (!is_read && !host->data->error) { +- /* Start a timer in case a transfer error occurs because +- there is no error interrupt */ +- mod_timer(&host->pio_timer, jiffies + host->pio_timeout); + } ++ log_event("XFP>", (u32)host->data, host->blocks); + } + +- +-static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) ++static void bcm2835_sdhost_prepare_dma(struct bcm2835_host *host, ++ struct mmc_data *data) + { +- u32 len, dir_data, dir_slave; ++ int len, dir_data, dir_slave; + struct dma_async_tx_descriptor *desc = NULL; + struct dma_chan *dma_chan; + +- pr_debug("bcm2835_sdhost_transfer_dma()\n"); +- +- WARN_ON(!host->data); +- +- if (!host->data) +- return; ++ log_event("PRD<", (u32)data, 0); ++ pr_debug("bcm2835_sdhost_prepare_dma()\n"); + +- if (host->data->flags & MMC_DATA_READ) { ++ if (data->flags & MMC_DATA_READ) { + dma_chan = host->dma_chan_rx; + dir_data = DMA_FROM_DEVICE; + dir_slave = DMA_DEV_TO_MEM; +@@ -625,35 +780,71 @@ static void bcm2835_sdhost_transfer_dma(struct bcm2835_host *host) + dir_data = DMA_TO_DEVICE; + dir_slave = DMA_MEM_TO_DEV; + } ++ log_event("PRD1", (u32)dma_chan, 0); + + BUG_ON(!dma_chan->device); + BUG_ON(!dma_chan->device->dev); +- BUG_ON(!host->data->sg); ++ BUG_ON(!data->sg); ++ ++ /* The block doesn't manage the FIFO DREQs properly for multi-block ++ transfers, so don't attempt to DMA the final few words. ++ Unfortunately this requires the final sg entry to be trimmed. ++ N.B. This code demands that the overspill is contained in ++ a single sg entry. ++ */ ++ ++ host->drain_words = 0; ++ if ((data->blocks > 1) && (dir_data == DMA_FROM_DEVICE)) { ++ struct scatterlist *sg; ++ u32 len; ++ int i; ++ ++ len = min((u32)(FIFO_READ_THRESHOLD - 1) * 4, ++ (u32)data->blocks * data->blksz); + +- len = dma_map_sg(dma_chan->device->dev, host->data->sg, +- host->data->sg_len, dir_data); +- if (len > 0) { +- desc = dmaengine_prep_slave_sg(dma_chan, host->data->sg, ++ for_each_sg(data->sg, sg, data->sg_len, i) { ++ if (sg_is_last(sg)) { ++ BUG_ON(sg->length < len); ++ sg->length -= len; ++ host->drain_page = (struct page *)sg->page_link; ++ host->drain_offset = sg->offset + sg->length; ++ } ++ } ++ host->drain_words = len/4; ++ } ++ ++ len = dma_map_sg(dma_chan->device->dev, data->sg, data->sg_len, ++ dir_data); ++ ++ log_event("PRD2", len, 0); ++ if (len > 0) ++ desc = dmaengine_prep_slave_sg(dma_chan, data->sg, + len, dir_slave, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); +- } else { +- dev_err(mmc_dev(host->mmc), "dma_map_sg returned zero length\n"); +- } ++ log_event("PRD3", (u32)desc, 0); ++ + if (desc) { + desc->callback = bcm2835_sdhost_dma_complete; + desc->callback_param = host; +- dmaengine_submit(desc); +- dma_async_issue_pending(dma_chan); ++ host->dma_desc = desc; ++ host->dma_chan = dma_chan; ++ host->dma_dir = dir_data; + } +- ++ log_event("PDM>", (u32)data, 0); + } + ++static void bcm2835_sdhost_start_dma(struct bcm2835_host *host) ++{ ++ log_event("SDMA", (u32)host->data, (u32)host->dma_chan); ++ dmaengine_submit(host->dma_desc); ++ dma_async_issue_pending(host->dma_chan); ++} + + static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) + { + u32 all_irqs = SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN | + SDHCFG_BUSY_IRPT_EN; +- if (host->use_dma) ++ if (host->dma_desc) + host->hcfg = (host->hcfg & ~all_irqs) | + SDHCFG_BUSY_IRPT_EN; + else +@@ -664,13 +855,13 @@ static void bcm2835_sdhost_set_transfer_irqs(struct bcm2835_host *host) + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + } + +- + static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_command *cmd) + { + struct mmc_data *data = cmd->data; + + WARN_ON(host->data); + ++ host->data = data; + if (!data) + return; + +@@ -679,46 +870,19 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co + BUG_ON(data->blksz > host->mmc->max_blk_size); + BUG_ON(data->blocks > 65535); + +- host->data = data; + host->data_complete = 0; + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + +- if (!host->sectors && host->mmc->card && !(host->debug_flags & 1)) +- { +- struct mmc_card *card = host->mmc->card; +- if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { +- /* +- * The EXT_CSD sector count is in number of 512 byte +- * sectors. +- */ +- host->sectors = card->ext_csd.sectors; +- pr_err("%s: using ext_csd!\n", mmc_hostname(host->mmc)); +- } else { +- /* +- * The CSD capacity field is in units of read_blkbits. +- * set_capacity takes units of 512 bytes. +- */ +- host->sectors = card->csd.capacity << +- (card->csd.read_blkbits - 9); +- } +- host->single_read_sectors[0] = host->sectors - 65; +- host->single_read_sectors[1] = host->sectors - 64; +- host->single_read_sectors[2] = host->sectors - 33; +- host->single_read_sectors[3] = host->sectors - 32; +- host->single_read_sectors[4] = host->sectors - 1; +- host->single_read_sectors[5] = ~0; /* Safety net */ +- } + +- host->use_dma = host->have_dma && (data->blocks > host->pio_limit); +- if (!host->use_dma) { ++ if (!host->dma_desc) { ++ /* Use PIO */ + int flags; + +- flags = SG_MITER_ATOMIC; + if (data->flags & MMC_DATA_READ) +- flags |= SG_MITER_TO_SG; ++ flags = SG_MITER_TO_SG; + else +- flags |= SG_MITER_FROM_SG; ++ flags = SG_MITER_FROM_SG; + sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); + host->blocks = data->blocks; + } +@@ -726,19 +890,20 @@ 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, host->use_dma ? data->blocks : 0, SDHBLC); ++ bcm2835_sdhost_write(host, data->blocks, SDHBLC); + + BUG_ON(!host->data); + } + +- +-void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command *cmd) ++bool bcm2835_sdhost_send_command(struct bcm2835_host *host, ++ struct mmc_command *cmd) + { + u32 sdcmd, sdhsts; + unsigned long timeout; + int delay; + + WARN_ON(host->cmd); ++ log_event("CMD<", cmd->opcode, cmd->arg); + + if (cmd->data) + pr_debug("%s: send_command %d 0x%x " +@@ -761,9 +926,9 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * + pr_err("%s: previous command never completed.\n", + mmc_hostname(host->mmc)); + bcm2835_sdhost_dumpregs(host); +- cmd->error = -EIO; ++ cmd->error = -EILSEQ; + tasklet_schedule(&host->finish_tasklet); +- return; ++ return false; + } + timeout--; + udelay(10); +@@ -791,23 +956,24 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * + if (sdhsts & SDHSTS_ERROR_MASK) + bcm2835_sdhost_write(host, sdhsts, SDHSTS); + +- bcm2835_sdhost_prepare_data(host, cmd); +- +- bcm2835_sdhost_write(host, cmd->arg, SDARG); +- + if ((cmd->flags & MMC_RSP_136) && (cmd->flags & MMC_RSP_BUSY)) { + pr_err("%s: unsupported response type!\n", + mmc_hostname(host->mmc)); + cmd->error = -EINVAL; + tasklet_schedule(&host->finish_tasklet); +- return; ++ return false; + } + ++ bcm2835_sdhost_prepare_data(host, cmd); ++ ++ bcm2835_sdhost_write(host, cmd->arg, SDARG); ++ + sdcmd = cmd->opcode & SDCMD_CMD_MASK; + +- if (!(cmd->flags & MMC_RSP_PRESENT)) ++ host->use_busy = 0; ++ if (!(cmd->flags & MMC_RSP_PRESENT)) { + sdcmd |= SDCMD_NO_RESPONSE; +- else { ++ } else { + if (cmd->flags & MMC_RSP_136) + sdcmd |= SDCMD_LONG_RESPONSE; + if (cmd->flags & MMC_RSP_BUSY) { +@@ -817,6 +983,7 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * + } + + if (cmd->data) { ++ log_event("CMDD", cmd->data->blocks, cmd->data->blksz); + if (host->delay_after_stop) { + struct timeval now; + int time_since_stop; +@@ -839,10 +1006,12 @@ void bcm2835_sdhost_send_command(struct bcm2835_host *host, struct mmc_command * + } + + bcm2835_sdhost_write(host, sdcmd | SDCMD_NEW_FLAG, SDCMD); +-} + ++ return true; ++} + +-static void bcm2835_sdhost_finish_command(struct bcm2835_host *host); ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags); + static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host); + + static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) +@@ -852,6 +1021,7 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) + data = host->data; + BUG_ON(!data); + ++ log_event("FDA<", (u32)host->mrq, (u32)host->cmd); + pr_debug("finish_data(error %d, stop %d, sbc %d)\n", + data->error, data->stop ? 1 : 0, + host->mrq->sbc ? 1 : 0); +@@ -859,10 +1029,7 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) + host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); + bcm2835_sdhost_write(host, host->hcfg, SDHCFG); + +- if (data->error) { +- data->bytes_xfered = 0; +- } else +- data->bytes_xfered = data->blksz * data->blocks; ++ data->bytes_xfered = data->error ? 0 : (data->blksz * data->blocks); + + host->data_complete = 1; + +@@ -877,9 +1044,9 @@ static void bcm2835_sdhost_finish_data(struct bcm2835_host *host) + } + else + bcm2835_sdhost_transfer_complete(host); ++ log_event("FDA>", (u32)host->mrq, (u32)host->cmd); + } + +- + static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) + { + struct mmc_data *data; +@@ -891,6 +1058,7 @@ static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) + data = host->data; + host->data = NULL; + ++ log_event("TCM<", (u32)data, data->error); + pr_debug("transfer_complete(error %d, stop %d)\n", + data->error, data->stop ? 1 : 0); + +@@ -899,88 +1067,114 @@ static void bcm2835_sdhost_transfer_complete(struct bcm2835_host *host) + * a) open-ended multiblock transfer (no CMD23) + * b) error in multiblock transfer + */ +- if (data->stop && +- (data->error || +- !host->mrq->sbc)) { +- host->flush_fifo = 1; +- bcm2835_sdhost_send_command(host, data->stop); +- if (host->delay_after_stop) +- do_gettimeofday(&host->stop_time); +- if (!host->use_busy) +- bcm2835_sdhost_finish_command(host); ++ if (host->mrq->stop && (data->error || !host->use_sbc)) { ++ if (bcm2835_sdhost_send_command(host, host->mrq->stop)) { ++ /* No busy, so poll for completion */ ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ ++ if (host->delay_after_stop) ++ do_gettimeofday(&host->stop_time); ++ } + } else { ++ bcm2835_sdhost_wait_transfer_complete(host); + tasklet_schedule(&host->finish_tasklet); + } ++ log_event("TCM>", (u32)data, 0); + } + +-static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) ++/* If irq_flags is valid, the caller is in a thread context and is allowed ++ to sleep */ ++static void bcm2835_sdhost_finish_command(struct bcm2835_host *host, ++ unsigned long *irq_flags) + { + u32 sdcmd; +- unsigned long timeout; ++ u32 retries; + #ifdef DEBUG + struct timeval before, after; + int timediff = 0; + #endif + ++ log_event("FCM<", (u32)host->mrq, (u32)host->cmd); + pr_debug("finish_command(%x)\n", bcm2835_sdhost_read(host, SDCMD)); + + BUG_ON(!host->cmd || !host->mrq); + +-#ifdef DEBUG +- do_gettimeofday(&before); +-#endif +- /* Wait max 100 ms */ +- timeout = 10000; ++ /* Poll quickly at first */ ++ ++ retries = host->cmd_quick_poll_retries; ++ if (!retries) { ++ /* Work out how many polls take 1us by timing 10us */ ++ struct timeval start, now; ++ int us_diff; ++ ++ retries = 1; ++ do { ++ int i; ++ ++ retries *= 2; ++ ++ do_gettimeofday(&start); ++ ++ for (i = 0; i < retries; i++) { ++ cpu_relax(); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ } ++ ++ do_gettimeofday(&now); ++ us_diff = (now.tv_sec - start.tv_sec) * 1000000 + ++ (now.tv_usec - start.tv_usec); ++ } while (us_diff < 10); ++ ++ host->cmd_quick_poll_retries = ((retries * us_diff + 9)*CMD_DALLY_US)/10 + 1; ++ retries = 1; // We've already waited long enough this time ++ } ++ ++ retries = host->cmd_quick_poll_retries; + for (sdcmd = bcm2835_sdhost_read(host, SDCMD); +- (sdcmd & SDCMD_NEW_FLAG) && timeout; +- timeout--) { +- if (host->flush_fifo) { +- while (bcm2835_sdhost_read(host, SDHSTS) & +- SDHSTS_DATA_FLAG) +- (void)bcm2835_sdhost_read(host, SDDATA); +- } +- udelay(10); ++ (sdcmd & SDCMD_NEW_FLAG) && !(sdcmd & SDCMD_FAIL_FLAG) && retries; ++ retries--) { ++ cpu_relax(); + sdcmd = bcm2835_sdhost_read(host, SDCMD); + } +-#ifdef DEBUG +- do_gettimeofday(&after); +- timediff = (after.tv_sec - before.tv_sec)*1000000 + +- (after.tv_usec - before.tv_usec); + +- pr_debug(" finish_command - waited %dus\n", timediff); +-#endif ++ if (!retries) { ++ unsigned long wait_max; ++ ++ if (!irq_flags) { ++ /* Schedule the work */ ++ log_event("CWWQ", 0, 0); ++ schedule_work(&host->cmd_wait_wq); ++ return; ++ } ++ ++ /* Wait max 100 ms */ ++ wait_max = jiffies + msecs_to_jiffies(100); ++ while (time_before(jiffies, wait_max)) { ++ spin_unlock_irqrestore(&host->lock, *irq_flags); ++ usleep_range(1, 10); ++ spin_lock_irqsave(&host->lock, *irq_flags); ++ sdcmd = bcm2835_sdhost_read(host, SDCMD); ++ if (!(sdcmd & SDCMD_NEW_FLAG) || ++ (sdcmd & SDCMD_FAIL_FLAG)) ++ break; ++ } ++ } + +- if (timeout == 0) { ++ /* Check for errors */ ++ if (sdcmd & SDCMD_NEW_FLAG) { + pr_err("%s: command never completed.\n", + mmc_hostname(host->mmc)); + bcm2835_sdhost_dumpregs(host); + host->cmd->error = -EIO; + tasklet_schedule(&host->finish_tasklet); + return; +- } +- +- if (host->flush_fifo) { +- for (timeout = 100; +- (bcm2835_sdhost_read(host, SDHSTS) & SDHSTS_DATA_FLAG) && timeout; +- timeout--) { +- (void)bcm2835_sdhost_read(host, SDDATA); +- } +- host->flush_fifo = 0; +- if (timeout == 0) { +- pr_err("%s: FIFO never drained.\n", +- mmc_hostname(host->mmc)); +- bcm2835_sdhost_dumpregs(host); +- host->cmd->error = -EIO; +- tasklet_schedule(&host->finish_tasklet); +- return; +- } +- } +- +- /* Check for errors */ +- if (sdcmd & SDCMD_FAIL_FLAG) +- { ++ } else if (sdcmd & SDCMD_FAIL_FLAG) { + u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); + ++ /* Clear the errors */ ++ bcm2835_sdhost_write(host, SDHSTS_ERROR_MASK, SDHSTS); ++ + if (host->debug) + pr_info("%s: error detected - CMD %x, HSTS %03x, EDM %x\n", + mmc_hostname(host->mmc), sdcmd, sdhsts, +@@ -1003,7 +1197,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + mmc_hostname(host->mmc), + host->cmd->opcode); + bcm2835_sdhost_dumpregs(host); +- host->cmd->error = -EIO; ++ host->cmd->error = -EILSEQ; + } + tasklet_schedule(&host->finish_tasklet); + return; +@@ -1018,31 +1212,31 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + pr_debug("%s: finish_command %08x %08x %08x %08x\n", + mmc_hostname(host->mmc), + host->cmd->resp[0], host->cmd->resp[1], host->cmd->resp[2], host->cmd->resp[3]); ++ log_event("RSP ", host->cmd->resp[0], host->cmd->resp[1]); + } else { + host->cmd->resp[0] = bcm2835_sdhost_read(host, SDRSP0); + pr_debug("%s: finish_command %08x\n", + mmc_hostname(host->mmc), + host->cmd->resp[0]); ++ log_event("RSP ", host->cmd->resp[0], 0); + } + } + +- host->cmd->error = 0; +- + if (host->cmd == host->mrq->sbc) { + /* Finished CMD23, now send actual command. */ + host->cmd = NULL; +- bcm2835_sdhost_send_command(host, host->mrq->cmd); +- +- if (host->cmd->data && host->use_dma) +- /* DMA transfer starts now, PIO starts after irq */ +- bcm2835_sdhost_transfer_dma(host); ++ if (bcm2835_sdhost_send_command(host, host->mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); + +- if (!host->use_busy) +- bcm2835_sdhost_finish_command(host); +- } else if (host->cmd == host->mrq->stop) ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, NULL); ++ } ++ } else if (host->cmd == host->mrq->stop) { + /* Finished CMD12 */ + tasklet_schedule(&host->finish_tasklet); +- else { ++ } else { + /* Processed actual command. */ + host->cmd = NULL; + if (!host->data) +@@ -1050,6 +1244,7 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + else if (host->data_complete) + bcm2835_sdhost_transfer_complete(host); + } ++ log_event("FCM>", (u32)host->mrq, (u32)host->cmd); + } + + static void bcm2835_sdhost_timeout(unsigned long data) +@@ -1060,10 +1255,12 @@ static void bcm2835_sdhost_timeout(unsigned long data) + host = (struct bcm2835_host *)data; + + spin_lock_irqsave(&host->lock, flags); ++ log_event("TIM<", 0, 0); + + if (host->mrq) { + pr_err("%s: timeout waiting for hardware interrupt.\n", + mmc_hostname(host->mmc)); ++ log_dump(); + bcm2835_sdhost_dumpregs(host); + + if (host->data) { +@@ -1084,74 +1281,15 @@ static void bcm2835_sdhost_timeout(unsigned long data) + spin_unlock_irqrestore(&host->lock, flags); + } + +-static void bcm2835_sdhost_pio_timeout(unsigned long data) ++static void bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) + { +- struct bcm2835_host *host; +- unsigned long flags; +- +- host = (struct bcm2835_host *)data; +- +- spin_lock_irqsave(&host->lock, flags); +- +- if (host->data) { +- u32 sdhsts = bcm2835_sdhost_read(host, SDHSTS); +- +- if (sdhsts & SDHSTS_REW_TIME_OUT) { +- pr_err("%s: transfer timeout\n", +- mmc_hostname(host->mmc)); +- if (host->debug) +- bcm2835_sdhost_dumpregs(host); +- } else { +- pr_err("%s: unexpected transfer timeout\n", +- mmc_hostname(host->mmc)); +- bcm2835_sdhost_dumpregs(host); +- } +- +- bcm2835_sdhost_write(host, SDHSTS_TRANSFER_ERROR_MASK, +- SDHSTS); +- +- host->data->error = -ETIMEDOUT; +- +- bcm2835_sdhost_finish_data(host); +- } +- +- mmiowb(); +- spin_unlock_irqrestore(&host->lock, flags); +-} +- +-static void bcm2835_sdhost_enable_sdio_irq_nolock(struct bcm2835_host *host, int enable) +-{ +- if (enable) +- host->hcfg |= SDHCFG_SDIO_IRPT_EN; +- else +- host->hcfg &= ~SDHCFG_SDIO_IRPT_EN; +- bcm2835_sdhost_write(host, host->hcfg, SDHCFG); +- mmiowb(); +-} +- +-static void bcm2835_sdhost_enable_sdio_irq(struct mmc_host *mmc, int enable) +-{ +- struct bcm2835_host *host = mmc_priv(mmc); +- unsigned long flags; +- +- pr_debug("%s: enable_sdio_irq(%d)\n", mmc_hostname(mmc), enable); +- spin_lock_irqsave(&host->lock, flags); +- bcm2835_sdhost_enable_sdio_irq_nolock(host, enable); +- spin_unlock_irqrestore(&host->lock, flags); +-} +- +-static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) +-{ +- const u32 handled = (SDHSTS_REW_TIME_OUT | SDHSTS_CMD_TIME_OUT | +- SDHSTS_CRC16_ERROR | SDHSTS_CRC7_ERROR | +- SDHSTS_FIFO_ERROR); +- ++ log_event("IRQB", (u32)host->cmd, intmask); + if (!host->cmd) { + pr_err("%s: got command busy interrupt 0x%08x even " + "though no command operation was in progress.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); +- return 0; ++ return; + } + + if (!host->use_busy) { +@@ -1159,7 +1297,7 @@ static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) + "though not expecting one.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); +- return 0; ++ return; + } + host->use_busy = 0; + +@@ -1182,28 +1320,23 @@ static u32 bcm2835_sdhost_busy_irq(struct bcm2835_host *host, u32 intmask) + } else if (intmask & SDHSTS_CMD_TIME_OUT) + host->cmd->error = -ETIMEDOUT; + ++ log_dump(); + bcm2835_sdhost_dumpregs(host); +- tasklet_schedule(&host->finish_tasklet); + } + else +- bcm2835_sdhost_finish_command(host); +- +- return handled; ++ bcm2835_sdhost_finish_command(host, NULL); + } + +-static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) + { +- const u32 handled = (SDHSTS_REW_TIME_OUT | +- SDHSTS_CRC16_ERROR | +- SDHSTS_FIFO_ERROR); +- + /* There are no dedicated data/space available interrupt + status bits, so it is necessary to use the single shared + data/space available FIFO status bits. It is therefore not + an error to get here when there is no data transfer in + progress. */ ++ log_event("IRQD", (u32)host->data, intmask); + if (!host->data) +- return 0; ++ return; + + if (intmask & (SDHSTS_CRC16_ERROR | + SDHSTS_FIFO_ERROR | +@@ -1214,46 +1347,37 @@ static u32 bcm2835_sdhost_data_irq(struct bcm2835_host *host, u32 intmask) + else + host->data->error = -ETIMEDOUT; + +- bcm2835_sdhost_dumpregs(host); +- tasklet_schedule(&host->finish_tasklet); +- return handled; ++ if (host->debug) { ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ } + } + +- /* Use the block interrupt for writes after the first block */ +- if (host->data->flags & MMC_DATA_WRITE) { ++ if (host->data->error) { ++ bcm2835_sdhost_finish_data(host); ++ } else if (host->data->flags & MMC_DATA_WRITE) { ++ /* Use the block interrupt for writes after the first block */ + 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); +- else +- bcm2835_sdhost_transfer_pio(host); ++ bcm2835_sdhost_transfer_pio(host); + } else { +- if (!host->data->error) { +- bcm2835_sdhost_transfer_pio(host); +- host->blocks--; +- } ++ bcm2835_sdhost_transfer_pio(host); ++ host->blocks--; + if ((host->blocks == 0) || host->data->error) + bcm2835_sdhost_finish_data(host); + } +- +- return handled; + } + +-static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) ++static void bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) + { +- struct dma_chan *dma_chan; +- u32 dir_data; +- const u32 handled = (SDHSTS_REW_TIME_OUT | +- SDHSTS_CRC16_ERROR | +- SDHSTS_FIFO_ERROR); +- ++ log_event("IRQK", (u32)host->data, intmask); + if (!host->data) { + pr_err("%s: got block interrupt 0x%08x even " + "though no data operation was in progress.\n", + mmc_hostname(host->mmc), (unsigned)intmask); + bcm2835_sdhost_dumpregs(host); +- return handled; ++ return; + } + + if (intmask & (SDHSTS_CRC16_ERROR | +@@ -1265,149 +1389,69 @@ static u32 bcm2835_sdhost_block_irq(struct bcm2835_host *host, u32 intmask) + else + host->data->error = -ETIMEDOUT; + +- if (host->debug) ++ if (host->debug) { ++ log_dump(); + bcm2835_sdhost_dumpregs(host); +- tasklet_schedule(&host->finish_tasklet); +- return handled; ++ } + } + +- if (!host->use_dma) { ++ if (!host->dma_desc) { + BUG_ON(!host->blocks); +- host->blocks--; +- if ((host->blocks == 0) || host->data->error) { +- /* Cancel the timer */ +- del_timer(&host->pio_timer); +- ++ if (host->data->error || (--host->blocks == 0)) { + bcm2835_sdhost_finish_data(host); + } else { +- /* Reset the timer */ +- mod_timer(&host->pio_timer, +- jiffies + host->pio_timeout); +- + bcm2835_sdhost_transfer_pio(host); +- +- /* Reset the timer */ +- mod_timer(&host->pio_timer, +- jiffies + host->pio_timeout); + } + } else if (host->data->flags & MMC_DATA_WRITE) { +- dma_chan = host->dma_chan_tx; +- dir_data = DMA_TO_DEVICE; +- dma_unmap_sg(dma_chan->device->dev, +- host->data->sg, host->data->sg_len, +- dir_data); +- + bcm2835_sdhost_finish_data(host); + } +- +- return handled; + } + +- + static irqreturn_t bcm2835_sdhost_irq(int irq, void *dev_id) + { + irqreturn_t result = IRQ_NONE; + struct bcm2835_host *host = dev_id; +- u32 unexpected = 0, early = 0; +- int loops = 0; ++ u32 intmask; + + spin_lock(&host->lock); + +- for (loops = 0; loops < 1; loops++) { +- u32 intmask, handled; +- +- intmask = bcm2835_sdhost_read(host, SDHSTS); +- handled = intmask & (SDHSTS_BUSY_IRPT | +- SDHSTS_BLOCK_IRPT | +- SDHSTS_SDIO_IRPT | +- SDHSTS_DATA_FLAG); +- if ((handled == SDHSTS_DATA_FLAG) && +- (loops == 0) && !host->data) { +- pr_err("%s: sdhost_irq data interrupt 0x%08x even " +- "though no data operation was in progress.\n", +- mmc_hostname(host->mmc), +- (unsigned)intmask); +- +- bcm2835_sdhost_dumpregs(host); +- } +- +- if (!handled) +- break; ++ intmask = bcm2835_sdhost_read(host, SDHSTS); ++ log_event("IRQ<", intmask, 0); + +- if (loops) +- early |= handled; ++ bcm2835_sdhost_write(host, ++ SDHSTS_BUSY_IRPT | ++ SDHSTS_BLOCK_IRPT | ++ SDHSTS_SDIO_IRPT | ++ SDHSTS_DATA_FLAG, ++ SDHSTS); + ++ if (intmask & SDHSTS_BLOCK_IRPT) { ++ bcm2835_sdhost_block_irq(host, intmask); + result = IRQ_HANDLED; ++ } + +- /* Clear all interrupts and notifications */ +- bcm2835_sdhost_write(host, intmask, SDHSTS); +- +- if (intmask & SDHSTS_BUSY_IRPT) +- handled |= bcm2835_sdhost_busy_irq(host, intmask); +- +- /* There is no true data interrupt status bit, so it is +- necessary to qualify the data flag with the interrupt +- enable bit */ +- if ((intmask & SDHSTS_DATA_FLAG) && +- (host->hcfg & SDHCFG_DATA_IRPT_EN)) +- handled |= bcm2835_sdhost_data_irq(host, intmask); +- +- if (intmask & SDHSTS_BLOCK_IRPT) +- handled |= bcm2835_sdhost_block_irq(host, intmask); +- +- if (intmask & SDHSTS_SDIO_IRPT) { +- bcm2835_sdhost_enable_sdio_irq_nolock(host, false); +- host->thread_isr |= SDHSTS_SDIO_IRPT; +- result = IRQ_WAKE_THREAD; +- } ++ if (intmask & SDHSTS_BUSY_IRPT) { ++ bcm2835_sdhost_busy_irq(host, intmask); ++ result = IRQ_HANDLED; ++ } + +- unexpected |= (intmask & ~handled); ++ /* There is no true data interrupt status bit, so it is ++ necessary to qualify the data flag with the interrupt ++ enable bit */ ++ if ((intmask & SDHSTS_DATA_FLAG) && ++ (host->hcfg & SDHCFG_DATA_IRPT_EN)) { ++ bcm2835_sdhost_data_irq(host, intmask); ++ result = IRQ_HANDLED; + } + + mmiowb(); + ++ log_event("IRQ>", bcm2835_sdhost_read(host, SDHSTS), 0); + spin_unlock(&host->lock); + +- if (early) +- pr_debug("%s: early %x (loops %d)\n", +- mmc_hostname(host->mmc), early, loops); +- +- if (unexpected) { +- pr_err("%s: unexpected interrupt 0x%08x.\n", +- mmc_hostname(host->mmc), unexpected); +- bcm2835_sdhost_dumpregs(host); +- } +- + return result; + } + +-static irqreturn_t bcm2835_sdhost_thread_irq(int irq, void *dev_id) +-{ +- struct bcm2835_host *host = dev_id; +- unsigned long flags; +- u32 isr; +- +- spin_lock_irqsave(&host->lock, flags); +- isr = host->thread_isr; +- host->thread_isr = 0; +- spin_unlock_irqrestore(&host->lock, flags); +- +- if (isr & SDHSTS_SDIO_IRPT) { +- sdio_run_irqs(host->mmc); +- +-/* Is this necessary? Why re-enable an interrupt which is enabled? +- spin_lock_irqsave(&host->lock, flags); +- if (host->flags & SDHSTS_SDIO_IRPT_ENABLED) +- bcm2835_sdhost_enable_sdio_irq_nolock(host, true); +- spin_unlock_irqrestore(&host->lock, flags); +-*/ +- } +- +- return isr ? IRQ_HANDLED : IRQ_NONE; +-} +- +- +- + void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + { + int div = 0; /* Initialized for compiler warning */ +@@ -1417,9 +1461,8 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + pr_info("%s: set_clock(%d)\n", mmc_hostname(host->mmc), clock); + + if ((host->overclock_50 > 50) && +- (clock == 50*MHZ)) { ++ (clock == 50*MHZ)) + clock = host->overclock_50 * MHZ + (MHZ - 1); +- } + + /* The SDCDIV register has 11 bits, and holds (div - 2). + But in data mode the max is 50MHz wihout a minimum, and only the +@@ -1466,6 +1509,11 @@ void bcm2835_sdhost_set_clock(struct bcm2835_host *host, unsigned int clock) + clock = host->max_clk / (div + 2); + host->mmc->actual_clock = clock; + ++ /* Calibrate some delays */ ++ ++ host->ns_per_fifo_word = (1000000000/clock) * ++ ((host->mmc->caps & MMC_CAP_4_BIT_DATA) ? 8 : 32); ++ + if (clock > input_clock) { + /* Save the closest value, to make it easier + to reduce in the event of error */ +@@ -1501,6 +1549,7 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq + { + struct bcm2835_host *host; + unsigned long flags; ++ u32 edm, fsm; + + host = mmc_priv(mmc); + +@@ -1521,6 +1570,8 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq + } + + /* Reset the error statuses in case this is a retry */ ++ if (mrq->sbc) ++ mrq->sbc->error = 0; + if (mrq->cmd) + mrq->cmd->error = 0; + if (mrq->data) +@@ -1536,28 +1587,58 @@ static void bcm2835_sdhost_request(struct mmc_host *mmc, struct mmc_request *mrq + return; + } + ++ if (host->use_dma && mrq->data && ++ (mrq->data->blocks > host->pio_limit)) ++ bcm2835_sdhost_prepare_dma(host, mrq->data); ++ + spin_lock_irqsave(&host->lock, flags); + + WARN_ON(host->mrq != NULL); +- + host->mrq = mrq; + +- if (mrq->sbc) +- bcm2835_sdhost_send_command(host, mrq->sbc); +- else +- bcm2835_sdhost_send_command(host, mrq->cmd); ++ edm = bcm2835_sdhost_read(host, SDEDM); ++ fsm = edm & SDEDM_FSM_MASK; + +- mmiowb(); +- spin_unlock_irqrestore(&host->lock, flags); ++ log_event("REQ<", (u32)mrq, edm); ++ if ((fsm != SDEDM_FSM_IDENTMODE) && ++ (fsm != SDEDM_FSM_DATAMODE)) { ++ pr_err("%s: previous command (%d) not complete (EDM %x)\n", ++ mmc_hostname(host->mmc), ++ bcm2835_sdhost_read(host, SDCMD) & SDCMD_CMD_MASK, ++ edm); ++ log_event("REQ!", (u32)mrq, edm); ++ log_dump(); ++ bcm2835_sdhost_dumpregs(host); ++ mrq->cmd->error = -EILSEQ; ++ tasklet_schedule(&host->finish_tasklet); ++ mmiowb(); ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; ++ } + +- if (!mrq->sbc && mrq->cmd->data && host->use_dma) +- /* DMA transfer starts now, PIO starts after irq */ +- bcm2835_sdhost_transfer_dma(host); ++ host->use_sbc = !!mrq->sbc && ++ (host->mrq->data->flags & USE_CMD23_FLAGS); ++ if (host->use_sbc) { ++ if (bcm2835_sdhost_send_command(host, mrq->sbc)) { ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } ++ } else if (bcm2835_sdhost_send_command(host, mrq->cmd)) { ++ if (host->data && host->dma_desc) ++ /* DMA transfer starts now, PIO starts after irq */ ++ bcm2835_sdhost_start_dma(host); + +- if (!host->use_busy) +- bcm2835_sdhost_finish_command(host); +-} ++ if (!host->use_busy) ++ bcm2835_sdhost_finish_command(host, &flags); ++ } + ++ log_event("CMD ", (u32)mrq->cmd->opcode, ++ mrq->data ? (u32)mrq->data->blksz : 0); ++ mmiowb(); ++ ++ log_event("REQ>", (u32)mrq, 0); ++ spin_unlock_irqrestore(&host->lock, flags); ++} + + static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + { +@@ -1574,6 +1655,8 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + + spin_lock_irqsave(&host->lock, flags); + ++ log_event("IOS<", ios->clock, 0); ++ + if (!ios->clock || ios->clock != host->clock) { + bcm2835_sdhost_set_clock(host, ios->clock); + host->clock = ios->clock; +@@ -1596,59 +1679,53 @@ static void bcm2835_sdhost_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) + spin_unlock_irqrestore(&host->lock, flags); + } + +-static int bcm2835_sdhost_multi_io_quirk(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, int blk_size) ++static struct mmc_host_ops bcm2835_sdhost_ops = { ++ .request = bcm2835_sdhost_request, ++ .set_ios = bcm2835_sdhost_set_ios, ++ .hw_reset = bcm2835_sdhost_reset, ++}; ++ ++static void bcm2835_sdhost_cmd_wait_work(struct work_struct *work) + { +- /* There is a bug in the host controller hardware that makes +- reading the final sector of the card as part of a multiple read +- problematic. Detect that case and shorten the read accordingly. +- */ + struct bcm2835_host *host; ++ unsigned long flags; + +- host = mmc_priv(card->host); ++ host = container_of(work, struct bcm2835_host, cmd_wait_wq); + +- if (!host->sectors) { +- /* csd.capacity is in weird units - convert to sectors */ +- u32 card_sectors = (card->csd.capacity << (card->csd.read_blkbits - 9)); +- if ((direction == MMC_DATA_READ) && +- ((blk_pos + blk_size) == card_sectors)) +- blk_size--; +- return blk_size; +- } ++ spin_lock_irqsave(&host->lock, flags); + +- if (direction == MMC_DATA_READ) { +- int i; +- int sector; +- for (i = 0; blk_pos > (sector = host->single_read_sectors[i]); i++) +- continue; ++ log_event("CWK<", (u32)host->cmd, (u32)host->mrq); + +- if ((blk_pos + blk_size) > sector) +- blk_size = (blk_pos == sector) ? 1 : (sector - blk_pos); ++ /* ++ * If this tasklet gets rescheduled while running, it will ++ * be run again afterwards but without any active request. ++ */ ++ if (!host->mrq) { ++ spin_unlock_irqrestore(&host->lock, flags); ++ return; + } +- return blk_size; +-} + ++ bcm2835_sdhost_finish_command(host, &flags); + +-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, +- .hw_reset = bcm2835_sdhost_reset, +- .multi_io_quirk = bcm2835_sdhost_multi_io_quirk, +-}; ++ mmiowb(); ++ ++ log_event("CWK>", (u32)host->cmd, 0); + ++ spin_unlock_irqrestore(&host->lock, flags); ++} + + static void bcm2835_sdhost_tasklet_finish(unsigned long param) + { + struct bcm2835_host *host; + unsigned long flags; + struct mmc_request *mrq; ++ struct dma_chan *terminate_chan = NULL; + + host = (struct bcm2835_host *)param; + + spin_lock_irqsave(&host->lock, flags); + ++ log_event("TSK<", (u32)host->mrq, 0); + /* + * If this tasklet gets rescheduled while running, it will + * be run again afterwards but without any active request. +@@ -1683,11 +1760,23 @@ static void bcm2835_sdhost_tasklet_finish(unsigned long param) + + mmiowb(); + ++ host->dma_desc = NULL; ++ terminate_chan = host->dma_chan; ++ host->dma_chan = NULL; ++ + spin_unlock_irqrestore(&host->lock, flags); +- mmc_request_done(host->mmc, mrq); +-} + ++ if (terminate_chan) ++ { ++ int err = dmaengine_terminate_all(terminate_chan); ++ if (err) ++ pr_err("%s: failed to terminate DMA (%d)\n", ++ mmc_hostname(host->mmc), err); ++ } + ++ mmc_request_done(host->mmc, mrq); ++ log_event("TSK>", (u32)mrq, 0); ++} + + int bcm2835_sdhost_add_host(struct bcm2835_host *host) + { +@@ -1709,10 +1798,10 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + mmc->f_max, mmc->f_min, mmc->max_busy_timeout); + + /* host controller capabilities */ +- mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | ++ mmc->caps |= + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | + MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | +- (ALLOW_CMD23 * MMC_CAP_CMD23); ++ ((ALLOW_CMD23_READ|ALLOW_CMD23_WRITE) * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + +@@ -1722,9 +1811,9 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + pr_err("%s: unable to initialise DMA channels. " + "Falling back to PIO\n", + mmc_hostname(mmc)); +- host->have_dma = false; ++ host->use_dma = false; + } else { +- host->have_dma = true; ++ host->use_dma = true; + + cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; +@@ -1741,7 +1830,7 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + ret = dmaengine_slave_config(host->dma_chan_rx, &cfg); + } + } else { +- host->have_dma = false; ++ host->use_dma = false; + } + + mmc->max_segs = 128; +@@ -1756,16 +1845,15 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + tasklet_init(&host->finish_tasklet, + bcm2835_sdhost_tasklet_finish, (unsigned long)host); + +- setup_timer(&host->timer, bcm2835_sdhost_timeout, +- (unsigned long)host); ++ INIT_WORK(&host->cmd_wait_wq, bcm2835_sdhost_cmd_wait_work); + +- setup_timer(&host->pio_timer, bcm2835_sdhost_pio_timeout, ++ setup_timer(&host->timer, bcm2835_sdhost_timeout, + (unsigned long)host); + + bcm2835_sdhost_init(host, 0); +- ret = request_threaded_irq(host->irq, bcm2835_sdhost_irq, +- bcm2835_sdhost_thread_irq, +- IRQF_SHARED, mmc_hostname(mmc), host); ++ ++ ret = request_irq(host->irq, bcm2835_sdhost_irq, 0 /*IRQF_SHARED*/, ++ mmc_hostname(mmc), host); + if (ret) { + pr_err("%s: failed to request IRQ %d: %d\n", + mmc_hostname(mmc), host->irq, ret); +@@ -1776,11 +1864,11 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + mmc_add_host(mmc); + + pio_limit_string[0] = '\0'; +- if (host->have_dma && (host->pio_limit > 0)) ++ if (host->use_dma && (host->pio_limit > 0)) + sprintf(pio_limit_string, " (>%d)", host->pio_limit); + pr_info("%s: %s loaded - DMA %s%s\n", + mmc_hostname(mmc), DRIVER_NAME, +- host->have_dma ? "enabled" : "disabled", ++ host->use_dma ? "enabled" : "disabled", + pio_limit_string); + + return 0; +@@ -1810,8 +1898,11 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + mmc->ops = &bcm2835_sdhost_ops; + host = mmc_priv(mmc); + host->mmc = mmc; ++ host->cmd_quick_poll_retries = 0; + host->pio_timeout = msecs_to_jiffies(500); ++ host->pio_limit = 1; + host->max_delay = 1; /* Warn if over 1ms */ ++ host->allow_dma = 1; + spin_lock_init(&host->lock); + + iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); +@@ -1827,13 +1918,12 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + return -ENODEV; + } + host->bus_addr = be32_to_cpup(addr); ++ log_init(iomem->start - host->bus_addr); + pr_debug(" - ioaddr %lx, iomem->start %lx, bus_addr %lx\n", + (unsigned long)host->ioaddr, + (unsigned long)iomem->start, + (unsigned long)host->bus_addr); + +- host->allow_dma = ALLOW_DMA; +- + if (node) { + /* Read any custom properties */ + of_property_read_u32(node, +@@ -1845,16 +1935,17 @@ static int bcm2835_sdhost_probe(struct platform_device *pdev) + of_property_read_u32(node, + "brcm,pio-limit", + &host->pio_limit); +- host->allow_dma = ALLOW_DMA && ++ host->allow_dma = + !of_property_read_bool(node, "brcm,force-pio"); + host->debug = of_property_read_bool(node, "brcm,debug"); +- of_property_read_u32(node, +- "brcm,debug-flags", +- &host->debug_flags); + } + +- if (host->debug_flags) +- dev_err(dev, "debug_flags=%x\n", host->debug_flags); ++ host->dma_chan = NULL; ++ host->dma_desc = NULL; ++ ++ /* Formally recognise the other way of disabling DMA */ ++ if (host->pio_limit == 0x7fffffff) ++ host->allow_dma = false; + + if (host->allow_dma) { + if (node) { +@@ -1940,15 +2031,12 @@ static int bcm2835_sdhost_remove(struct platform_device *pdev) + return 0; + } + +- + static const struct of_device_id bcm2835_sdhost_match[] = { + { .compatible = "brcm,bcm2835-sdhost" }, + { } + }; + MODULE_DEVICE_TABLE(of, bcm2835_sdhost_match); + +- +- + static struct platform_driver bcm2835_sdhost_driver = { + .probe = bcm2835_sdhost_probe, + .remove = bcm2835_sdhost_remove, + +From d15e041e838bd735a7ed3eaa5dbff785213baf6d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 12 Feb 2016 15:38:00 +0000 +Subject: [PATCH 150/170] BCM270X_DT: Add dtparams for the SD interface + +Add new base dtparams sd_overclock, sd_force_pio, sd_pio_limit +and sd_debug. +--- + 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.dts | 1 - + arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 13 +++++++++++++ + arch/arm/boot/dts/bcm2708_common.dtsi | 2 ++ + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++++ + arch/arm/boot/dts/overlays/README | 11 ++++++++++- + arch/arm/boot/dts/overlays/mmc-overlay.dts | 1 - + arch/arm/boot/dts/overlays/sdhost-overlay.dts | 27 +++++++++++++------------- + arch/arm/boot/dts/overlays/sdtweak-overlay.dts | 14 ++++++------- + 10 files changed, 58 insertions(+), 23 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 2e4df17..d2d6fa0 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -141,5 +141,9 @@ + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 0445b46..d033ee4 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -131,5 +131,9 @@ + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 87c1a54..8bcafb41 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -97,6 +97,5 @@ + i2c0_baudrate = <&i2c0>,"clock-frequency:0"; + i2c1_baudrate = <&i2c1>,"clock-frequency:0"; + i2c2_baudrate = <&i2c2>,"clock-frequency:0"; +- core_freq = <&clk_core>,"clock-frequency:0"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +index 3c8bdde..e09e499 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi +@@ -7,6 +7,13 @@ + }; + }; + ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++}; ++ + &leds { + act_led: act { + label = "led0"; +@@ -29,6 +36,8 @@ + + / { + __overrides__ { ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ + act_led_gpio = <&act_led>,"gpios:4"; + act_led_activelow = <&act_led>,"gpios:8"; + act_led_trigger = <&act_led>,"linux,default-trigger"; +@@ -36,5 +45,9 @@ + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; + }; +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 75fb4ce..18d3c45 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -135,6 +135,7 @@ + dmas = <&dma 13>, + <&dma 13>; + dma-names = "tx", "rx"; ++ brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; + status = "disabled"; + }; +@@ -203,6 +204,7 @@ + dmas = <&dma 11>, + <&dma 11>; + dma-names = "tx", "rx"; ++ brcm,overclock-50 = <0>; + status = "disabled"; + }; + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 5206ba2..aca253f 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -141,5 +141,9 @@ + audio = <&audio>,"status"; + watchdog = <&watchdog>,"status"; + random = <&random>,"status"; ++ sd_overclock = <&sdhost>,"brcm,overclock-50:0"; ++ sd_force_pio = <&sdhost>,"brcm,force-pio?"; ++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0"; ++ sd_debug = <&sdhost>,"brcm,debug"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index f987565..0a2df01 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -112,6 +112,16 @@ Params: + random Set to "on" to enable the hardware random + number generator (default "on") + ++ sd_overclock Clock (in MHz) to use when the MMC framework ++ requests 50MHz ++ ++ sd_force_pio Disable DMA support for SD driver (default off) ++ ++ sd_pio_limit Number of blocks above which to use DMA for ++ SD card (default 1) ++ ++ sd_debug Enable debug output from SD driver (default off) ++ + uart0 Set to "off" to disable uart0 (default "on") + + watchdog Set to "on" to enable the hardware watchdog +@@ -443,7 +453,6 @@ 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 +diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts +index 00a22be..d32b02c 100644 +--- a/arch/arm/boot/dts/overlays/mmc-overlay.dts ++++ b/arch/arm/boot/dts/overlays/mmc-overlay.dts +@@ -34,6 +34,5 @@ + + __overrides__ { + overclock_50 = <&frag0>,"brcm,overclock-50:0"; +- force_pio = <&frag0>,"brcm,force-pio?"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +index dbe6574..a431177 100644 +--- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts +@@ -1,19 +1,14 @@ + /dts-v1/; + /plugin/; + ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ + /{ + compatible = "brcm,bcm2708"; + + fragment@0 { +- target = <&mmc>; +- __overlay__ { +- status = "disabled"; +- }; +- }; +- +- fragment@1 { + target = <&sdhost>; +- frag1: __overlay__ { ++ frag0: __overlay__ { + brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; + brcm,debug-flags = <0>; +@@ -21,11 +16,17 @@ + }; + }; + ++ fragment@1 { ++ target = <&mmc>; ++ __overlay__ { ++ status = "disabled"; ++ }; ++ }; ++ + __overrides__ { +- overclock_50 = <&frag1>,"brcm,overclock-50:0"; +- force_pio = <&frag1>,"brcm,force-pio?"; +- pio_limit = <&frag1>,"brcm,pio-limit:0"; +- debug = <&frag1>,"brcm,debug?"; +- debug_flags = <&frag1>,"brcm,debug-flags:0"; ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +index b0b208c..e4a4677 100644 +--- a/arch/arm/boot/dts/overlays/sdtweak-overlay.dts ++++ b/arch/arm/boot/dts/overlays/sdtweak-overlay.dts +@@ -1,23 +1,23 @@ + /dts-v1/; + /plugin/; + ++/* Provide backwards compatible aliases for the old sdhost dtparams. */ ++ + /{ + compatible = "brcm,bcm2708"; + + fragment@0 { + target = <&sdhost>; +- frag1: __overlay__ { ++ frag0: __overlay__ { + brcm,overclock-50 = <0>; + brcm,pio-limit = <1>; +- brcm,debug-flags = <0>; + }; + }; + + __overrides__ { +- overclock_50 = <&frag1>,"brcm,overclock-50:0"; +- force_pio = <&frag1>,"brcm,force-pio?"; +- pio_limit = <&frag1>,"brcm,pio-limit:0"; +- debug = <&frag1>,"brcm,debug?"; +- debug_flags = <&frag1>,"brcm,debug-flags:0"; ++ overclock_50 = <&frag0>,"brcm,overclock-50:0"; ++ force_pio = <&frag0>,"brcm,force-pio?"; ++ pio_limit = <&frag0>,"brcm,pio-limit:0"; ++ debug = <&frag0>,"brcm,debug?"; + }; + }; + +From bc7400cadff6bf33451b124eac2e8bf80ebb0197 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 12 Feb 2016 14:50:25 +0000 +Subject: [PATCH 151/170] dcw_otg: trim xfer length when buffer larger than + allocated size is received + +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index 8db3dfc..d672a76 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -737,6 +737,11 @@ static int update_urb_state_xfer_comp(dwc_hc_t * hc, + DWC_OTG_HC_XFER_COMPLETE, + &short_read); + ++ if (urb->actual_length + xfer_length > urb->length) { ++ DWC_WARN("%s(): trimming xfer length\n", __func__); ++ xfer_length = urb->length - urb->actual_length; ++ } ++ + /* non DWORD-aligned buffer case handling. */ + if (hc->align_buff && xfer_length && hc->ep_is_in) { + dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, +@@ -1423,6 +1428,12 @@ static void update_urb_state_xfer_intr(dwc_hc_t * hc, + { + uint32_t bytes_transferred = get_actual_xfer_length(hc, hc_regs, qtd, + halt_status, NULL); ++ ++ if (urb->actual_length + bytes_transferred > urb->length) { ++ DWC_WARN("%s(): trimming xfer length\n", __func__); ++ bytes_transferred = urb->length - urb->actual_length; ++ } ++ + /* non DWORD-aligned buffer case handling. */ + if (hc->align_buff && bytes_transferred && hc->ep_is_in) { + dwc_memcpy(urb->buf + urb->actual_length, hc->qh->dw_align_buf, + +From f395ff998f2bde846499b1a0ef84519989dc2d4e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 15 Feb 2016 10:00:27 +0000 +Subject: [PATCH 152/170] bcm2835-sdhost: Restore ATOMIC flag to PIO sg mapping + +Allocation problems have been seen in a wireless driver, and +this is the only change which might have been responsible. +--- + drivers/mmc/host/bcm2835-sdhost.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 262180b..d66385c 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -874,15 +874,14 @@ static void bcm2835_sdhost_prepare_data(struct bcm2835_host *host, struct mmc_co + host->flush_fifo = 0; + host->data->bytes_xfered = 0; + +- + if (!host->dma_desc) { + /* Use PIO */ +- int flags; ++ int flags = SG_MITER_ATOMIC; + + if (data->flags & MMC_DATA_READ) +- flags = SG_MITER_TO_SG; ++ flags |= SG_MITER_TO_SG; + else +- flags = SG_MITER_FROM_SG; ++ flags |= SG_MITER_FROM_SG; + sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); + host->blocks = data->blocks; + } + +From d2943c4ee1c52cb2c9802be194ca90442e4fe34f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 16 Feb 2016 08:47:56 +0000 +Subject: [PATCH 153/170] Revert "Add blk_pos parameter to mmc multi_io_quirk + callback" + +This reverts commit aab95f9b10e8c3d32de2bf163b86f220c88214fe. + +The bcm2835-sdhost driver no longer needs this patch. +--- + drivers/mmc/card/block.c | 1 - + drivers/mmc/host/omap_hsmmc.c | 4 +--- + drivers/mmc/host/sh_mobile_sdhi.c | 4 +--- + drivers/mmc/host/tmio_mmc_pio.c | 4 +--- + include/linux/mmc/host.h | 4 +--- + 5 files changed, 4 insertions(+), 13 deletions(-) + +diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c +index b35f0c4..d848616 100644 +--- a/drivers/mmc/card/block.c ++++ b/drivers/mmc/card/block.c +@@ -1510,7 +1510,6 @@ 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, +- blk_rq_pos(req), + brq->data.blocks); + } + +diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c +index 708d0fa..7fb0753 100644 +--- a/drivers/mmc/host/omap_hsmmc.c ++++ b/drivers/mmc/host/omap_hsmmc.c +@@ -1832,9 +1832,7 @@ static void omap_hsmmc_conf_bus_power(struct omap_hsmmc_host *host) + } + + static int omap_hsmmc_multi_io_quirk(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, +- int blk_size) ++ unsigned int direction, int blk_size) + { + /* This controller can't do multiblock reads due to hw bugs */ + if (direction == MMC_DATA_READ) +diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c +index 4f1ccf3..354f4f3 100644 +--- a/drivers/mmc/host/sh_mobile_sdhi.c ++++ b/drivers/mmc/host/sh_mobile_sdhi.c +@@ -170,9 +170,7 @@ static int sh_mobile_sdhi_write16_hook(struct tmio_mmc_host *host, int addr) + } + + static int sh_mobile_sdhi_multi_io_quirk(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, +- int blk_size) ++ unsigned int direction, int blk_size) + { + /* + * 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 7b730d8..a10fde4 100644 +--- a/drivers/mmc/host/tmio_mmc_pio.c ++++ b/drivers/mmc/host/tmio_mmc_pio.c +@@ -1003,9 +1003,7 @@ static int tmio_mmc_get_ro(struct mmc_host *mmc) + } + + static int tmio_multi_io_quirk(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, +- int blk_size) ++ unsigned int direction, int blk_size) + { + struct tmio_mmc_host *host = mmc_priv(card->host); + +diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h +index 105b3e6..ad22ebb 100644 +--- a/include/linux/mmc/host.h ++++ b/include/linux/mmc/host.h +@@ -143,9 +143,7 @@ struct mmc_host_ops { + * I/O. Returns the number of supported blocks for the request. + */ + int (*multi_io_quirk)(struct mmc_card *card, +- unsigned int direction, +- u32 blk_pos, +- int blk_size); ++ unsigned int direction, int blk_size); + }; + + struct mmc_card; + +From ee83592659ae5dc5ceee63790a8cba57ebfa57b3 Mon Sep 17 00:00:00 2001 +From: Craig Roberts +Date: Tue, 16 Feb 2016 10:03:42 +0000 +Subject: [PATCH 154/170] Updated smsc95xx driver to check for a valid MAC + address in eeprom before using smsc95xx.macaddr parameter passed on command + line. + +The built-in RPi adaptor will still get a MAC address based on the parameter passed on the command line as the RPi hardware does not have an eeprom, +however usb->ethernet adaptors using the same driver should have an eeprom with MAC address as part of their hardware and therefore will use this +meaning they don't end up with the same MAC address as the built-in RPi adaptor. +--- + drivers/net/usb/smsc95xx.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +index 3244a90..7483222 100755 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -817,10 +817,6 @@ static int smsc95xx_is_macaddr_param(struct usbnet *dev, u8 *dev_mac) + + static void smsc95xx_init_mac_address(struct usbnet *dev) + { +- /* Check module parameters */ +- if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) +- return; +- + /* try reading mac address from EEPROM */ + if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, + dev->net->dev_addr) == 0) { +@@ -831,7 +827,11 @@ static void smsc95xx_init_mac_address(struct usbnet *dev) + } + } + +- /* no eeprom, or eeprom values are invalid. generate random MAC */ ++ /* Check module parameters */ ++ if (smsc95xx_is_macaddr_param(dev, dev->net->dev_addr)) ++ return; ++ ++ /* no eeprom, or eeprom values are invalid, and no module parameter specified to set MAC. Generate random MAC */ + eth_hw_addr_random(dev->net); + netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); + } + +From 1c43ff69763f4537b76b3248850256da2bda211b Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 17 Feb 2016 19:02:31 +0000 +Subject: [PATCH 155/170] dcw_otg: Make trimming messages less noisy + +--- + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +index d672a76..e6b38ac3 100644 +--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c ++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +@@ -738,7 +738,8 @@ static int update_urb_state_xfer_comp(dwc_hc_t * hc, + &short_read); + + if (urb->actual_length + xfer_length > urb->length) { +- DWC_WARN("%s(): trimming xfer length\n", __func__); ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); + xfer_length = urb->length - urb->actual_length; + } + +@@ -1430,7 +1431,8 @@ static void update_urb_state_xfer_intr(dwc_hc_t * hc, + halt_status, NULL); + + if (urb->actual_length + bytes_transferred > urb->length) { +- DWC_WARN("%s(): trimming xfer length\n", __func__); ++ printk_once(KERN_DEBUG "dwc_otg: DEVICE:%03d : %s:%d:trimming xfer length\n", ++ hc->dev_addr, __func__, __LINE__); + bytes_transferred = urb->length - urb->actual_length; + } + + +From 7f9781f9875f2aa638d5afdaa9709fa1ef9bda8d Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 18 Feb 2016 15:28:14 +0000 +Subject: [PATCH 156/170] BCM270X_DT: at86rf233 overlay - drop to 3MHz + +The consensus is that 6MHz is too fast, but that 3MHz is OK. + +See: https://github.com/raspberrypi/linux/issues/1294 + https://github.com/raspberrypi/linux/issues/1151 +--- + arch/arm/boot/dts/overlays/README | 2 +- + arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 0a2df01..4de0b6f 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -188,7 +188,7 @@ Load: dtoverlay=at86rf233,= + Params: interrupt GPIO used for INT (default 23) + reset GPIO used for Reset (default 24) + sleep GPIO used for Sleep (default 25) +- speed SPI bus speed in Hz (default 6000000) ++ speed SPI bus speed in Hz (default 3000000) + trim Fine tuning of the internal capacitance + arrays (0=+0pF, 15=+4.5pF, default 15) + +diff --git a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +index 0460269..eab4052 100644 +--- a/arch/arm/boot/dts/overlays/at86rf233-overlay.dts ++++ b/arch/arm/boot/dts/overlays/at86rf233-overlay.dts +@@ -25,7 +25,7 @@ + interrupts = <23 4>; /* active high */ + reset-gpio = <&gpio 24 1>; + sleep-gpio = <&gpio 25 1>; +- spi-max-frequency = <6000000>; ++ spi-max-frequency = <3000000>; + xtal-trim = /bits/ 8 <0xf>; + }; + }; + +From 5af831a3f879c89c8c0b39c8f88e7600bdc3a765 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 19 Feb 2016 12:04:48 +0000 +Subject: [PATCH 157/170] bcm2835-sdhost: Downgrade log message status + +--- + drivers/mmc/host/bcm2835-sdhost.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index d66385c..4f6cab5 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -232,8 +232,8 @@ static void log_init(u32 bus_to_phys) + sdhost_log_buf = dma_zalloc_coherent(NULL, LOG_SIZE, &sdhost_log_addr, + GFP_KERNEL); + if (sdhost_log_buf) { +- pr_err("sdhost: log_buf @ %p (%x)\n", +- sdhost_log_buf, sdhost_log_addr); ++ pr_info("sdhost: log_buf @ %p (%x)\n", ++ sdhost_log_buf, sdhost_log_addr); + timer_base = ioremap_nocache(bus_to_phys + 0x7e003000, SZ_4K); + if (!timer_base) + pr_err("sdhost: failed to remap timer\n"); + +From e08f6b3aad073d8130d2ec0f8398f55983c0eac8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 15 Jan 2016 16:48:27 +0000 +Subject: [PATCH 158/170] config: Enable HCI over UARTs + +--- + arch/arm/configs/bcm2709_defconfig | 3 +++ + arch/arm/configs/bcmrpi_defconfig | 2 ++ + 2 files changed, 5 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index fc35254..48ecb2e 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -376,6 +376,9 @@ CONFIG_BT_BNEP_PROTO_FILTER=y + CONFIG_BT_HIDP=m + CONFIG_BT_6LOWPAN=m + CONFIG_BT_HCIBTUSB=m ++CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y + CONFIG_BT_HCIBCM203X=m + CONFIG_BT_HCIBPA10X=m + CONFIG_BT_HCIBFUSB=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 51dc019..4368f0d 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -370,6 +370,8 @@ CONFIG_BT_HIDP=m + CONFIG_BT_6LOWPAN=m + CONFIG_BT_HCIBTUSB=m + CONFIG_BT_HCIUART=m ++CONFIG_BT_HCIUART_3WIRE=y ++CONFIG_BT_HCIUART_BCM=y + CONFIG_BT_HCIBCM203X=m + CONFIG_BT_HCIBPA10X=m + CONFIG_BT_HCIBFUSB=m + +From 20c4c47bca3674d746518b1cca1e066e46b52900 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 17 Dec 2015 13:37:07 +0000 +Subject: [PATCH 159/170] hci_h5: Don't send conf_req when ACTIVE + +Without this patch, a modem and kernel can continuously bombard each +other with conf_req and conf_rsp messages, in a demented game of tag. +--- + drivers/bluetooth/hci_h5.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c +index abee221..2825833 100644 +--- a/drivers/bluetooth/hci_h5.c ++++ b/drivers/bluetooth/hci_h5.c +@@ -314,7 +314,8 @@ static void h5_handle_internal_rx(struct hci_uart *hu) + h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_req, 2) == 0) { + h5_link_control(hu, conf_rsp, 2); +- h5_link_control(hu, conf_req, 3); ++ if (h5->state != H5_ACTIVE) ++ h5_link_control(hu, conf_req, 3); + } else if (memcmp(data, conf_rsp, 2) == 0) { + if (H5_HDR_LEN(hdr) > 2) + h5->tx_win = (data[2] & 7); + +From 00dba6ec2ac004fc17075febd4504646eb3dc543 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 23 Feb 2016 17:26:48 +0000 +Subject: [PATCH 160/170] amba_pl011: Don't use DT aliases for numbering + +The pl011 driver looks for DT aliases of the form "serial", +and if found uses as the device ID. This can cause +/dev/ttyAMA0 to become /dev/ttyAMA1, which is confusing if the +other serial port is provided by the 8250 driver which doesn't +use the same logic. +--- + drivers/tty/serial/amba-pl011.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 899a771..68b3353 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2313,7 +2313,12 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap, + if (IS_ERR(base)) + return PTR_ERR(base); + ++ /* Don't use DT serial aliases - it causes the device to ++ be renumbered to ttyAMA1 if it is the second serial port in the ++ system, even though the other one is ttyS0. The 8250 driver ++ doesn't use this logic, so always remains ttyS0. + index = pl011_probe_dt_alias(index, dev); ++ */ + + uap->old_cr = 0; + uap->port.dev = dev; + +From 95136c932ac4433a6a50d394817812f8eb2cc914 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 15 Dec 2015 15:35:57 -0800 +Subject: [PATCH 161/170] clk: bcm2835: Add bindings for the auxiliary + peripheral clock gates. + +These will be used for enabling UART1, SPI1, and SPI2. + +Signed-off-by: Eric Anholt +Acked-by: Rob Herring +Signed-off-by: Michael Turquette +--- + .../bindings/clock/brcm,bcm2835-aux-clock.txt | 31 ++++++++++++++++++++++ + include/dt-bindings/clock/bcm2835-aux.h | 17 ++++++++++++ + 2 files changed, 48 insertions(+) + create mode 100644 Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt + create mode 100644 include/dt-bindings/clock/bcm2835-aux.h + +diff --git a/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt +new file mode 100644 +index 0000000..7a837d2 +--- /dev/null ++++ b/Documentation/devicetree/bindings/clock/brcm,bcm2835-aux-clock.txt +@@ -0,0 +1,31 @@ ++Broadcom BCM2835 auxiliary peripheral support ++ ++This binding uses the common clock binding: ++ Documentation/devicetree/bindings/clock/clock-bindings.txt ++ ++The auxiliary peripherals (UART, SPI1, and SPI2) have a small register ++area controlling clock gating to the peripherals, and providing an IRQ ++status register. ++ ++Required properties: ++- compatible: Should be "brcm,bcm2835-aux" ++- #clock-cells: Should be <1>. The permitted clock-specifier values can be ++ found in include/dt-bindings/clock/bcm2835-aux.h ++- reg: Specifies base physical address and size of the registers ++- clocks: The parent clock phandle ++ ++Example: ++ ++ clocks: cprman@7e101000 { ++ compatible = "brcm,bcm2835-cprman"; ++ #clock-cells = <1>; ++ reg = <0x7e101000 0x2000>; ++ clocks = <&clk_osc>; ++ }; ++ ++ aux: aux@0x7e215004 { ++ compatible = "brcm,bcm2835-aux"; ++ #clock-cells = <1>; ++ reg = <0x7e215000 0x8>; ++ clocks = <&clocks BCM2835_CLOCK_VPU>; ++ }; +diff --git a/include/dt-bindings/clock/bcm2835-aux.h b/include/dt-bindings/clock/bcm2835-aux.h +new file mode 100644 +index 0000000..d91156e +--- /dev/null ++++ b/include/dt-bindings/clock/bcm2835-aux.h +@@ -0,0 +1,17 @@ ++/* ++ * Copyright (C) 2015 Broadcom Corporation ++ * ++ * 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 version 2. ++ * ++ * This program is distributed "as is" WITHOUT ANY WARRANTY of any ++ * kind, whether express or implied; without even the implied warranty ++ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ */ ++ ++#define BCM2835_AUX_CLOCK_UART 0 ++#define BCM2835_AUX_CLOCK_SPI1 1 ++#define BCM2835_AUX_CLOCK_SPI2 2 ++#define BCM2835_AUX_CLOCK_COUNT 3 + +From 924276b92ff47f0e778a9405d00637be4ca88736 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 15 Dec 2015 15:35:58 -0800 +Subject: [PATCH 162/170] clk: bcm2835: Add a driver for the auxiliary + peripheral clock gates. + +There are a pair of SPI masters and a mini UART that were last minute +additions. As a result, they didn't get integrated in the same way as +the other gates off of the VPU clock in CPRMAN. + +Signed-off-by: Eric Anholt +Signed-off-by: Michael Turquette + +updated Makefile to preserve the rasoberry pi architectures +--- + drivers/clk/bcm/Makefile | 1 + + drivers/clk/bcm/clk-bcm2835-aux.c | 85 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 86 insertions(+) + create mode 100644 drivers/clk/bcm/clk-bcm2835-aux.c + +diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile +index a1b4cbc..84070d51 100644 +--- a/drivers/clk/bcm/Makefile ++++ b/drivers/clk/bcm/Makefile +@@ -4,6 +4,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o + obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o ++obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o + obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o + obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o +diff --git a/drivers/clk/bcm/clk-bcm2835-aux.c b/drivers/clk/bcm/clk-bcm2835-aux.c +new file mode 100644 +index 0000000..e4f89e2 +--- /dev/null ++++ b/drivers/clk/bcm/clk-bcm2835-aux.c +@@ -0,0 +1,85 @@ ++/* ++ * Copyright (C) 2015 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define BCM2835_AUXIRQ 0x00 ++#define BCM2835_AUXENB 0x04 ++ ++static int bcm2835_aux_clk_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct clk_onecell_data *onecell; ++ const char *parent; ++ struct clk *parent_clk; ++ struct resource *res; ++ void __iomem *reg, *gate; ++ ++ parent_clk = devm_clk_get(dev, NULL); ++ if (IS_ERR(parent_clk)) ++ return PTR_ERR(parent_clk); ++ parent = __clk_get_name(parent_clk); ++ ++ res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ reg = devm_ioremap_resource(dev, res); ++ if (!reg) ++ return -ENODEV; ++ ++ onecell = devm_kmalloc(dev, sizeof(*onecell), GFP_KERNEL); ++ if (!onecell) ++ return -ENOMEM; ++ onecell->clk_num = BCM2835_AUX_CLOCK_COUNT; ++ onecell->clks = devm_kcalloc(dev, BCM2835_AUX_CLOCK_COUNT, ++ sizeof(*onecell->clks), GFP_KERNEL); ++ if (!onecell->clks) ++ return -ENOMEM; ++ ++ gate = reg + BCM2835_AUXENB; ++ onecell->clks[BCM2835_AUX_CLOCK_UART] = ++ clk_register_gate(dev, "aux_uart", parent, 0, gate, 0, 0, NULL); ++ ++ onecell->clks[BCM2835_AUX_CLOCK_SPI1] = ++ clk_register_gate(dev, "aux_spi1", parent, 0, gate, 1, 0, NULL); ++ ++ onecell->clks[BCM2835_AUX_CLOCK_SPI2] = ++ clk_register_gate(dev, "aux_spi2", parent, 0, gate, 2, 0, NULL); ++ ++ of_clk_add_provider(pdev->dev.of_node, of_clk_src_onecell_get, onecell); ++ ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_aux_clk_of_match[] = { ++ { .compatible = "brcm,bcm2835-aux", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_aux_clk_of_match); ++ ++static struct platform_driver bcm2835_aux_clk_driver = { ++ .driver = { ++ .name = "bcm2835-aux-clk", ++ .of_match_table = bcm2835_aux_clk_of_match, ++ }, ++ .probe = bcm2835_aux_clk_probe, ++}; ++builtin_platform_driver(bcm2835_aux_clk_driver); ++ ++MODULE_AUTHOR("Eric Anholt "); ++MODULE_DESCRIPTION("BCM2835 auxiliary peripheral clock driver"); ++MODULE_LICENSE("GPL v2"); + +From 43477e669f736f6da34afbd8a96683b239b1fd1f Mon Sep 17 00:00:00 2001 +From: Fraser +Date: Tue, 23 Feb 2016 10:04:37 +1100 +Subject: [PATCH 163/170] Aux SPI 1&2 implementation + +Adds aux spi 1 & 2 devices to compatible raspberry PIs. +* Minor config of the driver build environment to ensure they get built +for CONFIG_ARCH_BCM2708 & CONFIG_ARCH_BCM2709 devices. +* Adds the aux spi driver into the defconfigs as a module. +* Adds the auxiliary and spi1/2 devices into the device tree in a +disabled state +* Provides decide tree overlays which enables the devices and gives +users a degree of control over how they are setup. +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 34 ++++++++- + arch/arm/boot/dts/overlays/Makefile | 6 ++ + arch/arm/boot/dts/overlays/README | 99 +++++++++++++++++++++++++ + arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 ++++++++++++++ + arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 +++++++++++++++++ + arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++++++++++++++++++++ + arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 ++++++++++++++ + arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 +++++++++++++++++ + arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++++++++++++++++++++ + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + drivers/clk/bcm/Makefile | 2 +- + drivers/spi/Kconfig | 2 +- + 13 files changed, 556 insertions(+), 3 deletions(-) + create mode 100644 arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 18d3c45..4f65203 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -1,3 +1,4 @@ ++#include + #include "skeleton.dtsi" + + / { +@@ -5,6 +6,7 @@ + + aliases { + audio = &audio; ++ aux = &aux; + sound = &sound; + soc = &soc; + dma = &dma; +@@ -19,6 +21,8 @@ + spi0 = &spi0; + i2c0 = &i2c0; + uart1 = &uart1; ++ spi1 = &spi1; ++ spi2 = &spi2; + mmc = &mmc; + i2c1 = &i2c1; + i2c2 = &i2c2; +@@ -186,6 +190,14 @@ + status = "disabled"; + }; + ++ aux: aux@0x7e215004 { ++ compatible = "brcm,bcm2835-aux"; ++ #clock-cells = <1>; ++ reg = <0x7e215000 0x8>; ++ clocks = <&clk_core>; ++ status = "disabled"; ++ }; ++ + uart1: uart@7e215040 { + compatible = "brcm,bcm2835-aux-uart", "ns16550"; + reg = <0x7e215040 0x40>; +@@ -194,7 +206,27 @@ + reg-shift = <2>; + no-loopback-test; + status = "disabled"; +- }; ++ }; ++ ++ spi1: spi@7e215080 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e215080 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI1>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; ++ ++ spi2: spi@7e2150C0 { ++ compatible = "brcm,bcm2835-aux-spi"; ++ reg = <0x7e2150C0 0x40>, <0x7e215000 0x8>; ++ interrupts = <1 29>; ++ clocks = <&aux BCM2835_AUX_CLOCK_SPI2>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "disabled"; ++ }; + + mmc: mmc@7e300000 { + compatible = "brcm,bcm2835-mmc"; +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 4d9d640..a787d66 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -57,6 +57,12 @@ dtb-$(RPI_DT_OVERLAYS) += sdtweak-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-dev-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-nand-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += smi-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi1-1cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi1-2cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi1-3cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi2-1cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi2-2cs-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += spi2-3cs-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-gpio35-39-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 4de0b6f..cf5f5be 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -713,6 +713,105 @@ Load: dtoverlay=spi-gpio35-39 + Params: + + ++Name: spi1-1cs ++Info: Enables spi1 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-1cs,= ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-2cs ++Info: Enables spi1 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-2cs,= ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi1-3cs ++Info: Enables spi1 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi1 is only accessible on devices with a 40pin header, eg: ++ A+, B+, Zero and PI2 B; as well as the Compute Module. ++Load: dtoverlay=spi1-3cs,= ++Params: cs0_pin GPIO pin for CS0 (default 18 - BCM SPI1_CE0). ++ cs1_pin GPIO pin for CS1 (default 17 - BCM SPI1_CE1). ++ cs2_pin GPIO pin for CS2 (default 16 - BCM SPI1_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev1.2 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-1cs ++Info: Enables spi2 with a single chip select (CS) line and associated spidev ++ dev node. The gpio pin number for the CS line and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-1cs,= ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-2cs ++Info: Enables spi2 with two chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-2cs,= ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ ++ ++Name: spi2-3cs ++Info: Enables spi2 with three chip select (CS) lines and associated spidev ++ dev nodes. The gpio pin numbers for the CS lines and spidev device node ++ creation are configurable. ++ N.B.: spi2 is only accessible with the Compute Module. ++Load: dtoverlay=spi2-3cs,= ++Params: cs0_pin GPIO pin for CS0 (default 43 - BCM SPI2_CE0). ++ cs1_pin GPIO pin for CS1 (default 44 - BCM SPI2_CE1). ++ cs2_pin GPIO pin for CS2 (default 45 - BCM SPI2_CE2). ++ cs0_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.0 (default ++ is 'okay' or enabled). ++ cs1_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.1 (default ++ is 'okay' or enabled). ++ cs2_spidev Set to 'disabled' to stop the creation of a ++ userspace device node /dev/spidev2.2 (default ++ is 'okay' or enabled). ++ ++ + Name: tinylcd35 + Info: 3.5" Color TFT Display by www.tinylcd.com + Options: Touch, RTC, keypad +diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +new file mode 100644 +index 0000000..71c2439 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +new file mode 100644 +index 0000000..2ae0885 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +new file mode 100644 +index 0000000..8f79044 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi1_pins: spi1_pins { ++ brcm,pins = <19 20 21>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi1_cs_pins: spi1_cs_pins { ++ brcm,pins = <18 17 16>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi1>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi1_pins &spi1_cs_pins>; ++ cs-gpios = <&gpio 18 1>, <&gpio 17 1>, <&gpio 16 1>; ++ status = "okay"; ++ ++ spidev1_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev1_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi1_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi1_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi1_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev1_0>,"status"; ++ cs1_spidev = <&spidev1_1>,"status"; ++ cs2_spidev = <&spidev1_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +new file mode 100644 +index 0000000..6f57bc7 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +@@ -0,0 +1,57 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +new file mode 100644 +index 0000000..d090631 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +@@ -0,0 +1,69 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +new file mode 100644 +index 0000000..e258672 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +@@ -0,0 +1,81 @@ ++/dts-v1/; ++/plugin/; ++ ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ spi2_pins: spi2_pins { ++ brcm,pins = <40 41 42>; ++ brcm,function = <3>; /* alt4 */ ++ }; ++ ++ spi2_cs_pins: spi2_cs_pins { ++ brcm,pins = <43 44 45>; ++ brcm,function = <1>; /* output */ ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&spi2>; ++ frag1: __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi2_pins &spi2_cs_pins>; ++ cs-gpios = <&gpio 43 1>, <&gpio 44 1>, <&gpio 45 1>; ++ status = "okay"; ++ ++ spidev2_0: spidev@0 { ++ compatible = "spidev"; ++ reg = <0>; /* CE0 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_1: spidev@1 { ++ compatible = "spidev"; ++ reg = <1>; /* CE1 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ ++ spidev2_2: spidev@2 { ++ compatible = "spidev"; ++ reg = <2>; /* CE2 */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ spi-max-frequency = <500000>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ __overrides__ { ++ cs0_pin = <&spi2_cs_pins>,"brcm,pins:0", ++ <&frag1>,"cs-gpios:4"; ++ cs1_pin = <&spi2_cs_pins>,"brcm,pins:4", ++ <&frag1>,"cs-gpios:16"; ++ cs2_pin = <&spi2_cs_pins>,"brcm,pins:8", ++ <&frag1>,"cs-gpios:28"; ++ cs0_spidev = <&spidev2_0>,"status"; ++ cs1_spidev = <&spidev2_1>,"status"; ++ cs2_spidev = <&spidev2_2>,"status"; ++ }; ++}; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 48ecb2e..76b3a88 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -601,6 +601,7 @@ CONFIG_I2C_BCM2708=m + CONFIG_I2C_GPIO=m + CONFIG_SPI=y + CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m + CONFIG_SPI_SPIDEV=y + CONFIG_PPS=m + CONFIG_PPS_CLIENT_LDISC=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 4368f0d..1ca1695 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -593,6 +593,7 @@ CONFIG_I2C_BCM2708=m + CONFIG_I2C_GPIO=m + CONFIG_SPI=y + CONFIG_SPI_BCM2835=m ++CONFIG_SPI_BCM2835AUX=m + CONFIG_SPI_SPIDEV=y + CONFIG_PPS=m + CONFIG_PPS_CLIENT_LDISC=m +diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile +index 84070d51..d60fd3f 100644 +--- a/drivers/clk/bcm/Makefile ++++ b/drivers/clk/bcm/Makefile +@@ -4,7 +4,7 @@ obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm281xx.o + obj-$(CONFIG_CLK_BCM_KONA) += clk-bcm21664.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-asiu.o + obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835.o +-obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o ++obj-$(CONFIG_ARCH_BCM2835)$(CONFIG_ARCH_BCM2708)$(CONFIG_ARCH_BCM2709) += clk-bcm2835-aux.o + obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o + obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o + obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o +diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig +index e842e86..c9d1558 100644 +--- a/drivers/spi/Kconfig ++++ b/drivers/spi/Kconfig +@@ -90,7 +90,7 @@ config SPI_BCM2835 + + config SPI_BCM2835AUX + tristate "BCM2835 SPI auxiliary controller" +- depends on ARCH_BCM2835 || COMPILE_TEST ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST + depends on GPIOLIB + help + This selects a driver for the Broadcom BCM2835 SPI aux master. + +From 84c2e063885bb0ae3d5d2ad2e24e7a2bdb5729ae Mon Sep 17 00:00:00 2001 +From: Matthias Reichl +Date: Tue, 23 Feb 2016 17:28:23 +0100 +Subject: [PATCH 164/170] ASoC: bcm: add missing .owner fields in sound card + drivers + +If snd_soc_card.owner is not set the kernel won't do usage refcounting +and one can remove the card driver module while it's in use (eg playback +active) - which leads to a kernel crash. + +The missing owner field also prevents ALSA slot ordering +(options snd slots=module-name1,module-name-2,...) from working with +the I2S cards as it has no module name to match against. + +Fix these issues by setting the .owner field in the snd_soc_card structs. + +Signed-off-by: Matthias Reichl +--- + sound/soc/bcm/hifiberry_amp.c | 1 + + sound/soc/bcm/hifiberry_dac.c | 1 + + sound/soc/bcm/hifiberry_dacplus.c | 1 + + sound/soc/bcm/hifiberry_digi.c | 1 + + sound/soc/bcm/iqaudio-dac.c | 1 + + sound/soc/bcm/raspidac3.c | 1 + + sound/soc/bcm/rpi-dac.c | 1 + + sound/soc/bcm/rpi-proto.c | 1 + + 8 files changed, 8 insertions(+) + +diff --git a/sound/soc/bcm/hifiberry_amp.c b/sound/soc/bcm/hifiberry_amp.c +index 5903915..0bb12e4 100644 +--- a/sound/soc/bcm/hifiberry_amp.c ++++ b/sound/soc/bcm/hifiberry_amp.c +@@ -61,6 +61,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_amp_dai[] = { + + static struct snd_soc_card snd_rpi_hifiberry_amp = { + .name = "snd_rpi_hifiberry_amp", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_hifiberry_amp_dai, + .num_links = ARRAY_SIZE(snd_rpi_hifiberry_amp_dai), + }; +diff --git a/sound/soc/bcm/hifiberry_dac.c b/sound/soc/bcm/hifiberry_dac.c +index 3ab0f47..29ecc08 100644 +--- a/sound/soc/bcm/hifiberry_dac.c ++++ b/sound/soc/bcm/hifiberry_dac.c +@@ -63,6 +63,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dac_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_hifiberry_dac = { + .name = "snd_rpi_hifiberry_dac", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_hifiberry_dac_dai, + .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dac_dai), + }; +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c +index 153dbcd..03d8d2a 100644 +--- a/sound/soc/bcm/hifiberry_dacplus.c ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -287,6 +287,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_dacplus_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_hifiberry_dacplus = { + .name = "snd_rpi_hifiberry_dacplus", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_hifiberry_dacplus_dai, + .num_links = ARRAY_SIZE(snd_rpi_hifiberry_dacplus_dai), + }; +diff --git a/sound/soc/bcm/hifiberry_digi.c b/sound/soc/bcm/hifiberry_digi.c +index 80732b8..9840e15 100644 +--- a/sound/soc/bcm/hifiberry_digi.c ++++ b/sound/soc/bcm/hifiberry_digi.c +@@ -164,6 +164,7 @@ static struct snd_soc_dai_link snd_rpi_hifiberry_digi_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_hifiberry_digi = { + .name = "snd_rpi_hifiberry_digi", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_hifiberry_digi_dai, + .num_links = ARRAY_SIZE(snd_rpi_hifiberry_digi_dai), + }; +diff --git a/sound/soc/bcm/iqaudio-dac.c b/sound/soc/bcm/iqaudio-dac.c +index 124d7a9..a5eaa9e 100644 +--- a/sound/soc/bcm/iqaudio-dac.c ++++ b/sound/soc/bcm/iqaudio-dac.c +@@ -77,6 +77,7 @@ static struct snd_soc_dai_link snd_rpi_iqaudio_dac_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_iqaudio_dac = { + .name = "IQaudIODAC", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_iqaudio_dac_dai, + .num_links = ARRAY_SIZE(snd_rpi_iqaudio_dac_dai), + }; +diff --git a/sound/soc/bcm/raspidac3.c b/sound/soc/bcm/raspidac3.c +index 3cabf5b..e7422e2 100644 +--- a/sound/soc/bcm/raspidac3.c ++++ b/sound/soc/bcm/raspidac3.c +@@ -128,6 +128,7 @@ static struct snd_soc_dai_link snd_rpi_raspidac3_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_raspidac3 = { + .name = "RaspiDAC Rev.3x HiFi Audio Card", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_raspidac3_dai, + .num_links = ARRAY_SIZE(snd_rpi_raspidac3_dai), + }; +diff --git a/sound/soc/bcm/rpi-dac.c b/sound/soc/bcm/rpi-dac.c +index d5fac1b..59dc89e 100644 +--- a/sound/soc/bcm/rpi-dac.c ++++ b/sound/soc/bcm/rpi-dac.c +@@ -60,6 +60,7 @@ static struct snd_soc_dai_link snd_rpi_rpi_dac_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_rpi_dac = { + .name = "snd_rpi_rpi_dac", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_rpi_dac_dai, + .num_links = ARRAY_SIZE(snd_rpi_rpi_dac_dai), + }; +diff --git a/sound/soc/bcm/rpi-proto.c b/sound/soc/bcm/rpi-proto.c +index c6e45a0..9db678e 100644 +--- a/sound/soc/bcm/rpi-proto.c ++++ b/sound/soc/bcm/rpi-proto.c +@@ -91,6 +91,7 @@ static struct snd_soc_dai_link snd_rpi_proto_dai[] = { + /* audio machine driver */ + static struct snd_soc_card snd_rpi_proto = { + .name = "snd_rpi_proto", ++ .owner = THIS_MODULE, + .dai_link = snd_rpi_proto_dai, + .num_links = ARRAY_SIZE(snd_rpi_proto_dai), + }; + +From 18674a7da1c3d50d9c957a8f88aaea2aa653d223 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 20 Jan 2016 17:50:09 +0000 +Subject: [PATCH 165/170] smsx95xx: Add option to disable the crimes against + truesize fix + +It may improve iperf numbers on Pi 1, but may generate dmesg warnings and possibly cause network issues +See issue 1248. +--- + drivers/net/usb/smsc95xx.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + mode change 100755 => 100644 drivers/net/usb/smsc95xx.c + +diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c +old mode 100755 +new mode 100644 +index 7483222..a61bd08 +--- a/drivers/net/usb/smsc95xx.c ++++ b/drivers/net/usb/smsc95xx.c +@@ -75,6 +75,10 @@ static bool turbo_mode = false; + module_param(turbo_mode, bool, 0644); + MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); + ++static bool truesize_mode = false; ++module_param(truesize_mode, bool, 0644); ++MODULE_PARM_DESC(truesize_mode, "Report larger truesize value"); ++ + static char *macaddr = ":"; + module_param(macaddr, charp, 0); + MODULE_PARM_DESC(macaddr, "MAC address"); +@@ -1841,6 +1845,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + if (dev->net->features & NETIF_F_RXCSUM) + smsc95xx_rx_csum_offload(skb); + skb_trim(skb, skb->len - 4); /* remove fcs */ ++ if (truesize_mode) ++ skb->truesize = size + sizeof(struct sk_buff); + + return 1; + } +@@ -1858,6 +1864,8 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb) + if (dev->net->features & NETIF_F_RXCSUM) + smsc95xx_rx_csum_offload(ax_skb); + skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */ ++ if (truesize_mode) ++ ax_skb->truesize = size + sizeof(struct sk_buff); + + usbnet_skb_return(dev, ax_skb); + } + +From 5e3c3e845f998f86c2f22017576cb19e5d7fe9bb Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 23 Feb 2016 19:56:04 +0000 +Subject: [PATCH 166/170] bcm2835-virtgpio: Virtual GPIO driver + +Add a virtual GPIO driver that uses the firmware mailbox interface to +request that the VPU toggles LEDs. +--- + arch/arm/configs/bcm2709_defconfig | 1 + + drivers/gpio/Kconfig | 6 + + drivers/gpio/Makefile | 1 + + drivers/gpio/gpio-bcm-virt.c | 180 +++++++++++++++++++++++++++++ + include/soc/bcm2835/raspberrypi-firmware.h | 1 + + 5 files changed, 189 insertions(+) + create mode 100644 drivers/gpio/gpio-bcm-virt.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 76b3a88..6d6b519 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -607,6 +607,7 @@ CONFIG_PPS=m + CONFIG_PPS_CLIENT_LDISC=m + CONFIG_PPS_CLIENT_GPIO=m + CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_BCM_VIRT=y + CONFIG_GPIO_ARIZONA=m + CONFIG_GPIO_STMPE=y + CONFIG_W1=m +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig +index b18bea0..a1f4ccee 100644 +--- a/drivers/gpio/Kconfig ++++ b/drivers/gpio/Kconfig +@@ -132,6 +132,12 @@ config GPIO_BCM_KONA + help + Turn on GPIO support for Broadcom "Kona" chips. + ++config GPIO_BCM_VIRT ++ bool "Broadcom Virt GPIO" ++ depends on OF_GPIO && RASPBERRYPI_FIRMWARE && (ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST) ++ help ++ Turn on virtual GPIO support for Broadcom BCM283X chips. ++ + config GPIO_BRCMSTB + tristate "BRCMSTB GPIO support" + default y if ARCH_BRCMSTB +diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile +index 986dbd8..b2ccc9f 100644 +--- a/drivers/gpio/Makefile ++++ b/drivers/gpio/Makefile +@@ -24,6 +24,7 @@ obj-$(CONFIG_GPIO_AMDPT) += gpio-amdpt.o + obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o + obj-$(CONFIG_ATH79) += gpio-ath79.o + obj-$(CONFIG_GPIO_BCM_KONA) += gpio-bcm-kona.o ++obj-$(CONFIG_GPIO_BCM_VIRT) += gpio-bcm-virt.o + obj-$(CONFIG_GPIO_BRCMSTB) += gpio-brcmstb.o + obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o + obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o +diff --git a/drivers/gpio/gpio-bcm-virt.c b/drivers/gpio/gpio-bcm-virt.c +new file mode 100644 +index 0000000..53edcb4 +--- /dev/null ++++ b/drivers/gpio/gpio-bcm-virt.c +@@ -0,0 +1,180 @@ ++/* ++ * brcmvirt GPIO driver ++ * ++ * Copyright (C) 2012,2013 Dom Cobley ++ * Based on gpio-clps711x.c by Alexander Shiyan ++ * ++ * 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. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MODULE_NAME "brcmvirt-gpio" ++#define NUM_GPIO 2 ++ ++struct brcmvirt_gpio { ++ struct gpio_chip gc; ++ u32 __iomem *ts_base; ++ /* two packed 16-bit counts of enabled and disables ++ Allows host to detect a brief enable that was missed */ ++ u32 enables_disables[NUM_GPIO]; ++}; ++ ++static int brcmvirt_gpio_dir_in(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return -EINVAL; ++} ++ ++static int brcmvirt_gpio_dir_out(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ return 0; ++} ++ ++static int brcmvirt_gpio_get(struct gpio_chip *gc, unsigned off) ++{ ++ struct brcmvirt_gpio *gpio; ++ unsigned v; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ v = readl(gpio->ts_base + off); ++ return (v >> off) & 1; ++} ++ ++static void brcmvirt_gpio_set(struct gpio_chip *gc, unsigned off, int val) ++{ ++ struct brcmvirt_gpio *gpio; ++ u16 enables, disables; ++ s16 diff; ++ bool lit; ++ gpio = container_of(gc, struct brcmvirt_gpio, gc); ++ enables = gpio->enables_disables[off] >> 16; ++ disables = gpio->enables_disables[off] >> 0; ++ diff = (s16)(enables - disables); ++ lit = diff > 0; ++ if ((val && lit) || (!val && !lit)) ++ return; ++ if (val) ++ enables++; ++ else ++ disables++; ++ diff = (s16)(enables - disables); ++ BUG_ON(diff != 0 && diff != 1); ++ gpio->enables_disables[off] = (enables << 16) | (disables << 0); ++ writel(gpio->enables_disables[off], gpio->ts_base + off); ++} ++ ++static int brcmvirt_gpio_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ struct device_node *np = dev->of_node; ++ struct device_node *fw_node; ++ struct rpi_firmware *fw; ++ struct brcmvirt_gpio *ucb; ++ u32 gpiovirtbuf; ++ int err = 0; ++ ++ fw_node = of_parse_phandle(np, "firmware", 0); ++ if (!fw_node) { ++ dev_err(dev, "Missing firmware node\n"); ++ return -ENOENT; ++ } ++ ++ fw = rpi_firmware_get(fw_node); ++ if (!fw) ++ return -EPROBE_DEFER; ++ ++ err = rpi_firmware_property(fw, RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF, ++ &gpiovirtbuf, sizeof(gpiovirtbuf)); ++ ++ if (err) { ++ dev_err(dev, "Failed to get gpiovirtbuf\n"); ++ goto err; ++ } ++ ++ if (!gpiovirtbuf) { ++ dev_err(dev, "No virtgpio buffer\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb = devm_kzalloc(dev, sizeof *ucb, GFP_KERNEL); ++ if (!ucb) { ++ err = -EINVAL; ++ goto err; ++ } ++ ++ // mmap the physical memory ++ gpiovirtbuf &= ~0xc0000000; ++ ucb->ts_base = ioremap(gpiovirtbuf, 4096); ++ if (ucb->ts_base == NULL) { ++ dev_err(dev, "Failed to map physical address\n"); ++ err = -ENOENT; ++ goto err; ++ } ++ ++ ucb->gc.label = MODULE_NAME; ++ ucb->gc.owner = THIS_MODULE; ++ ucb->gc.dev = dev; ++ ucb->gc.of_node = np; ++ ucb->gc.base = 100; ++ ucb->gc.ngpio = NUM_GPIO; ++ ++ ucb->gc.direction_input = brcmvirt_gpio_dir_in; ++ ucb->gc.direction_output = brcmvirt_gpio_dir_out; ++ ucb->gc.get = brcmvirt_gpio_get; ++ ucb->gc.set = brcmvirt_gpio_set; ++ ucb->gc.can_sleep = true; ++ ++ err = gpiochip_add(&ucb->gc); ++ if (err) ++ goto err; ++ ++ platform_set_drvdata(pdev, ucb); ++ ++err: ++ return err; ++ ++} ++ ++static int brcmvirt_gpio_remove(struct platform_device *pdev) ++{ ++ int err = 0; ++ struct brcmvirt_gpio *ucb = platform_get_drvdata(pdev); ++ ++ gpiochip_remove(&ucb->gc); ++ iounmap(ucb->ts_base); ++ return err; ++} ++ ++static const struct of_device_id __maybe_unused brcmvirt_gpio_ids[] = { ++ { .compatible = "brcm,bcm2835-virtgpio" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(of, brcmvirt_gpio_ids); ++ ++static struct platform_driver brcmvirt_gpio_driver = { ++ .driver = { ++ .name = MODULE_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = of_match_ptr(brcmvirt_gpio_ids), ++ }, ++ .probe = brcmvirt_gpio_probe, ++ .remove = brcmvirt_gpio_remove, ++}; ++module_platform_driver(brcmvirt_gpio_driver); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Dom Cobley "); ++MODULE_DESCRIPTION("brcmvirt GPIO driver"); ++MODULE_ALIAS("platform:brcmvirt-gpio"); +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index b011489..c844968 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -93,6 +93,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, + RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, + RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_GPIOVIRTBUF = 0x00040010, + RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, + +From 6aa2c847f76f21c830544e8c79f9030a170ef475 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 21 Jan 2016 17:57:49 +0000 +Subject: [PATCH 167/170] BCM270X_DT: Add Pi3 support + +--- + arch/arm/boot/dts/Makefile | 1 + + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 174 ++++++++++++++++++++++++++++++++++ + arch/arm/boot/dts/bcm2710.dtsi | 102 ++++++++++++++++++++ + 3 files changed, 277 insertions(+) + create mode 100644 arch/arm/boot/dts/bcm2710-rpi-3-b.dts + create mode 100644 arch/arm/boot/dts/bcm2710.dtsi + +diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +index d583e67..fdc450f4 100644 +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -5,6 +5,7 @@ dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb + dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb + dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb + dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb ++dtb-$(CONFIG_ARCH_BCM2709) += bcm2710-rpi-3-b.dtb + + # Raspberry Pi + ifeq ($(CONFIG_ARCH_BCM2708),y) +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +new file mode 100644 +index 0000000..a6ecb51 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -0,0 +1,174 @@ ++/dts-v1/; ++ ++#include "bcm2710.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "Raspberry Pi 3 Model B"; ++}; ++ ++&gpio { ++ sdhost_pins: sdhost_pins { ++ brcm,pins = <48 49 50 51 52 53>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_pins: spi0_pins { ++ brcm,pins = <9 10 11>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ spi0_cs_pins: spi0_cs_pins { ++ brcm,pins = <8 7>; ++ brcm,function = <1>; /* output */ ++ }; ++ ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; ++ }; ++ ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; ++ }; ++ ++ i2s_pins: i2s { ++ brcm,pins = <18 19 20 21>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ ++ sdio_pins: sdio_pins { ++ brcm,pins = <34 35 36 37 38 39>; ++ brcm,function = <7>; // alt3 = SD1 ++ brcm,pull = <0 2 2 2 2 2>; ++ }; ++ ++ bt_pins: bt_pins { ++ brcm,pins = <28 29 30 31 14 15 43>; ++ brcm,function = <6 6 6 6 2 2 4>; ++ // alt2:PCM alt5:UART1 alt0:GPCLK2 ++ brcm,pull = <0 0 0 0 0 2 0>; ++ }; ++ ++ uart1_pins: uart1_pins { ++ brcm,pins = <32 33>; ++ brcm,function = <7>; /* alt3=UART0 */ ++ brcm,pull = <0>; ++ }; ++}; ++ ++&sdhost { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdhost_pins>; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&mmc { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&sdio_pins>; ++ non-removable; ++ bus-width = <4>; ++ status = "okay"; ++}; ++ ++&fb { ++ status = "okay"; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins &bt_pins>; ++ status = "okay"; ++}; ++ ++&spi0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>; ++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>; ++ ++ 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 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c1_pins>; ++ clock-frequency = <100000>; ++}; ++ ++&i2c2 { ++ clock-frequency = <100000>; ++}; ++ ++&i2s { ++ #sound-dai-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2s_pins>; ++}; ++ ++&random { ++ status = "okay"; ++}; ++ ++&leds { ++ act_led: act { ++ label = "led0"; ++ linux,default-trigger = "mmc0"; ++ gpios = <&gpio 47 0>; ++ }; ++}; ++ ++/ { ++ chosen { ++ bootargs = "8250.nr_uarts=1"; ++ }; ++}; ++ ++/ { ++ __overrides__ { ++ uart0 = <&uart0>,"status"; ++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0"; ++ i2s = <&i2s>,"status"; ++ spi = <&spi0>,"status"; ++ i2c0 = <&i2c0>,"status"; ++ i2c1 = <&i2c1>,"status"; ++ i2c2_iknowwhatimdoing = <&i2c2>,"status"; ++ i2c0_baudrate = <&i2c0>,"clock-frequency:0"; ++ i2c1_baudrate = <&i2c1>,"clock-frequency:0"; ++ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; ++ core_freq = <&clk_core>,"clock-frequency:0"; ++ ++ 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"; ++ watchdog = <&watchdog>,"status"; ++ random = <&random>,"status"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/bcm2710.dtsi b/arch/arm/boot/dts/bcm2710.dtsi +new file mode 100644 +index 0000000..1a48686 +--- /dev/null ++++ b/arch/arm/boot/dts/bcm2710.dtsi +@@ -0,0 +1,102 @@ ++#include "bcm2708_common.dtsi" ++ ++/ { ++ compatible = "brcm,bcm2710","brcm,bcm2709"; ++ model = "BCM2710"; ++ ++ chosen { ++ /* No padding required - the boot loader can do that. */ ++ bootargs = ""; ++ }; ++ ++ soc { ++ ranges = <0x7e000000 0x3f000000 0x01000000>, ++ <0x40000000 0x40000000 0x00040000>; ++ ++ local_intc: local_intc { ++ compatible = "brcm,bcm2836-l1-intc"; ++ reg = <0x40000000 0x100>; ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ interrupt-parent = <&local_intc>; ++ }; ++ ++ arm-pmu { ++ compatible = "arm,cortex-a7-pmu"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <9>; ++ }; ++ ++ gpiomem { ++ compatible = "brcm,bcm2835-gpiomem"; ++ reg = <0x7e200000 0x1000>; ++ status = "okay"; ++ }; ++ ++ timer { ++ compatible = "arm,armv7-timer"; ++ clock-frequency = <19200000>; ++ interrupt-parent = <&local_intc>; ++ interrupts = <0>, // PHYS_SECURE_PPI ++ <1>, // PHYS_NONSECURE_PPI ++ <3>, // VIRT_PPI ++ <2>; // HYP_PPI ++ always-on; ++ }; ++ ++ syscon@40000000 { ++ compatible = "brcm,bcm2836-arm-local", "syscon"; ++ reg = <0x40000000 0x100>; ++ }; ++ }; ++ ++ cpus: cpus { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ v7_cpu0: cpu@0 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x000>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu1: cpu@1 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x001>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu2: cpu@2 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x002>; ++ clock-frequency = <800000000>; ++ }; ++ ++ v7_cpu3: cpu@3 { ++ device_type = "cpu"; ++ compatible = "arm,cortex-a7"; ++ reg = <0x003>; ++ clock-frequency = <800000000>; ++ }; ++ }; ++ ++ __overrides__ { ++ arm_freq = <&v7_cpu0>, "clock-frequency:0", ++ <&v7_cpu1>, "clock-frequency:0", ++ <&v7_cpu2>, "clock-frequency:0", ++ <&v7_cpu3>, "clock-frequency:0"; ++ }; ++}; ++ ++&watchdog { ++ status = "okay"; ++}; ++ ++&intc { ++ compatible = "brcm,bcm2836-armctrl-ic"; ++ interrupt-parent = <&local_intc>; ++ interrupts = <8>; ++}; + +From 52015bd5f0bb4d64ca51c5f8539cf2552dfb8a42 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 21 Jan 2016 17:57:49 +0000 +Subject: [PATCH 168/170] FIXUP: BCM270X_DT: Update to latest Pi3 DTS + +--- + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 34 ++++++++++++++++++++++++++-------- + 1 file changed, 26 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +index a6ecb51..cc060898 100644 +--- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -45,16 +45,21 @@ + }; + + bt_pins: bt_pins { +- brcm,pins = <28 29 30 31 14 15 43>; +- brcm,function = <6 6 6 6 2 2 4>; +- // alt2:PCM alt5:UART1 alt0:GPCLK2 +- brcm,pull = <0 0 0 0 0 2 0>; ++ brcm,pins = <28 29 30 31 43>; ++ brcm,function = <6 6 6 6 4>; /* alt2:PCM alt0:GPCLK2 */ ++ brcm,pull = <0 0 0 0 0>; + }; + +- uart1_pins: uart1_pins { ++ uart0_pins: uart0_pins { + brcm,pins = <32 33>; + brcm,function = <7>; /* alt3=UART0 */ +- brcm,pull = <0>; ++ brcm,pull = <0 0>; ++ }; ++ ++ uart1_pins: uart1_pins { ++ brcm,pins = <14 15>; ++ brcm,function = <2>; /* alt5=UART1 */ ++ brcm,pull = <0 0>; + }; + }; + +@@ -71,6 +76,17 @@ + non-removable; + bus-width = <4>; + status = "okay"; ++ brcm,overclock-50 = <0>; ++}; ++ ++&soc { ++ virtgpio: virtgpio { ++ compatible = "brcm,bcm2835-virtgpio"; ++ gpio-controller; ++ #gpio-cells = <2>; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; + }; + + &fb { +@@ -78,12 +94,14 @@ + }; + + &uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins &bt_pins>; + status = "okay"; + }; + + &uart1 { + pinctrl-names = "default"; +- pinctrl-0 = <&uart1_pins &bt_pins>; ++ pinctrl-0 = <&uart1_pins>; + status = "okay"; + }; + +@@ -139,7 +157,7 @@ + act_led: act { + label = "led0"; + linux,default-trigger = "mmc0"; +- gpios = <&gpio 47 0>; ++ gpios = <&virtgpio 0 0>; + }; + }; + + +From 310f5af54ca26b68795f0376c67b41e2bb18a0e0 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <6by9@users.noreply.github.com> +Date: Mon, 8 Feb 2016 23:49:41 +0000 +Subject: [PATCH 169/170] DT: Add overlays to configure I2C pins + +Lifted from +https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=120938&p=825883 +so not claiming this to be my own work. +Adds overlays i2c0-bcm2708 and i2c1-bcm2708 that allow the pin +allocations for i2c-0 and i2c-1 to be changed. +--- + arch/arm/boot/dts/overlays/Makefile | 2 ++ + arch/arm/boot/dts/overlays/README | 16 ++++++++++ + .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 36 +++++++++++++++++++++ + .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 ++++++++++++++++++++++ + 4 files changed, 91 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index a787d66..f2bc3ce 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -29,6 +29,8 @@ 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) += i2c-gpio-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += i2c0-bcm2708-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += i2c1-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += i2s-mmap-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index cf5f5be..7d7bbb8 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -371,6 +371,22 @@ Params: ds1307 Select the DS1307 device + pcf8563 Select the PCF8563 device + + ++Name: i2c0-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c0 bus ++Load: dtoverlay=i2c0-bcm2708,= ++Params: sda0_pin GPIO pin for SDA0 (0, 28 [or 44] - default 0) ++ scl0_pin GPIO pin for SCL0 (1, 29 [or 45] - default 1) ++ ++ ++Name: i2c1-bcm2708 ++Info: Enable the i2c_bcm2708 driver for the i2c1 bus ++Load: dtoverlay=i2c1-bcm2708,= ++Params: sda1_pin GPIO pin for SDA1 (2 or 44 - default 2) ++ scl1_pin GPIO pin for SCL1 (3 or 45 - default 3) ++ pin_func Alternative pin function (4 (alt0), 6 (alt2) - ++ default 4) ++ ++ + Name: i2s-mmap + Info: Enables mmap support in the bcm2708-i2s driver + Load: dtoverlay=i2s-mmap +diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +new file mode 100644 +index 0000000..5c0e55b +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts +@@ -0,0 +1,36 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c0 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c0-bcm2708-overlay.dtb i2c0-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c0>; ++ __overlay__ { ++ pinctrl-0 = <&i2c0_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c0_pins: i2c0 { ++ brcm,pins = <0 1>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ sda0_pin = <&i2c0_pins>,"brcm,pins:0"; ++ scl0_pin = <&i2c0_pins>,"brcm,pins:4"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +new file mode 100644 +index 0000000..e303b9c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts +@@ -0,0 +1,37 @@ ++/* ++ * Device tree overlay for i2c_bcm2708, i2c1 bus ++ * ++ * Compile: ++ * dtc -@ -I dts -O dtb -o i2c1-bcm2708-overlay.dtb i2c1-bcm2708-overlay.dts ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ pinctrl-0 = <&i2c1_pins>; ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ i2c1_pins: i2c1 { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; /* alt0 */ ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; ++ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; ++ pin_func = <&i2c1_pins>,"brcm,function:0"; ++ }; ++}; + +From c5cbb66686e7e289e8a7aff49a954f86893e628d Mon Sep 17 00:00:00 2001 +From: Dhiraj Goel +Date: Thu, 3 Mar 2016 21:10:50 -0800 +Subject: [PATCH 170/170] bcm2835-camera: fix a bug in computation of frame + timestamp + +Fixes #1318 +--- + drivers/media/platform/bcm2835/bcm2835-camera.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +index e83334c..98a892e 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.c ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -360,8 +360,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, + div = + div_u64_rem(runtime_us, USEC_PER_SEC, &rem); + buf->vb.timestamp.tv_sec = +- dev->capture.kernel_start_ts.tv_sec - 1 + +- div; ++ dev->capture.kernel_start_ts.tv_sec + div; + buf->vb.timestamp.tv_usec = + dev->capture.kernel_start_ts.tv_usec + rem; +