diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch index 9da370c113..c87244fc95 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 f12410478cffff991f5e3c3d3fd68bab0bd33c2c Mon Sep 17 00:00:00 2001 +From 57f6047cdbd633f660b9a859b903503709cc821e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 001/105] Main bcm2708/bcm2709 linux port +Subject: [PATCH 001/131] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -7002,370 +7002,10 @@ index b5bedae..b0258e8 100644 mmc_pm_flag_t pm_caps; /* supported pm features */ -From e3d3c97f9f253df42f218071e9f9bb7fd8f602f0 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 16 Jun 2015 23:48:09 +0100 -Subject: [PATCH 002/105] power: Add power driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -BCM270x: power: Change initcall level to subsys - -Load ordering of modules are determined by the initcall used. -If it's the same initcall level, makefile ordering decides. -Now that the mailbox driver is being moved, it's no longer -placed before the power driver by the linker. -So use a later initcall level to let the mailbox driver -load first. - -Signed-off-by: Noralf Trønnes - -BCM270x: Move power module - -Make the power module available on ARCH_BCM2835 by moving it. -The module turns on USB power making it possible to boot -ARCH_BCM2835 directly with the VC bootloader. - -Signed-off-by: Noralf Trønnes ---- - drivers/soc/Kconfig | 1 + - drivers/soc/Makefile | 1 + - drivers/soc/bcm2835/Kconfig | 9 ++ - drivers/soc/bcm2835/Makefile | 1 + - drivers/soc/bcm2835/bcm2708-power.c | 200 ++++++++++++++++++++++++++++++++++++ - include/soc/bcm2835/power.h | 61 +++++++++++ - 6 files changed, 273 insertions(+) - create mode 100644 drivers/soc/bcm2835/Kconfig - create mode 100644 drivers/soc/bcm2835/Makefile - create mode 100644 drivers/soc/bcm2835/bcm2708-power.c - create mode 100644 include/soc/bcm2835/power.h - -diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig -index d8bde82..595c9cd 100644 ---- a/drivers/soc/Kconfig -+++ b/drivers/soc/Kconfig -@@ -1,5 +1,6 @@ - menu "SOC (System On Chip) specific Drivers" - -+source "drivers/soc/bcm2835/Kconfig" - source "drivers/soc/mediatek/Kconfig" - source "drivers/soc/qcom/Kconfig" - source "drivers/soc/ti/Kconfig" -diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile -index 70042b2..9ad449c 100644 ---- a/drivers/soc/Makefile -+++ b/drivers/soc/Makefile -@@ -2,6 +2,7 @@ - # Makefile for the Linux Kernel SOC specific device drivers. - # - -+obj-y += bcm2835/ - obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ - obj-$(CONFIG_ARCH_QCOM) += qcom/ - obj-$(CONFIG_ARCH_TEGRA) += tegra/ -diff --git a/drivers/soc/bcm2835/Kconfig b/drivers/soc/bcm2835/Kconfig -new file mode 100644 -index 0000000..c2980f3 ---- /dev/null -+++ b/drivers/soc/bcm2835/Kconfig -@@ -0,0 +1,9 @@ -+# -+# BCM2835 Soc drivers -+# -+config BCM2708_POWER -+ tristate "BCM2708 legacy power driver" -+ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) && BCM2708_MBOX -+ default y -+ help -+ Turns on USB power and provides an API for controlling power. -diff --git a/drivers/soc/bcm2835/Makefile b/drivers/soc/bcm2835/Makefile -new file mode 100644 -index 0000000..3614ad9 ---- /dev/null -+++ b/drivers/soc/bcm2835/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_BCM2708_POWER) += bcm2708-power.o -diff --git a/drivers/soc/bcm2835/bcm2708-power.c b/drivers/soc/bcm2835/bcm2708-power.c -new file mode 100644 -index 0000000..e7931a9 ---- /dev/null -+++ b/drivers/soc/bcm2835/bcm2708-power.c -@@ -0,0 +1,200 @@ -+/* -+ * linux/arch/arm/mach-bcm2708/power.c -+ * -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * This device provides a shared mechanism for controlling the power to -+ * VideoCore subsystems. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "bcm2708_power" -+ -+#define BCM_POWER_MAXCLIENTS 4 -+#define BCM_POWER_NOCLIENT (1<<31) -+ -+/* Some drivers expect there devices to be permanently powered */ -+ -+#ifdef CONFIG_USB -+#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) -+#endif -+ -+#if 1 -+#define DPRINTK printk -+#else -+#define DPRINTK if (0) printk -+#endif -+ -+struct state_struct { -+ uint32_t global_request; -+ uint32_t client_request[BCM_POWER_MAXCLIENTS]; -+ struct semaphore client_mutex; -+ struct semaphore mutex; -+} g_state; -+ -+int bcm_power_open(BCM_POWER_HANDLE_T *handle) -+{ -+ BCM_POWER_HANDLE_T i; -+ int ret = -EBUSY; -+ -+ down(&g_state.client_mutex); -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { -+ if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { -+ g_state.client_request[i] = BCM_POWER_NONE; -+ *handle = i; -+ ret = 0; -+ break; -+ } -+ } -+ -+ up(&g_state.client_mutex); -+ -+ DPRINTK("bcm_power_open() -> %d\n", *handle); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(bcm_power_open); -+ -+int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) -+{ -+ int rc = 0; -+ -+ DPRINTK("bcm_power_request(%d, %x)\n", handle, request); -+ -+ if ((handle < BCM_POWER_MAXCLIENTS) && -+ (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { -+ if (down_interruptible(&g_state.mutex) != 0) { -+ DPRINTK("bcm_power_request -> interrupted\n"); -+ return -EINTR; -+ } -+ -+ if (request != g_state.client_request[handle]) { -+ uint32_t others_request = 0; -+ uint32_t global_request; -+ BCM_POWER_HANDLE_T i; -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { -+ if (i != handle) -+ others_request |= -+ g_state.client_request[i]; -+ } -+ others_request &= ~BCM_POWER_NOCLIENT; -+ -+ global_request = request | others_request; -+ if (global_request != g_state.global_request) { -+ uint32_t actual; -+ -+ /* Send a request to VideoCore */ -+ bcm_mailbox_write(MBOX_CHAN_POWER, -+ global_request << 4); -+ -+ /* Wait for a response during power-up */ -+ if (global_request & ~g_state.global_request) { -+ rc = bcm_mailbox_read(MBOX_CHAN_POWER, -+ &actual); -+ DPRINTK -+ ("bcm_mailbox_read -> %08x, %d\n", -+ actual, rc); -+ actual >>= 4; -+ } else { -+ rc = 0; -+ actual = global_request; -+ } -+ -+ if (rc == 0) { -+ if (actual != global_request) { -+ printk(KERN_ERR -+ "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", -+ __func__, -+ g_state.global_request, -+ global_request, actual, request, others_request); -+ /* A failure */ -+ BUG_ON((others_request & actual) -+ != others_request); -+ request &= actual; -+ rc = -EIO; -+ } -+ -+ g_state.global_request = actual; -+ g_state.client_request[handle] = -+ request; -+ } -+ } -+ } -+ up(&g_state.mutex); -+ } else { -+ rc = -EINVAL; -+ } -+ DPRINTK("bcm_power_request -> %d\n", rc); -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_power_request); -+ -+int bcm_power_close(BCM_POWER_HANDLE_T handle) -+{ -+ int rc; -+ -+ DPRINTK("bcm_power_close(%d)\n", handle); -+ -+ rc = bcm_power_request(handle, BCM_POWER_NONE); -+ if (rc == 0) -+ g_state.client_request[handle] = BCM_POWER_NOCLIENT; -+ -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_power_close); -+ -+static int __init bcm_power_init(void) -+{ -+#if defined(BCM_POWER_ALWAYS_ON) -+ BCM_POWER_HANDLE_T always_on_handle; -+#endif -+ int rc = 0; -+ int i; -+ -+ printk(KERN_INFO "bcm_power: Broadcom power driver\n"); -+ bcm_mailbox_write(MBOX_CHAN_POWER, 0); -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) -+ g_state.client_request[i] = BCM_POWER_NOCLIENT; -+ -+ sema_init(&g_state.client_mutex, 1); -+ sema_init(&g_state.mutex, 1); -+ -+ g_state.global_request = 0; -+ -+#if defined(BCM_POWER_ALWAYS_ON) -+ if (BCM_POWER_ALWAYS_ON) { -+ bcm_power_open(&always_on_handle); -+ bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); -+ } -+#endif -+ -+ return rc; -+} -+ -+static void __exit bcm_power_exit(void) -+{ -+ bcm_mailbox_write(MBOX_CHAN_POWER, 0); -+} -+ -+/* -+ * Load after the mailbox driver is initialized (arch_initcall), -+ * but before depending drivers (module_init). -+ */ -+subsys_initcall(bcm_power_init); -+module_exit(bcm_power_exit); -+ -+MODULE_AUTHOR("Phil Elwell"); -+MODULE_DESCRIPTION("Interface to BCM2708 power management"); -+MODULE_LICENSE("GPL"); -diff --git a/include/soc/bcm2835/power.h b/include/soc/bcm2835/power.h -new file mode 100644 -index 0000000..bf22b26 ---- /dev/null -+++ b/include/soc/bcm2835/power.h -@@ -0,0 +1,61 @@ -+/* -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * This device provides a shared mechanism for controlling the power to -+ * VideoCore subsystems. -+ */ -+ -+#ifndef _BCM2708_POWER_H -+#define _BCM2708_POWER_H -+ -+#include -+ -+/* Use meaningful names on each side */ -+#ifdef __VIDEOCORE__ -+#define PREFIX(x) ARM_##x -+#else -+#define PREFIX(x) BCM_##x -+#endif -+ -+enum { -+ PREFIX(POWER_SDCARD_BIT), -+ PREFIX(POWER_UART_BIT), -+ PREFIX(POWER_MINIUART_BIT), -+ PREFIX(POWER_USB_BIT), -+ PREFIX(POWER_I2C0_BIT), -+ PREFIX(POWER_I2C1_BIT), -+ PREFIX(POWER_I2C2_BIT), -+ PREFIX(POWER_SPI_BIT), -+ PREFIX(POWER_CCP2TX_BIT), -+ PREFIX(POWER_DSI_BIT), -+ -+ PREFIX(POWER_MAX) -+}; -+ -+enum { -+ PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), -+ PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), -+ PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), -+ PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), -+ PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), -+ PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), -+ PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), -+ PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), -+ PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), -+ PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), -+ -+ PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, -+ PREFIX(POWER_NONE) = 0 -+}; -+ -+typedef unsigned int BCM_POWER_HANDLE_T; -+ -+extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); -+extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); -+extern int bcm_power_close(BCM_POWER_HANDLE_T handle); -+ -+#endif - -From 6f7a17a848b57ac66f13d9ee9f09f4be89e74824 Mon Sep 17 00:00:00 2001 +From eef200f75c4a6f6701f1693f8f59ab2c83d1abcd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Oct 2014 18:50:05 +0100 -Subject: [PATCH 003/105] Add bcm2708_gpio driver +Subject: [PATCH 002/131] Add bcm2708_gpio driver Signed-off-by: popcornmix @@ -7995,10 +7635,10 @@ index 0000000..fb69624 + +#endif -From e1fa284edd01b1a623096845dbe54c8d936aaaaf Mon Sep 17 00:00:00 2001 +From 6f5003498da677a660cbdfaf9be78d3c0aff2e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 1 May 2015 19:11:03 +0200 -Subject: [PATCH 004/105] mailbox: bcm2708: Add bcm2708-vcio +Subject: [PATCH 003/131] mailbox: bcm2708: Add bcm2708-vcio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -8629,10 +8269,10 @@ index 0000000..cc284ed + +#endif -From 495cfff15f23f9b3ee26b0b92673ad77fc3e8d22 Mon Sep 17 00:00:00 2001 +From 7c8a47937b598fa8dad4cd50753164b5ee44f8c1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 005/105] Add dwc_otg driver +Subject: [PATCH 004/131] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69906,10 +69546,10 @@ index 0000000..cdc9963 +test_main(); +0; -From 2fee602715f8de08540132094fe160dd21978680 Mon Sep 17 00:00:00 2001 +From 70cf7eac2e13367cb8939741ee140c6bbac32f62 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:54:32 +0100 -Subject: [PATCH 006/105] bcm2708 watchdog driver +Subject: [PATCH 005/131] bcm2708 watchdog driver Signed-off-by: popcornmix --- @@ -70346,10 +69986,10 @@ index 0000000..8a27d68 +MODULE_ALIAS_MISCDEV(TEMP_MINOR); +MODULE_LICENSE("GPL"); -From 164b737c320aca85798130a904c964f748423937 Mon Sep 17 00:00:00 2001 +From 6655b0b613cde9e4eb6aacaf43d04a388d8cd6c6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 007/105] bcm2708 framebuffer driver +Subject: [PATCH 006/131] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -73788,10 +73428,10 @@ index 3c14e43..7626beb6a 100644 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From b1c418d504c5c7b800fee387abf9a03af0e1b4a4 Mon Sep 17 00:00:00 2001 +From 0f8c3ed7803f3a871df49398b678c364aa4929c2 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 008/105] dmaengine: Add support for BCM2708 +Subject: [PATCH 007/131] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -75559,10 +75199,10 @@ index 0000000..2310e34 + +#endif /* _PLAT_BCM2708_DMA_H */ -From 8500a8de635dc4ce251330dfe0950453689d7a65 Mon Sep 17 00:00:00 2001 +From 0464f674cf3e441b8651c4a5ea0131fa24a3adc4 Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 009/105] MMC: added alternative MMC driver +Subject: [PATCH 008/131] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -77378,10 +77018,10 @@ index 0000000..b7c4883 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 6a1f159f160fec9d7b8f10cc0b37c79c58be80c8 Mon Sep 17 00:00:00 2001 +From 7bf3e966797438781e11dbc233e17bbe4746bd5b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 010/105] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 009/131] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -79151,10 +78791,10 @@ index 0000000..eef8a24 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From 8f5a0afb8bc65e48695b38a33dba8a17bb0c4218 Mon Sep 17 00:00:00 2001 +From 2bb9c01de4c90a8b7a9b52be95f504177abeaf45 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 011/105] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 010/131] cma: Add vc_cma driver to enable use of CMA Signed-off-by: popcornmix @@ -80479,10 +80119,10 @@ index 0000000..5325832 + +#endif /* VC_CMA_H */ -From 8af8b7d264e546ee29b28acca735bd4ce8dbdb71 Mon Sep 17 00:00:00 2001 +From 801a4cbc4ea0f0ffd64b4fa0065be3f791b9d1d0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 012/105] bcm2708: alsa sound driver +Subject: [PATCH 011/131] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -83324,10 +82964,10 @@ index 0000000..af3e6eb + +#endif // _VC_AUDIO_DEFS_H_ -From d01fbc5cd5784094ffe247f269eaa1b31bb023d5 Mon Sep 17 00:00:00 2001 +From 32495b1b4a656f2388b1dc133278a80616e40994 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 013/105] bcm2708 vchiq driver +Subject: [PATCH 012/131] bcm2708 vchiq driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -96581,10 +96221,10 @@ index 0000000..b6bfa21 + return vchiq_build_time; +} -From efc783d883c14618d52d0d804a856ee31a152fcb Mon Sep 17 00:00:00 2001 +From 8909329c134abdf242dc345a4528e98e86c85c33 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 16:07:06 +0100 -Subject: [PATCH 014/105] vc_mem: Add vc_mem driver +Subject: [PATCH 013/131] vc_mem: Add vc_mem driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -97590,10 +97230,10 @@ index 0000000..20a4753 + +#endif /* _VC_MEM_H */ -From 72c49d81f0dd002228b6cb26db9e5428eef39d41 Mon Sep 17 00:00:00 2001 +From 3dc51b65ed267fd3cc57feeda298e6c02af5cf82 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 015/105] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 014/131] vcsm: VideoCore shared memory service for BCM2835 Add experimental support for the VideoCore shared memory service. This allows user processes to allocate memory from VideoCore's @@ -102003,10 +101643,10 @@ index 0000000..0bfb42e +MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); +MODULE_LICENSE("GPL v2"); -From 6b13df3a424914c3db0687d471236611c0cd6d60 Mon Sep 17 00:00:00 2001 +From 250314915c749fccd25d98aca0b9a2d29f55ec1c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:51:55 +0100 -Subject: [PATCH 016/105] Add hwrng (hardware random number generator) driver +Subject: [PATCH 015/131] Add hwrng (hardware random number generator) driver --- drivers/char/hw_random/Kconfig | 13 +++- @@ -102183,10 +101823,10 @@ index 0000000..340f004 +MODULE_DESCRIPTION("BCM2708 H/W Random Number Generator (RNG) driver"); +MODULE_LICENSE("GPL and additional rights"); -From 71858ccb0a96e022238c9644177fcbf891807ffd Mon Sep 17 00:00:00 2001 +From e074d656e4011eae32577e4d20d7ce6dfa15f6e8 Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 017/105] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 016/131] 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 @@ -103039,10 +102679,10 @@ index 0000000..24563ec +module_param(debug, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Enable debugging messages"); -From 36fe69547259b45803b0cb11085d60374c92446a Mon Sep 17 00:00:00 2001 +From ccdc49f30be0caec97b9b7e4352b8c63eb45acdd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 018/105] Add cpufreq driver +Subject: [PATCH 017/131] Add cpufreq driver Signed-off-by: popcornmix --- @@ -103315,10 +102955,10 @@ index 0000000..6735da9 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From 50d7170ec5cf300e239ab575de3e0917ec44b8a6 Mon Sep 17 00:00:00 2001 +From b7e45ce253f9aa6f3f4b33967b124198d3e2b74f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 019/105] Added hwmon/thermal driver for reporting core +Subject: [PATCH 018/131] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -103615,10 +103255,10 @@ index 0000000..3bc80f1 + +module_platform_driver(bcm2835_thermal_driver); -From 4011c7c5c3c5a03af182dbed2e824a491d12e96c Mon Sep 17 00:00:00 2001 +From f65673287078cca868595a556d8613802e9a1743 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:41:33 +0100 -Subject: [PATCH 020/105] Add Chris Boot's spi driver. +Subject: [PATCH 019/131] Add Chris Boot's spi driver. spi: bcm2708: add device tree support @@ -104530,10 +104170,10 @@ index 0000000..041b5e2 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 04e6956b7d15554967ca2620563efc31a63cd69e Mon Sep 17 00:00:00 2001 +From 31dade83cc4f448f81d7d460c59d02b9ebc3b05b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 021/105] Add Chris Boot's i2c driver +Subject: [PATCH 020/131] Add Chris Boot's i2c driver i2c-bcm2708: fixed baudrate @@ -105334,10 +104974,10 @@ index 0000000..8773203 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 9ed8236717339aab28673519a2300e6f0165d2da Mon Sep 17 00:00:00 2001 +From 170ee05def27ef6ddedf2561d1dd770c992962b1 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 022/105] bcm2835: add v4l2 camera device +Subject: [PATCH 021/131] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -112664,10 +112304,10 @@ index 0000000..9d1d11e + +#endif /* MMAL_VCHIQ_H */ -From 8daf7f4a4f40fd1d6008fa8438d72ae3c9f2cd4f Mon Sep 17 00:00:00 2001 +From e864404b1afe2fdb0dbd9b3bc5968ea2173fd3e7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 23 Jan 2015 14:48:55 +0000 -Subject: [PATCH 023/105] scripts/dtc: Update to upstream version with overlay +Subject: [PATCH 022/131] scripts/dtc: Update to upstream version with overlay patches --- @@ -117515,7 +117155,7 @@ index 665dad7..f439b40 100644 } diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c -index e464727..6e5878a 100644 +index e464727c..6e5878a 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c @@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname) @@ -117880,10 +117520,10 @@ index 54d4e904..d644002 100644 -#define DTC_VERSION "DTC 1.4.0-dirty" +#define DTC_VERSION "DTC 1.4.1-g36c70742" -From 0d794d8e6cccfbefeb6320acf871913dcd94d2ff Mon Sep 17 00:00:00 2001 +From 5b2523aae9c5beb443315a7814633fc740992d07 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 024/105] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 023/131] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -118368,10 +118008,10 @@ index 0000000..3dff948 + return (($val eq 'y') || ($val eq '1')); +} -From 79ae5c40586808d01368549b13b3c7a4709c9564 Mon Sep 17 00:00:00 2001 +From 2d9c312e5b7a52fc0e311f909bb475ecc68b1199 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 025/105] fdt: Add support for the CONFIG_CMDLINE_EXTEND option +Subject: [PATCH 024/131] fdt: Add support for the CONFIG_CMDLINE_EXTEND option --- drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- @@ -118426,10 +118066,10 @@ index cde35c5d01..dd7fbfe 100644 pr_debug("Command line is: %s\n", (char*)data); -From 01a18bea60e6b60a6fcb0a58faaf34f1b5cc0281 Mon Sep 17 00:00:00 2001 +From 73ffc770b510d914757449f9bd52ff5e0b300a52 Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 026/105] BCM2708: Add core Device Tree support +Subject: [PATCH 025/131] BCM2708: Add core Device Tree support Add the bare minimum needed to boot BCM2708 from a Device Tree. @@ -122306,10 +121946,10 @@ index 0000000..66a98f6 + }; +}; -From 7c5cfbcdfa96680f63b0e82202ab509ef78bc023 Mon Sep 17 00:00:00 2001 +From 4559e395eaf5d2a4c9af93066c8edc7d184287e3 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 027/105] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 026/131] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -122402,10 +122042,10 @@ index fb795c3..fa72af0 100644 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -From b16b65cdb4064e32b321e4d3801bc1990ee258f7 Mon Sep 17 00:00:00 2001 +From 68d4d166abf2d287a3b333bbae60e2c9c027fa71 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 030/105] Speed up console framebuffer imageblit function +Subject: [PATCH 029/131] 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 @@ -122614,10 +122254,10 @@ index a2bb276..436494f 100644 start_index, pitch_index); } else -From bda0a510175903069a6e36ee03df8bb58da535fc Mon Sep 17 00:00:00 2001 +From 5e3834b22d4c560ac1354cfff30a6713b6d94e64 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 031/105] Allow mac address to be set in smsc95xx +Subject: [PATCH 030/131] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -122708,10 +122348,10 @@ index 26423ad..e29a323 100644 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { -From cc2b2db4dd1eea70daf6a7b2122bc2cc4fff16b5 Mon Sep 17 00:00:00 2001 +From 9c50f6318fdf116e5abaeb05bffa0b65e48ba259 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 032/105] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 031/131] 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 @@ -123109,10 +122749,10 @@ index d58594a..feae942 100644 unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; -From f0f58bbd87e81fe4ff162b11faedbacc6b0c8f38 Mon Sep 17 00:00:00 2001 +From 2722779be49b7b76dea3de564e03d9fd0083f094 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 034/105] config: Enable CONFIG_MEMCG, but leave it disabled +Subject: [PATCH 033/131] config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. --- @@ -123167,10 +122807,10 @@ index a04225d..a2ef8af 100644 /** -From c475efe6fd77dc1288117ba41451f11c7e46c74c Mon Sep 17 00:00:00 2001 +From 27e4ffc36fc9366bfcefe25321191a78460ba1fd Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:33:38 +0100 -Subject: [PATCH 035/105] ASoC: Add support for BCM2708 +Subject: [PATCH 034/131] ASoC: Add support for BCM2708 This driver adds support for digital audio (I2S) for the BCM2708 SoC that is used by the @@ -124313,10 +123953,10 @@ index 0000000..6fdcbc1 + +#endif -From ea9da38e0ab7aae107b1b2cb86f9e6728c54f72d Mon Sep 17 00:00:00 2001 +From c368e010eacbc50e6a5f527fcc8651ea1cdc5f26 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 036/105] ASoC: Add support for PCM5102A codec +Subject: [PATCH 035/131] ASoC: Add support for PCM5102A codec Some definitions to support the PCM5102A codec by Texas Instruments. @@ -124441,10 +124081,10 @@ index 0000000..126f1e9 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 3843c763a49f690052a369c75a4b91e63e65ccd3 Mon Sep 17 00:00:00 2001 +From 1ae47f91380b552b3bb3adb28f3283be31786064 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:04:54 +0100 -Subject: [PATCH 037/105] BCM2708: Add I2S support to board file +Subject: [PATCH 036/131] BCM2708: Add I2S support to board file Adds the required initializations for I2S to the board file of mach-bcm2708. @@ -124533,10 +124173,10 @@ index a3b65dc..a515992 100644 for (i = 0; i <= 1; i++) { void __iomem *base; -From 9305f38947159f8027408f9caf57ff11d3a14e5d Mon Sep 17 00:00:00 2001 +From 65a3e3f912faa5d0c0cdb937b23e641d45608236 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 038/105] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 037/131] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -124685,10 +124325,10 @@ index 0000000..4b70b45 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From d48fc2d392448b821b9ff95e26cf859f2efe4794 Mon Sep 17 00:00:00 2001 +From 1fee3fa181deb59422ad4f5f08262c8328189370 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 039/105] BCM2708: Add HifiBerry DAC to board file +Subject: [PATCH 038/131] BCM2708: Add HifiBerry DAC to board file This adds the initalization of the HifiBerry DAC to the mach-bcm2708 board file. @@ -124736,10 +124376,10 @@ index 01f2de7..1d9b788 100644 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { struct amba_device *d = amba_devs[i]; -From 1d90a3734460be00e20106847f347ff0bd4c322b Mon Sep 17 00:00:00 2001 +From c5a634c60f6706ba7ffaec669d6ddae793a7b889 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 6 Dec 2013 20:50:28 +0100 -Subject: [PATCH 040/105] ASoC: BCM2708: Add support for RPi-DAC +Subject: [PATCH 039/131] ASoC: BCM2708: Add support for RPi-DAC This adds a machine driver for the RPi-DAC. @@ -125034,10 +124674,10 @@ index 0000000..b4eaa44 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 54b60a8b83358d2fedc3e401908d96e9053033fb Mon Sep 17 00:00:00 2001 +From c739ac8e078de6188449830672c7dd1e5b57af52 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 041/105] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 040/131] 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 @@ -125077,10 +124717,10 @@ index 1e403f6..d4efa85 100644 #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ -From bda0438e5d2450329f79c9c203eb7700ea94bcdc Mon Sep 17 00:00:00 2001 +From 7cce7a2fdf84a988e7b23caa129dddbcc7613b10 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 042/105] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 041/131] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -125345,10 +124985,10 @@ index 0000000..92e9e46 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From f0b7e3863c1025b7318dfe2672828fc1186f5f0c Mon Sep 17 00:00:00 2001 +From 6912c1ddd399d69d7704e9f6445014d40ec21c9b Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:26:08 +0100 -Subject: [PATCH 043/105] BCM2708: Added support for HiFiBerry Digi board Board +Subject: [PATCH 042/131] BCM2708: Added support for HiFiBerry Digi board Board initalization by I2C Signed-off-by: Daniel Matuschek @@ -125395,10 +125035,10 @@ index 6d53beb..a062d7f 100644 bcm_register_device_dt(&snd_rpi_dac_device); bcm_register_device_dt(&snd_pcm1794a_codec_device); -From f1d5146257a0181f53a76aa7c1eab75d8cde3722 Mon Sep 17 00:00:00 2001 +From c1291a2b3390ab53e3a6ca2325e39d0a01908d87 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 044/105] ASoC: wm8804: Set idle_bias_off to false Idle bias +Subject: [PATCH 043/131] ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup Signed-off-by: Daniel Matuschek @@ -125420,10 +125060,10 @@ index d4efa85..f3f26a2 100644 .dapm_widgets = wm8804_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), -From e2bd270cae6b71e799cd32309da2efb131bfc0f7 Mon Sep 17 00:00:00 2001 +From 3cefe8f4539e290215418a54ff815913bb658814 Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 045/105] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 044/131] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -125631,10 +125271,10 @@ index 0000000..aff7377 +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From 3722358310334b175672d037724974a827219c91 Mon Sep 17 00:00:00 2001 +From 63dc5102ff1e782a18c891169ef614ff83fd16da Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 046/105] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 045/131] vmstat: Workaround for issue where dirty page count goes negative See: @@ -125661,10 +125301,10 @@ index 82e7db7..f87d16d 100644 static inline void __inc_zone_page_state(struct page *page, -From d0561fb6028c8eb1c26f3ad2f59d21d70eb778f4 Mon Sep 17 00:00:00 2001 +From 4b7eb6e29aee506fd82e9eea37b951f0a4101f8a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 047/105] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 046/131] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -125700,10 +125340,10 @@ index bfbe1be..a738b25 100644 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From efa286e84267224fb05bfe8615489d50932ed5b8 Mon Sep 17 00:00:00 2001 +From e35b74b6335b49387b09d114966b89549a13f1d5 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 048/105] Added support for HiFiBerry DAC+ +Subject: [PATCH 047/131] 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. @@ -125914,10 +125554,10 @@ index 0000000..c63387b +MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); +MODULE_LICENSE("GPL v2"); -From f0b1de75a01f88b6250c208157a3a2f4a5c6b52d Mon Sep 17 00:00:00 2001 +From ee406533a463686db7d11c7ad0f626578c1edcac Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 049/105] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 048/131] 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. @@ -126786,10 +126426,10 @@ index 0000000..8f019e0 + +#endif /* _TAS5713_H */ -From 354cb37f33bee3d72e5a514999323689b00ca275 Mon Sep 17 00:00:00 2001 +From b904f76b1090667c9f4741a60da8e60cebc8a91c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Apr 2015 19:14:18 +0100 -Subject: [PATCH 050/105] bcm2708: Allow option card devices to be configured +Subject: [PATCH 049/131] bcm2708: Allow option card devices to be configured via DT If the kernel is built with Device Tree support, and if a DT blob @@ -126814,10 +126454,10 @@ index 03fa1cb..c816526 100644 static struct platform_driver bcm2835_i2s_driver = { .probe = bcm2835_i2s_probe, -From f5a17a7715495cd47e7c4eef2655346833b71139 Mon Sep 17 00:00:00 2001 +From 8b4aab9c9a47544e493ba3479ad0e6397e4ea27a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 18:45:39 +0100 -Subject: [PATCH 051/105] Adding Device Tree support for some RPi audio cards +Subject: [PATCH 050/131] Adding Device Tree support for some RPi audio cards --- arch/arm/mach-bcm2709/bcm2709.c | 143 ++++++++++++++++++++++++++++++++++++++ @@ -127180,10 +126820,10 @@ index 126f1e9..7c6598e 100644 }; -From 83c934f5afe83dab78859dbdcb6bc2fbcd24904a Mon Sep 17 00:00:00 2001 +From bc32dfd7d696d4e3c381344064aabc38961b7f46 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Wed, 29 Oct 2014 23:30:30 -0700 -Subject: [PATCH 052/105] Added support to reserve/enable a GPIO pin to be used +Subject: [PATCH 051/131] Added support to reserve/enable a GPIO pin to be used from pps-gpio module (LinuxPPS). Enable PPS modules in default config for RPi. @@ -127319,10 +126959,10 @@ index 57e1f3d..721559b 100644 +module_param(pps_gpio_pin, int, 0644); +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); -From 98235f2a450b2f029e0bba2b566b5c86df9a6fef Mon Sep 17 00:00:00 2001 +From 5b706049d22fc0593a14a1d94ebf7f9bf54feeea Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 053/105] Update ds1307 driver for device-tree support +Subject: [PATCH 052/131] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -127349,10 +126989,10 @@ index 4ffabb3..c6789a7 100644 .driver = { .name = "rtc-ds1307", -From d25a65991d2262ee56bf481b47a9980edf5e1ff0 Mon Sep 17 00:00:00 2001 +From 1578dbee8e10fed1be0f64820fe511dc4b7a720e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 054/105] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 053/131] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -127463,10 +127103,10 @@ index 0000000..2ca2b98 +MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); +MODULE_LICENSE("GPL"); -From b478a1224ddadc079a085b1a9fd2f921f3492543 Mon Sep 17 00:00:00 2001 +From a926a1d2720eef63b580a4510a9aec4540836d40 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 20 Jun 2014 17:19:27 +0100 -Subject: [PATCH 055/105] bcm2709: Simplify and strip down IRQ handler +Subject: [PATCH 054/131] bcm2709: Simplify and strip down IRQ handler --- arch/arm/include/asm/entry-macro-multi.S | 2 + @@ -127685,10 +127325,10 @@ index d08591b..08d184c 100644 +1: get_irqnr_and_base r0, r2, r6, lr + .endm -From a149f4195cb6283d974f29f6853bc73666252e28 Mon Sep 17 00:00:00 2001 +From 39cf4677b7c38fac3da503b75d5cd7efc64dd19a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 12 Feb 2015 11:17:53 +0000 -Subject: [PATCH 056/105] Fix LED "input" trigger implementation for 3.19 +Subject: [PATCH 055/131] Fix LED "input" trigger implementation for 3.19 --- drivers/leds/leds-gpio.c | 10 +++++++++- @@ -127775,10 +127415,10 @@ index 9a2b000..60accc5 100644 /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ -From 63f720f1e358012fdb2631c18c794c32beb1c53f Mon Sep 17 00:00:00 2001 +From d6f122c984a90914b054c16def454ee77a002bad Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 057/105] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 056/131] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -127800,10 +127440,10 @@ index 8d908e3..7a1900d 100644 .can_sleep = false, }; -From 344a03d0bd987220640f4dd4ba4d083d2fdbb449 Mon Sep 17 00:00:00 2001 +From 0bb455e4eca847aa74560f58bfd7daa13e9fb496 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 4 Feb 2015 10:02:24 +0000 -Subject: [PATCH 058/105] pinctrl-bcm2835: bcm2835_gpio_direction_output must +Subject: [PATCH 057/131] pinctrl-bcm2835: bcm2835_gpio_direction_output must set the value --- @@ -127831,10 +127471,10 @@ index 7a1900d..62f85aa 100644 static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) -From 1c683d296c9424f0cf7dac30d8992258c28cbeb1 Mon Sep 17 00:00:00 2001 +From 1ee5ccaeae81a9acd296d4d3eaba9fa1807b9e17 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 059/105] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 058/131] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -127980,10 +127620,10 @@ index 62f85aa..c7cf266 100644 }, }; -From e1a45c7cf40f11598c7faed4a1d1b594bcc05796 Mon Sep 17 00:00:00 2001 +From 7e2506a80d3a218bab8db21c947187c92d29812c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 060/105] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 059/131] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -128010,10 +127650,10 @@ index c7cf266..986779a 100644 pc->irq_data[i].irqgroup = i; -From 0fff72fcb15c962d0723f9cea13eb2c3fc31d465 Mon Sep 17 00:00:00 2001 +From 69c25727685034a06c041fee3938afba0b84e582 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 061/105] enc28j60: Add device tree compatible string and an +Subject: [PATCH 060/131] enc28j60: Add device tree compatible string and an overlay --- @@ -128047,10 +127687,10 @@ index b1b5f66..c6b6e1a 100644 .probe = enc28j60_probe, .remove = enc28j60_remove, -From 74c1893348470c0ec98d83ea63ab8e22e3da8c13 Mon Sep 17 00:00:00 2001 +From 9ea362cfd9b8e0b2a8896a713b8b82c0c5834a68 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 062/105] Add driver for rpi-proto +Subject: [PATCH 061/131] 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 @@ -128265,10 +127905,10 @@ index 0000000..c6e45a0 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From 607ebcbdf67cb576a652c505a367e614014547dd Mon Sep 17 00:00:00 2001 +From db5f1ae7154cf08397ba74b67af282f246a17ddf Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Thu, 2 Apr 2015 12:22:55 +0100 -Subject: [PATCH 063/105] Add Device Tree support for RPi-DAC. +Subject: [PATCH 062/131] Add Device Tree support for RPi-DAC. --- sound/soc/bcm/rpi-dac.c | 21 +++++++++++++++++++++ @@ -128343,10 +127983,10 @@ index b4eaa44..afe1b41 100644 }; -From 1fa756b7cbc29e7ce003ed6f6b269faf8f114467 Mon Sep 17 00:00:00 2001 +From 0fa5223ca68a9c68b92b6ea149fccc42d50c3357 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 064/105] config: Add default configs +Subject: [PATCH 063/131] config: Add default configs --- arch/arm/configs/bcm2709_defconfig | 1204 ++++++++++++++++++++++++++++++++++++ @@ -130771,10 +130411,10 @@ index 0000000..6a41231 +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From 7d987bad7109b37ffac673a9975718ee4e9ea9ae Mon Sep 17 00:00:00 2001 +From 4fc03ec1bfe73a125775bb06937a246be639dc55 Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 065/105] smsx95xx: fix crimes against truesize +Subject: [PATCH 064/131] 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. @@ -130809,10 +130449,10 @@ index e29a323..aff63dc usbnet_skb_return(dev, ax_skb); } -From 888ea57ee7c57e7f43b3be9d7f9c70ea92e3ef2e Mon Sep 17 00:00:00 2001 +From 9131a29e8e039bdc5055dad93d41f11a111a13b9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 066/105] smsc95xx: Disable turbo mode by default +Subject: [PATCH 065/131] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- @@ -130832,10 +130472,10 @@ index aff63dc..08a8a8c 100755 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); -From 43e2441e42ce3e68910e50a862e82cefff1491a8 Mon Sep 17 00:00:00 2001 +From 510eb2621d1b1b74618236a324538c19c9106ece Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 067/105] Add blk_pos parameter to mmc multi_io_quirk callback +Subject: [PATCH 066/131] Add blk_pos parameter to mmc multi_io_quirk callback --- drivers/mmc/card/block.c | 1 + @@ -130918,10 +130558,10 @@ index b0258e8..d3cdad9 100644 struct mmc_card; -From 3c38adf40dd65f96d317f60295ee47ddd5412d11 Mon Sep 17 00:00:00 2001 +From d2482f75a64fce6da8a4138f88a6c59cb0de4d9b 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 068/105] bcm2835: bcm2835_defconfig +Subject: [PATCH 067/131] bcm2835: bcm2835_defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -132251,10 +131891,10 @@ index 31cb073..2e8a95a 100644 # CONFIG_XZ_DEC_ARM is not set # CONFIG_XZ_DEC_ARMTHUMB is not set -From 219d0cd5afbcfc1d8d1bffc63c535c323ae8bf2e Mon Sep 17 00:00:00 2001 +From 984698645ff73ed2100b4bfea99ed035139ac721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 1 May 2015 23:00:15 +0200 -Subject: [PATCH 069/105] BCM270x_DT: Add mailbox bcm2708-vcio +Subject: [PATCH 068/131] BCM270x_DT: Add mailbox bcm2708-vcio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -132295,10 +131935,10 @@ index 721559b..4a00561 100644 #ifdef CONFIG_BCM2708_GPIO bcm_register_device_dt(&bcm2708_gpio_device); -From 3c10332d5214199b7df6d5d220eeef023706cbaf Mon Sep 17 00:00:00 2001 +From 156ce0fa550bbcb8e63eb60d11ac05cc28c14775 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 070/105] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 069/131] rpi-ft5406: Add touchscreen driver for pi LCD display --- drivers/input/touchscreen/Kconfig | 7 + @@ -132615,10 +132255,10 @@ index cc284ed..d3ea839 100644 VCMSG_SET_CURSOR_STATE = 0x00008011, }; -From 10fe6a8ff8d397d392f84f71bccef590007c1035 Mon Sep 17 00:00:00 2001 +From e2149721bbb442d9f1622bfd0b4c89a892afd88f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Oct 2014 11:47:53 +0100 -Subject: [PATCH 071/105] Improve __copy_to_user and __copy_from_user +Subject: [PATCH 070/131] Improve __copy_to_user and __copy_from_user performance Provide a __copy_from_user that uses memcpy. On BCM2708, use @@ -134143,10 +133783,10 @@ index 3e58d71..0622891 100644 static unsigned long noinline __clear_user_memset(void __user *addr, unsigned long n) -From 55e619a1d22f898210f4d5df7056de9ca22262ef Mon Sep 17 00:00:00 2001 +From 92f76fcdda43617a0f3461741bba9e6d328684da Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 27 May 2015 17:22:15 +0100 -Subject: [PATCH 072/105] bcm2835-audio: Create the platform device if the DT +Subject: [PATCH 071/131] bcm2835-audio: Create the platform device if the DT node is disabled For backwards compatibility, allow the built-in ALSA driver to be enabled @@ -134200,10 +133840,10 @@ index 4a00561..dec8043 100644 bcm_register_device_dt(&bcm2708_spi_device); -From 3a23003af149876e9459bf65f14eff38ddb57778 Mon Sep 17 00:00:00 2001 +From e64ab6c66db34627b7765099e815a8c2d4957296 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 073/105] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 072/131] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -134262,10 +133902,10 @@ index 70f2f39..f7fdacd 100644 static const char * const bcm2835_compat[] = { -From a16205df7ca3759a05bf56e126d17fb496c12775 Mon Sep 17 00:00:00 2001 +From 8a609b1977da490cd177740e61169444383fd8c4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 Jun 2015 17:47:27 +0100 -Subject: [PATCH 074/105] platform: Add force_core command line setting to boot +Subject: [PATCH 073/131] platform: Add force_core command line setting to boot from a different core number --- @@ -134336,10 +133976,10 @@ index dec8043..fe71c50 100644 module_param(serial, uint, 0644); module_param(uart_clock, uint, 0644); -From d4fe01b4f1f6d84fb12a04e228edc19aea23865a Mon Sep 17 00:00:00 2001 +From 2efab5a48bc519a3901b62da297ee5523c91ee58 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 18 Jun 2015 17:46:17 +0100 -Subject: [PATCH 075/105] mach-bcm270x: Enable the building of pinctrl-bcm2835 +Subject: [PATCH 074/131] mach-bcm270x: Enable the building of pinctrl-bcm2835 --- drivers/pinctrl/Makefile | 1 + @@ -134358,10 +133998,10 @@ index 6eadf04..9119513 100644 obj-$(CONFIG_ARCH_BERLIN) += berlin/ obj-y += freescale/ -From cd146348cbf2ff432f0cb3b05b0e0cf117dbba74 Mon Sep 17 00:00:00 2001 +From 436bd2ba164863768b90c2456a943dcfed3b053c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 19 Jun 2015 16:41:39 +0100 -Subject: [PATCH 076/105] BCM270X_DT: Document the i2s-mmap overlay +Subject: [PATCH 075/131] BCM270X_DT: Document the i2s-mmap overlay --- arch/arm/boot/dts/overlays/README | 6 ++++++ @@ -134385,10 +134025,10 @@ index 3e08f98..7fa6d33 100644 Info: Configures the IQaudio DAC audio card Load: dtoverlay=iqaudio-dac -From 88ffec3ff5b4505e53ee2fdcbc564fe734145ae6 Mon Sep 17 00:00:00 2001 +From 175d8f77d2fe5ed0d43d53ece08978fd50c97a97 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 17 Jun 2015 11:36:53 +0100 -Subject: [PATCH 077/105] bcm2835-sdhost: Improve error handling and recovery +Subject: [PATCH 076/131] bcm2835-sdhost: Improve error handling and recovery 1) Expose the hw_reset method to the MMC framework, removing many internal calls by the driver. @@ -135480,10 +135120,10 @@ index eef8a24..6277e43 100644 if (host->allow_dma) { -From afd5ae68ceec9ee73fb979c32ed1fd19ab6a1038 Mon Sep 17 00:00:00 2001 +From 48297e4045a1d8a3b2a0edbe6cf371a34c5eb3be Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Jun 2015 13:11:46 -0700 -Subject: [PATCH 078/105] ARM: bcm2835: Add the Raspberry Pi firmware driver +Subject: [PATCH 077/131] ARM: bcm2835: Add the Raspberry Pi firmware driver This gives us a function for making mailbox property channel requests of the firmware, which is most notable in that it will let us get and @@ -135917,10 +135557,10 @@ index 0000000..9d9efb7 + void *data, size_t tag_size); +struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); -From c3629eb3fda93e5727602a1484daab7d08da61cb Mon Sep 17 00:00:00 2001 +From 9762ae8cc9ebb55739cb553f3b2c5bc604aec9e4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 22 Mar 2015 13:33:23 +0000 -Subject: [PATCH 079/105] config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING +Subject: [PATCH 078/131] config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING --- arch/arm/configs/bcm2709_defconfig | 4 ++++ @@ -135972,10 +135612,10 @@ index 6a41231..cacde14 100644 CONFIG_BLK_DEV_CRYPTOLOOP=m CONFIG_BLK_DEV_DRBD=m -From 667729cc2a536b1cc6241973276fad1e72909f3a Mon Sep 17 00:00:00 2001 +From dd888666ae9c4f80521f3bbe48edb86b423bb6f6 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Mon, 22 Jun 2015 16:27:07 +0100 -Subject: [PATCH 080/105] Add rpi-ft5406 overlay Add rpi-ft5406 driver as +Subject: [PATCH 079/131] Add rpi-ft5406 overlay Add rpi-ft5406 driver as module --- @@ -136062,10 +135702,10 @@ index cacde14..f952ff2 100644 CONFIG_TOUCHSCREEN_STMPE=m CONFIG_INPUT_MISC=y -From b2d8f6a978e70e941859cc4cfacaee8121f71b7c Mon Sep 17 00:00:00 2001 +From afae7dff11e5ee1d5aaf0d00cf26ea3cf24db2d8 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 23 Jun 2015 09:53:40 +0100 -Subject: [PATCH 081/105] Fix driver detection failure Check that the buffer +Subject: [PATCH 080/131] Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected --- @@ -136086,10 +135726,10 @@ index f55151b..d41851d 100644 dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", request.tag.val); } -From 47e896b8d1e0614ae8dc7a01b037d3d30bd87bf1 Mon Sep 17 00:00:00 2001 +From 9e053b2e623361aa3a3bbfa298e7b8d33adf7abc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Jun 2015 13:24:01 +0100 -Subject: [PATCH 082/105] config: Enable 8250 serial port +Subject: [PATCH 081/131] config: Enable 8250 serial port --- arch/arm/configs/bcm2709_defconfig | 7 +++++++ @@ -136137,10 +135777,10 @@ index f952ff2..0c25d8b 100644 CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_BCM2835=m -From e6e9f242d287b3fa1008ef3bfdac211906587585 Mon Sep 17 00:00:00 2001 +From 60300e1082cd46b3ae2732854776ee549e217387 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Jun 2015 14:10:58 +0100 -Subject: [PATCH 083/105] config: Enable POWER_RESET_GPIO +Subject: [PATCH 082/131] config: Enable POWER_RESET_GPIO --- arch/arm/configs/bcm2709_defconfig | 2 ++ @@ -136174,10 +135814,10 @@ index 0c25d8b..e757db6 100644 CONFIG_THERMAL=y CONFIG_THERMAL_BCM2835=y -From acfa836e00324826a1aa3dc816d7dc5f4b5d5790 Mon Sep 17 00:00:00 2001 +From 79796a03fa8311ea9030817db27690f24f72214c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 26 Jun 2015 17:37:38 +0100 -Subject: [PATCH 084/105] bcm2708-vcio: Remove restriction of only a single +Subject: [PATCH 083/131] bcm2708-vcio: Remove restriction of only a single instance being open We need more than one process to be able to use mailbox interface (e.g. HW cursor in fbturbo and hello_fft). @@ -136222,10 +135862,10 @@ index d91672b..06fb2c2f 100644 return 0; -From 7f23eccb28dd764cf1af231fdc69bc9f93db4972 Mon Sep 17 00:00:00 2001 +From 6bda1bf0de21592f772c2d65b3e66ddf89d50bdf Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 Jun 2015 08:39:19 +0100 -Subject: [PATCH 085/105] BCM270X_DT: Create a "core" clock, use it for SPI and +Subject: [PATCH 084/131] BCM270X_DT: Create a "core" clock, use it for SPI and sdhost --- @@ -136376,10 +136016,10 @@ index b408ab4..897204a 100644 }; }; -From f64348123913a79fd145c5208039c8f66c0c4252 Mon Sep 17 00:00:00 2001 +From d4a0abb7a644365a9f21204a5e3f530a8112d5e8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 09:24:31 +0100 -Subject: [PATCH 086/105] BCM270X_DT: Add MCP7941X to i2c-rtc overlay +Subject: [PATCH 085/131] BCM270X_DT: Add MCP7941X to i2c-rtc overlay --- arch/arm/boot/dts/overlays/README | 3 +++ @@ -136432,10 +136072,10 @@ index 6bccfdc..7052c71 100644 pcf8523 = <&pcf8523>,"status"; pcf8563 = <&pcf8563>,"status"; -From 57fd1fbaa2d9281f2b9d70c8d15dbaa201af2b71 Mon Sep 17 00:00:00 2001 +From 54695dcb27d8e4c37e8dd9620e85257b8abb89d8 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 24 Jun 2015 11:23:06 +0100 -Subject: [PATCH 087/105] dts/overlays: document DHT11 overlay +Subject: [PATCH 086/131] dts/overlays: document DHT11 overlay --- arch/arm/boot/dts/overlays/README | 8 ++++++++ @@ -136461,10 +136101,10 @@ index 425eb19..9406cf3 100644 -From e072d9e5801bb111be321dff6feadd5c12e8d2ad Mon Sep 17 00:00:00 2001 +From 842fe412d512dabb76d169395086b6337150015a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 088/105] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 087/131] 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 @@ -136579,10 +136219,10 @@ index e5332f1..6e3fec2 100644 "%s: pm_power_off function already registered", __func__); -From 45567cec8e8dc1be2d45fead5332258d3a49a088 Mon Sep 17 00:00:00 2001 +From 311119b99b34e88df249d706c69bdcffcd8dafb5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 17 Jun 2015 17:10:40 +0100 -Subject: [PATCH 089/105] BCM270x_DT: Default Compute Module i2c, i2s and spi +Subject: [PATCH 088/131] BCM270x_DT: Default Compute Module i2c, i2s and spi support --- @@ -136672,10 +136312,10 @@ index e82fcb2..af252bd 100755 }; }; -From 2c610cb4fa176ac54d4e32a4744761aa9c600f3c Mon Sep 17 00:00:00 2001 +From bd6dabc8c7f6cdaba821ff3246034cd704f6364d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 Jun 2015 14:21:55 +0100 -Subject: [PATCH 090/105] BCM270X_DT: Sort nodes by bus address, and +Subject: [PATCH 089/131] BCM270X_DT: Sort nodes by bus address, and consolidate aliases --- @@ -136917,10 +136557,10 @@ index 24fa849..ccb9c31 100644 &gpio { -From dab507d5936f3847a320b11be5a21b4c25c4601b Mon Sep 17 00:00:00 2001 +From f40ed032e6f0892778bac7d33d45593c0483628b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 Jun 2015 14:23:03 +0100 -Subject: [PATCH 091/105] i2c-bcm2708/BCM270X_DT: Add support for I2C2 +Subject: [PATCH 090/131] i2c-bcm2708/BCM270X_DT: Add support for I2C2 The third I2C bus (I2C2) is normally reserved for HDMI use. Careless use of this bus can break an attached display - use with caution. @@ -137093,10 +136733,10 @@ index 8773203..7a24fbe 100644 goto out_free_bi; } -From c887101553aed347b4e0e29422cd5a7315cce18a Mon Sep 17 00:00:00 2001 +From 9451939c7a95b4f81886a2bf89f953be1833189d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 29 Jun 2015 12:14:02 +0100 -Subject: [PATCH 092/105] BCM270X_DT: Correct the lirc-rpi overlay +Subject: [PATCH 091/131] BCM270X_DT: Correct the lirc-rpi overlay documentation The polarity of the "sense" parameter was inverted with respect to reality. @@ -137122,10 +136762,10 @@ index 0ed7094..ec762d2 100644 (default "-1") -From b55c8ef4eab8f62f3087bcdf4eb9a603105d16fb Mon Sep 17 00:00:00 2001 +From d645d31525be338b1baa22916217f3ac0c3705f9 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 08:47:09 +0100 -Subject: [PATCH 093/105] bcm2835-sdhost: Further improve overclock back-off +Subject: [PATCH 092/131] bcm2835-sdhost: Further improve overclock back-off --- drivers/mmc/host/bcm2835-sdhost.c | 144 +++++++++++++++++++++----------------- @@ -137417,10 +137057,10 @@ index 6277e43..a03db06 100644 iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -From 3d5ba5c480137b87aaee59c14f8e486e747cd450 Mon Sep 17 00:00:00 2001 +From 11667799f99dca096d4d92e63b7823db2a8f8779 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 10:28:59 +0100 -Subject: [PATCH 094/105] i2c-bcm2708: Increase timeouts to allow larger +Subject: [PATCH 093/131] i2c-bcm2708: Increase timeouts to allow larger transfers Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting @@ -137458,10 +137098,10 @@ index 7a24fbe..8b8762d 100644 dev_err(&adap->dev, "transfer timed out\n"); goto error_timeout; -From 31a5408b0734bc64969ab91be9cb3c1d898d655a Mon Sep 17 00:00:00 2001 +From 04f7264e602d7148822f3a162176190fcc41f71a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 10:33:52 +0100 -Subject: [PATCH 095/105] spi-bcm2708: Increase timeout from 150ms to 1s +Subject: [PATCH 094/131] spi-bcm2708: Increase timeout from 150ms to 1s See: https://github.com/raspberrypi/linux/issues/260 --- @@ -137485,10 +137125,10 @@ index 041b5e2..5c0214e 100644 struct bcm2708_spi { spinlock_t lock; -From c66c0c2993daff0c44d7daae71421b1404f92233 Mon Sep 17 00:00:00 2001 +From 2e6c5de15687dadf4c24d880d0cdcb6763aacda5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 15 Jun 2015 09:59:38 +0100 -Subject: [PATCH 096/105] bcm2708-spi: Don't use static pin configuration with +Subject: [PATCH 095/131] bcm2708-spi: Don't use static pin configuration with DT Also remove superfluous error checking - the SPI framework ensures the @@ -137527,10 +137167,10 @@ index 5c0214e..781c747 100644 master = spi_alloc_master(&pdev->dev, sizeof(*bs)); if (!master) { -From fb8c469783f4521176bebb9de94b6b456b4c35bb Mon Sep 17 00:00:00 2001 +From 699c056af380b45856086c0b33a65acc3d2ad3d8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 15 Jun 2015 10:10:59 +0100 -Subject: [PATCH 097/105] bcm2708-i2s: Don't use static pin configuration with +Subject: [PATCH 096/131] bcm2708-i2s: Don't use static pin configuration with DT --- @@ -137553,10 +137193,10 @@ index a515992..5e93cd6 100644 /* * Adjust the data length according to the format. -From 68df7b46c42bd73c44ae405adbd12be35e308a2b Mon Sep 17 00:00:00 2001 +From 6b8e6f74b78fcc225c873ea1b07890352dd77ee5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 098/105] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 097/131] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ @@ -137576,10 +137216,10 @@ index 4506e40..f03a19a 100644 for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From 3ceec0b963f3001adaa523d65508cc54a6f93cd0 Mon Sep 17 00:00:00 2001 +From 5131bc710dd79b98d12c08b2f22477f48fdbd0d3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 Jun 2015 08:50:11 +0100 -Subject: [PATCH 099/105] BCM270X_DT: Add overlay to enable uart1 +Subject: [PATCH 098/131] BCM270X_DT: Add overlay to enable uart1 N.B. The UART1 clock is derived from the core clock. The firmware will update clock-frequency if core_freq is set, but be aware @@ -137748,10 +137388,10 @@ index e757db6..363c894 100644 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y -From 0365608651a901ee0b84351ed8ec9b7f0cdfd986 Mon Sep 17 00:00:00 2001 +From 72d2ba8d7fa2d47c53ed1425501c2dac2aa909b0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 100/105] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 099/131] 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 @@ -137832,10 +137472,10 @@ index 37875cf..55e81c2 100644 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -From 1674fcd926873998471f71ad88306d47bc99862b Mon Sep 17 00:00:00 2001 +From 4bf9c275c9733d1fcf41f6ee70b40e321b39eac1 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 17:37:38 +0100 -Subject: [PATCH 101/105] BCM270X_DT: Change pio_limit of sdhost driver to 1 +Subject: [PATCH 100/131] BCM270X_DT: Change pio_limit of sdhost driver to 1 --- arch/arm/boot/dts/overlays/sdhost-overlay.dts | 2 +- @@ -137855,10 +137495,10 @@ index 897204a..2da14a4 100644 }; }; -From f72606ab1e40707a3dc9243e0d0b87b98654e02b Mon Sep 17 00:00:00 2001 +From 0ca1e1d7ffdfcf1e716205491a00bf025fb71a77 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Jul 2015 12:51:52 +0100 -Subject: [PATCH 102/105] bcm2835-sdhost: Clear HBLC for PIO mode +Subject: [PATCH 101/131] bcm2835-sdhost: Clear HBLC for PIO mode Also update pio_limit default in overlay README. --- @@ -137894,10 +137534,10 @@ index a03db06..d65870a 100644 BUG_ON(!host->data); } -From 93e9bd0c71d224db35cc8019a1ebc16bf77f0fa2 Mon Sep 17 00:00:00 2001 +From f158c5aa486712cfad1c405eb849d65272b2cbc3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 3 Jul 2015 12:21:01 +0100 -Subject: [PATCH 103/105] BCM270X_DT: I2S needs function Alt2 +Subject: [PATCH 102/131] BCM270X_DT: I2S needs function Alt2 --- arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 +- @@ -137959,10 +137599,10 @@ index f25f0a2..62d1c62 100644 }; -From 5edaac580d81f7edd48afd1e8c296cdedd94cc7a Mon Sep 17 00:00:00 2001 +From 704b53d89697a2542dfa6d23224f49c0d5350abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:16:15 +0200 -Subject: [PATCH 104/105] configs: Incorporate v4.1 dependency changes +Subject: [PATCH 103/131] configs: Incorporate v4.1 dependency changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -138125,10 +137765,10 @@ index 363c894..80f84d7 100644 CONFIG_CRC_ITU_T=y CONFIG_LIBCRC32C=y -From 18f4efa3ad700a4caf72f45ff95d7acfb40f3255 Mon Sep 17 00:00:00 2001 +From d47845877b27576daac3c55bdb742a43209baaed Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 3 Jul 2015 15:47:33 +0100 -Subject: [PATCH 105/105] bcmrpi_defconfigs: Add SND_SOC_WM8804_I2C (for +Subject: [PATCH 104/131] bcmrpi_defconfigs: Add SND_SOC_WM8804_I2C (for HifiBerry Digi) 4.1 has split out support for the I2C and SPI variants, so it now @@ -138162,3 +137802,3831 @@ index 80f84d7..14b91fdf 100644 CONFIG_SND_SIMPLE_CARD=m CONFIG_SOUND_PRIME=m CONFIG_HIDRAW=y + +From a984b5d876c74984fad16d90507b95a50db22fba Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Sat, 4 Jul 2015 19:55:23 +0100 +Subject: [PATCH 105/131] squash: BCM270X_DT: I2S only needs Alt2 on 28-31 + +See: https://github.com/raspberrypi/linux/issues/1046 +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 +- + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 2 +- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 562eb08..3ad2e0d 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -25,7 +25,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 5e3db01..96d8b97 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -28,7 +28,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 62d1c62..f25f0a2 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -25,7 +25,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + + +From edb21286ac7e246dfe7c9ee05101880f719e00e8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 8 Jul 2015 14:48:57 +0100 +Subject: [PATCH 106/131] vchiq_arm: Two cacheing fixes + +1) Make fragment size vary with cache line size +Without this patch, non-cache-line-aligned transfers may corrupt +(or be corrupted by) adjacent data structures. + +Both ARM and VC need to be updated to enable this feature. This is +ensured by having the loader apply a new DT parameter - +cache-line-size. The existence of this parameter guarantees that the +kernel is capable, and the parameter will only be modified from the +safe default if the loader is capable. + +2) Flush/invalidate vmalloc'd memory, and invalidate after reads +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 5 + + .../interface/vchiq_arm/vchiq_2835_arm.c | 112 +++++++++++++-------- + 2 files changed, 77 insertions(+), 40 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 8181a4e..abf3e5d 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -218,6 +218,7 @@ + compatible = "brcm,bcm2835-vchiq"; + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; ++ cache-line-size = <32>; + }; + + thermal: thermal { +@@ -270,4 +271,8 @@ + clock-frequency = <126000000>; + }; + }; ++ ++ __overrides__ { ++ cache_line_size = <&vchiq>, "cache-line-size:0"; ++ }; + }; +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index c739083..5edba23 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + #include + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) +@@ -64,8 +65,10 @@ typedef struct vchiq_2835_state_struct { + } VCHIQ_2835_ARM_STATE_T; + + static void __iomem *g_regs; +-static FRAGMENTS_T *g_fragments_base; +-static FRAGMENTS_T *g_free_fragments; ++static unsigned int g_cache_line_size = sizeof(CACHE_LINE_SIZE); ++static unsigned int g_fragments_size; ++static char *g_fragments_base; ++static char *g_free_fragments; + static struct semaphore g_free_fragments_sema; + static unsigned long g_virt_to_bus_offset; + +@@ -95,9 +98,13 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + + g_virt_to_bus_offset = virt_to_dma(dev, (void *)0); + ++ (void)of_property_read_u32(dev->of_node, "cache-line-size", ++ &g_cache_line_size); ++ g_fragments_size = 2 * g_cache_line_size; ++ + /* Allocate space for the channels in coherent memory */ + slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); +- frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); ++ frag_mem_size = PAGE_ALIGN(g_fragments_size * MAX_FRAGMENTS); + + slot_mem = dmam_alloc_coherent(dev, slot_mem_size + frag_mem_size, + &slot_phys, GFP_KERNEL); +@@ -117,15 +124,15 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX] = + MAX_FRAGMENTS; + +- g_fragments_base = (FRAGMENTS_T *)(slot_mem + slot_mem_size); ++ g_fragments_base = (char *)slot_mem + slot_mem_size; + slot_mem_size += frag_mem_size; + + g_free_fragments = g_fragments_base; + for (i = 0; i < (MAX_FRAGMENTS - 1); i++) { +- *(FRAGMENTS_T **)&g_fragments_base[i] = +- &g_fragments_base[i + 1]; ++ *(char **)&g_fragments_base[i*g_fragments_size] = ++ &g_fragments_base[(i + 1)*g_fragments_size]; + } +- *(FRAGMENTS_T **)&g_fragments_base[i] = NULL; ++ *(char **)&g_fragments_base[i * g_fragments_size] = NULL; + sema_init(&g_free_fragments_sema, MAX_FRAGMENTS); + + if (vchiq_init_state(state, vchiq_slot_zero, 0) != VCHIQ_SUCCESS) +@@ -344,7 +351,7 @@ vchiq_doorbell_irq(int irq, void *dev_id) + ** cached area. + + ** N.B. This implementation plays slightly fast and loose with the Linux +-** driver programming rules, e.g. its use of __virt_to_bus instead of ++** driver programming rules, e.g. its use of dmac_map_area instead of + ** dma_map_single, but it isn't a multi-platform driver and it benefits + ** from increased speed as a result. + */ +@@ -355,7 +362,6 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + { + PAGELIST_T *pagelist; + struct page **pages; +- struct page *page; + unsigned long *addrs; + unsigned int num_pages, offset, i; + char *addr, *base_addr, *next_addr; +@@ -386,10 +392,25 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + pages = (struct page **)(addrs + num_pages + 1); + + if (is_vmalloc_addr(buf)) { +- for (actual_pages = 0; actual_pages < num_pages; actual_pages++) { +- pages[actual_pages] = vmalloc_to_page(buf + (actual_pages * PAGE_SIZE)); ++ int dir = (type == PAGELIST_WRITE) ? ++ DMA_TO_DEVICE : DMA_FROM_DEVICE; ++ unsigned long length = pagelist->length; ++ unsigned int offset = pagelist->offset; ++ ++ for (actual_pages = 0; actual_pages < num_pages; ++ actual_pages++) { ++ struct page *pg = vmalloc_to_page(buf + (actual_pages * ++ PAGE_SIZE)); ++ size_t bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ pages[actual_pages] = pg; ++ dmac_map_area(page_address(pg) + offset, bytes, dir); ++ length -= bytes; ++ offset = 0; + } +- *need_release = 0; /* do not try and release vmalloc pages */ ++ *need_release = 0; /* do not try and release vmalloc pages */ + } else { + down_read(&task->mm->mmap_sem); + actual_pages = get_user_pages(task, task->mm, +@@ -418,7 +439,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + actual_pages = -ENOMEM; + return actual_pages; + } +- *need_release = 1; /* release user pages */ ++ *need_release = 1; /* release user pages */ + } + + pagelist->length = count; +@@ -451,10 +472,10 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + + /* Partial cache lines (fragments) require special measures */ + if ((type == PAGELIST_READ) && +- ((pagelist->offset & (CACHE_LINE_SIZE - 1)) || ++ ((pagelist->offset & (g_cache_line_size - 1)) || + ((pagelist->offset + pagelist->length) & +- (CACHE_LINE_SIZE - 1)))) { +- FRAGMENTS_T *fragments; ++ (g_cache_line_size - 1)))) { ++ char *fragments; + + if (down_interruptible(&g_free_fragments_sema) != 0) { + kfree(pagelist); +@@ -464,19 +485,15 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + WARN_ON(g_free_fragments == NULL); + + down(&g_free_fragments_mutex); +- fragments = (FRAGMENTS_T *) g_free_fragments; ++ fragments = g_free_fragments; + WARN_ON(fragments == NULL); +- g_free_fragments = *(FRAGMENTS_T **) g_free_fragments; ++ g_free_fragments = *(char **) g_free_fragments; + up(&g_free_fragments_mutex); +- pagelist->type = +- PAGELIST_READ_WITH_FRAGMENTS + (fragments - +- g_fragments_base); ++ pagelist->type = PAGELIST_READ_WITH_FRAGMENTS + ++ (fragments - g_fragments_base) / g_fragments_size; + } + +- for (page = virt_to_page(pagelist); +- page <= virt_to_page(addrs + num_pages - 1); page++) { +- flush_dcache_page(page); +- } ++ dmac_flush_range(pagelist, addrs + num_pages); + + *ppagelist = pagelist; + +@@ -502,13 +519,14 @@ free_pagelist(PAGELIST_T *pagelist, int actual) + + /* Deal with any partial cache lines (fragments) */ + if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { +- FRAGMENTS_T *fragments = g_fragments_base + +- (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS); ++ char *fragments = g_fragments_base + ++ (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * ++ g_fragments_size; + int head_bytes, tail_bytes; +- head_bytes = (CACHE_LINE_SIZE - pagelist->offset) & +- (CACHE_LINE_SIZE - 1); ++ head_bytes = (g_cache_line_size - pagelist->offset) & ++ (g_cache_line_size - 1); + tail_bytes = (pagelist->offset + actual) & +- (CACHE_LINE_SIZE - 1); ++ (g_cache_line_size - 1); + + if ((actual >= 0) && (head_bytes != 0)) { + if (head_bytes > actual) +@@ -516,32 +534,46 @@ free_pagelist(PAGELIST_T *pagelist, int actual) + + memcpy((char *)page_address(pages[0]) + + pagelist->offset, +- fragments->headbuf, ++ fragments, + head_bytes); + } + if ((actual >= 0) && (head_bytes < actual) && + (tail_bytes != 0)) { + memcpy((char *)page_address(pages[num_pages - 1]) + + ((pagelist->offset + actual) & +- (PAGE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1)), +- fragments->tailbuf, tail_bytes); ++ (PAGE_SIZE - 1) & ~(g_cache_line_size - 1)), ++ fragments + g_cache_line_size, ++ tail_bytes); + } + + down(&g_free_fragments_mutex); +- *(FRAGMENTS_T **) fragments = g_free_fragments; ++ *(char **)fragments = g_free_fragments; + g_free_fragments = fragments; + up(&g_free_fragments_mutex); + up(&g_free_fragments_sema); + } + +- if (*need_release) { +- for (i = 0; i < num_pages; i++) { +- if (pagelist->type != PAGELIST_WRITE) +- set_page_dirty(pages[i]); ++ if (*need_release) { ++ unsigned int length = pagelist->length; ++ unsigned int offset = pagelist->offset; + +- page_cache_release(pages[i]); ++ for (i = 0; i < num_pages; i++) { ++ struct page *pg = pages[i]; ++ ++ if (pagelist->type != PAGELIST_WRITE) { ++ unsigned int bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ dmac_unmap_area(page_address(pg) + offset, ++ bytes, DMA_FROM_DEVICE); ++ length -= bytes; ++ offset = 0; ++ set_page_dirty(pg); ++ } ++ page_cache_release(pg); + } +- } ++ } + + kfree(pagelist); + } + +From 265838d467aedd75abf2949373d889cfec090168 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 30 Jun 2015 09:10:36 +0100 +Subject: [PATCH 107/131] BCM270X_DT: Overlay for the Fen Logic VGA666 board + +The VGA666 board requires GPIOs 2-21 (so no I2C or UART). Using the +overlay (instead of a custom dt-blob.bin) has the advantage that it will +reserve those pins and stop other devices using them (except for GPIO), +but it does delay the point at which the output becomes valid until 2-3 +seconds after the kernel has started. +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 8 +++++++ + arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 +++++++++++++++++++++++++++ + 3 files changed, 39 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index e91548c..74ec825 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -43,6 +43,7 @@ dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 980d358..5e1f530 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -497,6 +497,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) + + ++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 ++ after the kernel has started. ++Load: dtoverlay=vga666 ++Params: ++ ++ + 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. +diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +new file mode 100644 +index 0000000..7fcab96 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts +@@ -0,0 +1,30 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ // There is no VGA driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vga666_pins>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ vga666_pins: vga666_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 ++ 13 14 15 16 17 18 19 20 21>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; ++}; + +From 5c8148df6f5147fcaa9fe81425b58a3e7a64cdba Mon Sep 17 00:00:00 2001 +From: petit-miner +Date: Fri, 10 Jul 2015 13:59:18 +0200 +Subject: [PATCH 108/131] Added support for 2 mcp2515 CAN Bus IC + +See: https://github.com/raspberrypi/linux/issues/1018 + https://github.com/raspberrypi/linux/pull/1049 + https://github.com/raspberrypi/linux/pull/1052 +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 12 +++- + .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 69 ++++++++++++++++++++++ + 3 files changed, 81 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 74ec825..4ff9836 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -29,6 +29,7 @@ dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 5e1f530..88ed678 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -328,7 +328,7 @@ Params: gpio_out_pin GPIO for output (default "17") + + + Name: mcp2515-can0 +-Info: Configures the MCP2515 CAN controller ++Info: Configures the MCP2515 CAN controller on spi0.0 + Load: dtoverlay=mcp2515-can0,= + Params: oscillator Clock frequency for the CAN controller (Hz) + +@@ -337,6 +337,16 @@ Params: oscillator Clock frequency for the CAN controller (Hz) + 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) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ + Name: mmc + Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock + Load: dtoverlay=mmc,= +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +new file mode 100644 +index 0000000..6bef9ae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.1 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ can1_pins: can1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@2 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on spi0.1 */ ++ can1_osc: can1_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can1: mcp2515@1 { ++ reg = <1>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can1_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can1_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can1_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can1>,"spi-max-frequency:0"; ++ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; ++ }; ++}; + +From a097ef23c580bdcad619cca1deabd71eb6237984 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Tue, 5 May 2015 13:27:45 -0700 +Subject: [PATCH 109/131] mailbox: Enable BCM2835 mailbox support + +This mailbox driver provides a single mailbox channel to write 32-bit +values to the VPU and get a 32-bit response. The Raspberry Pi +firmware uses this mailbox channel to implement firmware calls, while +Roku 2 (despite being derived from the same firmware tree) doesn't. + +The driver was originally submitted by Lubomir, based on the +out-of-tree 2708 mailbox driver. Eric Anholt fixed it up for +upstreaming, with the major functional change being that it now has no +notion of multiple channels (since that is a firmware-dependent +concept) and instead the raspberrypi-firmware driver will do that +bit-twiddling in its own messages. +[Jassi: made the 'mbox_chan_ops' struct as const and removed a redundant +variable] + +Signed-off-by: Lubomir Rintel +Signed-off-by: Craig McGeachie +Signed-off-by: Eric Anholt +Acked-by: Stephen Warren +Signed-off-by: Jassi Brar +--- + drivers/mailbox/Kconfig | 9 ++ + drivers/mailbox/Makefile | 2 + + drivers/mailbox/bcm2835-mailbox.c | 216 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 227 insertions(+) + create mode 100644 drivers/mailbox/bcm2835-mailbox.c + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 7f19cb4..dc64c93 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -66,4 +66,13 @@ config ALTERA_MBOX + An implementation of the Altera Mailbox soft core. It is used + to send message between processors. Say Y here if you want to use the + Altera mailbox support. ++ ++config BCM2835_MBOX ++ tristate "BCM2835 Mailbox" ++ depends on ARCH_BCM2835 ++ help ++ An implementation of the BCM2385 Mailbox. It is used to invoke ++ the services of the Videocore. Say Y here if you want to use the ++ BCM2835 Mailbox. ++ + endif +diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile +index cecfad3..c86bc91 100644 +--- a/drivers/mailbox/Makefile ++++ b/drivers/mailbox/Makefile +@@ -13,3 +13,5 @@ obj-$(CONFIG_OMAP2PLUS_MBOX) += omap-mailbox.o + obj-$(CONFIG_PCC) += pcc.o + + obj-$(CONFIG_ALTERA_MBOX) += mailbox-altera.o ++ ++obj-$(CONFIG_BCM2835_MBOX) += bcm2835-mailbox.o +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +new file mode 100644 +index 0000000..4b13268 +--- /dev/null ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -0,0 +1,216 @@ ++/* ++ * Copyright (C) 2010,2015 Broadcom ++ * Copyright (C) 2013-2014 Lubomir Rintel ++ * Copyright (C) 2013 Craig McGeachie ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This device provides a mechanism for writing to the mailboxes, ++ * that are shared between the ARM and the VideoCore processor ++ * ++ * Parts of the driver are based on: ++ * - arch/arm/mach-bcm2708/vcio.c file written by Gray Girling that was ++ * obtained from branch "rpi-3.6.y" of git://github.com/raspberrypi/ ++ * linux.git ++ * - drivers/mailbox/bcm2835-ipc.c by Lubomir Rintel at ++ * https://github.com/hackerspace/rpi-linux/blob/lr-raspberry-pi/drivers/ ++ * mailbox/bcm2835-ipc.c ++ * - documentation available on the following web site: ++ * https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Mailboxes */ ++#define ARM_0_MAIL0 0x00 ++#define ARM_0_MAIL1 0x20 ++ ++/* ++ * Mailbox registers. We basically only support mailbox 0 & 1. We ++ * deliver to the VC in mailbox 1, it delivers to us in mailbox 0. See ++ * BCM2835-ARM-Peripherals.pdf section 1.3 for an explanation about ++ * the placement of memory barriers. ++ */ ++#define MAIL0_RD (ARM_0_MAIL0 + 0x00) ++#define MAIL0_POL (ARM_0_MAIL0 + 0x10) ++#define MAIL0_STA (ARM_0_MAIL0 + 0x18) ++#define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) ++#define MAIL1_WRT (ARM_0_MAIL1 + 0x00) ++ ++/* Status register: FIFO state. */ ++#define ARM_MS_FULL BIT(31) ++#define ARM_MS_EMPTY BIT(30) ++ ++/* Configuration register: Enable interrupts. */ ++#define ARM_MC_IHAVEDATAIRQEN BIT(0) ++ ++struct bcm2835_mbox { ++ void __iomem *regs; ++ spinlock_t lock; ++ struct mbox_controller controller; ++}; ++ ++static struct bcm2835_mbox *bcm2835_link_mbox(struct mbox_chan *link) ++{ ++ return container_of(link->mbox, struct bcm2835_mbox, controller); ++} ++ ++static irqreturn_t bcm2835_mbox_irq(int irq, void *dev_id) ++{ ++ struct bcm2835_mbox *mbox = dev_id; ++ struct device *dev = mbox->controller.dev; ++ struct mbox_chan *link = &mbox->controller.chans[0]; ++ ++ while (!(readl(mbox->regs + MAIL0_STA) & ARM_MS_EMPTY)) { ++ u32 msg = readl(mbox->regs + MAIL0_RD); ++ dev_dbg(dev, "Reply 0x%08X\n", msg); ++ mbox_chan_received_data(link, &msg); ++ } ++ return IRQ_HANDLED; ++} ++ ++static int bcm2835_send_data(struct mbox_chan *link, void *data) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ u32 msg = *(u32 *)data; ++ ++ spin_lock(&mbox->lock); ++ writel(msg, mbox->regs + MAIL1_WRT); ++ dev_dbg(mbox->controller.dev, "Request 0x%08X\n", msg); ++ spin_unlock(&mbox->lock); ++ return 0; ++} ++ ++static int bcm2835_startup(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ ++ /* Enable the interrupt on data reception */ ++ writel(ARM_MC_IHAVEDATAIRQEN, mbox->regs + MAIL0_CNF); ++ ++ return 0; ++} ++ ++static void bcm2835_shutdown(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ ++ writel(0, mbox->regs + MAIL0_CNF); ++} ++ ++static bool bcm2835_last_tx_done(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ bool ret; ++ ++ spin_lock(&mbox->lock); ++ ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); ++ spin_unlock(&mbox->lock); ++ return ret; ++} ++ ++static const struct mbox_chan_ops bcm2835_mbox_chan_ops = { ++ .send_data = bcm2835_send_data, ++ .startup = bcm2835_startup, ++ .shutdown = bcm2835_shutdown, ++ .last_tx_done = bcm2835_last_tx_done ++}; ++ ++static struct mbox_chan *bcm2835_mbox_index_xlate(struct mbox_controller *mbox, ++ const struct of_phandle_args *sp) ++{ ++ if (sp->args_count != 0) ++ return NULL; ++ ++ return &mbox->chans[0]; ++} ++ ++static int bcm2835_mbox_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ int ret = 0; ++ struct resource *iomem; ++ struct bcm2835_mbox *mbox; ++ ++ mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); ++ if (mbox == NULL) ++ return -ENOMEM; ++ spin_lock_init(&mbox->lock); ++ ++ ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ bcm2835_mbox_irq, 0, dev_name(dev), mbox); ++ if (ret) { ++ dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", ++ ret); ++ return -ENODEV; ++ } ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mbox->regs = devm_ioremap_resource(&pdev->dev, iomem); ++ if (IS_ERR(mbox->regs)) { ++ ret = PTR_ERR(mbox->regs); ++ dev_err(&pdev->dev, "Failed to remap mailbox regs: %d\n", ret); ++ return ret; ++ } ++ ++ mbox->controller.txdone_poll = true; ++ mbox->controller.txpoll_period = 5; ++ mbox->controller.ops = &bcm2835_mbox_chan_ops; ++ mbox->controller.of_xlate = &bcm2835_mbox_index_xlate; ++ mbox->controller.dev = dev; ++ mbox->controller.num_chans = 1; ++ mbox->controller.chans = devm_kzalloc(dev, ++ sizeof(*mbox->controller.chans), GFP_KERNEL); ++ if (!mbox->controller.chans) ++ return -ENOMEM; ++ ++ ret = mbox_controller_register(&mbox->controller); ++ if (ret) ++ return ret; ++ ++ platform_set_drvdata(pdev, mbox); ++ dev_info(dev, "mailbox enabled\n"); ++ ++ return ret; ++} ++ ++static int bcm2835_mbox_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_mbox *mbox = platform_get_drvdata(pdev); ++ mbox_controller_unregister(&mbox->controller); ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_mbox_of_match[] = { ++ { .compatible = "brcm,bcm2835-mbox", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_mbox_of_match); ++ ++static struct platform_driver bcm2835_mbox_driver = { ++ .driver = { ++ .name = "bcm2835-mbox", ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_mbox_of_match, ++ }, ++ .probe = bcm2835_mbox_probe, ++ .remove = bcm2835_mbox_remove, ++}; ++module_platform_driver(bcm2835_mbox_driver); ++ ++MODULE_AUTHOR("Lubomir Rintel "); ++MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); ++MODULE_LICENSE("GPL v2"); + +From aa1ca835a9a179168f9d8355a458bd0eecda3912 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Wed, 13 May 2015 13:10:32 -0700 +Subject: [PATCH 110/131] mailbox/bcm2835: Fix mailbox full detection. + +With the VC reader blocked and the ARM writing, MAIL0_STA reads empty +permanently while MAIL1_STA goes from empty (0x40000000) to non-empty +(0x00000001-0x00000007) to full (0x80000008). + +This bug ended up having no effect on us, because all of our +transactions in the client driver were synchronous and under a mutex. + +Suggested-by: Phil Elwell +Signed-off-by: Eric Anholt +Acked-by: Stephen Warren +Signed-off-by: Jassi Brar +--- + drivers/mailbox/bcm2835-mailbox.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index 4b13268..0b47dd4 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -49,6 +49,7 @@ + #define MAIL0_STA (ARM_0_MAIL0 + 0x18) + #define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) ++#define MAIL1_STA (ARM_0_MAIL1 + 0x18) + + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) +@@ -117,7 +118,7 @@ static bool bcm2835_last_tx_done(struct mbox_chan *link) + bool ret; + + spin_lock(&mbox->lock); +- ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); ++ ret = !(readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL); + spin_unlock(&mbox->lock); + return ret; + } + +From 36301913195582a2398add6d60477be534d4f603 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:19:30 +0200 +Subject: [PATCH 111/131] mailbox: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make it possible to use bcm2835-mailbox without Device Tree. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- + drivers/mailbox/mailbox.c | 13 ++++++++++++- + 3 files changed, 29 insertions(+), 4 deletions(-) + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index dc64c93..962b80c 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -69,7 +69,7 @@ config ALTERA_MBOX + + config BCM2835_MBOX + tristate "BCM2835 Mailbox" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + An implementation of the BCM2385 Mailbox. It is used to invoke + the services of the Videocore. Say Y here if you want to use the +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index 0b47dd4..d16e286 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -51,12 +51,15 @@ + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) + #define MAIL1_STA (ARM_0_MAIL1 + 0x18) + ++/* On ARCH_BCM270x these come through (arm_control.h ) */ ++#ifndef ARM_MS_FULL + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) + #define ARM_MS_EMPTY BIT(30) + + /* Configuration register: Enable interrupts. */ + #define ARM_MC_IHAVEDATAIRQEN BIT(0) ++#endif + + struct bcm2835_mbox { + void __iomem *regs; +@@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) + return -ENOMEM; + spin_lock_init(&mbox->lock); + +- ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), + bcm2835_mbox_irq, 0, dev_name(dev), mbox); + if (ret) { + dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", +@@ -210,7 +213,18 @@ static struct platform_driver bcm2835_mbox_driver = { + .probe = bcm2835_mbox_probe, + .remove = bcm2835_mbox_remove, + }; +-module_platform_driver(bcm2835_mbox_driver); ++ ++static int __init bcm2835_mbox_init(void) ++{ ++ return platform_driver_register(&bcm2835_mbox_driver); ++} ++arch_initcall(bcm2835_mbox_init); ++ ++static void __init bcm2835_mbox_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_mbox_driver); ++} ++module_exit(bcm2835_mbox_exit); + + MODULE_AUTHOR("Lubomir Rintel "); + MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); +diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c +index 19b491d..cc07d71 100644 +--- a/drivers/mailbox/mailbox.c ++++ b/drivers/mailbox/mailbox.c +@@ -304,13 +304,23 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) + unsigned long flags; + int ret; + +- if (!dev || !dev->of_node) { ++ if (!dev) { + pr_debug("%s: No owner device node\n", __func__); + return ERR_PTR(-ENODEV); + } + + mutex_lock(&con_mutex); + ++ if (!dev->of_node) { ++ chan = NULL; ++ /* pick the first controller in the list */ ++ list_for_each_entry(mbox, &mbox_cons, node) { ++ chan = &mbox->chans[0]; ++ break; ++ } ++ goto skip_dt; ++ } ++ + if (of_parse_phandle_with_args(dev->of_node, "mboxes", + "#mbox-cells", index, &spec)) { + dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__); +@@ -327,6 +337,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) + + of_node_put(spec.np); + ++skip_dt: + if (!chan || chan->cl || !try_module_get(mbox->dev->driver->owner)) { + dev_dbg(dev, "%s: mailbox not free\n", __func__); + mutex_unlock(&con_mutex); + +From e3d1e45b4cf84fead585758e48adad894858670c Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Thu, 4 Jun 2015 13:11:47 -0700 +Subject: [PATCH 112/131] ARM: bcm2835: Add the firmware driver information to + the RPi DT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Eric Anholt +Acked-by: Lee Jones (previous version with pm-domains) +Acked-by: Stephen Warren +[Rebased on rpi-4.1.y] +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index 466f02b..5cdfd5a 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -27,6 +27,13 @@ + }; + }; + ++ soc { ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ }; ++ + /* Onboard audio */ + audio: audio { + compatible = "brcm,bcm2835-audio"; + +From 4b72dfbcb5e820f4bfdb2ccb423538b2e4821329 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 113/131] firmware: bcm2835: Add missing property tags +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + include/soc/bcm2835/raspberrypi-firmware.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index 9d9efb7..d3933af 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -60,6 +60,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_MIN_VOLTAGE = 0x00030008, + RPI_FIRMWARE_GET_TURBO = 0x00030009, + RPI_FIRMWARE_GET_MAX_TEMPERATURE = 0x0003000a, ++ RPI_FIRMWARE_GET_STC = 0x0003000b, + RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, + RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, + RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, +@@ -69,10 +70,12 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, + RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, + RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, ++ RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, + RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, + RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, + RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, + RPI_FIRMWARE_SET_TURBO = 0x00038009, ++ RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, + + /* Dispmanx TAGS */ + RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, +@@ -86,6 +89,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, + RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, + RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, + RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +@@ -95,6 +99,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, + RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, ++ RPI_FIRMWARE_FRAMEBUFFER_TEST_VSYNC = 0x0004400e, + RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, + RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, +@@ -103,6 +108,9 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, + RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, + RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, ++ ++ RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, + + RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + +From d72c334f7fe3305ae13034ac0562123c26820ade 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 114/131] firmware: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Support booting without Device Tree. +Turn on USB power. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 41 +++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 39 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index dd506cd3..b980d53 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -28,6 +28,8 @@ struct rpi_firmware { + u32 enabled; + }; + ++static struct platform_device *g_pdev; ++ + static DEFINE_MUTEX(transaction_lock); + + static void response_callback(struct mbox_client *cl, void *msg) +@@ -183,6 +185,25 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw) + } + } + ++static int raspberrypi_firmware_set_power(struct rpi_firmware *fw, ++ u32 domain, bool on) ++{ ++ struct { ++ u32 domain; ++ u32 on; ++ } packet; ++ int ret; ++ ++ packet.domain = domain; ++ packet.on = on; ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_SET_POWER_STATE, ++ &packet, sizeof(packet)); ++ if (!ret && packet.on != on) ++ ret = -EINVAL; ++ ++ return ret; ++} ++ + static int rpi_firmware_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -207,9 +228,13 @@ static int rpi_firmware_probe(struct platform_device *pdev) + init_completion(&fw->c); + + platform_set_drvdata(pdev, fw); ++ g_pdev = pdev; + + rpi_firmware_print_firmware_revision(fw); + ++ if (raspberrypi_firmware_set_power(fw, 3, true)) ++ dev_err(dev, "failed to turn on USB power\n"); ++ + return 0; + } + +@@ -218,6 +243,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + struct rpi_firmware *fw = platform_get_drvdata(pdev); + + mbox_free_channel(fw->chan); ++ g_pdev = NULL; + + return 0; + } +@@ -230,7 +256,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + */ + struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) + { +- struct platform_device *pdev = of_find_device_by_node(firmware_node); ++ struct platform_device *pdev = g_pdev; + + if (!pdev) + return NULL; +@@ -253,7 +279,18 @@ static struct platform_driver rpi_firmware_driver = { + .probe = rpi_firmware_probe, + .remove = rpi_firmware_remove, + }; +-module_platform_driver(rpi_firmware_driver); ++ ++static int __init rpi_firmware_init(void) ++{ ++ return platform_driver_register(&rpi_firmware_driver); ++} ++subsys_initcall(rpi_firmware_init); ++ ++static void __init rpi_firmware_exit(void) ++{ ++ platform_driver_unregister(&rpi_firmware_driver); ++} ++module_exit(rpi_firmware_exit); + + MODULE_AUTHOR("Eric Anholt "); + MODULE_DESCRIPTION("Raspberry Pi firmware driver"); + +From be083fb29207201d3db279f9d5654c5f8c2cb6de Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:26:10 +0200 +Subject: [PATCH 115/131] firmware: bcm2835: Support legacy mailbox API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for the bcm_mailbox_*() functions. +This is temporary until all drivers have been converted to the +firmware API (rpi_firmware_property*()). + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 15 +++++++++++++-- + include/soc/bcm2835/raspberrypi-firmware.h | 2 ++ + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index b980d53..89421a9 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -19,6 +19,7 @@ + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) + #define MBOX_CHAN(msg) ((msg) & 0xf) + #define MBOX_DATA28(msg) ((msg) & ~0xf) ++#define MBOX_CHAN_VCHIQ 3 + #define MBOX_CHAN_PROPERTY 8 + + struct rpi_firmware { +@@ -26,6 +27,7 @@ struct rpi_firmware { + struct mbox_chan *chan; /* The property channel. */ + struct completion c; + u32 enabled; ++ u32 received; + }; + + static struct platform_device *g_pdev; +@@ -35,6 +37,7 @@ static DEFINE_MUTEX(transaction_lock); + static void response_callback(struct mbox_client *cl, void *msg) + { + struct rpi_firmware *fw = container_of(cl, struct rpi_firmware, cl); ++ fw->received = *(u32 *)msg; + complete(&fw->c); + } + +@@ -42,7 +45,7 @@ static void response_callback(struct mbox_client *cl, void *msg) + * Sends a request to the firmware through the BCM2835 mailbox driver, + * and synchronously waits for the reply. + */ +-static int ++int + rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + { + u32 message = MBOX_MSG(chan, data); +@@ -54,7 +57,8 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + reinit_completion(&fw->c); + ret = mbox_send_message(fw->chan, &message); + if (ret >= 0) { +- wait_for_completion(&fw->c); ++ if (chan != MBOX_CHAN_VCHIQ) ++ wait_for_completion(&fw->c); + ret = 0; + } else { + dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret); +@@ -63,6 +67,13 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + + return ret; + } ++EXPORT_SYMBOL(rpi_firmware_transaction); ++ ++u32 rpi_firmware_transaction_received(struct rpi_firmware *fw) ++{ ++ return MBOX_DATA28(fw->received); ++} ++EXPORT_SYMBOL(rpi_firmware_transaction_received); + + /** + * rpi_firmware_property_list - Submit firmware property list +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index d3933af..9a08cf1 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -116,6 +116,8 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + }; + ++int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data); ++u32 rpi_firmware_transaction_received(struct rpi_firmware *fw); + int rpi_firmware_property(struct rpi_firmware *fw, + u32 tag, void *data, size_t len); + int rpi_firmware_property_list(struct rpi_firmware *fw, + +From becc3412eae55ac3b1642ddc074cb9ca2cbc2e11 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 116/131] char: broadcom: Add vcio module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add module for accessing the mailbox property channel through +/dev/vcio. Was previously in bcm2708-vcio. + +Signed-off-by: Noralf Trønnes +--- + drivers/char/broadcom/Kconfig | 6 ++ + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vcio.c | 175 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 182 insertions(+) + create mode 100644 drivers/char/broadcom/vcio.c + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 75fa1cb..fc40846 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -22,6 +22,12 @@ config BCM2708_VCMEM + help + Helper for videocore memory access and total size allocation. + ++config BCM_VCIO ++ tristate "Mailbox userspace access" ++ depends on BCM2835_MBOX ++ help ++ Gives access to the mailbox property channel from userspace. ++ + endif + + config BCM_VC_SM +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index de8feb9..18171e2 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,3 +1,4 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o ++obj-$(CONFIG_BCM_VCIO) += vcio.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ +diff --git a/drivers/char/broadcom/vcio.c b/drivers/char/broadcom/vcio.c +new file mode 100644 +index 0000000..c19bc20 +--- /dev/null ++++ b/drivers/char/broadcom/vcio.c +@@ -0,0 +1,175 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2015 Noralf Trønnes ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MBOX_CHAN_PROPERTY 8 ++ ++#define VCIO_IOC_MAGIC 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *) ++ ++static struct { ++ dev_t devt; ++ struct cdev cdev; ++ struct class *class; ++ struct rpi_firmware *fw; ++} vcio; ++ ++static int vcio_user_property_list(void *user) ++{ ++ u32 *buf, size; ++ int ret; ++ ++ /* The first 32-bit is the size of the buffer */ ++ if (copy_from_user(&size, user, sizeof(size))) ++ return -EFAULT; ++ ++ buf = kmalloc(size, GFP_KERNEL); ++ if (!buf) ++ return -ENOMEM; ++ ++ if (copy_from_user(buf, user, size)) { ++ kfree(buf); ++ return -EFAULT; ++ } ++ ++ /* Strip off protocol encapsulation */ ++ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12); ++ if (ret) { ++ kfree(buf); ++ return ret; ++ } ++ ++ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS; ++ if (copy_to_user(user, buf, size)) ++ ret = -EFAULT; ++ ++ kfree(buf); ++ ++ return ret; ++} ++ ++static int vcio_device_open(struct inode *inode, struct file *file) ++{ ++ try_module_get(THIS_MODULE); ++ ++ return 0; ++} ++ ++static int vcio_device_release(struct inode *inode, struct file *file) ++{ ++ module_put(THIS_MODULE); ++ ++ return 0; ++} ++ ++static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ switch (ioctl_num) { ++ case IOCTL_MBOX_PROPERTY: ++ return vcio_user_property_list((void *)ioctl_param); ++ default: ++ pr_err("unknown ioctl: %d\n", ioctl_num); ++ return -EINVAL; ++ } ++} ++ ++const struct file_operations vcio_fops = { ++ .unlocked_ioctl = vcio_device_ioctl, ++ .open = vcio_device_open, ++ .release = vcio_device_release, ++}; ++ ++static int __init vcio_init(void) ++{ ++ struct device_node *np; ++ static struct device *dev; ++ int ret; ++ ++ np = of_find_compatible_node(NULL, NULL, ++ "raspberrypi,bcm2835-firmware"); ++/* Uncomment this when we only boot with Device Tree ++ if (!of_device_is_available(np)) ++ return -ENODEV; ++*/ ++ vcio.fw = rpi_firmware_get(np); ++ if (!vcio.fw) ++ return -ENODEV; ++ ++ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio"); ++ if (ret) { ++ pr_err("failed to allocate device number\n"); ++ return ret; ++ } ++ ++ cdev_init(&vcio.cdev, &vcio_fops); ++ vcio.cdev.owner = THIS_MODULE; ++ ret = cdev_add(&vcio.cdev, vcio.devt, 1); ++ if (ret) { ++ pr_err("failed to register device\n"); ++ goto err_unregister_chardev; ++ } ++ ++ /* ++ * Create sysfs entries ++ * 'bcm2708_vcio' is used for backwards compatibility so we don't break ++ * userspace. Raspian has a udev rule that changes the permissions. ++ */ ++ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio"); ++ if (IS_ERR(vcio.class)) { ++ ret = PTR_ERR(vcio.class); ++ pr_err("failed to create class\n"); ++ goto err_cdev_del; ++ } ++ ++ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio"); ++ if (IS_ERR(dev)) { ++ ret = PTR_ERR(dev); ++ pr_err("failed to create device\n"); ++ goto err_class_destroy; ++ } ++ ++ return 0; ++ ++err_class_destroy: ++ class_destroy(vcio.class); ++err_cdev_del: ++ cdev_del(&vcio.cdev); ++err_unregister_chardev: ++ unregister_chrdev_region(vcio.devt, 1); ++ ++ return ret; ++} ++module_init(vcio_init); ++ ++static void __exit vcio_exit(void) ++{ ++ device_destroy(vcio.class, vcio.devt); ++ class_destroy(vcio.class); ++ cdev_del(&vcio.cdev); ++ unregister_chrdev_region(vcio.devt, 1); ++} ++module_exit(vcio_exit); ++ ++MODULE_AUTHOR("Gray Girling"); ++MODULE_AUTHOR("Noralf Trønnes"); ++MODULE_DESCRIPTION("Mailbox userspace access"); ++MODULE_LICENSE("GPL"); + +From 3349eaf79dd91c2e6f9b7aed0c155668e4f5a856 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:37:19 +0200 +Subject: [PATCH 117/131] BCM270x: Switch to firmware driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO. +Add firmware node and change mailbox node in Device Tree. +Add/update platform file for firmware and mailbox. +Strip bcm2708-vcio of everything except the legacy API and hook it +up with the firmware driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 8 +- + arch/arm/configs/bcm2709_defconfig | 3 + + arch/arm/configs/bcmrpi_defconfig | 3 + + arch/arm/mach-bcm2708/bcm2708.c | 13 +- + arch/arm/mach-bcm2709/bcm2709.c | 13 +- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2708-vcio.c | 353 ++-------------------------------- + 7 files changed, 51 insertions(+), 344 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index abf3e5d..2dd25f7 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -74,9 +74,10 @@ + }; + + mailbox: mailbox@7e00b800 { +- compatible = "brcm,bcm2708-vcio"; ++ compatible = "brcm,bcm2835-mbox"; + reg = <0x7e00b880 0x40>; + interrupts = <0 1>; ++ #mbox-cells = <0>; + }; + + watchdog: watchdog@7e100000 { +@@ -205,6 +206,11 @@ + <1 9>; + }; + ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ + leds: leds { + compatible = "gpio-leds"; + }; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 5ecd84f..d75b104 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -574,6 +574,7 @@ CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1074,6 +1075,7 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +@@ -1082,6 +1084,7 @@ CONFIG_IIO_BUFFER=y + CONFIG_IIO_BUFFER_CB=y + CONFIG_IIO_KFIFO_BUF=m + CONFIG_DHT11=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y + CONFIG_EXT4_FS_SECURITY=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 14b91fdf..9159892 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -567,6 +567,7 @@ CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1067,6 +1068,7 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +@@ -1075,6 +1077,7 @@ CONFIG_IIO_BUFFER=y + CONFIG_IIO_BUFFER_CB=y + CONFIG_IIO_KFIFO_BUF=m + CONFIG_DHT11=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y + CONFIG_EXT4_FS_SECURITY=y +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 937c2d3..1b9c3be 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -405,7 +405,7 @@ static struct resource bcm2708_vcio_resources[] = { + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = "bcm2708_vcio", ++ .name = "bcm2835-mbox", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +@@ -415,6 +415,16 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static u64 rpifw_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_rpifw_device = { ++ .name = "raspberrypi-firmware", ++ .dev = { ++ .dma_mask = &rpifw_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + static struct resource bcm2708_vchiq_resources[] = { + { + .start = ARMCTRL_0_BELL_BASE, +@@ -871,6 +881,7 @@ void __init bcm2708_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_rpifw_device); + bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index fe71c50..e1934dc 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -426,7 +426,7 @@ static struct resource bcm2708_vcio_resources[] = { + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = "bcm2708_vcio", ++ .name = "bcm2835-mbox", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +@@ -436,6 +436,16 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static u64 rpifw_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_rpifw_device = { ++ .name = "raspberrypi-firmware", ++ .dev = { ++ .dma_mask = &rpifw_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + static struct resource bcm2708_vchiq_resources[] = { + { + .start = ARMCTRL_0_BELL_BASE, +@@ -892,6 +902,7 @@ void __init bcm2709_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_rpifw_device); + bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 962b80c..d1a6671 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -9,7 +9,7 @@ if MAILBOX + + config BCM2708_MBOX + bool "Broadcom BCM2708 Mailbox (vcio)" +- depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ depends on BCM2835_MBOX + help + Broadcom BCM2708 Mailbox (vcio) + +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +index 06fb2c2f..2e4031b 100644 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/arm/mach-bcm2708/vcio.c +- * + * Copyright (C) 2010 Broadcom + * + * This program is free software; you can redistribute it and/or modify +@@ -12,195 +10,38 @@ + * VideoCore processor + */ + +-#include + #include +-#include +-#include +-#include + #include +-#include +-#include +-#include ++#include + #include +-#include + #include ++#include + + #define DRIVER_NAME "bcm2708_vcio" +-#define DEVICE_FILE_NAME "vcio" +- +-/* offsets from a mail box base address */ +-#define MAIL0_RD 0x00 /* read - and next 4 words */ +-#define MAIL0_POL 0x10 /* read without popping the fifo */ +-#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL0_STA 0x18 /* status */ +-#define MAIL0_CNF 0x1C /* configuration */ +-#define MAIL1_WRT 0x20 /* write - and next 4 words */ +-#define MAIL1_STA 0x38 /* status */ +- +-/* On MACH_BCM270x these come through (arm_control.h ) */ +-#ifndef ARM_MS_EMPTY +-#define ARM_MS_EMPTY BIT(30) +-#define ARM_MS_FULL BIT(31) +- +-#define ARM_MC_IHAVEDATAIRQEN BIT(0) +-#endif +- +-#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +-#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +-#define MBOX_CHAN(msg) ((msg) & 0xf) +-#define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) +- +-#define MBOX_MAGIC 0xd0d0c0de +- +-#define MAJOR_NUM 100 +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +- +-static struct class *vcio_class; +- +-struct vc_mailbox { +- void __iomem *regs; +- uint32_t msg[MBOX_CHAN_COUNT]; +- struct semaphore sema[MBOX_CHAN_COUNT]; +- uint32_t magic; +-}; +- +-static void mbox_init(struct vc_mailbox *mbox_out) +-{ +- int i; +- +- for (i = 0; i < MBOX_CHAN_COUNT; i++) { +- mbox_out->msg[i] = 0; +- sema_init(&mbox_out->sema[i], 0); +- } +- +- /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); +- +- mbox_out->magic = MBOX_MAGIC; +-} +- +-static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL)) +- cpu_relax(); +- +- writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); +- +- return 0; +-} +- +-static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- +- return 0; +-} +- +-static irqreturn_t mbox_irq_handler(int irq, void *dev_id) +-{ +- /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +- int status = readl(mbox->regs + MAIL0_STA); +- int ret = IRQ_NONE; +- +- while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->regs + MAIL0_RD); +- int chan = MBOX_CHAN(msg); +- +- if (chan < MBOX_CHAN_COUNT) { +- if (mbox->msg[chan]) { +- pr_err(DRIVER_NAME +- ": mbox chan %d overflow - drop %08x\n", +- chan, msg); +- } else { +- mbox->msg[chan] = (msg | 0xf); +- up(&mbox->sema[chan]); +- } +- } else { +- pr_err(DRIVER_NAME +- ": invalid channel selector (msg %08x)\n", msg); +- } +- ret = IRQ_HANDLED; +- status = readl(mbox->regs + MAIL0_STA); +- } +- return ret; +-} +- +-/* Mailbox Methods */ +- +-static struct device *mbox_dev; /* we assume there's only one! */ +- +-static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_write(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_read(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} + + extern int bcm_mailbox_write(unsigned chan, uint32_t data28) + { +- if (!mbox_dev) ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); ++ ++ if (!fw) + return -ENODEV; + +- return dev_mbox_write(mbox_dev, chan, data28); ++ return rpi_firmware_transaction(fw, chan, data28); + } + EXPORT_SYMBOL_GPL(bcm_mailbox_write); + + extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) + { +- if (!mbox_dev) +- return -ENODEV; +- +- return dev_mbox_read(mbox_dev, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); + +-static int mbox_copy_from_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)src < TASK_SIZE) +- return copy_from_user(dst, src, size); +- +- memcpy(dst, src, size); +- +- return 0; +-} +- +-static int mbox_copy_to_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)dst < TASK_SIZE) +- return copy_to_user(dst, src, size); ++ if (!fw) ++ return -ENODEV; + +- memcpy(dst, src, size); ++ *data28 = rpi_firmware_transaction_received(fw); + + return 0; + } ++EXPORT_SYMBOL_GPL(bcm_mailbox_read); + + static DEFINE_MUTEX(mailbox_lock); + extern int bcm_mailbox_property(void *data, int size) +@@ -216,7 +57,7 @@ extern int bcm_mailbox_property(void *data, int size) + GFP_KERNEL); + if (mem_kern) { + /* create the message */ +- mbox_copy_from_user(mem_kern, data, size); ++ memcpy(mem_kern, data, size); + + /* send the message */ + wmb(); +@@ -226,7 +67,7 @@ extern int bcm_mailbox_property(void *data, int size) + if (s == 0) { + /* copy the response */ + rmb(); +- mbox_copy_to_user(data, mem_kern, size); ++ memcpy(data, mem_kern, size); + } + dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); + } else { +@@ -240,174 +81,6 @@ extern int bcm_mailbox_property(void *data, int size) + } + EXPORT_SYMBOL_GPL(bcm_mailbox_property); + +-/* Platform Device for Mailbox */ +- +-/* This is called whenever a process attempts to open the device file */ +-static int device_open(struct inode *inode, struct file *file) +-{ +- try_module_get(THIS_MODULE); +- +- return 0; +-} +- +-static int device_release(struct inode *inode, struct file *file) +-{ +- module_put(THIS_MODULE); +- +- return 0; +-} +- +-/* +- * This function is called whenever a process tries to do an ioctl on our +- * device file. We get two extra parameters (additional to the inode and file +- * structures, which all device functions get): the number of the ioctl called +- * and the parameter given to the ioctl function. +- * +- * If the ioctl is write or read/write (meaning output is returned to the +- * calling process), the ioctl call returns the output of this function. +- * +- */ +-static long device_ioctl(struct file *file, unsigned int ioctl_num, +- unsigned long ioctl_param) +-{ +- unsigned size; +- +- switch (ioctl_num) { +- case IOCTL_MBOX_PROPERTY: +- /* +- * Receive a pointer to a message (in user space) and set that +- * to be the device's message. Get the parameter given to +- * ioctl by the process. +- */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); +- return bcm_mailbox_property((void *)ioctl_param, size); +- default: +- pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); +- return -EINVAL; +- } +- +- return 0; +-} +- +-/* Module Declarations */ +- +-/* +- * This structure will hold the functions to be called +- * when a process does something to the device we +- * created. Since a pointer to this structure is kept in +- * the devices table, it can't be local to +- * init_module. NULL is for unimplemented functios. +- */ +-const struct file_operations fops = { +- .unlocked_ioctl = device_ioctl, +- .open = device_open, +- .release = device_release, /* a.k.a. close */ +-}; +- +-static int bcm_vcio_probe(struct platform_device *pdev) +-{ +- struct device *dev = &pdev->dev; +- struct device *vdev; +- struct vc_mailbox *mailbox; +- struct resource *res; +- int irq, ret; +- +- mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); +- if (!mailbox) +- return -ENOMEM; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- mailbox->regs = devm_ioremap_resource(dev, res); +- if (IS_ERR(mailbox->regs)) +- return PTR_ERR(mailbox->regs); +- +- irq = platform_get_irq(pdev, 0); +- ret = devm_request_irq(dev, irq, mbox_irq_handler, +- IRQF_IRQPOLL, +- dev_name(dev), mailbox); +- if (ret) { +- dev_err(dev, "Interrupt request failed %d\n", ret); +- return ret; +- } +- +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- if (ret < 0) { +- pr_err("Character device registration failed %d\n", ret); +- return ret; +- } +- +- vcio_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- pr_err("Class creation failed %d\n", ret); +- goto err_class; +- } +- +- vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); +- if (IS_ERR(vdev)) { +- ret = PTR_ERR(vdev); +- pr_err("Device creation failed %d\n", ret); +- goto err_dev; +- } +- +- mbox_init(mailbox); +- platform_set_drvdata(pdev, mailbox); +- mbox_dev = dev; +- +- dev_info(dev, "mailbox at %p\n", mailbox->regs); +- +- return 0; +- +-err_dev: +- class_destroy(vcio_class); +-err_class: +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return ret; +-} +- +-static int bcm_vcio_remove(struct platform_device *pdev) +-{ +- mbox_dev = NULL; +- platform_set_drvdata(pdev, NULL); +- device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return 0; +-} +- +-static const struct of_device_id bcm_vcio_of_match_table[] = { +- { .compatible = "brcm,bcm2708-vcio", }, +- {}, +-}; +-MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); +- +-static struct platform_driver bcm_mbox_driver = { +- .probe = bcm_vcio_probe, +- .remove = bcm_vcio_remove, +- +- .driver = { +- .name = DRIVER_NAME, +- .owner = THIS_MODULE, +- .of_match_table = bcm_vcio_of_match_table, +- }, +-}; +- +-static int __init bcm_mbox_init(void) +-{ +- return platform_driver_register(&bcm_mbox_driver); +-} +- +-static void __exit bcm_mbox_exit(void) +-{ +- platform_driver_unregister(&bcm_mbox_driver); +-} +- +-arch_initcall(bcm_mbox_init); /* Initialize early */ +-module_exit(bcm_mbox_exit); +- + MODULE_AUTHOR("Gray Girling"); + MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); + MODULE_LICENSE("GPL"); + +From 04f82e046133586649c9c9c72b565c2dbccf0e97 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:39:21 +0200 +Subject: [PATCH 118/131] bcm2835: Switch to firmware driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO. + +Add firmware node and change mailbox node in Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 3 ++- + arch/arm/configs/bcm2835_defconfig | 3 +++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 4b6dd65f..4a63704 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -62,9 +62,10 @@ + }; + + mailbox: mailbox@7e00b800 { +- compatible = "brcm,bcm2708-vcio"; ++ compatible = "brcm,bcm2835-mbox"; + reg = <0x7e00b880 0x40>; + interrupts = <0 1>; ++ #mbox-cells = <0>; + }; + + gpio: gpio@7e200000 { +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 47f2a6a..c284414 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -568,6 +568,7 @@ CONFIG_HW_RANDOM_BCM2835=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1064,9 +1065,11 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT2_FS=y + CONFIG_EXT2_FS_XATTR=y + CONFIG_EXT2_FS_POSIX_ACL=y + +From 0dd4dae3071d135836946ab1b990061c0899e9b5 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 13 Jul 2015 13:25:31 +0100 +Subject: [PATCH 119/131] Merge pull request #1059 from pelwell/rpi-4.0.y + +w1_therm: Back-port locking improvements from 4.2-rc1 +--- + Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 | 6 + + Documentation/w1/slaves/w1_therm | 11 +- + drivers/w1/slaves/w1_therm.c | 162 ++++++++++++++++++++-- + 3 files changed, 163 insertions(+), 16 deletions(-) + create mode 100644 Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 + +diff --git a/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 b/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 +new file mode 100644 +index 0000000..e928def +--- /dev/null ++++ b/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 +@@ -0,0 +1,6 @@ ++What: /sys/bus/w1/devices/.../w1_seq ++Date: Apr 2015 ++Contact: Matt Campbell ++Description: Support for the DS28EA00 chain sequence function ++ see Documentation/w1/slaves/w1_therm for detailed information ++Users: any user space application which wants to communicate with DS28EA00 +diff --git a/Documentation/w1/slaves/w1_therm b/Documentation/w1/slaves/w1_therm +index cc62a95..13411fe 100644 +--- a/Documentation/w1/slaves/w1_therm ++++ b/Documentation/w1/slaves/w1_therm +@@ -11,12 +11,14 @@ Author: Evgeniy Polyakov + Description + ----------- + +-w1_therm provides basic temperature conversion for ds18*20 devices. ++w1_therm provides basic temperature conversion for ds18*20 devices, and the ++ds28ea00 device. + supported family codes: + W1_THERM_DS18S20 0x10 + W1_THERM_DS1822 0x22 + W1_THERM_DS18B20 0x28 + W1_THERM_DS1825 0x3B ++W1_THERM_DS28EA00 0x42 + + Support is provided through the sysfs w1_slave file. Each open and + read sequence will initiate a temperature conversion then provide two +@@ -48,3 +50,10 @@ resistor). The DS18b20 temperature sensor specification lists a + maximum current draw of 1.5mA and that a 5k pullup resistor is not + sufficient. The strong pullup is designed to provide the additional + current required. ++ ++The DS28EA00 provides an additional two pins for implementing a sequence ++detection algorithm. This feature allows you to determine the physical ++location of the chip in the 1-wire bus without needing pre-existing ++knowledge of the bus ordering. Support is provided through the sysfs ++w1_seq file. The file will contain a single line with an integer value ++representing the device index in the bus starting at 0. +diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c +index 1f11a20..2f029e8 100644 +--- a/drivers/w1/slaves/w1_therm.c ++++ b/drivers/w1/slaves/w1_therm.c +@@ -59,16 +59,32 @@ MODULE_ALIAS("w1-family-" __stringify(W1_THERM_DS28EA00)); + static int w1_strong_pullup = 1; + module_param_named(strong_pullup, w1_strong_pullup, int, 0); + ++struct w1_therm_family_data { ++ uint8_t rom[9]; ++ atomic_t refcnt; ++}; ++ ++/* return the address of the refcnt in the family data */ ++#define THERM_REFCNT(family_data) \ ++ (&((struct w1_therm_family_data*)family_data)->refcnt) ++ + static int w1_therm_add_slave(struct w1_slave *sl) + { +- sl->family_data = kzalloc(9, GFP_KERNEL); ++ sl->family_data = kzalloc(sizeof(struct w1_therm_family_data), ++ GFP_KERNEL); + if (!sl->family_data) + return -ENOMEM; ++ atomic_set(THERM_REFCNT(sl->family_data), 1); + return 0; + } + + static void w1_therm_remove_slave(struct w1_slave *sl) + { ++ int refcnt = atomic_sub_return(1, THERM_REFCNT(sl->family_data)); ++ while(refcnt) { ++ msleep(1000); ++ refcnt = atomic_read(THERM_REFCNT(sl->family_data)); ++ } + kfree(sl->family_data); + sl->family_data = NULL; + } +@@ -76,13 +92,24 @@ static void w1_therm_remove_slave(struct w1_slave *sl) + static ssize_t w1_slave_show(struct device *device, + struct device_attribute *attr, char *buf); + ++static ssize_t w1_seq_show(struct device *device, ++ struct device_attribute *attr, char *buf); ++ + static DEVICE_ATTR_RO(w1_slave); ++static DEVICE_ATTR_RO(w1_seq); + + static struct attribute *w1_therm_attrs[] = { + &dev_attr_w1_slave.attr, + NULL, + }; ++ ++static struct attribute *w1_ds28ea00_attrs[] = { ++ &dev_attr_w1_slave.attr, ++ &dev_attr_w1_seq.attr, ++ NULL, ++}; + ATTRIBUTE_GROUPS(w1_therm); ++ATTRIBUTE_GROUPS(w1_ds28ea00); + + static struct w1_family_ops w1_therm_fops = { + .add_slave = w1_therm_add_slave, +@@ -90,6 +117,12 @@ static struct w1_family_ops w1_therm_fops = { + .groups = w1_therm_groups, + }; + ++static struct w1_family_ops w1_ds28ea00_fops = { ++ .add_slave = w1_therm_add_slave, ++ .remove_slave = w1_therm_remove_slave, ++ .groups = w1_ds28ea00_groups, ++}; ++ + static struct w1_family w1_therm_family_DS18S20 = { + .fid = W1_THERM_DS18S20, + .fops = &w1_therm_fops, +@@ -107,7 +140,7 @@ static struct w1_family w1_therm_family_DS1822 = { + + static struct w1_family w1_therm_family_DS28EA00 = { + .fid = W1_THERM_DS28EA00, +- .fops = &w1_therm_fops, ++ .fops = &w1_ds28ea00_fops, + }; + + static struct w1_family w1_therm_family_DS1825 = { +@@ -194,13 +227,22 @@ static ssize_t w1_slave_show(struct device *device, + struct w1_slave *sl = dev_to_w1_slave(device); + struct w1_master *dev = sl->master; + u8 rom[9], crc, verdict, external_power; +- int i, max_trying = 10; ++ int i, ret, max_trying = 10; + ssize_t c = PAGE_SIZE; ++ u8 *family_data = sl->family_data; + +- i = mutex_lock_interruptible(&dev->bus_mutex); +- if (i != 0) +- return i; ++ ret = mutex_lock_interruptible(&dev->bus_mutex); ++ if (ret != 0) ++ goto post_unlock; ++ ++ if(!sl->family_data) ++ { ++ ret = -ENODEV; ++ goto pre_unlock; ++ } + ++ /* prevent the slave from going away in sleep */ ++ atomic_inc(THERM_REFCNT(family_data)); + memset(rom, 0, sizeof(rom)); + + while (max_trying--) { +@@ -230,17 +272,19 @@ static ssize_t w1_slave_show(struct device *device, + mutex_unlock(&dev->bus_mutex); + + sleep_rem = msleep_interruptible(tm); +- if (sleep_rem != 0) +- return -EINTR; ++ if (sleep_rem != 0) { ++ ret = -EINTR; ++ goto post_unlock; ++ } + +- i = mutex_lock_interruptible(&dev->bus_mutex); +- if (i != 0) +- return i; ++ ret = mutex_lock_interruptible(&dev->bus_mutex); ++ if (ret != 0) ++ goto post_unlock; + } else if (!w1_strong_pullup) { + sleep_rem = msleep_interruptible(tm); + if (sleep_rem != 0) { +- mutex_unlock(&dev->bus_mutex); +- return -EINTR; ++ ret = -EINTR; ++ goto pre_unlock; + } + } + +@@ -269,19 +313,107 @@ static ssize_t w1_slave_show(struct device *device, + c -= snprintf(buf + PAGE_SIZE - c, c, ": crc=%02x %s\n", + crc, (verdict) ? "YES" : "NO"); + if (verdict) +- memcpy(sl->family_data, rom, sizeof(rom)); ++ memcpy(family_data, rom, sizeof(rom)); + else + dev_warn(device, "Read failed CRC check\n"); + + for (i = 0; i < 9; ++i) + c -= snprintf(buf + PAGE_SIZE - c, c, "%02x ", +- ((u8 *)sl->family_data)[i]); ++ ((u8 *)family_data)[i]); + + c -= snprintf(buf + PAGE_SIZE - c, c, "t=%d\n", + w1_convert_temp(rom, sl->family->fid)); ++ ret = PAGE_SIZE - c; ++ ++pre_unlock: + mutex_unlock(&dev->bus_mutex); + ++post_unlock: ++ atomic_dec(THERM_REFCNT(family_data)); ++ return ret; ++} ++ ++#define W1_42_CHAIN 0x99 ++#define W1_42_CHAIN_OFF 0x3C ++#define W1_42_CHAIN_OFF_INV 0xC3 ++#define W1_42_CHAIN_ON 0x5A ++#define W1_42_CHAIN_ON_INV 0xA5 ++#define W1_42_CHAIN_DONE 0x96 ++#define W1_42_CHAIN_DONE_INV 0x69 ++#define W1_42_COND_READ 0x0F ++#define W1_42_SUCCESS_CONFIRM_BYTE 0xAA ++#define W1_42_FINISHED_BYTE 0xFF ++static ssize_t w1_seq_show(struct device *device, ++ struct device_attribute *attr, char *buf) ++{ ++ struct w1_slave *sl = dev_to_w1_slave(device); ++ ssize_t c = PAGE_SIZE; ++ int rv; ++ int i; ++ u8 ack; ++ u64 rn; ++ struct w1_reg_num *reg_num; ++ int seq = 0; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ /* Place all devices in CHAIN state */ ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ w1_write_8(sl->master, W1_SKIP_ROM); ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_ON); ++ w1_write_8(sl->master, W1_42_CHAIN_ON_INV); ++ msleep(sl->master->pullup_duration); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ ++ /* In case the bus fails to send 0xFF, limit*/ ++ for (i = 0; i <= 64; i++) { ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ ++ w1_write_8(sl->master, W1_42_COND_READ); ++ rv = w1_read_block(sl->master, (u8 *)&rn, 8); ++ reg_num = (struct w1_reg_num *) &rn; ++ if (reg_num->family == W1_42_FINISHED_BYTE) ++ break; ++ if (sl->reg_num.id == reg_num->id) ++ seq = i; ++ ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_DONE); ++ w1_write_8(sl->master, W1_42_CHAIN_DONE_INV); ++ w1_read_block(sl->master, &ack, sizeof(ack)); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ ++ } ++ ++ /* Exit from CHAIN state */ ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ w1_write_8(sl->master, W1_SKIP_ROM); ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_OFF); ++ w1_write_8(sl->master, W1_42_CHAIN_OFF_INV); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ mutex_unlock(&sl->master->bus_mutex); ++ ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", seq); + return PAGE_SIZE - c; ++error: ++ mutex_unlock(&sl->master->bus_mutex); ++ return -EIO; + } + + static int __init w1_therm_init(void) + +From 042bc608f4877bcf9dd16db9657a33fcabd1023c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 11:11:51 +0100 +Subject: [PATCH 120/131] vchiq_arm: Sort out the vmalloc case + +See: https://github.com/raspberrypi/linux/issues/1055 +--- + .../misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 5edba23..56bff05 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -394,21 +394,21 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + if (is_vmalloc_addr(buf)) { + int dir = (type == PAGELIST_WRITE) ? + DMA_TO_DEVICE : DMA_FROM_DEVICE; +- unsigned long length = pagelist->length; +- unsigned int offset = pagelist->offset; ++ unsigned long length = count; ++ unsigned int off = offset; + + for (actual_pages = 0; actual_pages < num_pages; + actual_pages++) { + struct page *pg = vmalloc_to_page(buf + (actual_pages * + PAGE_SIZE)); +- size_t bytes = PAGE_SIZE - offset; ++ size_t bytes = PAGE_SIZE - off; + + if (bytes > length) + bytes = length; + pages[actual_pages] = pg; +- dmac_map_area(page_address(pg) + offset, bytes, dir); ++ dmac_map_area(page_address(pg) + off, bytes, dir); + length -= bytes; +- offset = 0; ++ off = 0; + } + *need_release = 0; /* do not try and release vmalloc pages */ + } else { + +From 133b98eee50e70510dbacae5b28a425987499bf8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 10:26:09 +0100 +Subject: [PATCH 121/131] spidev: Add "spidev" compatible string to silence + warning + +See: https://github.com/raspberrypi/linux/issues/1054 +--- + drivers/spi/spidev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 92c909e..0535375 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -706,6 +706,7 @@ static struct class *spidev_class; + #ifdef CONFIG_OF + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, ++ { .compatible = "spidev" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); + +From 5705242586b4688004ff73869d53ac532c671f84 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 14:32:47 +0100 +Subject: [PATCH 122/131] Merge pull request #1043 from XECDesign/sense-4.0 + +mfd: Add Raspberry Pi Sense HAT core driver +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 6 + + arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 +++++ + arch/arm/configs/bcm2709_defconfig | 2 + + arch/arm/configs/bcmrpi_defconfig | 2 + + drivers/input/joystick/Kconfig | 8 + + drivers/input/joystick/Makefile | 1 + + drivers/input/joystick/rpisense-js.c | 153 +++++++++++++++ + drivers/mfd/Kconfig | 8 + + drivers/mfd/Makefile | 2 + + drivers/mfd/rpisense-core.c | 157 +++++++++++++++ + drivers/video/fbdev/Kconfig | 13 ++ + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/rpisense-fb.c | 235 +++++++++++++++++++++++ + include/linux/mfd/rpisense/core.h | 47 +++++ + include/linux/mfd/rpisense/framebuffer.h | 28 +++ + include/linux/mfd/rpisense/joystick.h | 35 ++++ + 17 files changed, 746 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts + create mode 100644 drivers/input/joystick/rpisense-js.c + create mode 100644 drivers/mfd/rpisense-core.c + create mode 100644 drivers/video/fbdev/rpisense-fb.c + create mode 100644 include/linux/mfd/rpisense/core.h + create mode 100644 include/linux/mfd/rpisense/framebuffer.h + create mode 100644 include/linux/mfd/rpisense/joystick.h + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 4ff9836..5f6082f 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -39,6 +39,7 @@ dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb + 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) += spi-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 88ed678..8792f98 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -442,6 +442,12 @@ Load: dtoverlay=rpi-proto + Params: + + ++Name: rpi-sense ++Info: Raspberry Pi Sense HAT ++Load: dtoverlay=rpi-sense ++Params: ++ ++ + Name: sdhost + Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock + Load: dtoverlay=sdhost,= +diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +new file mode 100644 +index 0000000..2715324 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +@@ -0,0 +1,47 @@ ++// rpi-sense HAT ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ rpi-sense@46 { ++ compatible = "rpi,rpi-sense"; ++ reg = <0x46>; ++ keys-int-gpios = <&gpio 23 1>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-magn@1c { ++ compatible = "st,lsm9ds1-magn"; ++ reg = <0x1c>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-accel6a { ++ compatible = "st,lsm9ds1-accel"; ++ reg = <0x6a>; ++ status = "okay"; ++ }; ++ ++ lps25h-press@5c { ++ compatible = "st,lps25h-press"; ++ reg = <0x5c>; ++ status = "okay"; ++ }; ++ ++ hts221-humid@5f { ++ compatible = "st,hts221-humid"; ++ reg = <0x5f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index d75b104..f78a483 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -533,6 +533,7 @@ CONFIG_JOYSTICK_IFORCE=m + CONFIG_JOYSTICK_IFORCE_USB=y + CONFIG_JOYSTICK_XPAD=m + CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m + CONFIG_INPUT_TOUCHSCREEN=y + CONFIG_TOUCHSCREEN_ADS7846=m + CONFIG_TOUCHSCREEN_EGALAX=m +@@ -789,6 +790,7 @@ CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y + CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 9159892..b9b5bdf 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -526,6 +526,7 @@ CONFIG_JOYSTICK_IFORCE=m + CONFIG_JOYSTICK_IFORCE_USB=y + CONFIG_JOYSTICK_XPAD=m + CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m + CONFIG_INPUT_TOUCHSCREEN=y + CONFIG_TOUCHSCREEN_ADS7846=m + CONFIG_TOUCHSCREEN_EGALAX=m +@@ -782,6 +783,7 @@ CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y + CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig +index 56eb471..73e3a23 100644 +--- a/drivers/input/joystick/Kconfig ++++ b/drivers/input/joystick/Kconfig +@@ -329,4 +329,12 @@ config JOYSTICK_MAPLE + To compile this as a module choose M here: the module will be called + maplecontrol. + ++config JOYSTICK_RPISENSE ++ tristate "Raspberry Pi Sense HAT joystick" ++ depends on GPIOLIB && INPUT ++ select MFD_RPISENSE_CORE ++ ++ help ++ This is the joystick driver for the Raspberry Pi Sense HAT ++ + endif +diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile +index 92dc0de..1758160 100644 +--- a/drivers/input/joystick/Makefile ++++ b/drivers/input/joystick/Makefile +@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o + obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o + obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o + obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o ++obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o + +diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c +new file mode 100644 +index 0000000..9eca897 +--- /dev/null ++++ b/drivers/input/joystick/rpisense-js.c +@@ -0,0 +1,153 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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 ++ ++struct rpisense *rpisense; ++unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++ ++static void keys_work_fn(struct work_struct *work) ++{ ++ int i; ++ static s32 prev_keys; ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); ++ s32 changes = keys ^ prev_keys; ++ ++ prev_keys = keys; ++ for (i = 0; i < 5; i++) { ++ if (changes & 1) { ++ input_report_key(rpisense_js->keys_dev, ++ keymap[i], keys & 1); ++ } ++ changes >>= 1; ++ keys >>= 1; ++ } ++ input_sync(rpisense_js->keys_dev); ++} ++ ++static irqreturn_t keys_irq_handler(int irq, void *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ schedule_work(&rpisense_js->keys_work_s); ++ return IRQ_HANDLED; ++} ++ ++static int rpisense_js_probe(struct platform_device *pdev) ++{ ++ int ret; ++ int i; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_js = &rpisense->joystick; ++ ++ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); ++ ++ rpisense_js->keys_dev = input_allocate_device(); ++ if (!rpisense_js->keys_dev) { ++ dev_err(&pdev->dev, "Could not allocate input device.\n"); ++ return -ENOMEM; ++ } ++ ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); ++ for (i = 0; i < ARRAY_SIZE(keymap); i++) { ++ set_bit(keymap[i], ++ rpisense_js->keys_dev->keybit); ++ } ++ ++ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; ++ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; ++ rpisense_js->keys_dev->id.bustype = BUS_I2C; ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); ++ rpisense_js->keys_dev->keycode = keymap; ++ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); ++ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); ++ ++ ret = input_register_device(rpisense_js->keys_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not register input device.\n"); ++ goto err_keys_alloc; ++ } ++ ++ ret = gpiod_direction_input(rpisense_js->keys_desc); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); ++ goto err_keys_reg; ++ } ++ ++ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); ++ if (rpisense_js->keys_irq < 0) { ++ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); ++ ret = rpisense_js->keys_irq; ++ goto err_keys_reg; ++ } ++ ++ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, ++ keys_irq_handler, IRQF_TRIGGER_RISING, ++ "keys", &pdev->dev); ++ if (ret) { ++ dev_err(&pdev->dev, "IRQ request failed.\n"); ++ goto err_keys_reg; ++ } ++ return 0; ++err_keys_reg: ++ input_unregister_device(rpisense_js->keys_dev); ++err_keys_alloc: ++ input_free_device(rpisense_js->keys_dev); ++ return ret; ++} ++ ++static int rpisense_js_remove(struct platform_device *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ input_unregister_device(rpisense_js->keys_dev); ++ input_free_device(rpisense_js->keys_dev); ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_js_id[] = { ++ { .compatible = "rpi,rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_js_id); ++#endif ++ ++static struct platform_device_id rpisense_js_device_id[] = { ++ { .name = "rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); ++ ++static struct platform_driver rpisense_js_driver = { ++ .probe = rpisense_js_probe, ++ .remove = rpisense_js_remove, ++ .driver = { ++ .name = "rpi-sense-js", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_js_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index d5ad04d..dfb730e 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -10,6 +10,14 @@ config MFD_CORE + select IRQ_DOMAIN + default n + ++config MFD_RPISENSE_CORE ++ tristate "Raspberry Pi Sense HAT core functions" ++ depends on I2C ++ select MFD_CORE ++ help ++ This is the core driver for the Raspberry Pi Sense HAT. This provides ++ the necessary functions to communicate with the hardware. ++ + config MFD_CS5535 + tristate "AMD CS5535 and CS5536 southbridge core functions" + select MFD_CORE +diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile +index 0e5cfeb..9c491fb 100644 +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -185,3 +185,5 @@ obj-$(CONFIG_MFD_SKY81452) += sky81452.o + intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o + obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o + obj-$(CONFIG_MFD_MT6397) += mt6397-core.o ++ ++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 +--- /dev/null ++++ b/drivers/mfd/rpisense-core.c +@@ -0,0 +1,157 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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 driver is based on wm8350 implementation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct rpisense *rpisense; ++ ++static void rpisense_client_dev_register(struct rpisense *rpisense, ++ const char *name, ++ struct platform_device **pdev) ++{ ++ int ret; ++ ++ *pdev = platform_device_alloc(name, -1); ++ if (*pdev == NULL) { ++ dev_err(rpisense->dev, "Failed to allocate %s\n", name); ++ return; ++ } ++ ++ (*pdev)->dev.parent = rpisense->dev; ++ platform_set_drvdata(*pdev, rpisense); ++ ret = platform_device_add(*pdev); ++ if (ret != 0) { ++ dev_err(rpisense->dev, "Failed to register %s: %d\n", ++ name, ret); ++ platform_device_put(*pdev); ++ *pdev = NULL; ++ } ++} ++ ++static int rpisense_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); ++ if (rpisense == NULL) ++ return -ENOMEM; ++ ++ i2c_set_clientdata(i2c, rpisense); ++ rpisense->dev = &i2c->dev; ++ rpisense->i2c_client = i2c; ++ ++ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); ++ if (ret > 0) { ++ if (ret != 's') ++ return -EINVAL; ++ } else { ++ return ret; ++ } ++ ret = rpisense_reg_read(rpisense, RPISENSE_VER); ++ if (ret < 0) ++ return ret; ++ ++ dev_info(rpisense->dev, ++ "Raspberry Pi Sense HAT firmware version %i\n", ret); ++ ++ rpisense_js = &rpisense->joystick; ++ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, ++ "keys-int", GPIOD_IN); ++ if (IS_ERR(rpisense_js->keys_desc)) { ++ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); ++ rpisense_js->keys_desc = gpio_to_desc(23); ++ if (rpisense_js->keys_desc == NULL) { ++ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); ++ return PTR_ERR(rpisense_js->keys_desc); ++ } ++ } ++ rpisense_client_dev_register(rpisense, "rpi-sense-js", ++ &(rpisense->joystick.pdev)); ++ rpisense_client_dev_register(rpisense, "rpi-sense-fb", ++ &(rpisense->framebuffer.pdev)); ++ ++ return 0; ++} ++ ++static int rpisense_remove(struct i2c_client *i2c) ++{ ++ struct rpisense *rpisense = i2c_get_clientdata(i2c); ++ ++ platform_device_unregister(rpisense->joystick.pdev); ++ return 0; ++} ++ ++struct rpisense *rpisense_get_dev(void) ++{ ++ return rpisense; ++} ++EXPORT_SYMBOL_GPL(rpisense_get_dev); ++ ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg) ++{ ++ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); ++ /* Due to the BCM270x I2C clock stretching bug, some values ++ * may have MSB set. Clear it to avoid incorrect values. ++ * */ ++ return ret & 0x7F; ++} ++EXPORT_SYMBOL_GPL(rpisense_reg_read); ++ ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) ++{ ++ int ret = i2c_master_send(rpisense->i2c_client, buf, count); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Block write failed\n"); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rpisense_block_write); ++ ++static const struct i2c_device_id rpisense_i2c_id[] = { ++ { "rpi-sense", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); ++ ++ ++static struct i2c_driver rpisense_driver = { ++ .driver = { ++ .name = "rpi-sense", ++ .owner = THIS_MODULE, ++ }, ++ .probe = rpisense_probe, ++ .remove = rpisense_remove, ++ .id_table = rpisense_i2c_id, ++}; ++ ++module_i2c_driver(rpisense_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); ++ +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index 42e6c3b..3444a4c 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -2495,3 +2495,16 @@ config FB_SSD1307 + help + This driver implements support for the Solomon SSD1307 + OLED controller over I2C. ++ ++config FB_RPISENSE ++ tristate "Raspberry Pi Sense HAT framebuffer" ++ depends on FB ++ select MFD_RPISENSE_CORE ++ select FB_SYS_FOPS ++ select FB_SYS_FILLRECT ++ select FB_SYS_COPYAREA ++ select FB_SYS_IMAGEBLIT ++ select FB_DEFERRED_IO ++ ++ help ++ This is the framebuffer driver for the Raspberry Pi Sense HAT +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index 57181ad..ee7568b 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -150,6 +150,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o + obj-$(CONFIG_FB_MXS) += mxsfb.o + obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o + obj-$(CONFIG_FB_SIMPLE) += simplefb.o ++obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o + + # the test framebuffer is last + 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..99bb8ea +--- /dev/null ++++ b/drivers/video/fbdev/rpisense-fb.c +@@ -0,0 +1,235 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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 ++#include ++#include ++#include ++ ++#include ++#include ++ ++struct rpisense *rpisense; ++ ++struct rpisense_fb_param { ++ char __iomem *vmem; ++ u8 *vmem_work; ++ u32 vmemsize; ++ u8 gamma[32]; ++}; ++ ++static struct rpisense_fb_param rpisense_fb_param = { ++ .vmem = NULL, ++ .vmemsize = 128, ++ .gamma = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, ++ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, ++ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}, ++}; ++ ++static struct fb_deferred_io rpisense_fb_defio; ++ ++static struct fb_fix_screeninfo rpisense_fb_fix = { ++ .id = "RPi-Sense FB", ++ .type = FB_TYPE_PACKED_PIXELS, ++ .visual = FB_VISUAL_TRUECOLOR, ++ .xpanstep = 0, ++ .ypanstep = 0, ++ .ywrapstep = 0, ++ .accel = FB_ACCEL_NONE, ++ .line_length = 16, ++}; ++ ++static struct fb_var_screeninfo rpisense_fb_var = { ++ .xres = 8, ++ .yres = 8, ++ .xres_virtual = 8, ++ .yres_virtual = 8, ++ .bits_per_pixel = 16, ++ .red = {11, 5, 0}, ++ .green = {5, 6, 0}, ++ .blue = {0, 5, 0}, ++}; ++ ++static ssize_t rpisense_fb_write(struct fb_info *info, ++ const char __user *buf, size_t count, ++ loff_t *ppos) ++{ ++ ssize_t res = fb_sys_write(info, buf, count, ppos); ++ ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return res; ++} ++ ++static void rpisense_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) ++{ ++ sys_fillrect(info, rect); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *area) ++{ ++ sys_copyarea(info, area); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) ++{ ++ sys_imageblit(info, image); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_deferred_io(struct fb_info *info, ++ struct list_head *pagelist) ++{ ++ int i; ++ int j; ++ u8 *vmem_work = rpisense_fb_param.vmem_work; ++ u16 *mem = (u16 *)rpisense_fb_param.vmem; ++ u8 *gamma = rpisense_fb_param.gamma; ++ ++ vmem_work[0] = 0; ++ for (j = 0; j < 8; j++) { ++ for (i = 0; i < 8; i++) { ++ vmem_work[(j * 24) + i + 1] = ++ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; ++ vmem_work[(j * 24) + (i + 8) + 1] = ++ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; ++ vmem_work[(j * 24) + (i + 16) + 1] = ++ gamma[(mem[(j * 8) + i]) & 0x1F]; ++ } ++ } ++ rpisense_block_write(rpisense, vmem_work, 193); ++} ++ ++static struct fb_deferred_io rpisense_fb_defio = { ++ .delay = HZ/100, ++ .deferred_io = rpisense_fb_deferred_io, ++}; ++ ++static struct fb_ops rpisense_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_read = fb_sys_read, ++ .fb_write = rpisense_fb_write, ++ .fb_fillrect = rpisense_fb_fillrect, ++ .fb_copyarea = rpisense_fb_copyarea, ++ .fb_imageblit = rpisense_fb_imageblit, ++}; ++ ++static int rpisense_fb_probe(struct platform_device *pdev) ++{ ++ struct fb_info *info; ++ int ret = -ENOMEM; ++ struct rpisense_fb *rpisense_fb; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_fb = &rpisense->framebuffer; ++ ++ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); ++ if (!rpisense_fb_param.vmem) ++ return ret; ++ ++ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); ++ if (!rpisense_fb_param.vmem_work) ++ goto err_malloc; ++ ++ info = framebuffer_alloc(0, &pdev->dev); ++ if (!info) { ++ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); ++ goto err_malloc; ++ } ++ rpisense_fb->info = info; ++ ++ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; ++ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; ++ ++ info->fbops = &rpisense_fb_ops; ++ info->fix = rpisense_fb_fix; ++ info->var = rpisense_fb_var; ++ info->fbdefio = &rpisense_fb_defio; ++ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; ++ info->screen_base = rpisense_fb_param.vmem; ++ info->screen_size = rpisense_fb_param.vmemsize; ++ ++ fb_deferred_io_init(info); ++ ++ ret = register_framebuffer(info); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Could not register framebuffer.\n"); ++ goto err_fballoc; ++ } ++ ++ fb_info(info, "%s frame buffer device\n", info->fix.id); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return 0; ++err_fballoc: ++ framebuffer_release(info); ++err_malloc: ++ vfree(rpisense_fb_param.vmem); ++ return ret; ++} ++ ++static int rpisense_fb_remove(struct platform_device *pdev) ++{ ++ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; ++ struct fb_info *info = rpisense_fb->info; ++ ++ if (info) { ++ unregister_framebuffer(info); ++ fb_deferred_io_cleanup(info); ++ framebuffer_release(info); ++ vfree(rpisense_fb_param.vmem); ++ } ++ ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_fb_id[] = { ++ { .compatible = "rpi,rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_fb_id); ++#endif ++ ++static struct platform_device_id rpisense_fb_device_id[] = { ++ { .name = "rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); ++ ++static struct platform_driver rpisense_fb_driver = { ++ .probe = rpisense_fb_probe, ++ .remove = rpisense_fb_remove, ++ .driver = { ++ .name = "rpi-sense-fb", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_fb_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); ++ +diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h +new file mode 100644 +index 0000000..4856aa3 +--- /dev/null ++++ b/include/linux/mfd/rpisense/core.h +@@ -0,0 +1,47 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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. ++ * ++ */ ++ ++#ifndef __LINUX_MFD_RPISENSE_CORE_H_ ++#define __LINUX_MFD_RPISENSE_CORE_H_ ++ ++#include ++#include ++ ++/* ++ * Register values. ++ */ ++#define RPISENSE_FB 0x00 ++#define RPISENSE_WAI 0xF0 ++#define RPISENSE_VER 0xF1 ++#define RPISENSE_KEYS 0xF2 ++#define RPISENSE_EE_WP 0xF3 ++ ++#define RPISENSE_ID 's' ++ ++struct rpisense { ++ struct device *dev; ++ struct i2c_client *i2c_client; ++ ++ /* Client devices */ ++ struct rpisense_js joystick; ++ struct rpisense_fb framebuffer; ++}; ++ ++struct rpisense *rpisense_get_dev(void); ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg); ++int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); ++ ++#endif +diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h +new file mode 100644 +index 0000000..c4c1118 +--- /dev/null ++++ b/include/linux/mfd/rpisense/framebuffer.h +@@ -0,0 +1,28 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_FB_H_ ++#define __LINUX_RPISENSE_FB_H_ ++ ++#include ++ ++struct rpisense; ++ ++struct rpisense_fb { ++ struct platform_device *pdev; ++ struct fb_info *info; ++}; ++ ++#endif +diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h +new file mode 100644 +index 0000000..56196dc +--- /dev/null ++++ b/include/linux/mfd/rpisense/joystick.h +@@ -0,0 +1,35 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_JOYSTICK_H_ ++#define __LINUX_RPISENSE_JOYSTICK_H_ ++ ++#include ++#include ++#include ++#include ++ ++struct rpisense; ++ ++struct rpisense_js { ++ struct platform_device *pdev; ++ struct input_dev *keys_dev; ++ struct gpio_desc *keys_desc; ++ struct work_struct keys_work_s; ++ int keys_irq; ++}; ++ ++ ++#endif + +From dd0a5a6a6e441335df951679f1ee27bb8d35cdae Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 15 Jul 2015 13:46:08 +0100 +Subject: [PATCH 123/131] leds-gpio: Implement the brightness_get method + +The power LED uses some clever logic that means it is driven +by a voltage measuring circuit when configured as input, otherwise +it is driven by the GPIO output value. This patch wires up the +brightness_get method for leds-gpio so that user-space can monitor +the LED value via /sys/class/gpio/led1/brightness. Using the input +trigger this returns an indication of the system power health, +otherwise it is just whatever value the trigger has written most +recently. + +See: https://github.com/raspberrypi/linux/issues/1064 +--- + drivers/leds/leds-gpio.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index 3cfbd6a..4e4e132 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -82,6 +82,13 @@ static void gpio_led_set(struct led_classdev *led_cdev, + } + } + ++static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) ++{ ++ struct gpio_led_data *led_dat = ++ container_of(led_cdev, struct gpio_led_data, cdev); ++ return gpiod_get_value_cansleep(led_dat->gpiod) ? LED_FULL : LED_OFF; ++} ++ + static int gpio_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, unsigned long *delay_off) + { +@@ -138,6 +145,7 @@ static int create_gpio_led(const struct gpio_led *template, + led_dat->cdev.blink_set = gpio_blink_set; + } + led_dat->cdev.brightness_set = gpio_led_set; ++ led_dat->cdev.brightness_get = gpio_led_get; + if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) + state = !!gpiod_get_value_cansleep(led_dat->gpiod); + else + +From 232cca59a44a424f60e8af0517a3fb98c076393f Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Fri, 17 Jul 2015 09:50:55 +0200 +Subject: [PATCH 124/131] dmaengine: bcm2708-dmaengine: Fix memory leak when + stopping a running transfer + +--- + drivers/dma/bcm2708-dmaengine.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c +index 987ed53..73c6c00 100644 +--- a/drivers/dma/bcm2708-dmaengine.c ++++ b/drivers/dma/bcm2708-dmaengine.c +@@ -964,6 +964,7 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) + * c->desc is NULL and exit.) + */ + if (c->desc) { ++ bcm2835_dma_desc_free(&c->desc->vd); + c->desc = NULL; + bcm2835_dma_abort(c->chan_base); + + +From bc216042289449e4f8c07cea409a3d775d685a85 Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Mon, 20 Jul 2015 11:01:13 +0200 +Subject: [PATCH 125/131] BCM270X_DT: Fix I2S register map + +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 2dd25f7..728e14a 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -117,8 +117,8 @@ + + i2s: i2s@7e203000 { + compatible = "brcm,bcm2708-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + //dmas = <&dma 2>, + // <&dma 3>; + +From a4c38fc82dc02bbf1bfdef2627c2ed1ed522611e Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Mon, 20 Jul 2015 11:01:25 +0200 +Subject: [PATCH 126/131] BCM2835_DT: Fix I2S register map + +--- + Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- + Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- + arch/arm/boot/dts/bcm2835.dtsi | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +index 1396078..2db8294 100644 +--- a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt ++++ b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +@@ -48,8 +48,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = < 0x7e203000 0x20>, +- < 0x7e101098 0x02>; ++ reg = < 0x7e203000 0x24>, ++ < 0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +index 65783de..a89fe42 100644 +--- a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt ++++ b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +@@ -16,8 +16,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 4a63704..1135120 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -101,8 +101,8 @@ + + i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; + +From 76a6fde3d0ec48b42cc12cde51bb5713f8a8ee80 Mon Sep 17 00:00:00 2001 +From: David Frey +Date: Tue, 14 Jul 2015 15:57:36 +0200 +Subject: [PATCH 127/131] config: Enable SHT drivers for raspberry pi + +The SHT temperature and humidity sensors are often used in weather +station projects. + +Signed-off-by: David Frey +--- + arch/arm/configs/bcm2709_defconfig | 4 +++- + arch/arm/configs/bcmrpi_defconfig | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index f78a483..dd00e7c 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -611,7 +611,9 @@ CONFIG_W1_SLAVE_BQ27000=m + CONFIG_BATTERY_DS2760=m + CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_GPIO=y +-# CONFIG_HWMON is not set ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index b9b5bdf..7b24274 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -604,7 +604,9 @@ CONFIG_W1_SLAVE_BQ27000=m + CONFIG_BATTERY_DS2760=m + CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_GPIO=y +-# CONFIG_HWMON is not set ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y + +From 49158f0283abf882fd4497394729fe8e03349ca8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 14:07:14 +0100 +Subject: [PATCH 128/131] BCM270X_DT: Correct typo in overlays/README + +--- + 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 8792f98..ed484ae 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -78,7 +78,7 @@ Name: + Info: Configures the base Raspberry Pi hardware + Load: + Params: +- audio Set to "on" to disable the onboard ALSA audio ++ 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 + +From a5b4fabbfc1a60ae0cb13710b3084d62e6d1b27a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 10:53:26 +0100 +Subject: [PATCH 129/131] bcm2835-sdhost: Add the ERASE capability + +See: https://github.com/raspberrypi/linux/issues/1076 +--- + drivers/mmc/host/bcm2835-sdhost.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index d65870a..57a6ad3 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -1675,7 +1675,7 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + /* host controller capabilities */ + mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | +- MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | ++ MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | + (ALLOW_CMD23 * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + +From 48d4fef9df7f4d04ff6d7f37ab3b1c9b1737bdb3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 17:32:18 +0100 +Subject: [PATCH 130/131] bcm2835-sdhost: Ignore CRC7 for MMC CMD1 + +It seems that the sdhost interface returns CRC7 errors for CMD1, +which is the MMC-specific SEND_OP_COND. Returning these errors to +the MMC layer causes a downward spiral, but ignoring them seems +to be harmless. +--- + drivers/mmc/host/bcm2835-sdhost.c | 39 +++++++++++++++++++++++---------------- + 1 file changed, 23 insertions(+), 16 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 57a6ad3..84f645f 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -959,25 +959,32 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + mmc_hostname(host->mmc), sdcmd, sdhsts, + bcm2835_sdhost_read(host, SDEDM)); + +- if (sdhsts & SDHSTS_CMD_TIME_OUT) { +- switch (host->cmd->opcode) { +- case 5: case 52: case 53: +- /* Don't warn about SDIO commands */ +- break; +- default: +- pr_err("%s: command timeout\n", ++ if ((sdhsts & SDHSTS_CRC7_ERROR) && ++ (host->cmd->opcode == 1)) { ++ if (host->debug) ++ pr_info("%s: ignoring CRC7 error for CMD1\n", ++ mmc_hostname(host->mmc)); ++ } else { ++ if (sdhsts & SDHSTS_CMD_TIME_OUT) { ++ switch (host->cmd->opcode) { ++ case 5: case 52: case 53: ++ /* Don't warn about SDIO commands */ ++ break; ++ default: ++ pr_err("%s: command timeout\n", ++ mmc_hostname(host->mmc)); ++ break; ++ } ++ host->cmd->error = -ETIMEDOUT; ++ } else { ++ pr_err("%s: unexpected command error\n", + mmc_hostname(host->mmc)); +- break; ++ bcm2835_sdhost_dumpregs(host); ++ host->cmd->error = -EIO; + } +- host->cmd->error = -ETIMEDOUT; +- } else { +- pr_err("%s: unexpected command error\n", +- mmc_hostname(host->mmc)); +- bcm2835_sdhost_dumpregs(host); +- host->cmd->error = -EIO; ++ tasklet_schedule(&host->finish_tasklet); ++ return; + } +- tasklet_schedule(&host->finish_tasklet); +- return; + } + + if (host->cmd->flags & MMC_RSP_PRESENT) { + +From e6a77a6da2720d0687e9cdd0e9656712f1317d55 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 14:48:21 +0100 +Subject: [PATCH 131/131] BCM270X_DT: Add unit address to gpio node name + +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 728e14a..cb608df 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -92,7 +92,7 @@ + status = "disabled"; + }; + +- gpio: gpio { ++ gpio: gpio@7e200000 { + compatible = "brcm,bcm2835-gpio"; + reg = <0x7e200000 0xb4>; + interrupts = <2 17>, <2 18>; diff --git a/projects/RPi2/patches/linux/linux-01-RPi_support.patch b/projects/RPi2/patches/linux/linux-01-RPi_support.patch index 9da370c113..c87244fc95 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 f12410478cffff991f5e3c3d3fd68bab0bd33c2c Mon Sep 17 00:00:00 2001 +From 57f6047cdbd633f660b9a859b903503709cc821e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 001/105] Main bcm2708/bcm2709 linux port +Subject: [PATCH 001/131] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -7002,370 +7002,10 @@ index b5bedae..b0258e8 100644 mmc_pm_flag_t pm_caps; /* supported pm features */ -From e3d3c97f9f253df42f218071e9f9bb7fd8f602f0 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 16 Jun 2015 23:48:09 +0100 -Subject: [PATCH 002/105] power: Add power driver -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: popcornmix - -BCM270x: power: Change initcall level to subsys - -Load ordering of modules are determined by the initcall used. -If it's the same initcall level, makefile ordering decides. -Now that the mailbox driver is being moved, it's no longer -placed before the power driver by the linker. -So use a later initcall level to let the mailbox driver -load first. - -Signed-off-by: Noralf Trønnes - -BCM270x: Move power module - -Make the power module available on ARCH_BCM2835 by moving it. -The module turns on USB power making it possible to boot -ARCH_BCM2835 directly with the VC bootloader. - -Signed-off-by: Noralf Trønnes ---- - drivers/soc/Kconfig | 1 + - drivers/soc/Makefile | 1 + - drivers/soc/bcm2835/Kconfig | 9 ++ - drivers/soc/bcm2835/Makefile | 1 + - drivers/soc/bcm2835/bcm2708-power.c | 200 ++++++++++++++++++++++++++++++++++++ - include/soc/bcm2835/power.h | 61 +++++++++++ - 6 files changed, 273 insertions(+) - create mode 100644 drivers/soc/bcm2835/Kconfig - create mode 100644 drivers/soc/bcm2835/Makefile - create mode 100644 drivers/soc/bcm2835/bcm2708-power.c - create mode 100644 include/soc/bcm2835/power.h - -diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig -index d8bde82..595c9cd 100644 ---- a/drivers/soc/Kconfig -+++ b/drivers/soc/Kconfig -@@ -1,5 +1,6 @@ - menu "SOC (System On Chip) specific Drivers" - -+source "drivers/soc/bcm2835/Kconfig" - source "drivers/soc/mediatek/Kconfig" - source "drivers/soc/qcom/Kconfig" - source "drivers/soc/ti/Kconfig" -diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile -index 70042b2..9ad449c 100644 ---- a/drivers/soc/Makefile -+++ b/drivers/soc/Makefile -@@ -2,6 +2,7 @@ - # Makefile for the Linux Kernel SOC specific device drivers. - # - -+obj-y += bcm2835/ - obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ - obj-$(CONFIG_ARCH_QCOM) += qcom/ - obj-$(CONFIG_ARCH_TEGRA) += tegra/ -diff --git a/drivers/soc/bcm2835/Kconfig b/drivers/soc/bcm2835/Kconfig -new file mode 100644 -index 0000000..c2980f3 ---- /dev/null -+++ b/drivers/soc/bcm2835/Kconfig -@@ -0,0 +1,9 @@ -+# -+# BCM2835 Soc drivers -+# -+config BCM2708_POWER -+ tristate "BCM2708 legacy power driver" -+ depends on (ARCH_BCM2708 || ARCH_BCM2709 || ARCH_BCM2835) && BCM2708_MBOX -+ default y -+ help -+ Turns on USB power and provides an API for controlling power. -diff --git a/drivers/soc/bcm2835/Makefile b/drivers/soc/bcm2835/Makefile -new file mode 100644 -index 0000000..3614ad9 ---- /dev/null -+++ b/drivers/soc/bcm2835/Makefile -@@ -0,0 +1 @@ -+obj-$(CONFIG_BCM2708_POWER) += bcm2708-power.o -diff --git a/drivers/soc/bcm2835/bcm2708-power.c b/drivers/soc/bcm2835/bcm2708-power.c -new file mode 100644 -index 0000000..e7931a9 ---- /dev/null -+++ b/drivers/soc/bcm2835/bcm2708-power.c -@@ -0,0 +1,200 @@ -+/* -+ * linux/arch/arm/mach-bcm2708/power.c -+ * -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * This device provides a shared mechanism for controlling the power to -+ * VideoCore subsystems. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define DRIVER_NAME "bcm2708_power" -+ -+#define BCM_POWER_MAXCLIENTS 4 -+#define BCM_POWER_NOCLIENT (1<<31) -+ -+/* Some drivers expect there devices to be permanently powered */ -+ -+#ifdef CONFIG_USB -+#define BCM_POWER_ALWAYS_ON (BCM_POWER_USB) -+#endif -+ -+#if 1 -+#define DPRINTK printk -+#else -+#define DPRINTK if (0) printk -+#endif -+ -+struct state_struct { -+ uint32_t global_request; -+ uint32_t client_request[BCM_POWER_MAXCLIENTS]; -+ struct semaphore client_mutex; -+ struct semaphore mutex; -+} g_state; -+ -+int bcm_power_open(BCM_POWER_HANDLE_T *handle) -+{ -+ BCM_POWER_HANDLE_T i; -+ int ret = -EBUSY; -+ -+ down(&g_state.client_mutex); -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { -+ if (g_state.client_request[i] == BCM_POWER_NOCLIENT) { -+ g_state.client_request[i] = BCM_POWER_NONE; -+ *handle = i; -+ ret = 0; -+ break; -+ } -+ } -+ -+ up(&g_state.client_mutex); -+ -+ DPRINTK("bcm_power_open() -> %d\n", *handle); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(bcm_power_open); -+ -+int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request) -+{ -+ int rc = 0; -+ -+ DPRINTK("bcm_power_request(%d, %x)\n", handle, request); -+ -+ if ((handle < BCM_POWER_MAXCLIENTS) && -+ (g_state.client_request[handle] != BCM_POWER_NOCLIENT)) { -+ if (down_interruptible(&g_state.mutex) != 0) { -+ DPRINTK("bcm_power_request -> interrupted\n"); -+ return -EINTR; -+ } -+ -+ if (request != g_state.client_request[handle]) { -+ uint32_t others_request = 0; -+ uint32_t global_request; -+ BCM_POWER_HANDLE_T i; -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) { -+ if (i != handle) -+ others_request |= -+ g_state.client_request[i]; -+ } -+ others_request &= ~BCM_POWER_NOCLIENT; -+ -+ global_request = request | others_request; -+ if (global_request != g_state.global_request) { -+ uint32_t actual; -+ -+ /* Send a request to VideoCore */ -+ bcm_mailbox_write(MBOX_CHAN_POWER, -+ global_request << 4); -+ -+ /* Wait for a response during power-up */ -+ if (global_request & ~g_state.global_request) { -+ rc = bcm_mailbox_read(MBOX_CHAN_POWER, -+ &actual); -+ DPRINTK -+ ("bcm_mailbox_read -> %08x, %d\n", -+ actual, rc); -+ actual >>= 4; -+ } else { -+ rc = 0; -+ actual = global_request; -+ } -+ -+ if (rc == 0) { -+ if (actual != global_request) { -+ printk(KERN_ERR -+ "%s: prev global %x, new global %x, actual %x, request %x, others_request %x\n", -+ __func__, -+ g_state.global_request, -+ global_request, actual, request, others_request); -+ /* A failure */ -+ BUG_ON((others_request & actual) -+ != others_request); -+ request &= actual; -+ rc = -EIO; -+ } -+ -+ g_state.global_request = actual; -+ g_state.client_request[handle] = -+ request; -+ } -+ } -+ } -+ up(&g_state.mutex); -+ } else { -+ rc = -EINVAL; -+ } -+ DPRINTK("bcm_power_request -> %d\n", rc); -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_power_request); -+ -+int bcm_power_close(BCM_POWER_HANDLE_T handle) -+{ -+ int rc; -+ -+ DPRINTK("bcm_power_close(%d)\n", handle); -+ -+ rc = bcm_power_request(handle, BCM_POWER_NONE); -+ if (rc == 0) -+ g_state.client_request[handle] = BCM_POWER_NOCLIENT; -+ -+ return rc; -+} -+EXPORT_SYMBOL_GPL(bcm_power_close); -+ -+static int __init bcm_power_init(void) -+{ -+#if defined(BCM_POWER_ALWAYS_ON) -+ BCM_POWER_HANDLE_T always_on_handle; -+#endif -+ int rc = 0; -+ int i; -+ -+ printk(KERN_INFO "bcm_power: Broadcom power driver\n"); -+ bcm_mailbox_write(MBOX_CHAN_POWER, 0); -+ -+ for (i = 0; i < BCM_POWER_MAXCLIENTS; i++) -+ g_state.client_request[i] = BCM_POWER_NOCLIENT; -+ -+ sema_init(&g_state.client_mutex, 1); -+ sema_init(&g_state.mutex, 1); -+ -+ g_state.global_request = 0; -+ -+#if defined(BCM_POWER_ALWAYS_ON) -+ if (BCM_POWER_ALWAYS_ON) { -+ bcm_power_open(&always_on_handle); -+ bcm_power_request(always_on_handle, BCM_POWER_ALWAYS_ON); -+ } -+#endif -+ -+ return rc; -+} -+ -+static void __exit bcm_power_exit(void) -+{ -+ bcm_mailbox_write(MBOX_CHAN_POWER, 0); -+} -+ -+/* -+ * Load after the mailbox driver is initialized (arch_initcall), -+ * but before depending drivers (module_init). -+ */ -+subsys_initcall(bcm_power_init); -+module_exit(bcm_power_exit); -+ -+MODULE_AUTHOR("Phil Elwell"); -+MODULE_DESCRIPTION("Interface to BCM2708 power management"); -+MODULE_LICENSE("GPL"); -diff --git a/include/soc/bcm2835/power.h b/include/soc/bcm2835/power.h -new file mode 100644 -index 0000000..bf22b26 ---- /dev/null -+++ b/include/soc/bcm2835/power.h -@@ -0,0 +1,61 @@ -+/* -+ * Copyright (C) 2010 Broadcom -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License version 2 as -+ * published by the Free Software Foundation. -+ * -+ * This device provides a shared mechanism for controlling the power to -+ * VideoCore subsystems. -+ */ -+ -+#ifndef _BCM2708_POWER_H -+#define _BCM2708_POWER_H -+ -+#include -+ -+/* Use meaningful names on each side */ -+#ifdef __VIDEOCORE__ -+#define PREFIX(x) ARM_##x -+#else -+#define PREFIX(x) BCM_##x -+#endif -+ -+enum { -+ PREFIX(POWER_SDCARD_BIT), -+ PREFIX(POWER_UART_BIT), -+ PREFIX(POWER_MINIUART_BIT), -+ PREFIX(POWER_USB_BIT), -+ PREFIX(POWER_I2C0_BIT), -+ PREFIX(POWER_I2C1_BIT), -+ PREFIX(POWER_I2C2_BIT), -+ PREFIX(POWER_SPI_BIT), -+ PREFIX(POWER_CCP2TX_BIT), -+ PREFIX(POWER_DSI_BIT), -+ -+ PREFIX(POWER_MAX) -+}; -+ -+enum { -+ PREFIX(POWER_SDCARD) = (1 << PREFIX(POWER_SDCARD_BIT)), -+ PREFIX(POWER_UART) = (1 << PREFIX(POWER_UART_BIT)), -+ PREFIX(POWER_MINIUART) = (1 << PREFIX(POWER_MINIUART_BIT)), -+ PREFIX(POWER_USB) = (1 << PREFIX(POWER_USB_BIT)), -+ PREFIX(POWER_I2C0) = (1 << PREFIX(POWER_I2C0_BIT)), -+ PREFIX(POWER_I2C1_MASK) = (1 << PREFIX(POWER_I2C1_BIT)), -+ PREFIX(POWER_I2C2_MASK) = (1 << PREFIX(POWER_I2C2_BIT)), -+ PREFIX(POWER_SPI_MASK) = (1 << PREFIX(POWER_SPI_BIT)), -+ PREFIX(POWER_CCP2TX_MASK) = (1 << PREFIX(POWER_CCP2TX_BIT)), -+ PREFIX(POWER_DSI) = (1 << PREFIX(POWER_DSI_BIT)), -+ -+ PREFIX(POWER_MASK) = (1 << PREFIX(POWER_MAX)) - 1, -+ PREFIX(POWER_NONE) = 0 -+}; -+ -+typedef unsigned int BCM_POWER_HANDLE_T; -+ -+extern int bcm_power_open(BCM_POWER_HANDLE_T *handle); -+extern int bcm_power_request(BCM_POWER_HANDLE_T handle, uint32_t request); -+extern int bcm_power_close(BCM_POWER_HANDLE_T handle); -+ -+#endif - -From 6f7a17a848b57ac66f13d9ee9f09f4be89e74824 Mon Sep 17 00:00:00 2001 +From eef200f75c4a6f6701f1693f8f59ab2c83d1abcd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 Oct 2014 18:50:05 +0100 -Subject: [PATCH 003/105] Add bcm2708_gpio driver +Subject: [PATCH 002/131] Add bcm2708_gpio driver Signed-off-by: popcornmix @@ -7995,10 +7635,10 @@ index 0000000..fb69624 + +#endif -From e1fa284edd01b1a623096845dbe54c8d936aaaaf Mon Sep 17 00:00:00 2001 +From 6f5003498da677a660cbdfaf9be78d3c0aff2e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 1 May 2015 19:11:03 +0200 -Subject: [PATCH 004/105] mailbox: bcm2708: Add bcm2708-vcio +Subject: [PATCH 003/131] mailbox: bcm2708: Add bcm2708-vcio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -8629,10 +8269,10 @@ index 0000000..cc284ed + +#endif -From 495cfff15f23f9b3ee26b0b92673ad77fc3e8d22 Mon Sep 17 00:00:00 2001 +From 7c8a47937b598fa8dad4cd50753164b5ee44f8c1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 005/105] Add dwc_otg driver +Subject: [PATCH 004/131] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -69906,10 +69546,10 @@ index 0000000..cdc9963 +test_main(); +0; -From 2fee602715f8de08540132094fe160dd21978680 Mon Sep 17 00:00:00 2001 +From 70cf7eac2e13367cb8939741ee140c6bbac32f62 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:54:32 +0100 -Subject: [PATCH 006/105] bcm2708 watchdog driver +Subject: [PATCH 005/131] bcm2708 watchdog driver Signed-off-by: popcornmix --- @@ -70346,10 +69986,10 @@ index 0000000..8a27d68 +MODULE_ALIAS_MISCDEV(TEMP_MINOR); +MODULE_LICENSE("GPL"); -From 164b737c320aca85798130a904c964f748423937 Mon Sep 17 00:00:00 2001 +From 6655b0b613cde9e4eb6aacaf43d04a388d8cd6c6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 007/105] bcm2708 framebuffer driver +Subject: [PATCH 006/131] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -73788,10 +73428,10 @@ index 3c14e43..7626beb6a 100644 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From b1c418d504c5c7b800fee387abf9a03af0e1b4a4 Mon Sep 17 00:00:00 2001 +From 0f8c3ed7803f3a871df49398b678c364aa4929c2 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 008/105] dmaengine: Add support for BCM2708 +Subject: [PATCH 007/131] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -75559,10 +75199,10 @@ index 0000000..2310e34 + +#endif /* _PLAT_BCM2708_DMA_H */ -From 8500a8de635dc4ce251330dfe0950453689d7a65 Mon Sep 17 00:00:00 2001 +From 0464f674cf3e441b8651c4a5ea0131fa24a3adc4 Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 009/105] MMC: added alternative MMC driver +Subject: [PATCH 008/131] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -77378,10 +77018,10 @@ index 0000000..b7c4883 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 6a1f159f160fec9d7b8f10cc0b37c79c58be80c8 Mon Sep 17 00:00:00 2001 +From 7bf3e966797438781e11dbc233e17bbe4746bd5b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 010/105] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 009/131] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -79151,10 +78791,10 @@ index 0000000..eef8a24 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From 8f5a0afb8bc65e48695b38a33dba8a17bb0c4218 Mon Sep 17 00:00:00 2001 +From 2bb9c01de4c90a8b7a9b52be95f504177abeaf45 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 011/105] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 010/131] cma: Add vc_cma driver to enable use of CMA Signed-off-by: popcornmix @@ -80479,10 +80119,10 @@ index 0000000..5325832 + +#endif /* VC_CMA_H */ -From 8af8b7d264e546ee29b28acca735bd4ce8dbdb71 Mon Sep 17 00:00:00 2001 +From 801a4cbc4ea0f0ffd64b4fa0065be3f791b9d1d0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 012/105] bcm2708: alsa sound driver +Subject: [PATCH 011/131] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -83324,10 +82964,10 @@ index 0000000..af3e6eb + +#endif // _VC_AUDIO_DEFS_H_ -From d01fbc5cd5784094ffe247f269eaa1b31bb023d5 Mon Sep 17 00:00:00 2001 +From 32495b1b4a656f2388b1dc133278a80616e40994 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 Jul 2013 23:42:01 +0100 -Subject: [PATCH 013/105] bcm2708 vchiq driver +Subject: [PATCH 012/131] bcm2708 vchiq driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -96581,10 +96221,10 @@ index 0000000..b6bfa21 + return vchiq_build_time; +} -From efc783d883c14618d52d0d804a856ee31a152fcb Mon Sep 17 00:00:00 2001 +From 8909329c134abdf242dc345a4528e98e86c85c33 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 16:07:06 +0100 -Subject: [PATCH 014/105] vc_mem: Add vc_mem driver +Subject: [PATCH 013/131] vc_mem: Add vc_mem driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -97590,10 +97230,10 @@ index 0000000..20a4753 + +#endif /* _VC_MEM_H */ -From 72c49d81f0dd002228b6cb26db9e5428eef39d41 Mon Sep 17 00:00:00 2001 +From 3dc51b65ed267fd3cc57feeda298e6c02af5cf82 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 015/105] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 014/131] vcsm: VideoCore shared memory service for BCM2835 Add experimental support for the VideoCore shared memory service. This allows user processes to allocate memory from VideoCore's @@ -102003,10 +101643,10 @@ index 0000000..0bfb42e +MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); +MODULE_LICENSE("GPL v2"); -From 6b13df3a424914c3db0687d471236611c0cd6d60 Mon Sep 17 00:00:00 2001 +From 250314915c749fccd25d98aca0b9a2d29f55ec1c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:51:55 +0100 -Subject: [PATCH 016/105] Add hwrng (hardware random number generator) driver +Subject: [PATCH 015/131] Add hwrng (hardware random number generator) driver --- drivers/char/hw_random/Kconfig | 13 +++- @@ -102183,10 +101823,10 @@ index 0000000..340f004 +MODULE_DESCRIPTION("BCM2708 H/W Random Number Generator (RNG) driver"); +MODULE_LICENSE("GPL and additional rights"); -From 71858ccb0a96e022238c9644177fcbf891807ffd Mon Sep 17 00:00:00 2001 +From e074d656e4011eae32577e4d20d7ce6dfa15f6e8 Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 017/105] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 016/131] 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 @@ -103039,10 +102679,10 @@ index 0000000..24563ec +module_param(debug, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Enable debugging messages"); -From 36fe69547259b45803b0cb11085d60374c92446a Mon Sep 17 00:00:00 2001 +From ccdc49f30be0caec97b9b7e4352b8c63eb45acdd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 018/105] Add cpufreq driver +Subject: [PATCH 017/131] Add cpufreq driver Signed-off-by: popcornmix --- @@ -103315,10 +102955,10 @@ index 0000000..6735da9 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From 50d7170ec5cf300e239ab575de3e0917ec44b8a6 Mon Sep 17 00:00:00 2001 +From b7e45ce253f9aa6f3f4b33967b124198d3e2b74f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 019/105] Added hwmon/thermal driver for reporting core +Subject: [PATCH 018/131] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -103615,10 +103255,10 @@ index 0000000..3bc80f1 + +module_platform_driver(bcm2835_thermal_driver); -From 4011c7c5c3c5a03af182dbed2e824a491d12e96c Mon Sep 17 00:00:00 2001 +From f65673287078cca868595a556d8613802e9a1743 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:41:33 +0100 -Subject: [PATCH 020/105] Add Chris Boot's spi driver. +Subject: [PATCH 019/131] Add Chris Boot's spi driver. spi: bcm2708: add device tree support @@ -104530,10 +104170,10 @@ index 0000000..041b5e2 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 04e6956b7d15554967ca2620563efc31a63cd69e Mon Sep 17 00:00:00 2001 +From 31dade83cc4f448f81d7d460c59d02b9ebc3b05b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 021/105] Add Chris Boot's i2c driver +Subject: [PATCH 020/131] Add Chris Boot's i2c driver i2c-bcm2708: fixed baudrate @@ -105334,10 +104974,10 @@ index 0000000..8773203 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 9ed8236717339aab28673519a2300e6f0165d2da Mon Sep 17 00:00:00 2001 +From 170ee05def27ef6ddedf2561d1dd770c992962b1 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 022/105] bcm2835: add v4l2 camera device +Subject: [PATCH 021/131] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -112664,10 +112304,10 @@ index 0000000..9d1d11e + +#endif /* MMAL_VCHIQ_H */ -From 8daf7f4a4f40fd1d6008fa8438d72ae3c9f2cd4f Mon Sep 17 00:00:00 2001 +From e864404b1afe2fdb0dbd9b3bc5968ea2173fd3e7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 23 Jan 2015 14:48:55 +0000 -Subject: [PATCH 023/105] scripts/dtc: Update to upstream version with overlay +Subject: [PATCH 022/131] scripts/dtc: Update to upstream version with overlay patches --- @@ -117515,7 +117155,7 @@ index 665dad7..f439b40 100644 } diff --git a/scripts/dtc/fstree.c b/scripts/dtc/fstree.c -index e464727..6e5878a 100644 +index e464727c..6e5878a 100644 --- a/scripts/dtc/fstree.c +++ b/scripts/dtc/fstree.c @@ -37,26 +37,26 @@ static struct node *read_fstree(const char *dirname) @@ -117880,10 +117520,10 @@ index 54d4e904..d644002 100644 -#define DTC_VERSION "DTC 1.4.0-dirty" +#define DTC_VERSION "DTC 1.4.1-g36c70742" -From 0d794d8e6cccfbefeb6320acf871913dcd94d2ff Mon Sep 17 00:00:00 2001 +From 5b2523aae9c5beb443315a7814633fc740992d07 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 024/105] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 023/131] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -118368,10 +118008,10 @@ index 0000000..3dff948 + return (($val eq 'y') || ($val eq '1')); +} -From 79ae5c40586808d01368549b13b3c7a4709c9564 Mon Sep 17 00:00:00 2001 +From 2d9c312e5b7a52fc0e311f909bb475ecc68b1199 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 5 Dec 2014 17:26:26 +0000 -Subject: [PATCH 025/105] fdt: Add support for the CONFIG_CMDLINE_EXTEND option +Subject: [PATCH 024/131] fdt: Add support for the CONFIG_CMDLINE_EXTEND option --- drivers/of/fdt.c | 29 ++++++++++++++++++++++++----- @@ -118426,10 +118066,10 @@ index cde35c5d01..dd7fbfe 100644 pr_debug("Command line is: %s\n", (char*)data); -From 01a18bea60e6b60a6fcb0a58faaf34f1b5cc0281 Mon Sep 17 00:00:00 2001 +From 73ffc770b510d914757449f9bd52ff5e0b300a52 Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 026/105] BCM2708: Add core Device Tree support +Subject: [PATCH 025/131] BCM2708: Add core Device Tree support Add the bare minimum needed to boot BCM2708 from a Device Tree. @@ -122306,10 +121946,10 @@ index 0000000..66a98f6 + }; +}; -From 7c5cfbcdfa96680f63b0e82202ab509ef78bc023 Mon Sep 17 00:00:00 2001 +From 4559e395eaf5d2a4c9af93066c8edc7d184287e3 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 027/105] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 026/131] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -122402,10 +122042,10 @@ index fb795c3..fa72af0 100644 #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ #define FB_TYPE_PLANES 1 /* Non interleaved planes */ -From b16b65cdb4064e32b321e4d3801bc1990ee258f7 Mon Sep 17 00:00:00 2001 +From 68d4d166abf2d287a3b333bbae60e2c9c027fa71 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 030/105] Speed up console framebuffer imageblit function +Subject: [PATCH 029/131] 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 @@ -122614,10 +122254,10 @@ index a2bb276..436494f 100644 start_index, pitch_index); } else -From bda0a510175903069a6e36ee03df8bb58da535fc Mon Sep 17 00:00:00 2001 +From 5e3834b22d4c560ac1354cfff30a6713b6d94e64 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 031/105] Allow mac address to be set in smsc95xx +Subject: [PATCH 030/131] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -122708,10 +122348,10 @@ index 26423ad..e29a323 100644 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN, dev->net->dev_addr) == 0) { -From cc2b2db4dd1eea70daf6a7b2122bc2cc4fff16b5 Mon Sep 17 00:00:00 2001 +From 9c50f6318fdf116e5abaeb05bffa0b65e48ba259 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 032/105] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 031/131] 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 @@ -123109,10 +122749,10 @@ index d58594a..feae942 100644 unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; -From f0f58bbd87e81fe4ff162b11faedbacc6b0c8f38 Mon Sep 17 00:00:00 2001 +From 2722779be49b7b76dea3de564e03d9fd0083f094 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 034/105] config: Enable CONFIG_MEMCG, but leave it disabled +Subject: [PATCH 033/131] config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. --- @@ -123167,10 +122807,10 @@ index a04225d..a2ef8af 100644 /** -From c475efe6fd77dc1288117ba41451f11c7e46c74c Mon Sep 17 00:00:00 2001 +From 27e4ffc36fc9366bfcefe25321191a78460ba1fd Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:33:38 +0100 -Subject: [PATCH 035/105] ASoC: Add support for BCM2708 +Subject: [PATCH 034/131] ASoC: Add support for BCM2708 This driver adds support for digital audio (I2S) for the BCM2708 SoC that is used by the @@ -124313,10 +123953,10 @@ index 0000000..6fdcbc1 + +#endif -From ea9da38e0ab7aae107b1b2cb86f9e6728c54f72d Mon Sep 17 00:00:00 2001 +From c368e010eacbc50e6a5f527fcc8651ea1cdc5f26 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:59:51 +0100 -Subject: [PATCH 036/105] ASoC: Add support for PCM5102A codec +Subject: [PATCH 035/131] ASoC: Add support for PCM5102A codec Some definitions to support the PCM5102A codec by Texas Instruments. @@ -124441,10 +124081,10 @@ index 0000000..126f1e9 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 3843c763a49f690052a369c75a4b91e63e65ccd3 Mon Sep 17 00:00:00 2001 +From 1ae47f91380b552b3bb3adb28f3283be31786064 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:04:54 +0100 -Subject: [PATCH 037/105] BCM2708: Add I2S support to board file +Subject: [PATCH 036/131] BCM2708: Add I2S support to board file Adds the required initializations for I2S to the board file of mach-bcm2708. @@ -124533,10 +124173,10 @@ index a3b65dc..a515992 100644 for (i = 0; i <= 1; i++) { void __iomem *base; -From 9305f38947159f8027408f9caf57ff11d3a14e5d Mon Sep 17 00:00:00 2001 +From 65a3e3f912faa5d0c0cdb937b23e641d45608236 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 038/105] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 037/131] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -124685,10 +124325,10 @@ index 0000000..4b70b45 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From d48fc2d392448b821b9ff95e26cf859f2efe4794 Mon Sep 17 00:00:00 2001 +From 1fee3fa181deb59422ad4f5f08262c8328189370 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:21:34 +0100 -Subject: [PATCH 039/105] BCM2708: Add HifiBerry DAC to board file +Subject: [PATCH 038/131] BCM2708: Add HifiBerry DAC to board file This adds the initalization of the HifiBerry DAC to the mach-bcm2708 board file. @@ -124736,10 +124376,10 @@ index 01f2de7..1d9b788 100644 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { struct amba_device *d = amba_devs[i]; -From 1d90a3734460be00e20106847f347ff0bd4c322b Mon Sep 17 00:00:00 2001 +From c5a634c60f6706ba7ffaec669d6ddae793a7b889 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 6 Dec 2013 20:50:28 +0100 -Subject: [PATCH 040/105] ASoC: BCM2708: Add support for RPi-DAC +Subject: [PATCH 039/131] ASoC: BCM2708: Add support for RPi-DAC This adds a machine driver for the RPi-DAC. @@ -125034,10 +124674,10 @@ index 0000000..b4eaa44 +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 54b60a8b83358d2fedc3e401908d96e9053033fb Mon Sep 17 00:00:00 2001 +From c739ac8e078de6188449830672c7dd1e5b57af52 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 041/105] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 040/131] 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 @@ -125077,10 +124717,10 @@ index 1e403f6..d4efa85 100644 #define WM8804_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ -From bda0438e5d2450329f79c9c203eb7700ea94bcdc Mon Sep 17 00:00:00 2001 +From 7cce7a2fdf84a988e7b23caa129dddbcc7613b10 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 042/105] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 041/131] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -125345,10 +124985,10 @@ index 0000000..92e9e46 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From f0b7e3863c1025b7318dfe2672828fc1186f5f0c Mon Sep 17 00:00:00 2001 +From 6912c1ddd399d69d7704e9f6445014d40ec21c9b Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:26:08 +0100 -Subject: [PATCH 043/105] BCM2708: Added support for HiFiBerry Digi board Board +Subject: [PATCH 042/131] BCM2708: Added support for HiFiBerry Digi board Board initalization by I2C Signed-off-by: Daniel Matuschek @@ -125395,10 +125035,10 @@ index 6d53beb..a062d7f 100644 bcm_register_device_dt(&snd_rpi_dac_device); bcm_register_device_dt(&snd_pcm1794a_codec_device); -From f1d5146257a0181f53a76aa7c1eab75d8cde3722 Mon Sep 17 00:00:00 2001 +From c1291a2b3390ab53e3a6ca2325e39d0a01908d87 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Thu, 16 Jan 2014 07:36:35 +0100 -Subject: [PATCH 044/105] ASoC: wm8804: Set idle_bias_off to false Idle bias +Subject: [PATCH 043/131] ASoC: wm8804: Set idle_bias_off to false Idle bias has been change to remove warning on driver startup Signed-off-by: Daniel Matuschek @@ -125420,10 +125060,10 @@ index d4efa85..f3f26a2 100644 .dapm_widgets = wm8804_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(wm8804_dapm_widgets), -From e2bd270cae6b71e799cd32309da2efb131bfc0f7 Mon Sep 17 00:00:00 2001 +From 3cefe8f4539e290215418a54ff815913bb658814 Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 045/105] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 044/131] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -125631,10 +125271,10 @@ index 0000000..aff7377 +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From 3722358310334b175672d037724974a827219c91 Mon Sep 17 00:00:00 2001 +From 63dc5102ff1e782a18c891169ef614ff83fd16da Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 13:42:01 +0100 -Subject: [PATCH 046/105] vmstat: Workaround for issue where dirty page count +Subject: [PATCH 045/131] vmstat: Workaround for issue where dirty page count goes negative See: @@ -125661,10 +125301,10 @@ index 82e7db7..f87d16d 100644 static inline void __inc_zone_page_state(struct page *page, -From d0561fb6028c8eb1c26f3ad2f59d21d70eb778f4 Mon Sep 17 00:00:00 2001 +From 4b7eb6e29aee506fd82e9eea37b951f0a4101f8a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 047/105] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 046/131] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -125700,10 +125340,10 @@ index bfbe1be..a738b25 100644 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From efa286e84267224fb05bfe8615489d50932ed5b8 Mon Sep 17 00:00:00 2001 +From e35b74b6335b49387b09d114966b89549a13f1d5 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 048/105] Added support for HiFiBerry DAC+ +Subject: [PATCH 047/131] 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. @@ -125914,10 +125554,10 @@ index 0000000..c63387b +MODULE_DESCRIPTION("ASoC Driver for HiFiBerry DAC+"); +MODULE_LICENSE("GPL v2"); -From f0b1de75a01f88b6250c208157a3a2f4a5c6b52d Mon Sep 17 00:00:00 2001 +From ee406533a463686db7d11c7ad0f626578c1edcac Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 049/105] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 048/131] 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. @@ -126786,10 +126426,10 @@ index 0000000..8f019e0 + +#endif /* _TAS5713_H */ -From 354cb37f33bee3d72e5a514999323689b00ca275 Mon Sep 17 00:00:00 2001 +From b904f76b1090667c9f4741a60da8e60cebc8a91c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Apr 2015 19:14:18 +0100 -Subject: [PATCH 050/105] bcm2708: Allow option card devices to be configured +Subject: [PATCH 049/131] bcm2708: Allow option card devices to be configured via DT If the kernel is built with Device Tree support, and if a DT blob @@ -126814,10 +126454,10 @@ index 03fa1cb..c816526 100644 static struct platform_driver bcm2835_i2s_driver = { .probe = bcm2835_i2s_probe, -From f5a17a7715495cd47e7c4eef2655346833b71139 Mon Sep 17 00:00:00 2001 +From 8b4aab9c9a47544e493ba3479ad0e6397e4ea27a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 18:45:39 +0100 -Subject: [PATCH 051/105] Adding Device Tree support for some RPi audio cards +Subject: [PATCH 050/131] Adding Device Tree support for some RPi audio cards --- arch/arm/mach-bcm2709/bcm2709.c | 143 ++++++++++++++++++++++++++++++++++++++ @@ -127180,10 +126820,10 @@ index 126f1e9..7c6598e 100644 }; -From 83c934f5afe83dab78859dbdcb6bc2fbcd24904a Mon Sep 17 00:00:00 2001 +From bc32dfd7d696d4e3c381344064aabc38961b7f46 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Wed, 29 Oct 2014 23:30:30 -0700 -Subject: [PATCH 052/105] Added support to reserve/enable a GPIO pin to be used +Subject: [PATCH 051/131] Added support to reserve/enable a GPIO pin to be used from pps-gpio module (LinuxPPS). Enable PPS modules in default config for RPi. @@ -127319,10 +126959,10 @@ index 57e1f3d..721559b 100644 +module_param(pps_gpio_pin, int, 0644); +MODULE_PARM_DESC(pps_gpio_pin, "Set GPIO pin to reserve for PPS"); -From 98235f2a450b2f029e0bba2b566b5c86df9a6fef Mon Sep 17 00:00:00 2001 +From 5b706049d22fc0593a14a1d94ebf7f9bf54feeea Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 053/105] Update ds1307 driver for device-tree support +Subject: [PATCH 052/131] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -127349,10 +126989,10 @@ index 4ffabb3..c6789a7 100644 .driver = { .name = "rtc-ds1307", -From d25a65991d2262ee56bf481b47a9980edf5e1ff0 Mon Sep 17 00:00:00 2001 +From 1578dbee8e10fed1be0f64820fe511dc4b7a720e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 054/105] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 053/131] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -127463,10 +127103,10 @@ index 0000000..2ca2b98 +MODULE_DESCRIPTION("Set LED GPIO to Input \"trigger\""); +MODULE_LICENSE("GPL"); -From b478a1224ddadc079a085b1a9fd2f921f3492543 Mon Sep 17 00:00:00 2001 +From a926a1d2720eef63b580a4510a9aec4540836d40 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 20 Jun 2014 17:19:27 +0100 -Subject: [PATCH 055/105] bcm2709: Simplify and strip down IRQ handler +Subject: [PATCH 054/131] bcm2709: Simplify and strip down IRQ handler --- arch/arm/include/asm/entry-macro-multi.S | 2 + @@ -127685,10 +127325,10 @@ index d08591b..08d184c 100644 +1: get_irqnr_and_base r0, r2, r6, lr + .endm -From a149f4195cb6283d974f29f6853bc73666252e28 Mon Sep 17 00:00:00 2001 +From 39cf4677b7c38fac3da503b75d5cd7efc64dd19a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 12 Feb 2015 11:17:53 +0000 -Subject: [PATCH 056/105] Fix LED "input" trigger implementation for 3.19 +Subject: [PATCH 055/131] Fix LED "input" trigger implementation for 3.19 --- drivers/leds/leds-gpio.c | 10 +++++++++- @@ -127775,10 +127415,10 @@ index 9a2b000..60accc5 100644 /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ -From 63f720f1e358012fdb2631c18c794c32beb1c53f Mon Sep 17 00:00:00 2001 +From d6f122c984a90914b054c16def454ee77a002bad Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 057/105] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 056/131] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -127800,10 +127440,10 @@ index 8d908e3..7a1900d 100644 .can_sleep = false, }; -From 344a03d0bd987220640f4dd4ba4d083d2fdbb449 Mon Sep 17 00:00:00 2001 +From 0bb455e4eca847aa74560f58bfd7daa13e9fb496 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 4 Feb 2015 10:02:24 +0000 -Subject: [PATCH 058/105] pinctrl-bcm2835: bcm2835_gpio_direction_output must +Subject: [PATCH 057/131] pinctrl-bcm2835: bcm2835_gpio_direction_output must set the value --- @@ -127831,10 +127471,10 @@ index 7a1900d..62f85aa 100644 static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) -From 1c683d296c9424f0cf7dac30d8992258c28cbeb1 Mon Sep 17 00:00:00 2001 +From 1ee5ccaeae81a9acd296d4d3eaba9fa1807b9e17 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 059/105] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 058/131] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -127980,10 +127620,10 @@ index 62f85aa..c7cf266 100644 }, }; -From e1a45c7cf40f11598c7faed4a1d1b594bcc05796 Mon Sep 17 00:00:00 2001 +From 7e2506a80d3a218bab8db21c947187c92d29812c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 060/105] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 059/131] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -128010,10 +127650,10 @@ index c7cf266..986779a 100644 pc->irq_data[i].irqgroup = i; -From 0fff72fcb15c962d0723f9cea13eb2c3fc31d465 Mon Sep 17 00:00:00 2001 +From 69c25727685034a06c041fee3938afba0b84e582 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 27 Feb 2015 15:10:24 +0000 -Subject: [PATCH 061/105] enc28j60: Add device tree compatible string and an +Subject: [PATCH 060/131] enc28j60: Add device tree compatible string and an overlay --- @@ -128047,10 +127687,10 @@ index b1b5f66..c6b6e1a 100644 .probe = enc28j60_probe, .remove = enc28j60_remove, -From 74c1893348470c0ec98d83ea63ab8e22e3da8c13 Mon Sep 17 00:00:00 2001 +From 9ea362cfd9b8e0b2a8896a713b8b82c0c5834a68 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 062/105] Add driver for rpi-proto +Subject: [PATCH 061/131] 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 @@ -128265,10 +127905,10 @@ index 0000000..c6e45a0 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From 607ebcbdf67cb576a652c505a367e614014547dd Mon Sep 17 00:00:00 2001 +From db5f1ae7154cf08397ba74b67af282f246a17ddf Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Thu, 2 Apr 2015 12:22:55 +0100 -Subject: [PATCH 063/105] Add Device Tree support for RPi-DAC. +Subject: [PATCH 062/131] Add Device Tree support for RPi-DAC. --- sound/soc/bcm/rpi-dac.c | 21 +++++++++++++++++++++ @@ -128343,10 +127983,10 @@ index b4eaa44..afe1b41 100644 }; -From 1fa756b7cbc29e7ce003ed6f6b269faf8f114467 Mon Sep 17 00:00:00 2001 +From 0fa5223ca68a9c68b92b6ea149fccc42d50c3357 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 064/105] config: Add default configs +Subject: [PATCH 063/131] config: Add default configs --- arch/arm/configs/bcm2709_defconfig | 1204 ++++++++++++++++++++++++++++++++++++ @@ -130771,10 +130411,10 @@ index 0000000..6a41231 +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From 7d987bad7109b37ffac673a9975718ee4e9ea9ae Mon Sep 17 00:00:00 2001 +From 4fc03ec1bfe73a125775bb06937a246be639dc55 Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 065/105] smsx95xx: fix crimes against truesize +Subject: [PATCH 064/131] 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. @@ -130809,10 +130449,10 @@ index e29a323..aff63dc usbnet_skb_return(dev, ax_skb); } -From 888ea57ee7c57e7f43b3be9d7f9c70ea92e3ef2e Mon Sep 17 00:00:00 2001 +From 9131a29e8e039bdc5055dad93d41f11a111a13b9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 17 Apr 2015 16:58:45 +0100 -Subject: [PATCH 066/105] smsc95xx: Disable turbo mode by default +Subject: [PATCH 065/131] smsc95xx: Disable turbo mode by default --- drivers/net/usb/smsc95xx.c | 2 +- @@ -130832,10 +130472,10 @@ index aff63dc..08a8a8c 100755 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction"); -From 43e2441e42ce3e68910e50a862e82cefff1491a8 Mon Sep 17 00:00:00 2001 +From 510eb2621d1b1b74618236a324538c19c9106ece Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Apr 2015 19:30:22 +0100 -Subject: [PATCH 067/105] Add blk_pos parameter to mmc multi_io_quirk callback +Subject: [PATCH 066/131] Add blk_pos parameter to mmc multi_io_quirk callback --- drivers/mmc/card/block.c | 1 + @@ -130918,10 +130558,10 @@ index b0258e8..d3cdad9 100644 struct mmc_card; -From 3c38adf40dd65f96d317f60295ee47ddd5412d11 Mon Sep 17 00:00:00 2001 +From d2482f75a64fce6da8a4138f88a6c59cb0de4d9b 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 068/105] bcm2835: bcm2835_defconfig +Subject: [PATCH 067/131] bcm2835: bcm2835_defconfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -132251,10 +131891,10 @@ index 31cb073..2e8a95a 100644 # CONFIG_XZ_DEC_ARM is not set # CONFIG_XZ_DEC_ARMTHUMB is not set -From 219d0cd5afbcfc1d8d1bffc63c535c323ae8bf2e Mon Sep 17 00:00:00 2001 +From 984698645ff73ed2100b4bfea99ed035139ac721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 1 May 2015 23:00:15 +0200 -Subject: [PATCH 069/105] BCM270x_DT: Add mailbox bcm2708-vcio +Subject: [PATCH 068/131] BCM270x_DT: Add mailbox bcm2708-vcio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -132295,10 +131935,10 @@ index 721559b..4a00561 100644 #ifdef CONFIG_BCM2708_GPIO bcm_register_device_dt(&bcm2708_gpio_device); -From 3c10332d5214199b7df6d5d220eeef023706cbaf Mon Sep 17 00:00:00 2001 +From 156ce0fa550bbcb8e63eb60d11ac05cc28c14775 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 070/105] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 069/131] rpi-ft5406: Add touchscreen driver for pi LCD display --- drivers/input/touchscreen/Kconfig | 7 + @@ -132615,10 +132255,10 @@ index cc284ed..d3ea839 100644 VCMSG_SET_CURSOR_STATE = 0x00008011, }; -From 10fe6a8ff8d397d392f84f71bccef590007c1035 Mon Sep 17 00:00:00 2001 +From e2149721bbb442d9f1622bfd0b4c89a892afd88f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Oct 2014 11:47:53 +0100 -Subject: [PATCH 071/105] Improve __copy_to_user and __copy_from_user +Subject: [PATCH 070/131] Improve __copy_to_user and __copy_from_user performance Provide a __copy_from_user that uses memcpy. On BCM2708, use @@ -134143,10 +133783,10 @@ index 3e58d71..0622891 100644 static unsigned long noinline __clear_user_memset(void __user *addr, unsigned long n) -From 55e619a1d22f898210f4d5df7056de9ca22262ef Mon Sep 17 00:00:00 2001 +From 92f76fcdda43617a0f3461741bba9e6d328684da Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 27 May 2015 17:22:15 +0100 -Subject: [PATCH 072/105] bcm2835-audio: Create the platform device if the DT +Subject: [PATCH 071/131] bcm2835-audio: Create the platform device if the DT node is disabled For backwards compatibility, allow the built-in ALSA driver to be enabled @@ -134200,10 +133840,10 @@ index 4a00561..dec8043 100644 bcm_register_device_dt(&bcm2708_spi_device); -From 3a23003af149876e9459bf65f14eff38ddb57778 Mon Sep 17 00:00:00 2001 +From e64ab6c66db34627b7765099e815a8c2d4957296 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 073/105] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 072/131] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -134262,10 +133902,10 @@ index 70f2f39..f7fdacd 100644 static const char * const bcm2835_compat[] = { -From a16205df7ca3759a05bf56e126d17fb496c12775 Mon Sep 17 00:00:00 2001 +From 8a609b1977da490cd177740e61169444383fd8c4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 Jun 2015 17:47:27 +0100 -Subject: [PATCH 074/105] platform: Add force_core command line setting to boot +Subject: [PATCH 073/131] platform: Add force_core command line setting to boot from a different core number --- @@ -134336,10 +133976,10 @@ index dec8043..fe71c50 100644 module_param(serial, uint, 0644); module_param(uart_clock, uint, 0644); -From d4fe01b4f1f6d84fb12a04e228edc19aea23865a Mon Sep 17 00:00:00 2001 +From 2efab5a48bc519a3901b62da297ee5523c91ee58 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 18 Jun 2015 17:46:17 +0100 -Subject: [PATCH 075/105] mach-bcm270x: Enable the building of pinctrl-bcm2835 +Subject: [PATCH 074/131] mach-bcm270x: Enable the building of pinctrl-bcm2835 --- drivers/pinctrl/Makefile | 1 + @@ -134358,10 +133998,10 @@ index 6eadf04..9119513 100644 obj-$(CONFIG_ARCH_BERLIN) += berlin/ obj-y += freescale/ -From cd146348cbf2ff432f0cb3b05b0e0cf117dbba74 Mon Sep 17 00:00:00 2001 +From 436bd2ba164863768b90c2456a943dcfed3b053c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 19 Jun 2015 16:41:39 +0100 -Subject: [PATCH 076/105] BCM270X_DT: Document the i2s-mmap overlay +Subject: [PATCH 075/131] BCM270X_DT: Document the i2s-mmap overlay --- arch/arm/boot/dts/overlays/README | 6 ++++++ @@ -134385,10 +134025,10 @@ index 3e08f98..7fa6d33 100644 Info: Configures the IQaudio DAC audio card Load: dtoverlay=iqaudio-dac -From 88ffec3ff5b4505e53ee2fdcbc564fe734145ae6 Mon Sep 17 00:00:00 2001 +From 175d8f77d2fe5ed0d43d53ece08978fd50c97a97 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 17 Jun 2015 11:36:53 +0100 -Subject: [PATCH 077/105] bcm2835-sdhost: Improve error handling and recovery +Subject: [PATCH 076/131] bcm2835-sdhost: Improve error handling and recovery 1) Expose the hw_reset method to the MMC framework, removing many internal calls by the driver. @@ -135480,10 +135120,10 @@ index eef8a24..6277e43 100644 if (host->allow_dma) { -From afd5ae68ceec9ee73fb979c32ed1fd19ab6a1038 Mon Sep 17 00:00:00 2001 +From 48297e4045a1d8a3b2a0edbe6cf371a34c5eb3be Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 4 Jun 2015 13:11:46 -0700 -Subject: [PATCH 078/105] ARM: bcm2835: Add the Raspberry Pi firmware driver +Subject: [PATCH 077/131] ARM: bcm2835: Add the Raspberry Pi firmware driver This gives us a function for making mailbox property channel requests of the firmware, which is most notable in that it will let us get and @@ -135917,10 +135557,10 @@ index 0000000..9d9efb7 + void *data, size_t tag_size); +struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node); -From c3629eb3fda93e5727602a1484daab7d08da61cb Mon Sep 17 00:00:00 2001 +From 9762ae8cc9ebb55739cb553f3b2c5bc604aec9e4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 22 Mar 2015 13:33:23 +0000 -Subject: [PATCH 079/105] config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING +Subject: [PATCH 078/131] config: Enable ZSMALLOC, ZRAM and PGTABLE_MAPPING --- arch/arm/configs/bcm2709_defconfig | 4 ++++ @@ -135972,10 +135612,10 @@ index 6a41231..cacde14 100644 CONFIG_BLK_DEV_CRYPTOLOOP=m CONFIG_BLK_DEV_DRBD=m -From 667729cc2a536b1cc6241973276fad1e72909f3a Mon Sep 17 00:00:00 2001 +From dd888666ae9c4f80521f3bbe48edb86b423bb6f6 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Mon, 22 Jun 2015 16:27:07 +0100 -Subject: [PATCH 080/105] Add rpi-ft5406 overlay Add rpi-ft5406 driver as +Subject: [PATCH 079/131] Add rpi-ft5406 overlay Add rpi-ft5406 driver as module --- @@ -136062,10 +135702,10 @@ index cacde14..f952ff2 100644 CONFIG_TOUCHSCREEN_STMPE=m CONFIG_INPUT_MISC=y -From b2d8f6a978e70e941859cc4cfacaee8121f71b7c Mon Sep 17 00:00:00 2001 +From afae7dff11e5ee1d5aaf0d00cf26ea3cf24db2d8 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 23 Jun 2015 09:53:40 +0100 -Subject: [PATCH 081/105] Fix driver detection failure Check that the buffer +Subject: [PATCH 080/131] Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected --- @@ -136086,10 +135726,10 @@ index f55151b..d41851d 100644 dev_dbg(&pdev->dev, "Got TS buffer 0x%x\n", request.tag.val); } -From 47e896b8d1e0614ae8dc7a01b037d3d30bd87bf1 Mon Sep 17 00:00:00 2001 +From 9e053b2e623361aa3a3bbfa298e7b8d33adf7abc Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Jun 2015 13:24:01 +0100 -Subject: [PATCH 082/105] config: Enable 8250 serial port +Subject: [PATCH 081/131] config: Enable 8250 serial port --- arch/arm/configs/bcm2709_defconfig | 7 +++++++ @@ -136137,10 +135777,10 @@ index f952ff2..0c25d8b 100644 CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_BCM2835=m -From e6e9f242d287b3fa1008ef3bfdac211906587585 Mon Sep 17 00:00:00 2001 +From 60300e1082cd46b3ae2732854776ee549e217387 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Jun 2015 14:10:58 +0100 -Subject: [PATCH 083/105] config: Enable POWER_RESET_GPIO +Subject: [PATCH 082/131] config: Enable POWER_RESET_GPIO --- arch/arm/configs/bcm2709_defconfig | 2 ++ @@ -136174,10 +135814,10 @@ index 0c25d8b..e757db6 100644 CONFIG_THERMAL=y CONFIG_THERMAL_BCM2835=y -From acfa836e00324826a1aa3dc816d7dc5f4b5d5790 Mon Sep 17 00:00:00 2001 +From 79796a03fa8311ea9030817db27690f24f72214c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 26 Jun 2015 17:37:38 +0100 -Subject: [PATCH 084/105] bcm2708-vcio: Remove restriction of only a single +Subject: [PATCH 083/131] bcm2708-vcio: Remove restriction of only a single instance being open We need more than one process to be able to use mailbox interface (e.g. HW cursor in fbturbo and hello_fft). @@ -136222,10 +135862,10 @@ index d91672b..06fb2c2f 100644 return 0; -From 7f23eccb28dd764cf1af231fdc69bc9f93db4972 Mon Sep 17 00:00:00 2001 +From 6bda1bf0de21592f772c2d65b3e66ddf89d50bdf Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 Jun 2015 08:39:19 +0100 -Subject: [PATCH 085/105] BCM270X_DT: Create a "core" clock, use it for SPI and +Subject: [PATCH 084/131] BCM270X_DT: Create a "core" clock, use it for SPI and sdhost --- @@ -136376,10 +136016,10 @@ index b408ab4..897204a 100644 }; }; -From f64348123913a79fd145c5208039c8f66c0c4252 Mon Sep 17 00:00:00 2001 +From d4a0abb7a644365a9f21204a5e3f530a8112d5e8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 09:24:31 +0100 -Subject: [PATCH 086/105] BCM270X_DT: Add MCP7941X to i2c-rtc overlay +Subject: [PATCH 085/131] BCM270X_DT: Add MCP7941X to i2c-rtc overlay --- arch/arm/boot/dts/overlays/README | 3 +++ @@ -136432,10 +136072,10 @@ index 6bccfdc..7052c71 100644 pcf8523 = <&pcf8523>,"status"; pcf8563 = <&pcf8563>,"status"; -From 57fd1fbaa2d9281f2b9d70c8d15dbaa201af2b71 Mon Sep 17 00:00:00 2001 +From 54695dcb27d8e4c37e8dd9620e85257b8abb89d8 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 24 Jun 2015 11:23:06 +0100 -Subject: [PATCH 087/105] dts/overlays: document DHT11 overlay +Subject: [PATCH 086/131] dts/overlays: document DHT11 overlay --- arch/arm/boot/dts/overlays/README | 8 ++++++++ @@ -136461,10 +136101,10 @@ index 425eb19..9406cf3 100644 -From e072d9e5801bb111be321dff6feadd5c12e8d2ad Mon Sep 17 00:00:00 2001 +From 842fe412d512dabb76d169395086b6337150015a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 088/105] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 087/131] 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 @@ -136579,10 +136219,10 @@ index e5332f1..6e3fec2 100644 "%s: pm_power_off function already registered", __func__); -From 45567cec8e8dc1be2d45fead5332258d3a49a088 Mon Sep 17 00:00:00 2001 +From 311119b99b34e88df249d706c69bdcffcd8dafb5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 17 Jun 2015 17:10:40 +0100 -Subject: [PATCH 089/105] BCM270x_DT: Default Compute Module i2c, i2s and spi +Subject: [PATCH 088/131] BCM270x_DT: Default Compute Module i2c, i2s and spi support --- @@ -136672,10 +136312,10 @@ index e82fcb2..af252bd 100755 }; }; -From 2c610cb4fa176ac54d4e32a4744761aa9c600f3c Mon Sep 17 00:00:00 2001 +From bd6dabc8c7f6cdaba821ff3246034cd704f6364d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 Jun 2015 14:21:55 +0100 -Subject: [PATCH 090/105] BCM270X_DT: Sort nodes by bus address, and +Subject: [PATCH 089/131] BCM270X_DT: Sort nodes by bus address, and consolidate aliases --- @@ -136917,10 +136557,10 @@ index 24fa849..ccb9c31 100644 &gpio { -From dab507d5936f3847a320b11be5a21b4c25c4601b Mon Sep 17 00:00:00 2001 +From f40ed032e6f0892778bac7d33d45593c0483628b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 Jun 2015 14:23:03 +0100 -Subject: [PATCH 091/105] i2c-bcm2708/BCM270X_DT: Add support for I2C2 +Subject: [PATCH 090/131] i2c-bcm2708/BCM270X_DT: Add support for I2C2 The third I2C bus (I2C2) is normally reserved for HDMI use. Careless use of this bus can break an attached display - use with caution. @@ -137093,10 +136733,10 @@ index 8773203..7a24fbe 100644 goto out_free_bi; } -From c887101553aed347b4e0e29422cd5a7315cce18a Mon Sep 17 00:00:00 2001 +From 9451939c7a95b4f81886a2bf89f953be1833189d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 29 Jun 2015 12:14:02 +0100 -Subject: [PATCH 092/105] BCM270X_DT: Correct the lirc-rpi overlay +Subject: [PATCH 091/131] BCM270X_DT: Correct the lirc-rpi overlay documentation The polarity of the "sense" parameter was inverted with respect to reality. @@ -137122,10 +136762,10 @@ index 0ed7094..ec762d2 100644 (default "-1") -From b55c8ef4eab8f62f3087bcdf4eb9a603105d16fb Mon Sep 17 00:00:00 2001 +From d645d31525be338b1baa22916217f3ac0c3705f9 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 08:47:09 +0100 -Subject: [PATCH 093/105] bcm2835-sdhost: Further improve overclock back-off +Subject: [PATCH 092/131] bcm2835-sdhost: Further improve overclock back-off --- drivers/mmc/host/bcm2835-sdhost.c | 144 +++++++++++++++++++++----------------- @@ -137417,10 +137057,10 @@ index 6277e43..a03db06 100644 iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); -From 3d5ba5c480137b87aaee59c14f8e486e747cd450 Mon Sep 17 00:00:00 2001 +From 11667799f99dca096d4d92e63b7823db2a8f8779 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 10:28:59 +0100 -Subject: [PATCH 094/105] i2c-bcm2708: Increase timeouts to allow larger +Subject: [PATCH 093/131] i2c-bcm2708: Increase timeouts to allow larger transfers Use the timeout value provided by the I2C_TIMEOUT ioctl when waiting @@ -137458,10 +137098,10 @@ index 7a24fbe..8b8762d 100644 dev_err(&adap->dev, "transfer timed out\n"); goto error_timeout; -From 31a5408b0734bc64969ab91be9cb3c1d898d655a Mon Sep 17 00:00:00 2001 +From 04f7264e602d7148822f3a162176190fcc41f71a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 10:33:52 +0100 -Subject: [PATCH 095/105] spi-bcm2708: Increase timeout from 150ms to 1s +Subject: [PATCH 094/131] spi-bcm2708: Increase timeout from 150ms to 1s See: https://github.com/raspberrypi/linux/issues/260 --- @@ -137485,10 +137125,10 @@ index 041b5e2..5c0214e 100644 struct bcm2708_spi { spinlock_t lock; -From c66c0c2993daff0c44d7daae71421b1404f92233 Mon Sep 17 00:00:00 2001 +From 2e6c5de15687dadf4c24d880d0cdcb6763aacda5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 15 Jun 2015 09:59:38 +0100 -Subject: [PATCH 096/105] bcm2708-spi: Don't use static pin configuration with +Subject: [PATCH 095/131] bcm2708-spi: Don't use static pin configuration with DT Also remove superfluous error checking - the SPI framework ensures the @@ -137527,10 +137167,10 @@ index 5c0214e..781c747 100644 master = spi_alloc_master(&pdev->dev, sizeof(*bs)); if (!master) { -From fb8c469783f4521176bebb9de94b6b456b4c35bb Mon Sep 17 00:00:00 2001 +From 699c056af380b45856086c0b33a65acc3d2ad3d8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 15 Jun 2015 10:10:59 +0100 -Subject: [PATCH 097/105] bcm2708-i2s: Don't use static pin configuration with +Subject: [PATCH 096/131] bcm2708-i2s: Don't use static pin configuration with DT --- @@ -137553,10 +137193,10 @@ index a515992..5e93cd6 100644 /* * Adjust the data length according to the format. -From 68df7b46c42bd73c44ae405adbd12be35e308a2b Mon Sep 17 00:00:00 2001 +From 6b8e6f74b78fcc225c873ea1b07890352dd77ee5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 098/105] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 097/131] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ @@ -137576,10 +137216,10 @@ index 4506e40..f03a19a 100644 for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From 3ceec0b963f3001adaa523d65508cc54a6f93cd0 Mon Sep 17 00:00:00 2001 +From 5131bc710dd79b98d12c08b2f22477f48fdbd0d3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 Jun 2015 08:50:11 +0100 -Subject: [PATCH 099/105] BCM270X_DT: Add overlay to enable uart1 +Subject: [PATCH 098/131] BCM270X_DT: Add overlay to enable uart1 N.B. The UART1 clock is derived from the core clock. The firmware will update clock-frequency if core_freq is set, but be aware @@ -137748,10 +137388,10 @@ index e757db6..363c894 100644 CONFIG_SERIAL_AMBA_PL011_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y -From 0365608651a901ee0b84351ed8ec9b7f0cdfd986 Mon Sep 17 00:00:00 2001 +From 72d2ba8d7fa2d47c53ed1425501c2dac2aa909b0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 100/105] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 099/131] 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 @@ -137832,10 +137472,10 @@ index 37875cf..55e81c2 100644 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -From 1674fcd926873998471f71ad88306d47bc99862b Mon Sep 17 00:00:00 2001 +From 4bf9c275c9733d1fcf41f6ee70b40e321b39eac1 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 17:37:38 +0100 -Subject: [PATCH 101/105] BCM270X_DT: Change pio_limit of sdhost driver to 1 +Subject: [PATCH 100/131] BCM270X_DT: Change pio_limit of sdhost driver to 1 --- arch/arm/boot/dts/overlays/sdhost-overlay.dts | 2 +- @@ -137855,10 +137495,10 @@ index 897204a..2da14a4 100644 }; }; -From f72606ab1e40707a3dc9243e0d0b87b98654e02b Mon Sep 17 00:00:00 2001 +From 0ca1e1d7ffdfcf1e716205491a00bf025fb71a77 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Jul 2015 12:51:52 +0100 -Subject: [PATCH 102/105] bcm2835-sdhost: Clear HBLC for PIO mode +Subject: [PATCH 101/131] bcm2835-sdhost: Clear HBLC for PIO mode Also update pio_limit default in overlay README. --- @@ -137894,10 +137534,10 @@ index a03db06..d65870a 100644 BUG_ON(!host->data); } -From 93e9bd0c71d224db35cc8019a1ebc16bf77f0fa2 Mon Sep 17 00:00:00 2001 +From f158c5aa486712cfad1c405eb849d65272b2cbc3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 3 Jul 2015 12:21:01 +0100 -Subject: [PATCH 103/105] BCM270X_DT: I2S needs function Alt2 +Subject: [PATCH 102/131] BCM270X_DT: I2S needs function Alt2 --- arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 +- @@ -137959,10 +137599,10 @@ index f25f0a2..62d1c62 100644 }; -From 5edaac580d81f7edd48afd1e8c296cdedd94cc7a Mon Sep 17 00:00:00 2001 +From 704b53d89697a2542dfa6d23224f49c0d5350abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:16:15 +0200 -Subject: [PATCH 104/105] configs: Incorporate v4.1 dependency changes +Subject: [PATCH 103/131] configs: Incorporate v4.1 dependency changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -138125,10 +137765,10 @@ index 363c894..80f84d7 100644 CONFIG_CRC_ITU_T=y CONFIG_LIBCRC32C=y -From 18f4efa3ad700a4caf72f45ff95d7acfb40f3255 Mon Sep 17 00:00:00 2001 +From d47845877b27576daac3c55bdb742a43209baaed Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 3 Jul 2015 15:47:33 +0100 -Subject: [PATCH 105/105] bcmrpi_defconfigs: Add SND_SOC_WM8804_I2C (for +Subject: [PATCH 104/131] bcmrpi_defconfigs: Add SND_SOC_WM8804_I2C (for HifiBerry Digi) 4.1 has split out support for the I2C and SPI variants, so it now @@ -138162,3 +137802,3831 @@ index 80f84d7..14b91fdf 100644 CONFIG_SND_SIMPLE_CARD=m CONFIG_SOUND_PRIME=m CONFIG_HIDRAW=y + +From a984b5d876c74984fad16d90507b95a50db22fba Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Sat, 4 Jul 2015 19:55:23 +0100 +Subject: [PATCH 105/131] squash: BCM270X_DT: I2S only needs Alt2 on 28-31 + +See: https://github.com/raspberrypi/linux/issues/1046 +--- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 2 +- + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 2 +- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 562eb08..3ad2e0d 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -25,7 +25,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 5e3db01..96d8b97 100755 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -28,7 +28,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 62d1c62..f25f0a2 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -25,7 +25,7 @@ + + i2s_pins: i2s { + brcm,pins = <18 19 20 21>; +- brcm,function = <6>; /* alt2 */ ++ brcm,function = <4>; /* alt0 */ + }; + }; + + +From edb21286ac7e246dfe7c9ee05101880f719e00e8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 8 Jul 2015 14:48:57 +0100 +Subject: [PATCH 106/131] vchiq_arm: Two cacheing fixes + +1) Make fragment size vary with cache line size +Without this patch, non-cache-line-aligned transfers may corrupt +(or be corrupted by) adjacent data structures. + +Both ARM and VC need to be updated to enable this feature. This is +ensured by having the loader apply a new DT parameter - +cache-line-size. The existence of this parameter guarantees that the +kernel is capable, and the parameter will only be modified from the +safe default if the loader is capable. + +2) Flush/invalidate vmalloc'd memory, and invalidate after reads +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 5 + + .../interface/vchiq_arm/vchiq_2835_arm.c | 112 +++++++++++++-------- + 2 files changed, 77 insertions(+), 40 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 8181a4e..abf3e5d 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -218,6 +218,7 @@ + compatible = "brcm,bcm2835-vchiq"; + reg = <0x7e00b840 0xf>; + interrupts = <0 2>; ++ cache-line-size = <32>; + }; + + thermal: thermal { +@@ -270,4 +271,8 @@ + clock-frequency = <126000000>; + }; + }; ++ ++ __overrides__ { ++ cache_line_size = <&vchiq>, "cache-line-size:0"; ++ }; + }; +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index c739083..5edba23 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + #include + + #define TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) +@@ -64,8 +65,10 @@ typedef struct vchiq_2835_state_struct { + } VCHIQ_2835_ARM_STATE_T; + + static void __iomem *g_regs; +-static FRAGMENTS_T *g_fragments_base; +-static FRAGMENTS_T *g_free_fragments; ++static unsigned int g_cache_line_size = sizeof(CACHE_LINE_SIZE); ++static unsigned int g_fragments_size; ++static char *g_fragments_base; ++static char *g_free_fragments; + static struct semaphore g_free_fragments_sema; + static unsigned long g_virt_to_bus_offset; + +@@ -95,9 +98,13 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + + g_virt_to_bus_offset = virt_to_dma(dev, (void *)0); + ++ (void)of_property_read_u32(dev->of_node, "cache-line-size", ++ &g_cache_line_size); ++ g_fragments_size = 2 * g_cache_line_size; ++ + /* Allocate space for the channels in coherent memory */ + slot_mem_size = PAGE_ALIGN(TOTAL_SLOTS * VCHIQ_SLOT_SIZE); +- frag_mem_size = PAGE_ALIGN(sizeof(FRAGMENTS_T) * MAX_FRAGMENTS); ++ frag_mem_size = PAGE_ALIGN(g_fragments_size * MAX_FRAGMENTS); + + slot_mem = dmam_alloc_coherent(dev, slot_mem_size + frag_mem_size, + &slot_phys, GFP_KERNEL); +@@ -117,15 +124,15 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) + vchiq_slot_zero->platform_data[VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX] = + MAX_FRAGMENTS; + +- g_fragments_base = (FRAGMENTS_T *)(slot_mem + slot_mem_size); ++ g_fragments_base = (char *)slot_mem + slot_mem_size; + slot_mem_size += frag_mem_size; + + g_free_fragments = g_fragments_base; + for (i = 0; i < (MAX_FRAGMENTS - 1); i++) { +- *(FRAGMENTS_T **)&g_fragments_base[i] = +- &g_fragments_base[i + 1]; ++ *(char **)&g_fragments_base[i*g_fragments_size] = ++ &g_fragments_base[(i + 1)*g_fragments_size]; + } +- *(FRAGMENTS_T **)&g_fragments_base[i] = NULL; ++ *(char **)&g_fragments_base[i * g_fragments_size] = NULL; + sema_init(&g_free_fragments_sema, MAX_FRAGMENTS); + + if (vchiq_init_state(state, vchiq_slot_zero, 0) != VCHIQ_SUCCESS) +@@ -344,7 +351,7 @@ vchiq_doorbell_irq(int irq, void *dev_id) + ** cached area. + + ** N.B. This implementation plays slightly fast and loose with the Linux +-** driver programming rules, e.g. its use of __virt_to_bus instead of ++** driver programming rules, e.g. its use of dmac_map_area instead of + ** dma_map_single, but it isn't a multi-platform driver and it benefits + ** from increased speed as a result. + */ +@@ -355,7 +362,6 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + { + PAGELIST_T *pagelist; + struct page **pages; +- struct page *page; + unsigned long *addrs; + unsigned int num_pages, offset, i; + char *addr, *base_addr, *next_addr; +@@ -386,10 +392,25 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + pages = (struct page **)(addrs + num_pages + 1); + + if (is_vmalloc_addr(buf)) { +- for (actual_pages = 0; actual_pages < num_pages; actual_pages++) { +- pages[actual_pages] = vmalloc_to_page(buf + (actual_pages * PAGE_SIZE)); ++ int dir = (type == PAGELIST_WRITE) ? ++ DMA_TO_DEVICE : DMA_FROM_DEVICE; ++ unsigned long length = pagelist->length; ++ unsigned int offset = pagelist->offset; ++ ++ for (actual_pages = 0; actual_pages < num_pages; ++ actual_pages++) { ++ struct page *pg = vmalloc_to_page(buf + (actual_pages * ++ PAGE_SIZE)); ++ size_t bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ pages[actual_pages] = pg; ++ dmac_map_area(page_address(pg) + offset, bytes, dir); ++ length -= bytes; ++ offset = 0; + } +- *need_release = 0; /* do not try and release vmalloc pages */ ++ *need_release = 0; /* do not try and release vmalloc pages */ + } else { + down_read(&task->mm->mmap_sem); + actual_pages = get_user_pages(task, task->mm, +@@ -418,7 +439,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + actual_pages = -ENOMEM; + return actual_pages; + } +- *need_release = 1; /* release user pages */ ++ *need_release = 1; /* release user pages */ + } + + pagelist->length = count; +@@ -451,10 +472,10 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + + /* Partial cache lines (fragments) require special measures */ + if ((type == PAGELIST_READ) && +- ((pagelist->offset & (CACHE_LINE_SIZE - 1)) || ++ ((pagelist->offset & (g_cache_line_size - 1)) || + ((pagelist->offset + pagelist->length) & +- (CACHE_LINE_SIZE - 1)))) { +- FRAGMENTS_T *fragments; ++ (g_cache_line_size - 1)))) { ++ char *fragments; + + if (down_interruptible(&g_free_fragments_sema) != 0) { + kfree(pagelist); +@@ -464,19 +485,15 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + WARN_ON(g_free_fragments == NULL); + + down(&g_free_fragments_mutex); +- fragments = (FRAGMENTS_T *) g_free_fragments; ++ fragments = g_free_fragments; + WARN_ON(fragments == NULL); +- g_free_fragments = *(FRAGMENTS_T **) g_free_fragments; ++ g_free_fragments = *(char **) g_free_fragments; + up(&g_free_fragments_mutex); +- pagelist->type = +- PAGELIST_READ_WITH_FRAGMENTS + (fragments - +- g_fragments_base); ++ pagelist->type = PAGELIST_READ_WITH_FRAGMENTS + ++ (fragments - g_fragments_base) / g_fragments_size; + } + +- for (page = virt_to_page(pagelist); +- page <= virt_to_page(addrs + num_pages - 1); page++) { +- flush_dcache_page(page); +- } ++ dmac_flush_range(pagelist, addrs + num_pages); + + *ppagelist = pagelist; + +@@ -502,13 +519,14 @@ free_pagelist(PAGELIST_T *pagelist, int actual) + + /* Deal with any partial cache lines (fragments) */ + if (pagelist->type >= PAGELIST_READ_WITH_FRAGMENTS) { +- FRAGMENTS_T *fragments = g_fragments_base + +- (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS); ++ char *fragments = g_fragments_base + ++ (pagelist->type - PAGELIST_READ_WITH_FRAGMENTS) * ++ g_fragments_size; + int head_bytes, tail_bytes; +- head_bytes = (CACHE_LINE_SIZE - pagelist->offset) & +- (CACHE_LINE_SIZE - 1); ++ head_bytes = (g_cache_line_size - pagelist->offset) & ++ (g_cache_line_size - 1); + tail_bytes = (pagelist->offset + actual) & +- (CACHE_LINE_SIZE - 1); ++ (g_cache_line_size - 1); + + if ((actual >= 0) && (head_bytes != 0)) { + if (head_bytes > actual) +@@ -516,32 +534,46 @@ free_pagelist(PAGELIST_T *pagelist, int actual) + + memcpy((char *)page_address(pages[0]) + + pagelist->offset, +- fragments->headbuf, ++ fragments, + head_bytes); + } + if ((actual >= 0) && (head_bytes < actual) && + (tail_bytes != 0)) { + memcpy((char *)page_address(pages[num_pages - 1]) + + ((pagelist->offset + actual) & +- (PAGE_SIZE - 1) & ~(CACHE_LINE_SIZE - 1)), +- fragments->tailbuf, tail_bytes); ++ (PAGE_SIZE - 1) & ~(g_cache_line_size - 1)), ++ fragments + g_cache_line_size, ++ tail_bytes); + } + + down(&g_free_fragments_mutex); +- *(FRAGMENTS_T **) fragments = g_free_fragments; ++ *(char **)fragments = g_free_fragments; + g_free_fragments = fragments; + up(&g_free_fragments_mutex); + up(&g_free_fragments_sema); + } + +- if (*need_release) { +- for (i = 0; i < num_pages; i++) { +- if (pagelist->type != PAGELIST_WRITE) +- set_page_dirty(pages[i]); ++ if (*need_release) { ++ unsigned int length = pagelist->length; ++ unsigned int offset = pagelist->offset; + +- page_cache_release(pages[i]); ++ for (i = 0; i < num_pages; i++) { ++ struct page *pg = pages[i]; ++ ++ if (pagelist->type != PAGELIST_WRITE) { ++ unsigned int bytes = PAGE_SIZE - offset; ++ ++ if (bytes > length) ++ bytes = length; ++ dmac_unmap_area(page_address(pg) + offset, ++ bytes, DMA_FROM_DEVICE); ++ length -= bytes; ++ offset = 0; ++ set_page_dirty(pg); ++ } ++ page_cache_release(pg); + } +- } ++ } + + kfree(pagelist); + } + +From 265838d467aedd75abf2949373d889cfec090168 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 30 Jun 2015 09:10:36 +0100 +Subject: [PATCH 107/131] BCM270X_DT: Overlay for the Fen Logic VGA666 board + +The VGA666 board requires GPIOs 2-21 (so no I2C or UART). Using the +overlay (instead of a custom dt-blob.bin) has the advantage that it will +reserve those pins and stop other devices using them (except for GPIO), +but it does delay the point at which the output becomes valid until 2-3 +seconds after the kernel has started. +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 8 +++++++ + arch/arm/boot/dts/overlays/vga666-overlay.dts | 30 +++++++++++++++++++++++++++ + 3 files changed, 39 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/vga666-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index e91548c..74ec825 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -43,6 +43,7 @@ dtb-$(RPI_DT_OVERLAYS) += spi-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += tinylcd35-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += uart1-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += vga666-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += w1-gpio-pullup-overlay.dtb + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 980d358..5e1f530 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -497,6 +497,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) + + ++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 ++ after the kernel has started. ++Load: dtoverlay=vga666 ++Params: ++ ++ + 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. +diff --git a/arch/arm/boot/dts/overlays/vga666-overlay.dts b/arch/arm/boot/dts/overlays/vga666-overlay.dts +new file mode 100644 +index 0000000..7fcab96 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/vga666-overlay.dts +@@ -0,0 +1,30 @@ ++/dts-v1/; ++/plugin/; ++ ++/{ ++ compatible = "brcm,bcm2708"; ++ ++ // There is no VGA driver module, but we need a platform device ++ // node (that doesn't already use pinctrl) to hang the pinctrl ++ // reference on - leds will do ++ ++ fragment@0 { ++ target = <&leds>; ++ __overlay__ { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&vga666_pins>; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ vga666_pins: vga666_pins { ++ brcm,pins = <2 3 4 5 6 7 8 9 10 11 12 ++ 13 14 15 16 17 18 19 20 21>; ++ brcm,function = <6>; /* alt2 */ ++ brcm,pull = <0>; /* no pull */ ++ }; ++ }; ++ }; ++}; + +From 5c8148df6f5147fcaa9fe81425b58a3e7a64cdba Mon Sep 17 00:00:00 2001 +From: petit-miner +Date: Fri, 10 Jul 2015 13:59:18 +0200 +Subject: [PATCH 108/131] Added support for 2 mcp2515 CAN Bus IC + +See: https://github.com/raspberrypi/linux/issues/1018 + https://github.com/raspberrypi/linux/pull/1049 + https://github.com/raspberrypi/linux/pull/1052 +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 12 +++- + .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 69 ++++++++++++++++++++++ + 3 files changed, 81 insertions(+), 1 deletion(-) + create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 74ec825..4ff9836 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -29,6 +29,7 @@ dtb-$(RPI_DT_OVERLAYS) += iqaudio-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += iqaudio-dacplus-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += lirc-rpi-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mcp2515-can0-overlay.dtb ++dtb-$(RPI_DT_OVERLAYS) += mcp2515-can1-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mmc-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += mz61581-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += piscreen-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 5e1f530..88ed678 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -328,7 +328,7 @@ Params: gpio_out_pin GPIO for output (default "17") + + + Name: mcp2515-can0 +-Info: Configures the MCP2515 CAN controller ++Info: Configures the MCP2515 CAN controller on spi0.0 + Load: dtoverlay=mcp2515-can0,= + Params: oscillator Clock frequency for the CAN controller (Hz) + +@@ -337,6 +337,16 @@ Params: oscillator Clock frequency for the CAN controller (Hz) + 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) ++ ++ spimaxfrequency Maximum SPI frequence (Hz) ++ ++ interrupt GPIO for interrupt signal ++ ++ + Name: mmc + Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock + Load: dtoverlay=mmc,= +diff --git a/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +new file mode 100644 +index 0000000..6bef9ae +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts +@@ -0,0 +1,69 @@ ++/* ++ * Device tree overlay for mcp251x/can1 on spi0.1 edited by petit_miner ++ */ ++ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835", "brcm,bcm2836", "brcm,bcm2708", "brcm,bcm2709"; ++ /* disable spi-dev for spi0.1 */ ++ fragment@0 { ++ target = <&spi0>; ++ __overlay__ { ++ status = "okay"; ++ spidev@1{ ++ status = "disabled"; ++ }; ++ }; ++ }; ++ ++ /* the interrupt pin of the can-controller */ ++ fragment@1 { ++ target = <&gpio>; ++ __overlay__ { ++ can1_pins: can1_pins { ++ brcm,pins = <25>; ++ brcm,function = <0>; /* input */ ++ }; ++ }; ++ }; ++ ++ /* the clock/oscillator of the can-controller */ ++ fragment@2 { ++ target-path = "/clocks"; ++ __overlay__ { ++ /* external oscillator of mcp2515 on spi0.1 */ ++ can1_osc: can1_osc { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <16000000>; ++ }; ++ }; ++ }; ++ ++ /* the spi config of the can-controller itself binding everything together */ ++ fragment@3 { ++ target = <&spi0>; ++ __overlay__ { ++ /* needed to avoid dtc warning */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ can1: mcp2515@1 { ++ reg = <1>; ++ compatible = "microchip,mcp2515"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&can1_pins>; ++ spi-max-frequency = <10000000>; ++ interrupt-parent = <&gpio>; ++ interrupts = <25 0x2>; ++ clocks = <&can1_osc>; ++ }; ++ }; ++ }; ++ __overrides__ { ++ oscillator = <&can1_osc>,"clock-frequency:0"; ++ spimaxfrequency = <&can1>,"spi-max-frequency:0"; ++ interrupt = <&can1_pins>,"brcm,pins:0",<&can1>,"interrupts:0"; ++ }; ++}; + +From a097ef23c580bdcad619cca1deabd71eb6237984 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Tue, 5 May 2015 13:27:45 -0700 +Subject: [PATCH 109/131] mailbox: Enable BCM2835 mailbox support + +This mailbox driver provides a single mailbox channel to write 32-bit +values to the VPU and get a 32-bit response. The Raspberry Pi +firmware uses this mailbox channel to implement firmware calls, while +Roku 2 (despite being derived from the same firmware tree) doesn't. + +The driver was originally submitted by Lubomir, based on the +out-of-tree 2708 mailbox driver. Eric Anholt fixed it up for +upstreaming, with the major functional change being that it now has no +notion of multiple channels (since that is a firmware-dependent +concept) and instead the raspberrypi-firmware driver will do that +bit-twiddling in its own messages. +[Jassi: made the 'mbox_chan_ops' struct as const and removed a redundant +variable] + +Signed-off-by: Lubomir Rintel +Signed-off-by: Craig McGeachie +Signed-off-by: Eric Anholt +Acked-by: Stephen Warren +Signed-off-by: Jassi Brar +--- + drivers/mailbox/Kconfig | 9 ++ + drivers/mailbox/Makefile | 2 + + drivers/mailbox/bcm2835-mailbox.c | 216 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 227 insertions(+) + create mode 100644 drivers/mailbox/bcm2835-mailbox.c + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 7f19cb4..dc64c93 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -66,4 +66,13 @@ config ALTERA_MBOX + An implementation of the Altera Mailbox soft core. It is used + to send message between processors. Say Y here if you want to use the + Altera mailbox support. ++ ++config BCM2835_MBOX ++ tristate "BCM2835 Mailbox" ++ depends on ARCH_BCM2835 ++ help ++ An implementation of the BCM2385 Mailbox. It is used to invoke ++ the services of the Videocore. Say Y here if you want to use the ++ BCM2835 Mailbox. ++ + endif +diff --git a/drivers/mailbox/Makefile b/drivers/mailbox/Makefile +index cecfad3..c86bc91 100644 +--- a/drivers/mailbox/Makefile ++++ b/drivers/mailbox/Makefile +@@ -13,3 +13,5 @@ obj-$(CONFIG_OMAP2PLUS_MBOX) += omap-mailbox.o + obj-$(CONFIG_PCC) += pcc.o + + obj-$(CONFIG_ALTERA_MBOX) += mailbox-altera.o ++ ++obj-$(CONFIG_BCM2835_MBOX) += bcm2835-mailbox.o +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +new file mode 100644 +index 0000000..4b13268 +--- /dev/null ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -0,0 +1,216 @@ ++/* ++ * Copyright (C) 2010,2015 Broadcom ++ * Copyright (C) 2013-2014 Lubomir Rintel ++ * Copyright (C) 2013 Craig McGeachie ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This device provides a mechanism for writing to the mailboxes, ++ * that are shared between the ARM and the VideoCore processor ++ * ++ * Parts of the driver are based on: ++ * - arch/arm/mach-bcm2708/vcio.c file written by Gray Girling that was ++ * obtained from branch "rpi-3.6.y" of git://github.com/raspberrypi/ ++ * linux.git ++ * - drivers/mailbox/bcm2835-ipc.c by Lubomir Rintel at ++ * https://github.com/hackerspace/rpi-linux/blob/lr-raspberry-pi/drivers/ ++ * mailbox/bcm2835-ipc.c ++ * - documentation available on the following web site: ++ * https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/* Mailboxes */ ++#define ARM_0_MAIL0 0x00 ++#define ARM_0_MAIL1 0x20 ++ ++/* ++ * Mailbox registers. We basically only support mailbox 0 & 1. We ++ * deliver to the VC in mailbox 1, it delivers to us in mailbox 0. See ++ * BCM2835-ARM-Peripherals.pdf section 1.3 for an explanation about ++ * the placement of memory barriers. ++ */ ++#define MAIL0_RD (ARM_0_MAIL0 + 0x00) ++#define MAIL0_POL (ARM_0_MAIL0 + 0x10) ++#define MAIL0_STA (ARM_0_MAIL0 + 0x18) ++#define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) ++#define MAIL1_WRT (ARM_0_MAIL1 + 0x00) ++ ++/* Status register: FIFO state. */ ++#define ARM_MS_FULL BIT(31) ++#define ARM_MS_EMPTY BIT(30) ++ ++/* Configuration register: Enable interrupts. */ ++#define ARM_MC_IHAVEDATAIRQEN BIT(0) ++ ++struct bcm2835_mbox { ++ void __iomem *regs; ++ spinlock_t lock; ++ struct mbox_controller controller; ++}; ++ ++static struct bcm2835_mbox *bcm2835_link_mbox(struct mbox_chan *link) ++{ ++ return container_of(link->mbox, struct bcm2835_mbox, controller); ++} ++ ++static irqreturn_t bcm2835_mbox_irq(int irq, void *dev_id) ++{ ++ struct bcm2835_mbox *mbox = dev_id; ++ struct device *dev = mbox->controller.dev; ++ struct mbox_chan *link = &mbox->controller.chans[0]; ++ ++ while (!(readl(mbox->regs + MAIL0_STA) & ARM_MS_EMPTY)) { ++ u32 msg = readl(mbox->regs + MAIL0_RD); ++ dev_dbg(dev, "Reply 0x%08X\n", msg); ++ mbox_chan_received_data(link, &msg); ++ } ++ return IRQ_HANDLED; ++} ++ ++static int bcm2835_send_data(struct mbox_chan *link, void *data) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ u32 msg = *(u32 *)data; ++ ++ spin_lock(&mbox->lock); ++ writel(msg, mbox->regs + MAIL1_WRT); ++ dev_dbg(mbox->controller.dev, "Request 0x%08X\n", msg); ++ spin_unlock(&mbox->lock); ++ return 0; ++} ++ ++static int bcm2835_startup(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ ++ /* Enable the interrupt on data reception */ ++ writel(ARM_MC_IHAVEDATAIRQEN, mbox->regs + MAIL0_CNF); ++ ++ return 0; ++} ++ ++static void bcm2835_shutdown(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ ++ writel(0, mbox->regs + MAIL0_CNF); ++} ++ ++static bool bcm2835_last_tx_done(struct mbox_chan *link) ++{ ++ struct bcm2835_mbox *mbox = bcm2835_link_mbox(link); ++ bool ret; ++ ++ spin_lock(&mbox->lock); ++ ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); ++ spin_unlock(&mbox->lock); ++ return ret; ++} ++ ++static const struct mbox_chan_ops bcm2835_mbox_chan_ops = { ++ .send_data = bcm2835_send_data, ++ .startup = bcm2835_startup, ++ .shutdown = bcm2835_shutdown, ++ .last_tx_done = bcm2835_last_tx_done ++}; ++ ++static struct mbox_chan *bcm2835_mbox_index_xlate(struct mbox_controller *mbox, ++ const struct of_phandle_args *sp) ++{ ++ if (sp->args_count != 0) ++ return NULL; ++ ++ return &mbox->chans[0]; ++} ++ ++static int bcm2835_mbox_probe(struct platform_device *pdev) ++{ ++ struct device *dev = &pdev->dev; ++ int ret = 0; ++ struct resource *iomem; ++ struct bcm2835_mbox *mbox; ++ ++ mbox = devm_kzalloc(dev, sizeof(*mbox), GFP_KERNEL); ++ if (mbox == NULL) ++ return -ENOMEM; ++ spin_lock_init(&mbox->lock); ++ ++ ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ bcm2835_mbox_irq, 0, dev_name(dev), mbox); ++ if (ret) { ++ dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", ++ ret); ++ return -ENODEV; ++ } ++ ++ iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); ++ mbox->regs = devm_ioremap_resource(&pdev->dev, iomem); ++ if (IS_ERR(mbox->regs)) { ++ ret = PTR_ERR(mbox->regs); ++ dev_err(&pdev->dev, "Failed to remap mailbox regs: %d\n", ret); ++ return ret; ++ } ++ ++ mbox->controller.txdone_poll = true; ++ mbox->controller.txpoll_period = 5; ++ mbox->controller.ops = &bcm2835_mbox_chan_ops; ++ mbox->controller.of_xlate = &bcm2835_mbox_index_xlate; ++ mbox->controller.dev = dev; ++ mbox->controller.num_chans = 1; ++ mbox->controller.chans = devm_kzalloc(dev, ++ sizeof(*mbox->controller.chans), GFP_KERNEL); ++ if (!mbox->controller.chans) ++ return -ENOMEM; ++ ++ ret = mbox_controller_register(&mbox->controller); ++ if (ret) ++ return ret; ++ ++ platform_set_drvdata(pdev, mbox); ++ dev_info(dev, "mailbox enabled\n"); ++ ++ return ret; ++} ++ ++static int bcm2835_mbox_remove(struct platform_device *pdev) ++{ ++ struct bcm2835_mbox *mbox = platform_get_drvdata(pdev); ++ mbox_controller_unregister(&mbox->controller); ++ return 0; ++} ++ ++static const struct of_device_id bcm2835_mbox_of_match[] = { ++ { .compatible = "brcm,bcm2835-mbox", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, bcm2835_mbox_of_match); ++ ++static struct platform_driver bcm2835_mbox_driver = { ++ .driver = { ++ .name = "bcm2835-mbox", ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_mbox_of_match, ++ }, ++ .probe = bcm2835_mbox_probe, ++ .remove = bcm2835_mbox_remove, ++}; ++module_platform_driver(bcm2835_mbox_driver); ++ ++MODULE_AUTHOR("Lubomir Rintel "); ++MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); ++MODULE_LICENSE("GPL v2"); + +From aa1ca835a9a179168f9d8355a458bd0eecda3912 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Wed, 13 May 2015 13:10:32 -0700 +Subject: [PATCH 110/131] mailbox/bcm2835: Fix mailbox full detection. + +With the VC reader blocked and the ARM writing, MAIL0_STA reads empty +permanently while MAIL1_STA goes from empty (0x40000000) to non-empty +(0x00000001-0x00000007) to full (0x80000008). + +This bug ended up having no effect on us, because all of our +transactions in the client driver were synchronous and under a mutex. + +Suggested-by: Phil Elwell +Signed-off-by: Eric Anholt +Acked-by: Stephen Warren +Signed-off-by: Jassi Brar +--- + drivers/mailbox/bcm2835-mailbox.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index 4b13268..0b47dd4 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -49,6 +49,7 @@ + #define MAIL0_STA (ARM_0_MAIL0 + 0x18) + #define MAIL0_CNF (ARM_0_MAIL0 + 0x1C) + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) ++#define MAIL1_STA (ARM_0_MAIL1 + 0x18) + + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) +@@ -117,7 +118,7 @@ static bool bcm2835_last_tx_done(struct mbox_chan *link) + bool ret; + + spin_lock(&mbox->lock); +- ret = !(readl(mbox->regs + MAIL0_STA) & ARM_MS_FULL); ++ ret = !(readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL); + spin_unlock(&mbox->lock); + return ret; + } + +From 36301913195582a2398add6d60477be534d4f603 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:19:30 +0200 +Subject: [PATCH 111/131] mailbox: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Make it possible to use bcm2835-mailbox without Device Tree. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++-- + drivers/mailbox/mailbox.c | 13 ++++++++++++- + 3 files changed, 29 insertions(+), 4 deletions(-) + +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index dc64c93..962b80c 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -69,7 +69,7 @@ config ALTERA_MBOX + + config BCM2835_MBOX + tristate "BCM2835 Mailbox" +- depends on ARCH_BCM2835 ++ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 + help + An implementation of the BCM2385 Mailbox. It is used to invoke + the services of the Videocore. Say Y here if you want to use the +diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c +index 0b47dd4..d16e286 100644 +--- a/drivers/mailbox/bcm2835-mailbox.c ++++ b/drivers/mailbox/bcm2835-mailbox.c +@@ -51,12 +51,15 @@ + #define MAIL1_WRT (ARM_0_MAIL1 + 0x00) + #define MAIL1_STA (ARM_0_MAIL1 + 0x18) + ++/* On ARCH_BCM270x these come through (arm_control.h ) */ ++#ifndef ARM_MS_FULL + /* Status register: FIFO state. */ + #define ARM_MS_FULL BIT(31) + #define ARM_MS_EMPTY BIT(30) + + /* Configuration register: Enable interrupts. */ + #define ARM_MC_IHAVEDATAIRQEN BIT(0) ++#endif + + struct bcm2835_mbox { + void __iomem *regs; +@@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) + return -ENOMEM; + spin_lock_init(&mbox->lock); + +- ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), ++ ret = devm_request_irq(dev, platform_get_irq(pdev, 0), + bcm2835_mbox_irq, 0, dev_name(dev), mbox); + if (ret) { + dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", +@@ -210,7 +213,18 @@ static struct platform_driver bcm2835_mbox_driver = { + .probe = bcm2835_mbox_probe, + .remove = bcm2835_mbox_remove, + }; +-module_platform_driver(bcm2835_mbox_driver); ++ ++static int __init bcm2835_mbox_init(void) ++{ ++ return platform_driver_register(&bcm2835_mbox_driver); ++} ++arch_initcall(bcm2835_mbox_init); ++ ++static void __init bcm2835_mbox_exit(void) ++{ ++ platform_driver_unregister(&bcm2835_mbox_driver); ++} ++module_exit(bcm2835_mbox_exit); + + MODULE_AUTHOR("Lubomir Rintel "); + MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); +diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c +index 19b491d..cc07d71 100644 +--- a/drivers/mailbox/mailbox.c ++++ b/drivers/mailbox/mailbox.c +@@ -304,13 +304,23 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) + unsigned long flags; + int ret; + +- if (!dev || !dev->of_node) { ++ if (!dev) { + pr_debug("%s: No owner device node\n", __func__); + return ERR_PTR(-ENODEV); + } + + mutex_lock(&con_mutex); + ++ if (!dev->of_node) { ++ chan = NULL; ++ /* pick the first controller in the list */ ++ list_for_each_entry(mbox, &mbox_cons, node) { ++ chan = &mbox->chans[0]; ++ break; ++ } ++ goto skip_dt; ++ } ++ + if (of_parse_phandle_with_args(dev->of_node, "mboxes", + "#mbox-cells", index, &spec)) { + dev_dbg(dev, "%s: can't parse \"mboxes\" property\n", __func__); +@@ -327,6 +337,7 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index) + + of_node_put(spec.np); + ++skip_dt: + if (!chan || chan->cl || !try_module_get(mbox->dev->driver->owner)) { + dev_dbg(dev, "%s: mailbox not free\n", __func__); + mutex_unlock(&con_mutex); + +From e3d1e45b4cf84fead585758e48adad894858670c Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Thu, 4 Jun 2015 13:11:47 -0700 +Subject: [PATCH 112/131] ARM: bcm2835: Add the firmware driver information to + the RPi DT +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Eric Anholt +Acked-by: Lee Jones (previous version with pm-domains) +Acked-by: Stephen Warren +[Rebased on rpi-4.1.y] +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835-rpi.dtsi | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi +index 466f02b..5cdfd5a 100644 +--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi +@@ -27,6 +27,13 @@ + }; + }; + ++ soc { ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ }; ++ + /* Onboard audio */ + audio: audio { + compatible = "brcm,bcm2835-audio"; + +From 4b72dfbcb5e820f4bfdb2ccb423538b2e4821329 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 113/131] firmware: bcm2835: Add missing property tags +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Noralf Trønnes +--- + include/soc/bcm2835/raspberrypi-firmware.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index 9d9efb7..d3933af 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -60,6 +60,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_MIN_VOLTAGE = 0x00030008, + RPI_FIRMWARE_GET_TURBO = 0x00030009, + RPI_FIRMWARE_GET_MAX_TEMPERATURE = 0x0003000a, ++ RPI_FIRMWARE_GET_STC = 0x0003000b, + RPI_FIRMWARE_ALLOCATE_MEMORY = 0x0003000c, + RPI_FIRMWARE_LOCK_MEMORY = 0x0003000d, + RPI_FIRMWARE_UNLOCK_MEMORY = 0x0003000e, +@@ -69,10 +70,12 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_SET_ENABLE_QPU = 0x00030012, + RPI_FIRMWARE_GET_DISPMANX_RESOURCE_MEM_HANDLE = 0x00030014, + RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020, ++ RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021, + RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001, + RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002, + RPI_FIRMWARE_SET_VOLTAGE = 0x00038003, + RPI_FIRMWARE_SET_TURBO = 0x00038009, ++ RPI_FIRMWARE_SET_CUSTOMER_OTP = 0x00038021, + + /* Dispmanx TAGS */ + RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, +@@ -86,6 +89,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_GET_VIRTUAL_OFFSET = 0x00040009, + RPI_FIRMWARE_FRAMEBUFFER_GET_OVERSCAN = 0x0004000a, + RPI_FIRMWARE_FRAMEBUFFER_GET_PALETTE = 0x0004000b, ++ RPI_FIRMWARE_FRAMEBUFFER_GET_TOUCHBUF = 0x0004000f, + RPI_FIRMWARE_FRAMEBUFFER_RELEASE = 0x00048001, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PHYSICAL_WIDTH_HEIGHT = 0x00044003, + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_WIDTH_HEIGHT = 0x00044004, +@@ -95,6 +99,7 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_TEST_VIRTUAL_OFFSET = 0x00044009, + RPI_FIRMWARE_FRAMEBUFFER_TEST_OVERSCAN = 0x0004400a, + RPI_FIRMWARE_FRAMEBUFFER_TEST_PALETTE = 0x0004400b, ++ RPI_FIRMWARE_FRAMEBUFFER_TEST_VSYNC = 0x0004400e, + RPI_FIRMWARE_FRAMEBUFFER_SET_PHYSICAL_WIDTH_HEIGHT = 0x00048003, + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_WIDTH_HEIGHT = 0x00048004, + RPI_FIRMWARE_FRAMEBUFFER_SET_DEPTH = 0x00048005, +@@ -103,6 +108,9 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_FRAMEBUFFER_SET_VIRTUAL_OFFSET = 0x00048009, + RPI_FIRMWARE_FRAMEBUFFER_SET_OVERSCAN = 0x0004800a, + RPI_FIRMWARE_FRAMEBUFFER_SET_PALETTE = 0x0004800b, ++ RPI_FIRMWARE_FRAMEBUFFER_SET_VSYNC = 0x0004800e, ++ ++ RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, + + RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + +From d72c334f7fe3305ae13034ac0562123c26820ade 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 114/131] firmware: bcm2835: Support ARCH_BCM270x +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Support booting without Device Tree. +Turn on USB power. +Load driver early because of lacking support for deferred probing +in many drivers. + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 41 +++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 39 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index dd506cd3..b980d53 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -28,6 +28,8 @@ struct rpi_firmware { + u32 enabled; + }; + ++static struct platform_device *g_pdev; ++ + static DEFINE_MUTEX(transaction_lock); + + static void response_callback(struct mbox_client *cl, void *msg) +@@ -183,6 +185,25 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw) + } + } + ++static int raspberrypi_firmware_set_power(struct rpi_firmware *fw, ++ u32 domain, bool on) ++{ ++ struct { ++ u32 domain; ++ u32 on; ++ } packet; ++ int ret; ++ ++ packet.domain = domain; ++ packet.on = on; ++ ret = rpi_firmware_property(fw, RPI_FIRMWARE_SET_POWER_STATE, ++ &packet, sizeof(packet)); ++ if (!ret && packet.on != on) ++ ret = -EINVAL; ++ ++ return ret; ++} ++ + static int rpi_firmware_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -207,9 +228,13 @@ static int rpi_firmware_probe(struct platform_device *pdev) + init_completion(&fw->c); + + platform_set_drvdata(pdev, fw); ++ g_pdev = pdev; + + rpi_firmware_print_firmware_revision(fw); + ++ if (raspberrypi_firmware_set_power(fw, 3, true)) ++ dev_err(dev, "failed to turn on USB power\n"); ++ + return 0; + } + +@@ -218,6 +243,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + struct rpi_firmware *fw = platform_get_drvdata(pdev); + + mbox_free_channel(fw->chan); ++ g_pdev = NULL; + + return 0; + } +@@ -230,7 +256,7 @@ static int rpi_firmware_remove(struct platform_device *pdev) + */ + struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node) + { +- struct platform_device *pdev = of_find_device_by_node(firmware_node); ++ struct platform_device *pdev = g_pdev; + + if (!pdev) + return NULL; +@@ -253,7 +279,18 @@ static struct platform_driver rpi_firmware_driver = { + .probe = rpi_firmware_probe, + .remove = rpi_firmware_remove, + }; +-module_platform_driver(rpi_firmware_driver); ++ ++static int __init rpi_firmware_init(void) ++{ ++ return platform_driver_register(&rpi_firmware_driver); ++} ++subsys_initcall(rpi_firmware_init); ++ ++static void __init rpi_firmware_exit(void) ++{ ++ platform_driver_unregister(&rpi_firmware_driver); ++} ++module_exit(rpi_firmware_exit); + + MODULE_AUTHOR("Eric Anholt "); + MODULE_DESCRIPTION("Raspberry Pi firmware driver"); + +From be083fb29207201d3db279f9d5654c5f8c2cb6de Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:26:10 +0200 +Subject: [PATCH 115/131] firmware: bcm2835: Support legacy mailbox API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add support for the bcm_mailbox_*() functions. +This is temporary until all drivers have been converted to the +firmware API (rpi_firmware_property*()). + +Signed-off-by: Noralf Trønnes +--- + drivers/firmware/raspberrypi.c | 15 +++++++++++++-- + include/soc/bcm2835/raspberrypi-firmware.h | 2 ++ + 2 files changed, 15 insertions(+), 2 deletions(-) + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index b980d53..89421a9 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -19,6 +19,7 @@ + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) + #define MBOX_CHAN(msg) ((msg) & 0xf) + #define MBOX_DATA28(msg) ((msg) & ~0xf) ++#define MBOX_CHAN_VCHIQ 3 + #define MBOX_CHAN_PROPERTY 8 + + struct rpi_firmware { +@@ -26,6 +27,7 @@ struct rpi_firmware { + struct mbox_chan *chan; /* The property channel. */ + struct completion c; + u32 enabled; ++ u32 received; + }; + + static struct platform_device *g_pdev; +@@ -35,6 +37,7 @@ static DEFINE_MUTEX(transaction_lock); + static void response_callback(struct mbox_client *cl, void *msg) + { + struct rpi_firmware *fw = container_of(cl, struct rpi_firmware, cl); ++ fw->received = *(u32 *)msg; + complete(&fw->c); + } + +@@ -42,7 +45,7 @@ static void response_callback(struct mbox_client *cl, void *msg) + * Sends a request to the firmware through the BCM2835 mailbox driver, + * and synchronously waits for the reply. + */ +-static int ++int + rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + { + u32 message = MBOX_MSG(chan, data); +@@ -54,7 +57,8 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + reinit_completion(&fw->c); + ret = mbox_send_message(fw->chan, &message); + if (ret >= 0) { +- wait_for_completion(&fw->c); ++ if (chan != MBOX_CHAN_VCHIQ) ++ wait_for_completion(&fw->c); + ret = 0; + } else { + dev_err(fw->cl.dev, "mbox_send_message returned %d\n", ret); +@@ -63,6 +67,13 @@ rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data) + + return ret; + } ++EXPORT_SYMBOL(rpi_firmware_transaction); ++ ++u32 rpi_firmware_transaction_received(struct rpi_firmware *fw) ++{ ++ return MBOX_DATA28(fw->received); ++} ++EXPORT_SYMBOL(rpi_firmware_transaction_received); + + /** + * rpi_firmware_property_list - Submit firmware property list +diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h +index d3933af..9a08cf1 100644 +--- a/include/soc/bcm2835/raspberrypi-firmware.h ++++ b/include/soc/bcm2835/raspberrypi-firmware.h +@@ -116,6 +116,8 @@ enum rpi_firmware_property_tag { + RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, + }; + ++int rpi_firmware_transaction(struct rpi_firmware *fw, u32 chan, u32 data); ++u32 rpi_firmware_transaction_received(struct rpi_firmware *fw); + int rpi_firmware_property(struct rpi_firmware *fw, + u32 tag, void *data, size_t len); + int rpi_firmware_property_list(struct rpi_firmware *fw, + +From becc3412eae55ac3b1642ddc074cb9ca2cbc2e11 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 116/131] char: broadcom: Add vcio module +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add module for accessing the mailbox property channel through +/dev/vcio. Was previously in bcm2708-vcio. + +Signed-off-by: Noralf Trønnes +--- + drivers/char/broadcom/Kconfig | 6 ++ + drivers/char/broadcom/Makefile | 1 + + drivers/char/broadcom/vcio.c | 175 +++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 182 insertions(+) + create mode 100644 drivers/char/broadcom/vcio.c + +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 75fa1cb..fc40846 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -22,6 +22,12 @@ config BCM2708_VCMEM + help + Helper for videocore memory access and total size allocation. + ++config BCM_VCIO ++ tristate "Mailbox userspace access" ++ depends on BCM2835_MBOX ++ help ++ Gives access to the mailbox property channel from userspace. ++ + endif + + config BCM_VC_SM +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index de8feb9..18171e2 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,3 +1,4 @@ + obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o ++obj-$(CONFIG_BCM_VCIO) += vcio.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ +diff --git a/drivers/char/broadcom/vcio.c b/drivers/char/broadcom/vcio.c +new file mode 100644 +index 0000000..c19bc20 +--- /dev/null ++++ b/drivers/char/broadcom/vcio.c +@@ -0,0 +1,175 @@ ++/* ++ * Copyright (C) 2010 Broadcom ++ * Copyright (C) 2015 Noralf Trønnes ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define MBOX_CHAN_PROPERTY 8 ++ ++#define VCIO_IOC_MAGIC 100 ++#define IOCTL_MBOX_PROPERTY _IOWR(VCIO_IOC_MAGIC, 0, char *) ++ ++static struct { ++ dev_t devt; ++ struct cdev cdev; ++ struct class *class; ++ struct rpi_firmware *fw; ++} vcio; ++ ++static int vcio_user_property_list(void *user) ++{ ++ u32 *buf, size; ++ int ret; ++ ++ /* The first 32-bit is the size of the buffer */ ++ if (copy_from_user(&size, user, sizeof(size))) ++ return -EFAULT; ++ ++ buf = kmalloc(size, GFP_KERNEL); ++ if (!buf) ++ return -ENOMEM; ++ ++ if (copy_from_user(buf, user, size)) { ++ kfree(buf); ++ return -EFAULT; ++ } ++ ++ /* Strip off protocol encapsulation */ ++ ret = rpi_firmware_property_list(vcio.fw, &buf[2], size - 12); ++ if (ret) { ++ kfree(buf); ++ return ret; ++ } ++ ++ buf[1] = RPI_FIRMWARE_STATUS_SUCCESS; ++ if (copy_to_user(user, buf, size)) ++ ret = -EFAULT; ++ ++ kfree(buf); ++ ++ return ret; ++} ++ ++static int vcio_device_open(struct inode *inode, struct file *file) ++{ ++ try_module_get(THIS_MODULE); ++ ++ return 0; ++} ++ ++static int vcio_device_release(struct inode *inode, struct file *file) ++{ ++ module_put(THIS_MODULE); ++ ++ return 0; ++} ++ ++static long vcio_device_ioctl(struct file *file, unsigned int ioctl_num, ++ unsigned long ioctl_param) ++{ ++ switch (ioctl_num) { ++ case IOCTL_MBOX_PROPERTY: ++ return vcio_user_property_list((void *)ioctl_param); ++ default: ++ pr_err("unknown ioctl: %d\n", ioctl_num); ++ return -EINVAL; ++ } ++} ++ ++const struct file_operations vcio_fops = { ++ .unlocked_ioctl = vcio_device_ioctl, ++ .open = vcio_device_open, ++ .release = vcio_device_release, ++}; ++ ++static int __init vcio_init(void) ++{ ++ struct device_node *np; ++ static struct device *dev; ++ int ret; ++ ++ np = of_find_compatible_node(NULL, NULL, ++ "raspberrypi,bcm2835-firmware"); ++/* Uncomment this when we only boot with Device Tree ++ if (!of_device_is_available(np)) ++ return -ENODEV; ++*/ ++ vcio.fw = rpi_firmware_get(np); ++ if (!vcio.fw) ++ return -ENODEV; ++ ++ ret = alloc_chrdev_region(&vcio.devt, 0, 1, "vcio"); ++ if (ret) { ++ pr_err("failed to allocate device number\n"); ++ return ret; ++ } ++ ++ cdev_init(&vcio.cdev, &vcio_fops); ++ vcio.cdev.owner = THIS_MODULE; ++ ret = cdev_add(&vcio.cdev, vcio.devt, 1); ++ if (ret) { ++ pr_err("failed to register device\n"); ++ goto err_unregister_chardev; ++ } ++ ++ /* ++ * Create sysfs entries ++ * 'bcm2708_vcio' is used for backwards compatibility so we don't break ++ * userspace. Raspian has a udev rule that changes the permissions. ++ */ ++ vcio.class = class_create(THIS_MODULE, "bcm2708_vcio"); ++ if (IS_ERR(vcio.class)) { ++ ret = PTR_ERR(vcio.class); ++ pr_err("failed to create class\n"); ++ goto err_cdev_del; ++ } ++ ++ dev = device_create(vcio.class, NULL, vcio.devt, NULL, "vcio"); ++ if (IS_ERR(dev)) { ++ ret = PTR_ERR(dev); ++ pr_err("failed to create device\n"); ++ goto err_class_destroy; ++ } ++ ++ return 0; ++ ++err_class_destroy: ++ class_destroy(vcio.class); ++err_cdev_del: ++ cdev_del(&vcio.cdev); ++err_unregister_chardev: ++ unregister_chrdev_region(vcio.devt, 1); ++ ++ return ret; ++} ++module_init(vcio_init); ++ ++static void __exit vcio_exit(void) ++{ ++ device_destroy(vcio.class, vcio.devt); ++ class_destroy(vcio.class); ++ cdev_del(&vcio.cdev); ++ unregister_chrdev_region(vcio.devt, 1); ++} ++module_exit(vcio_exit); ++ ++MODULE_AUTHOR("Gray Girling"); ++MODULE_AUTHOR("Noralf Trønnes"); ++MODULE_DESCRIPTION("Mailbox userspace access"); ++MODULE_LICENSE("GPL"); + +From 3349eaf79dd91c2e6f9b7aed0c155668e4f5a856 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:37:19 +0200 +Subject: [PATCH 117/131] BCM270x: Switch to firmware driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO. +Add firmware node and change mailbox node in Device Tree. +Add/update platform file for firmware and mailbox. +Strip bcm2708-vcio of everything except the legacy API and hook it +up with the firmware driver. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 8 +- + arch/arm/configs/bcm2709_defconfig | 3 + + arch/arm/configs/bcmrpi_defconfig | 3 + + arch/arm/mach-bcm2708/bcm2708.c | 13 +- + arch/arm/mach-bcm2709/bcm2709.c | 13 +- + drivers/mailbox/Kconfig | 2 +- + drivers/mailbox/bcm2708-vcio.c | 353 ++-------------------------------- + 7 files changed, 51 insertions(+), 344 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index abf3e5d..2dd25f7 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -74,9 +74,10 @@ + }; + + mailbox: mailbox@7e00b800 { +- compatible = "brcm,bcm2708-vcio"; ++ compatible = "brcm,bcm2835-mbox"; + reg = <0x7e00b880 0x40>; + interrupts = <0 1>; ++ #mbox-cells = <0>; + }; + + watchdog: watchdog@7e100000 { +@@ -205,6 +206,11 @@ + <1 9>; + }; + ++ firmware: firmware { ++ compatible = "raspberrypi,bcm2835-firmware"; ++ mboxes = <&mailbox>; ++ }; ++ + leds: leds { + compatible = "gpio-leds"; + }; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 5ecd84f..d75b104 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -574,6 +574,7 @@ CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1074,6 +1075,7 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +@@ -1082,6 +1084,7 @@ CONFIG_IIO_BUFFER=y + CONFIG_IIO_BUFFER_CB=y + CONFIG_IIO_KFIFO_BUF=m + CONFIG_DHT11=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y + CONFIG_EXT4_FS_SECURITY=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 14b91fdf..9159892 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -567,6 +567,7 @@ CONFIG_HW_RANDOM_BCM2708=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1067,6 +1068,7 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m +@@ -1075,6 +1077,7 @@ CONFIG_IIO_BUFFER=y + CONFIG_IIO_BUFFER_CB=y + CONFIG_IIO_KFIFO_BUF=m + CONFIG_DHT11=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_FS_POSIX_ACL=y + CONFIG_EXT4_FS_SECURITY=y +diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c +index 937c2d3..1b9c3be 100644 +--- a/arch/arm/mach-bcm2708/bcm2708.c ++++ b/arch/arm/mach-bcm2708/bcm2708.c +@@ -405,7 +405,7 @@ static struct resource bcm2708_vcio_resources[] = { + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = "bcm2708_vcio", ++ .name = "bcm2835-mbox", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +@@ -415,6 +415,16 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static u64 rpifw_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_rpifw_device = { ++ .name = "raspberrypi-firmware", ++ .dev = { ++ .dma_mask = &rpifw_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + static struct resource bcm2708_vchiq_resources[] = { + { + .start = ARMCTRL_0_BELL_BASE, +@@ -871,6 +881,7 @@ void __init bcm2708_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_rpifw_device); + bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); +diff --git a/arch/arm/mach-bcm2709/bcm2709.c b/arch/arm/mach-bcm2709/bcm2709.c +index fe71c50..e1934dc 100644 +--- a/arch/arm/mach-bcm2709/bcm2709.c ++++ b/arch/arm/mach-bcm2709/bcm2709.c +@@ -426,7 +426,7 @@ static struct resource bcm2708_vcio_resources[] = { + static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); + + static struct platform_device bcm2708_vcio_device = { +- .name = "bcm2708_vcio", ++ .name = "bcm2835-mbox", + .id = -1, /* only one VideoCore I/O area */ + .resource = bcm2708_vcio_resources, + .num_resources = ARRAY_SIZE(bcm2708_vcio_resources), +@@ -436,6 +436,16 @@ static struct platform_device bcm2708_vcio_device = { + }, + }; + ++static u64 rpifw_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON); ++ ++static struct platform_device bcm2708_rpifw_device = { ++ .name = "raspberrypi-firmware", ++ .dev = { ++ .dma_mask = &rpifw_dmamask, ++ .coherent_dma_mask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON), ++ }, ++}; ++ + static struct resource bcm2708_vchiq_resources[] = { + { + .start = ARMCTRL_0_BELL_BASE, +@@ -892,6 +902,7 @@ void __init bcm2709_init(void) + + bcm_register_device_dt(&bcm2708_dmaengine_device); + bcm_register_device_dt(&bcm2708_vcio_device); ++ bcm_register_device_dt(&bcm2708_rpifw_device); + bcm_register_device_dt(&bcm2708_vchiq_device); + #ifdef CONFIG_BCM2708_GPIO + bcm_register_device_dt(&bcm2708_gpio_device); +diff --git a/drivers/mailbox/Kconfig b/drivers/mailbox/Kconfig +index 962b80c..d1a6671 100644 +--- a/drivers/mailbox/Kconfig ++++ b/drivers/mailbox/Kconfig +@@ -9,7 +9,7 @@ if MAILBOX + + config BCM2708_MBOX + bool "Broadcom BCM2708 Mailbox (vcio)" +- depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 ++ depends on BCM2835_MBOX + help + Broadcom BCM2708 Mailbox (vcio) + +diff --git a/drivers/mailbox/bcm2708-vcio.c b/drivers/mailbox/bcm2708-vcio.c +index 06fb2c2f..2e4031b 100644 +--- a/drivers/mailbox/bcm2708-vcio.c ++++ b/drivers/mailbox/bcm2708-vcio.c +@@ -1,6 +1,4 @@ + /* +- * linux/arch/arm/mach-bcm2708/vcio.c +- * + * Copyright (C) 2010 Broadcom + * + * This program is free software; you can redistribute it and/or modify +@@ -12,195 +10,38 @@ + * VideoCore processor + */ + +-#include + #include +-#include +-#include +-#include + #include +-#include +-#include +-#include ++#include + #include +-#include + #include ++#include + + #define DRIVER_NAME "bcm2708_vcio" +-#define DEVICE_FILE_NAME "vcio" +- +-/* offsets from a mail box base address */ +-#define MAIL0_RD 0x00 /* read - and next 4 words */ +-#define MAIL0_POL 0x10 /* read without popping the fifo */ +-#define MAIL0_SND 0x14 /* sender ID (bottom two bits) */ +-#define MAIL0_STA 0x18 /* status */ +-#define MAIL0_CNF 0x1C /* configuration */ +-#define MAIL1_WRT 0x20 /* write - and next 4 words */ +-#define MAIL1_STA 0x38 /* status */ +- +-/* On MACH_BCM270x these come through (arm_control.h ) */ +-#ifndef ARM_MS_EMPTY +-#define ARM_MS_EMPTY BIT(30) +-#define ARM_MS_FULL BIT(31) +- +-#define ARM_MC_IHAVEDATAIRQEN BIT(0) +-#endif +- +-#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +-#define MBOX_MSG_LSB(chan, data28) (((data28) << 4) | ((chan) & 0xf)) +-#define MBOX_CHAN(msg) ((msg) & 0xf) +-#define MBOX_DATA28(msg) ((msg) & ~0xf) +-#define MBOX_DATA28_LSB(msg) (((uint32_t)msg) >> 4) +- +-#define MBOX_MAGIC 0xd0d0c0de +- +-#define MAJOR_NUM 100 +-#define IOCTL_MBOX_PROPERTY _IOWR(MAJOR_NUM, 0, char *) +- +-static struct class *vcio_class; +- +-struct vc_mailbox { +- void __iomem *regs; +- uint32_t msg[MBOX_CHAN_COUNT]; +- struct semaphore sema[MBOX_CHAN_COUNT]; +- uint32_t magic; +-}; +- +-static void mbox_init(struct vc_mailbox *mbox_out) +-{ +- int i; +- +- for (i = 0; i < MBOX_CHAN_COUNT; i++) { +- mbox_out->msg[i] = 0; +- sema_init(&mbox_out->sema[i], 0); +- } +- +- /* Enable the interrupt on data reception */ +- writel(ARM_MC_IHAVEDATAIRQEN, mbox_out->regs + MAIL0_CNF); +- +- mbox_out->magic = MBOX_MAGIC; +-} +- +-static int mbox_write(struct vc_mailbox *mbox, unsigned chan, uint32_t data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- /* wait for the mailbox FIFO to have some space in it */ +- while (0 != (readl(mbox->regs + MAIL1_STA) & ARM_MS_FULL)) +- cpu_relax(); +- +- writel(MBOX_MSG(chan, data28), mbox->regs + MAIL1_WRT); +- +- return 0; +-} +- +-static int mbox_read(struct vc_mailbox *mbox, unsigned chan, uint32_t *data28) +-{ +- if (mbox->magic != MBOX_MAGIC) +- return -EINVAL; +- +- down(&mbox->sema[chan]); +- *data28 = MBOX_DATA28(mbox->msg[chan]); +- mbox->msg[chan] = 0; +- +- return 0; +-} +- +-static irqreturn_t mbox_irq_handler(int irq, void *dev_id) +-{ +- /* wait for the mailbox FIFO to have some data in it */ +- struct vc_mailbox *mbox = (struct vc_mailbox *)dev_id; +- int status = readl(mbox->regs + MAIL0_STA); +- int ret = IRQ_NONE; +- +- while (!(status & ARM_MS_EMPTY)) { +- uint32_t msg = readl(mbox->regs + MAIL0_RD); +- int chan = MBOX_CHAN(msg); +- +- if (chan < MBOX_CHAN_COUNT) { +- if (mbox->msg[chan]) { +- pr_err(DRIVER_NAME +- ": mbox chan %d overflow - drop %08x\n", +- chan, msg); +- } else { +- mbox->msg[chan] = (msg | 0xf); +- up(&mbox->sema[chan]); +- } +- } else { +- pr_err(DRIVER_NAME +- ": invalid channel selector (msg %08x)\n", msg); +- } +- ret = IRQ_HANDLED; +- status = readl(mbox->regs + MAIL0_STA); +- } +- return ret; +-} +- +-/* Mailbox Methods */ +- +-static struct device *mbox_dev; /* we assume there's only one! */ +- +-static int dev_mbox_write(struct device *dev, unsigned chan, uint32_t data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_write(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} +- +-static int dev_mbox_read(struct device *dev, unsigned chan, uint32_t *data28) +-{ +- struct vc_mailbox *mailbox = dev_get_drvdata(dev); +- int rc; +- +- device_lock(dev); +- rc = mbox_read(mailbox, chan, data28); +- device_unlock(dev); +- +- return rc; +-} + + extern int bcm_mailbox_write(unsigned chan, uint32_t data28) + { +- if (!mbox_dev) ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); ++ ++ if (!fw) + return -ENODEV; + +- return dev_mbox_write(mbox_dev, chan, data28); ++ return rpi_firmware_transaction(fw, chan, data28); + } + EXPORT_SYMBOL_GPL(bcm_mailbox_write); + + extern int bcm_mailbox_read(unsigned chan, uint32_t *data28) + { +- if (!mbox_dev) +- return -ENODEV; +- +- return dev_mbox_read(mbox_dev, chan, data28); +-} +-EXPORT_SYMBOL_GPL(bcm_mailbox_read); ++ struct rpi_firmware *fw = rpi_firmware_get(NULL); + +-static int mbox_copy_from_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)src < TASK_SIZE) +- return copy_from_user(dst, src, size); +- +- memcpy(dst, src, size); +- +- return 0; +-} +- +-static int mbox_copy_to_user(void *dst, const void *src, int size) +-{ +- if ((uint32_t)dst < TASK_SIZE) +- return copy_to_user(dst, src, size); ++ if (!fw) ++ return -ENODEV; + +- memcpy(dst, src, size); ++ *data28 = rpi_firmware_transaction_received(fw); + + return 0; + } ++EXPORT_SYMBOL_GPL(bcm_mailbox_read); + + static DEFINE_MUTEX(mailbox_lock); + extern int bcm_mailbox_property(void *data, int size) +@@ -216,7 +57,7 @@ extern int bcm_mailbox_property(void *data, int size) + GFP_KERNEL); + if (mem_kern) { + /* create the message */ +- mbox_copy_from_user(mem_kern, data, size); ++ memcpy(mem_kern, data, size); + + /* send the message */ + wmb(); +@@ -226,7 +67,7 @@ extern int bcm_mailbox_property(void *data, int size) + if (s == 0) { + /* copy the response */ + rmb(); +- mbox_copy_to_user(data, mem_kern, size); ++ memcpy(data, mem_kern, size); + } + dma_free_coherent(NULL, PAGE_ALIGN(size), mem_kern, mem_bus); + } else { +@@ -240,174 +81,6 @@ extern int bcm_mailbox_property(void *data, int size) + } + EXPORT_SYMBOL_GPL(bcm_mailbox_property); + +-/* Platform Device for Mailbox */ +- +-/* This is called whenever a process attempts to open the device file */ +-static int device_open(struct inode *inode, struct file *file) +-{ +- try_module_get(THIS_MODULE); +- +- return 0; +-} +- +-static int device_release(struct inode *inode, struct file *file) +-{ +- module_put(THIS_MODULE); +- +- return 0; +-} +- +-/* +- * This function is called whenever a process tries to do an ioctl on our +- * device file. We get two extra parameters (additional to the inode and file +- * structures, which all device functions get): the number of the ioctl called +- * and the parameter given to the ioctl function. +- * +- * If the ioctl is write or read/write (meaning output is returned to the +- * calling process), the ioctl call returns the output of this function. +- * +- */ +-static long device_ioctl(struct file *file, unsigned int ioctl_num, +- unsigned long ioctl_param) +-{ +- unsigned size; +- +- switch (ioctl_num) { +- case IOCTL_MBOX_PROPERTY: +- /* +- * Receive a pointer to a message (in user space) and set that +- * to be the device's message. Get the parameter given to +- * ioctl by the process. +- */ +- mbox_copy_from_user(&size, (void *)ioctl_param, sizeof(size)); +- return bcm_mailbox_property((void *)ioctl_param, size); +- default: +- pr_err(DRIVER_NAME "unknown ioctl: %d\n", ioctl_num); +- return -EINVAL; +- } +- +- return 0; +-} +- +-/* Module Declarations */ +- +-/* +- * This structure will hold the functions to be called +- * when a process does something to the device we +- * created. Since a pointer to this structure is kept in +- * the devices table, it can't be local to +- * init_module. NULL is for unimplemented functios. +- */ +-const struct file_operations fops = { +- .unlocked_ioctl = device_ioctl, +- .open = device_open, +- .release = device_release, /* a.k.a. close */ +-}; +- +-static int bcm_vcio_probe(struct platform_device *pdev) +-{ +- struct device *dev = &pdev->dev; +- struct device *vdev; +- struct vc_mailbox *mailbox; +- struct resource *res; +- int irq, ret; +- +- mailbox = devm_kzalloc(dev, sizeof(*mailbox), GFP_KERNEL); +- if (!mailbox) +- return -ENOMEM; +- +- res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +- mailbox->regs = devm_ioremap_resource(dev, res); +- if (IS_ERR(mailbox->regs)) +- return PTR_ERR(mailbox->regs); +- +- irq = platform_get_irq(pdev, 0); +- ret = devm_request_irq(dev, irq, mbox_irq_handler, +- IRQF_IRQPOLL, +- dev_name(dev), mailbox); +- if (ret) { +- dev_err(dev, "Interrupt request failed %d\n", ret); +- return ret; +- } +- +- ret = register_chrdev(MAJOR_NUM, DEVICE_FILE_NAME, &fops); +- if (ret < 0) { +- pr_err("Character device registration failed %d\n", ret); +- return ret; +- } +- +- vcio_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vcio_class)) { +- ret = PTR_ERR(vcio_class); +- pr_err("Class creation failed %d\n", ret); +- goto err_class; +- } +- +- vdev = device_create(vcio_class, NULL, MKDEV(MAJOR_NUM, 0), NULL, +- "vcio"); +- if (IS_ERR(vdev)) { +- ret = PTR_ERR(vdev); +- pr_err("Device creation failed %d\n", ret); +- goto err_dev; +- } +- +- mbox_init(mailbox); +- platform_set_drvdata(pdev, mailbox); +- mbox_dev = dev; +- +- dev_info(dev, "mailbox at %p\n", mailbox->regs); +- +- return 0; +- +-err_dev: +- class_destroy(vcio_class); +-err_class: +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return ret; +-} +- +-static int bcm_vcio_remove(struct platform_device *pdev) +-{ +- mbox_dev = NULL; +- platform_set_drvdata(pdev, NULL); +- device_destroy(vcio_class, MKDEV(MAJOR_NUM, 0)); +- class_destroy(vcio_class); +- unregister_chrdev(MAJOR_NUM, DEVICE_FILE_NAME); +- +- return 0; +-} +- +-static const struct of_device_id bcm_vcio_of_match_table[] = { +- { .compatible = "brcm,bcm2708-vcio", }, +- {}, +-}; +-MODULE_DEVICE_TABLE(of, bcm_vcio_of_match_table); +- +-static struct platform_driver bcm_mbox_driver = { +- .probe = bcm_vcio_probe, +- .remove = bcm_vcio_remove, +- +- .driver = { +- .name = DRIVER_NAME, +- .owner = THIS_MODULE, +- .of_match_table = bcm_vcio_of_match_table, +- }, +-}; +- +-static int __init bcm_mbox_init(void) +-{ +- return platform_driver_register(&bcm_mbox_driver); +-} +- +-static void __exit bcm_mbox_exit(void) +-{ +- platform_driver_unregister(&bcm_mbox_driver); +-} +- +-arch_initcall(bcm_mbox_init); /* Initialize early */ +-module_exit(bcm_mbox_exit); +- + MODULE_AUTHOR("Gray Girling"); + MODULE_DESCRIPTION("ARM I/O to VideoCore processor"); + MODULE_LICENSE("GPL"); + +From 04f82e046133586649c9c9c72b565c2dbccf0e97 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= +Date: Fri, 26 Jun 2015 14:39:21 +0200 +Subject: [PATCH 118/131] bcm2835: Switch to firmware driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO. + +Add firmware node and change mailbox node in Device Tree. + +Signed-off-by: Noralf Trønnes +--- + arch/arm/boot/dts/bcm2835.dtsi | 3 ++- + arch/arm/configs/bcm2835_defconfig | 3 +++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 4b6dd65f..4a63704 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -62,9 +62,10 @@ + }; + + mailbox: mailbox@7e00b800 { +- compatible = "brcm,bcm2708-vcio"; ++ compatible = "brcm,bcm2835-mbox"; + reg = <0x7e00b880 0x40>; + interrupts = <0 1>; ++ #mbox-cells = <0>; + }; + + gpio: gpio@7e200000 { +diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig +index 47f2a6a..c284414 100644 +--- a/arch/arm/configs/bcm2835_defconfig ++++ b/arch/arm/configs/bcm2835_defconfig +@@ -568,6 +568,7 @@ CONFIG_HW_RANDOM_BCM2835=m + CONFIG_RAW_DRIVER=y + CONFIG_BRCM_CHAR_DRIVERS=y + CONFIG_BCM_VC_CMA=y ++CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + CONFIG_I2C=y + CONFIG_I2C_CHARDEV=m +@@ -1064,9 +1065,11 @@ CONFIG_FB_FLEX=m + CONFIG_FB_TFT_FBTFT_DEVICE=m + CONFIG_MAILBOX=y + CONFIG_BCM2708_MBOX=y ++CONFIG_BCM2835_MBOX=y + # CONFIG_IOMMU_SUPPORT is not set + CONFIG_EXTCON=m + CONFIG_EXTCON_ARIZONA=m ++CONFIG_RASPBERRYPI_FIRMWARE=y + CONFIG_EXT2_FS=y + CONFIG_EXT2_FS_XATTR=y + CONFIG_EXT2_FS_POSIX_ACL=y + +From 0dd4dae3071d135836946ab1b990061c0899e9b5 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 13 Jul 2015 13:25:31 +0100 +Subject: [PATCH 119/131] Merge pull request #1059 from pelwell/rpi-4.0.y + +w1_therm: Back-port locking improvements from 4.2-rc1 +--- + Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 | 6 + + Documentation/w1/slaves/w1_therm | 11 +- + drivers/w1/slaves/w1_therm.c | 162 ++++++++++++++++++++-- + 3 files changed, 163 insertions(+), 16 deletions(-) + create mode 100644 Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 + +diff --git a/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 b/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 +new file mode 100644 +index 0000000..e928def +--- /dev/null ++++ b/Documentation/ABI/stable/sysfs-driver-w1_ds28ea00 +@@ -0,0 +1,6 @@ ++What: /sys/bus/w1/devices/.../w1_seq ++Date: Apr 2015 ++Contact: Matt Campbell ++Description: Support for the DS28EA00 chain sequence function ++ see Documentation/w1/slaves/w1_therm for detailed information ++Users: any user space application which wants to communicate with DS28EA00 +diff --git a/Documentation/w1/slaves/w1_therm b/Documentation/w1/slaves/w1_therm +index cc62a95..13411fe 100644 +--- a/Documentation/w1/slaves/w1_therm ++++ b/Documentation/w1/slaves/w1_therm +@@ -11,12 +11,14 @@ Author: Evgeniy Polyakov + Description + ----------- + +-w1_therm provides basic temperature conversion for ds18*20 devices. ++w1_therm provides basic temperature conversion for ds18*20 devices, and the ++ds28ea00 device. + supported family codes: + W1_THERM_DS18S20 0x10 + W1_THERM_DS1822 0x22 + W1_THERM_DS18B20 0x28 + W1_THERM_DS1825 0x3B ++W1_THERM_DS28EA00 0x42 + + Support is provided through the sysfs w1_slave file. Each open and + read sequence will initiate a temperature conversion then provide two +@@ -48,3 +50,10 @@ resistor). The DS18b20 temperature sensor specification lists a + maximum current draw of 1.5mA and that a 5k pullup resistor is not + sufficient. The strong pullup is designed to provide the additional + current required. ++ ++The DS28EA00 provides an additional two pins for implementing a sequence ++detection algorithm. This feature allows you to determine the physical ++location of the chip in the 1-wire bus without needing pre-existing ++knowledge of the bus ordering. Support is provided through the sysfs ++w1_seq file. The file will contain a single line with an integer value ++representing the device index in the bus starting at 0. +diff --git a/drivers/w1/slaves/w1_therm.c b/drivers/w1/slaves/w1_therm.c +index 1f11a20..2f029e8 100644 +--- a/drivers/w1/slaves/w1_therm.c ++++ b/drivers/w1/slaves/w1_therm.c +@@ -59,16 +59,32 @@ MODULE_ALIAS("w1-family-" __stringify(W1_THERM_DS28EA00)); + static int w1_strong_pullup = 1; + module_param_named(strong_pullup, w1_strong_pullup, int, 0); + ++struct w1_therm_family_data { ++ uint8_t rom[9]; ++ atomic_t refcnt; ++}; ++ ++/* return the address of the refcnt in the family data */ ++#define THERM_REFCNT(family_data) \ ++ (&((struct w1_therm_family_data*)family_data)->refcnt) ++ + static int w1_therm_add_slave(struct w1_slave *sl) + { +- sl->family_data = kzalloc(9, GFP_KERNEL); ++ sl->family_data = kzalloc(sizeof(struct w1_therm_family_data), ++ GFP_KERNEL); + if (!sl->family_data) + return -ENOMEM; ++ atomic_set(THERM_REFCNT(sl->family_data), 1); + return 0; + } + + static void w1_therm_remove_slave(struct w1_slave *sl) + { ++ int refcnt = atomic_sub_return(1, THERM_REFCNT(sl->family_data)); ++ while(refcnt) { ++ msleep(1000); ++ refcnt = atomic_read(THERM_REFCNT(sl->family_data)); ++ } + kfree(sl->family_data); + sl->family_data = NULL; + } +@@ -76,13 +92,24 @@ static void w1_therm_remove_slave(struct w1_slave *sl) + static ssize_t w1_slave_show(struct device *device, + struct device_attribute *attr, char *buf); + ++static ssize_t w1_seq_show(struct device *device, ++ struct device_attribute *attr, char *buf); ++ + static DEVICE_ATTR_RO(w1_slave); ++static DEVICE_ATTR_RO(w1_seq); + + static struct attribute *w1_therm_attrs[] = { + &dev_attr_w1_slave.attr, + NULL, + }; ++ ++static struct attribute *w1_ds28ea00_attrs[] = { ++ &dev_attr_w1_slave.attr, ++ &dev_attr_w1_seq.attr, ++ NULL, ++}; + ATTRIBUTE_GROUPS(w1_therm); ++ATTRIBUTE_GROUPS(w1_ds28ea00); + + static struct w1_family_ops w1_therm_fops = { + .add_slave = w1_therm_add_slave, +@@ -90,6 +117,12 @@ static struct w1_family_ops w1_therm_fops = { + .groups = w1_therm_groups, + }; + ++static struct w1_family_ops w1_ds28ea00_fops = { ++ .add_slave = w1_therm_add_slave, ++ .remove_slave = w1_therm_remove_slave, ++ .groups = w1_ds28ea00_groups, ++}; ++ + static struct w1_family w1_therm_family_DS18S20 = { + .fid = W1_THERM_DS18S20, + .fops = &w1_therm_fops, +@@ -107,7 +140,7 @@ static struct w1_family w1_therm_family_DS1822 = { + + static struct w1_family w1_therm_family_DS28EA00 = { + .fid = W1_THERM_DS28EA00, +- .fops = &w1_therm_fops, ++ .fops = &w1_ds28ea00_fops, + }; + + static struct w1_family w1_therm_family_DS1825 = { +@@ -194,13 +227,22 @@ static ssize_t w1_slave_show(struct device *device, + struct w1_slave *sl = dev_to_w1_slave(device); + struct w1_master *dev = sl->master; + u8 rom[9], crc, verdict, external_power; +- int i, max_trying = 10; ++ int i, ret, max_trying = 10; + ssize_t c = PAGE_SIZE; ++ u8 *family_data = sl->family_data; + +- i = mutex_lock_interruptible(&dev->bus_mutex); +- if (i != 0) +- return i; ++ ret = mutex_lock_interruptible(&dev->bus_mutex); ++ if (ret != 0) ++ goto post_unlock; ++ ++ if(!sl->family_data) ++ { ++ ret = -ENODEV; ++ goto pre_unlock; ++ } + ++ /* prevent the slave from going away in sleep */ ++ atomic_inc(THERM_REFCNT(family_data)); + memset(rom, 0, sizeof(rom)); + + while (max_trying--) { +@@ -230,17 +272,19 @@ static ssize_t w1_slave_show(struct device *device, + mutex_unlock(&dev->bus_mutex); + + sleep_rem = msleep_interruptible(tm); +- if (sleep_rem != 0) +- return -EINTR; ++ if (sleep_rem != 0) { ++ ret = -EINTR; ++ goto post_unlock; ++ } + +- i = mutex_lock_interruptible(&dev->bus_mutex); +- if (i != 0) +- return i; ++ ret = mutex_lock_interruptible(&dev->bus_mutex); ++ if (ret != 0) ++ goto post_unlock; + } else if (!w1_strong_pullup) { + sleep_rem = msleep_interruptible(tm); + if (sleep_rem != 0) { +- mutex_unlock(&dev->bus_mutex); +- return -EINTR; ++ ret = -EINTR; ++ goto pre_unlock; + } + } + +@@ -269,19 +313,107 @@ static ssize_t w1_slave_show(struct device *device, + c -= snprintf(buf + PAGE_SIZE - c, c, ": crc=%02x %s\n", + crc, (verdict) ? "YES" : "NO"); + if (verdict) +- memcpy(sl->family_data, rom, sizeof(rom)); ++ memcpy(family_data, rom, sizeof(rom)); + else + dev_warn(device, "Read failed CRC check\n"); + + for (i = 0; i < 9; ++i) + c -= snprintf(buf + PAGE_SIZE - c, c, "%02x ", +- ((u8 *)sl->family_data)[i]); ++ ((u8 *)family_data)[i]); + + c -= snprintf(buf + PAGE_SIZE - c, c, "t=%d\n", + w1_convert_temp(rom, sl->family->fid)); ++ ret = PAGE_SIZE - c; ++ ++pre_unlock: + mutex_unlock(&dev->bus_mutex); + ++post_unlock: ++ atomic_dec(THERM_REFCNT(family_data)); ++ return ret; ++} ++ ++#define W1_42_CHAIN 0x99 ++#define W1_42_CHAIN_OFF 0x3C ++#define W1_42_CHAIN_OFF_INV 0xC3 ++#define W1_42_CHAIN_ON 0x5A ++#define W1_42_CHAIN_ON_INV 0xA5 ++#define W1_42_CHAIN_DONE 0x96 ++#define W1_42_CHAIN_DONE_INV 0x69 ++#define W1_42_COND_READ 0x0F ++#define W1_42_SUCCESS_CONFIRM_BYTE 0xAA ++#define W1_42_FINISHED_BYTE 0xFF ++static ssize_t w1_seq_show(struct device *device, ++ struct device_attribute *attr, char *buf) ++{ ++ struct w1_slave *sl = dev_to_w1_slave(device); ++ ssize_t c = PAGE_SIZE; ++ int rv; ++ int i; ++ u8 ack; ++ u64 rn; ++ struct w1_reg_num *reg_num; ++ int seq = 0; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ /* Place all devices in CHAIN state */ ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ w1_write_8(sl->master, W1_SKIP_ROM); ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_ON); ++ w1_write_8(sl->master, W1_42_CHAIN_ON_INV); ++ msleep(sl->master->pullup_duration); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ ++ /* In case the bus fails to send 0xFF, limit*/ ++ for (i = 0; i <= 64; i++) { ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ ++ w1_write_8(sl->master, W1_42_COND_READ); ++ rv = w1_read_block(sl->master, (u8 *)&rn, 8); ++ reg_num = (struct w1_reg_num *) &rn; ++ if (reg_num->family == W1_42_FINISHED_BYTE) ++ break; ++ if (sl->reg_num.id == reg_num->id) ++ seq = i; ++ ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_DONE); ++ w1_write_8(sl->master, W1_42_CHAIN_DONE_INV); ++ w1_read_block(sl->master, &ack, sizeof(ack)); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ ++ } ++ ++ /* Exit from CHAIN state */ ++ if (w1_reset_bus(sl->master)) ++ goto error; ++ w1_write_8(sl->master, W1_SKIP_ROM); ++ w1_write_8(sl->master, W1_42_CHAIN); ++ w1_write_8(sl->master, W1_42_CHAIN_OFF); ++ w1_write_8(sl->master, W1_42_CHAIN_OFF_INV); ++ ++ /* check for acknowledgment */ ++ ack = w1_read_8(sl->master); ++ if (ack != W1_42_SUCCESS_CONFIRM_BYTE) ++ goto error; ++ mutex_unlock(&sl->master->bus_mutex); ++ ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", seq); + return PAGE_SIZE - c; ++error: ++ mutex_unlock(&sl->master->bus_mutex); ++ return -EIO; + } + + static int __init w1_therm_init(void) + +From 042bc608f4877bcf9dd16db9657a33fcabd1023c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 11:11:51 +0100 +Subject: [PATCH 120/131] vchiq_arm: Sort out the vmalloc case + +See: https://github.com/raspberrypi/linux/issues/1055 +--- + .../misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +index 5edba23..56bff05 100644 +--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c ++++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +@@ -394,21 +394,21 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, + if (is_vmalloc_addr(buf)) { + int dir = (type == PAGELIST_WRITE) ? + DMA_TO_DEVICE : DMA_FROM_DEVICE; +- unsigned long length = pagelist->length; +- unsigned int offset = pagelist->offset; ++ unsigned long length = count; ++ unsigned int off = offset; + + for (actual_pages = 0; actual_pages < num_pages; + actual_pages++) { + struct page *pg = vmalloc_to_page(buf + (actual_pages * + PAGE_SIZE)); +- size_t bytes = PAGE_SIZE - offset; ++ size_t bytes = PAGE_SIZE - off; + + if (bytes > length) + bytes = length; + pages[actual_pages] = pg; +- dmac_map_area(page_address(pg) + offset, bytes, dir); ++ dmac_map_area(page_address(pg) + off, bytes, dir); + length -= bytes; +- offset = 0; ++ off = 0; + } + *need_release = 0; /* do not try and release vmalloc pages */ + } else { + +From 133b98eee50e70510dbacae5b28a425987499bf8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 10:26:09 +0100 +Subject: [PATCH 121/131] spidev: Add "spidev" compatible string to silence + warning + +See: https://github.com/raspberrypi/linux/issues/1054 +--- + drivers/spi/spidev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c +index 92c909e..0535375 100644 +--- a/drivers/spi/spidev.c ++++ b/drivers/spi/spidev.c +@@ -706,6 +706,7 @@ static struct class *spidev_class; + #ifdef CONFIG_OF + static const struct of_device_id spidev_dt_ids[] = { + { .compatible = "rohm,dh2228fv" }, ++ { .compatible = "spidev" }, + {}, + }; + MODULE_DEVICE_TABLE(of, spidev_dt_ids); + +From 5705242586b4688004ff73869d53ac532c671f84 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 14 Jul 2015 14:32:47 +0100 +Subject: [PATCH 122/131] Merge pull request #1043 from XECDesign/sense-4.0 + +mfd: Add Raspberry Pi Sense HAT core driver +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 6 + + arch/arm/boot/dts/overlays/rpi-sense-overlay.dts | 47 +++++ + arch/arm/configs/bcm2709_defconfig | 2 + + arch/arm/configs/bcmrpi_defconfig | 2 + + drivers/input/joystick/Kconfig | 8 + + drivers/input/joystick/Makefile | 1 + + drivers/input/joystick/rpisense-js.c | 153 +++++++++++++++ + drivers/mfd/Kconfig | 8 + + drivers/mfd/Makefile | 2 + + drivers/mfd/rpisense-core.c | 157 +++++++++++++++ + drivers/video/fbdev/Kconfig | 13 ++ + drivers/video/fbdev/Makefile | 1 + + drivers/video/fbdev/rpisense-fb.c | 235 +++++++++++++++++++++++ + include/linux/mfd/rpisense/core.h | 47 +++++ + include/linux/mfd/rpisense/framebuffer.h | 28 +++ + include/linux/mfd/rpisense/joystick.h | 35 ++++ + 17 files changed, 746 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/rpi-sense-overlay.dts + create mode 100644 drivers/input/joystick/rpisense-js.c + create mode 100644 drivers/mfd/rpisense-core.c + create mode 100644 drivers/video/fbdev/rpisense-fb.c + create mode 100644 include/linux/mfd/rpisense/core.h + create mode 100644 include/linux/mfd/rpisense/framebuffer.h + create mode 100644 include/linux/mfd/rpisense/joystick.h + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index 4ff9836..5f6082f 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -39,6 +39,7 @@ dtb-$(RPI_DT_OVERLAYS) += rpi-dac-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-display-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += rpi-ft5406-overlay.dtb + 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) += spi-bcm2708-overlay.dtb + dtb-$(RPI_DT_OVERLAYS) += spi-bcm2835-overlay.dtb +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 88ed678..8792f98 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -442,6 +442,12 @@ Load: dtoverlay=rpi-proto + Params: + + ++Name: rpi-sense ++Info: Raspberry Pi Sense HAT ++Load: dtoverlay=rpi-sense ++Params: ++ ++ + Name: sdhost + Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock + Load: dtoverlay=sdhost,= +diff --git a/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +new file mode 100644 +index 0000000..2715324 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rpi-sense-overlay.dts +@@ -0,0 +1,47 @@ ++// rpi-sense HAT ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708", "brcm,bcm2709"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ rpi-sense@46 { ++ compatible = "rpi,rpi-sense"; ++ reg = <0x46>; ++ keys-int-gpios = <&gpio 23 1>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-magn@1c { ++ compatible = "st,lsm9ds1-magn"; ++ reg = <0x1c>; ++ status = "okay"; ++ }; ++ ++ lsm9ds1-accel6a { ++ compatible = "st,lsm9ds1-accel"; ++ reg = <0x6a>; ++ status = "okay"; ++ }; ++ ++ lps25h-press@5c { ++ compatible = "st,lps25h-press"; ++ reg = <0x5c>; ++ status = "okay"; ++ }; ++ ++ hts221-humid@5f { ++ compatible = "st,hts221-humid"; ++ reg = <0x5f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++}; +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index d75b104..f78a483 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -533,6 +533,7 @@ CONFIG_JOYSTICK_IFORCE=m + CONFIG_JOYSTICK_IFORCE_USB=y + CONFIG_JOYSTICK_XPAD=m + CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m + CONFIG_INPUT_TOUCHSCREEN=y + CONFIG_TOUCHSCREEN_ADS7846=m + CONFIG_TOUCHSCREEN_EGALAX=m +@@ -789,6 +790,7 @@ CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y + CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 9159892..b9b5bdf 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -526,6 +526,7 @@ CONFIG_JOYSTICK_IFORCE=m + CONFIG_JOYSTICK_IFORCE_USB=y + CONFIG_JOYSTICK_XPAD=m + CONFIG_JOYSTICK_XPAD_FF=y ++CONFIG_JOYSTICK_RPISENSE=m + CONFIG_INPUT_TOUCHSCREEN=y + CONFIG_TOUCHSCREEN_ADS7846=m + CONFIG_TOUCHSCREEN_EGALAX=m +@@ -782,6 +783,7 @@ CONFIG_VIDEO_MT9V011=m + CONFIG_FB=y + CONFIG_FB_BCM2708=y + CONFIG_FB_SSD1307=m ++CONFIG_FB_RPISENSE=m + # CONFIG_BACKLIGHT_GENERIC is not set + CONFIG_BACKLIGHT_GPIO=m + CONFIG_FRAMEBUFFER_CONSOLE=y +diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig +index 56eb471..73e3a23 100644 +--- a/drivers/input/joystick/Kconfig ++++ b/drivers/input/joystick/Kconfig +@@ -329,4 +329,12 @@ config JOYSTICK_MAPLE + To compile this as a module choose M here: the module will be called + maplecontrol. + ++config JOYSTICK_RPISENSE ++ tristate "Raspberry Pi Sense HAT joystick" ++ depends on GPIOLIB && INPUT ++ select MFD_RPISENSE_CORE ++ ++ help ++ This is the joystick driver for the Raspberry Pi Sense HAT ++ + endif +diff --git a/drivers/input/joystick/Makefile b/drivers/input/joystick/Makefile +index 92dc0de..1758160 100644 +--- a/drivers/input/joystick/Makefile ++++ b/drivers/input/joystick/Makefile +@@ -32,4 +32,5 @@ obj-$(CONFIG_JOYSTICK_WARRIOR) += warrior.o + obj-$(CONFIG_JOYSTICK_XPAD) += xpad.o + obj-$(CONFIG_JOYSTICK_ZHENHUA) += zhenhua.o + obj-$(CONFIG_JOYSTICK_WALKERA0701) += walkera0701.o ++obj-$(CONFIG_JOYSTICK_RPISENSE) += rpisense-js.o + +diff --git a/drivers/input/joystick/rpisense-js.c b/drivers/input/joystick/rpisense-js.c +new file mode 100644 +index 0000000..9eca897 +--- /dev/null ++++ b/drivers/input/joystick/rpisense-js.c +@@ -0,0 +1,153 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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 ++ ++struct rpisense *rpisense; ++unsigned char keymap[5] = {KEY_DOWN, KEY_RIGHT, KEY_UP, KEY_ENTER, KEY_LEFT,}; ++ ++static void keys_work_fn(struct work_struct *work) ++{ ++ int i; ++ static s32 prev_keys; ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ s32 keys = rpisense_reg_read(rpisense, RPISENSE_KEYS); ++ s32 changes = keys ^ prev_keys; ++ ++ prev_keys = keys; ++ for (i = 0; i < 5; i++) { ++ if (changes & 1) { ++ input_report_key(rpisense_js->keys_dev, ++ keymap[i], keys & 1); ++ } ++ changes >>= 1; ++ keys >>= 1; ++ } ++ input_sync(rpisense_js->keys_dev); ++} ++ ++static irqreturn_t keys_irq_handler(int irq, void *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ schedule_work(&rpisense_js->keys_work_s); ++ return IRQ_HANDLED; ++} ++ ++static int rpisense_js_probe(struct platform_device *pdev) ++{ ++ int ret; ++ int i; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_js = &rpisense->joystick; ++ ++ INIT_WORK(&rpisense_js->keys_work_s, keys_work_fn); ++ ++ rpisense_js->keys_dev = input_allocate_device(); ++ if (!rpisense_js->keys_dev) { ++ dev_err(&pdev->dev, "Could not allocate input device.\n"); ++ return -ENOMEM; ++ } ++ ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY); ++ for (i = 0; i < ARRAY_SIZE(keymap); i++) { ++ set_bit(keymap[i], ++ rpisense_js->keys_dev->keybit); ++ } ++ ++ rpisense_js->keys_dev->name = "Raspberry Pi Sense HAT Joystick"; ++ rpisense_js->keys_dev->phys = "rpi-sense-joy/input0"; ++ rpisense_js->keys_dev->id.bustype = BUS_I2C; ++ rpisense_js->keys_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); ++ rpisense_js->keys_dev->keycode = keymap; ++ rpisense_js->keys_dev->keycodesize = sizeof(unsigned char); ++ rpisense_js->keys_dev->keycodemax = ARRAY_SIZE(keymap); ++ ++ ret = input_register_device(rpisense_js->keys_dev); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not register input device.\n"); ++ goto err_keys_alloc; ++ } ++ ++ ret = gpiod_direction_input(rpisense_js->keys_desc); ++ if (ret) { ++ dev_err(&pdev->dev, "Could not set keys-int direction.\n"); ++ goto err_keys_reg; ++ } ++ ++ rpisense_js->keys_irq = gpiod_to_irq(rpisense_js->keys_desc); ++ if (rpisense_js->keys_irq < 0) { ++ dev_err(&pdev->dev, "Could not determine keys-int IRQ.\n"); ++ ret = rpisense_js->keys_irq; ++ goto err_keys_reg; ++ } ++ ++ ret = devm_request_irq(&pdev->dev, rpisense_js->keys_irq, ++ keys_irq_handler, IRQF_TRIGGER_RISING, ++ "keys", &pdev->dev); ++ if (ret) { ++ dev_err(&pdev->dev, "IRQ request failed.\n"); ++ goto err_keys_reg; ++ } ++ return 0; ++err_keys_reg: ++ input_unregister_device(rpisense_js->keys_dev); ++err_keys_alloc: ++ input_free_device(rpisense_js->keys_dev); ++ return ret; ++} ++ ++static int rpisense_js_remove(struct platform_device *pdev) ++{ ++ struct rpisense_js *rpisense_js = &rpisense->joystick; ++ ++ input_unregister_device(rpisense_js->keys_dev); ++ input_free_device(rpisense_js->keys_dev); ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_js_id[] = { ++ { .compatible = "rpi,rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_js_id); ++#endif ++ ++static struct platform_device_id rpisense_js_device_id[] = { ++ { .name = "rpi-sense-js" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_js_device_id); ++ ++static struct platform_driver rpisense_js_driver = { ++ .probe = rpisense_js_probe, ++ .remove = rpisense_js_remove, ++ .driver = { ++ .name = "rpi-sense-js", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_js_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT joystick driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig +index d5ad04d..dfb730e 100644 +--- a/drivers/mfd/Kconfig ++++ b/drivers/mfd/Kconfig +@@ -10,6 +10,14 @@ config MFD_CORE + select IRQ_DOMAIN + default n + ++config MFD_RPISENSE_CORE ++ tristate "Raspberry Pi Sense HAT core functions" ++ depends on I2C ++ select MFD_CORE ++ help ++ This is the core driver for the Raspberry Pi Sense HAT. This provides ++ the necessary functions to communicate with the hardware. ++ + config MFD_CS5535 + tristate "AMD CS5535 and CS5536 southbridge core functions" + select MFD_CORE +diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile +index 0e5cfeb..9c491fb 100644 +--- a/drivers/mfd/Makefile ++++ b/drivers/mfd/Makefile +@@ -185,3 +185,5 @@ obj-$(CONFIG_MFD_SKY81452) += sky81452.o + intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o + obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o + obj-$(CONFIG_MFD_MT6397) += mt6397-core.o ++ ++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 +--- /dev/null ++++ b/drivers/mfd/rpisense-core.c +@@ -0,0 +1,157 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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 driver is based on wm8350 implementation. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++struct rpisense *rpisense; ++ ++static void rpisense_client_dev_register(struct rpisense *rpisense, ++ const char *name, ++ struct platform_device **pdev) ++{ ++ int ret; ++ ++ *pdev = platform_device_alloc(name, -1); ++ if (*pdev == NULL) { ++ dev_err(rpisense->dev, "Failed to allocate %s\n", name); ++ return; ++ } ++ ++ (*pdev)->dev.parent = rpisense->dev; ++ platform_set_drvdata(*pdev, rpisense); ++ ret = platform_device_add(*pdev); ++ if (ret != 0) { ++ dev_err(rpisense->dev, "Failed to register %s: %d\n", ++ name, ret); ++ platform_device_put(*pdev); ++ *pdev = NULL; ++ } ++} ++ ++static int rpisense_probe(struct i2c_client *i2c, ++ const struct i2c_device_id *id) ++{ ++ int ret; ++ struct rpisense_js *rpisense_js; ++ ++ rpisense = devm_kzalloc(&i2c->dev, sizeof(struct rpisense), GFP_KERNEL); ++ if (rpisense == NULL) ++ return -ENOMEM; ++ ++ i2c_set_clientdata(i2c, rpisense); ++ rpisense->dev = &i2c->dev; ++ rpisense->i2c_client = i2c; ++ ++ ret = rpisense_reg_read(rpisense, RPISENSE_WAI); ++ if (ret > 0) { ++ if (ret != 's') ++ return -EINVAL; ++ } else { ++ return ret; ++ } ++ ret = rpisense_reg_read(rpisense, RPISENSE_VER); ++ if (ret < 0) ++ return ret; ++ ++ dev_info(rpisense->dev, ++ "Raspberry Pi Sense HAT firmware version %i\n", ret); ++ ++ rpisense_js = &rpisense->joystick; ++ rpisense_js->keys_desc = devm_gpiod_get(&i2c->dev, ++ "keys-int", GPIOD_IN); ++ if (IS_ERR(rpisense_js->keys_desc)) { ++ dev_warn(&i2c->dev, "Failed to get keys-int descriptor.\n"); ++ rpisense_js->keys_desc = gpio_to_desc(23); ++ if (rpisense_js->keys_desc == NULL) { ++ dev_err(&i2c->dev, "GPIO23 fallback failed.\n"); ++ return PTR_ERR(rpisense_js->keys_desc); ++ } ++ } ++ rpisense_client_dev_register(rpisense, "rpi-sense-js", ++ &(rpisense->joystick.pdev)); ++ rpisense_client_dev_register(rpisense, "rpi-sense-fb", ++ &(rpisense->framebuffer.pdev)); ++ ++ return 0; ++} ++ ++static int rpisense_remove(struct i2c_client *i2c) ++{ ++ struct rpisense *rpisense = i2c_get_clientdata(i2c); ++ ++ platform_device_unregister(rpisense->joystick.pdev); ++ return 0; ++} ++ ++struct rpisense *rpisense_get_dev(void) ++{ ++ return rpisense; ++} ++EXPORT_SYMBOL_GPL(rpisense_get_dev); ++ ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg) ++{ ++ int ret = i2c_smbus_read_byte_data(rpisense->i2c_client, reg); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Read from reg %d failed\n", reg); ++ /* Due to the BCM270x I2C clock stretching bug, some values ++ * may have MSB set. Clear it to avoid incorrect values. ++ * */ ++ return ret & 0x7F; ++} ++EXPORT_SYMBOL_GPL(rpisense_reg_read); ++ ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count) ++{ ++ int ret = i2c_master_send(rpisense->i2c_client, buf, count); ++ ++ if (ret < 0) ++ dev_err(rpisense->dev, "Block write failed\n"); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(rpisense_block_write); ++ ++static const struct i2c_device_id rpisense_i2c_id[] = { ++ { "rpi-sense", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, rpisense_i2c_id); ++ ++ ++static struct i2c_driver rpisense_driver = { ++ .driver = { ++ .name = "rpi-sense", ++ .owner = THIS_MODULE, ++ }, ++ .probe = rpisense_probe, ++ .remove = rpisense_remove, ++ .id_table = rpisense_i2c_id, ++}; ++ ++module_i2c_driver(rpisense_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT core driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); ++ +diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig +index 42e6c3b..3444a4c 100644 +--- a/drivers/video/fbdev/Kconfig ++++ b/drivers/video/fbdev/Kconfig +@@ -2495,3 +2495,16 @@ config FB_SSD1307 + help + This driver implements support for the Solomon SSD1307 + OLED controller over I2C. ++ ++config FB_RPISENSE ++ tristate "Raspberry Pi Sense HAT framebuffer" ++ depends on FB ++ select MFD_RPISENSE_CORE ++ select FB_SYS_FOPS ++ select FB_SYS_FILLRECT ++ select FB_SYS_COPYAREA ++ select FB_SYS_IMAGEBLIT ++ select FB_DEFERRED_IO ++ ++ help ++ This is the framebuffer driver for the Raspberry Pi Sense HAT +diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile +index 57181ad..ee7568b 100644 +--- a/drivers/video/fbdev/Makefile ++++ b/drivers/video/fbdev/Makefile +@@ -150,6 +150,7 @@ obj-$(CONFIG_FB_DA8XX) += da8xx-fb.o + obj-$(CONFIG_FB_MXS) += mxsfb.o + obj-$(CONFIG_FB_SSD1307) += ssd1307fb.o + obj-$(CONFIG_FB_SIMPLE) += simplefb.o ++obj-$(CONFIG_FB_RPISENSE) += rpisense-fb.o + + # the test framebuffer is last + 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..99bb8ea +--- /dev/null ++++ b/drivers/video/fbdev/rpisense-fb.c +@@ -0,0 +1,235 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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 ++#include ++#include ++#include ++ ++#include ++#include ++ ++struct rpisense *rpisense; ++ ++struct rpisense_fb_param { ++ char __iomem *vmem; ++ u8 *vmem_work; ++ u32 vmemsize; ++ u8 gamma[32]; ++}; ++ ++static struct rpisense_fb_param rpisense_fb_param = { ++ .vmem = NULL, ++ .vmemsize = 128, ++ .gamma = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, ++ 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, ++ 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0E, 0x0F, 0x11, ++ 0x12, 0x14, 0x15, 0x17, 0x19, 0x1B, 0x1D, 0x1F,}, ++}; ++ ++static struct fb_deferred_io rpisense_fb_defio; ++ ++static struct fb_fix_screeninfo rpisense_fb_fix = { ++ .id = "RPi-Sense FB", ++ .type = FB_TYPE_PACKED_PIXELS, ++ .visual = FB_VISUAL_TRUECOLOR, ++ .xpanstep = 0, ++ .ypanstep = 0, ++ .ywrapstep = 0, ++ .accel = FB_ACCEL_NONE, ++ .line_length = 16, ++}; ++ ++static struct fb_var_screeninfo rpisense_fb_var = { ++ .xres = 8, ++ .yres = 8, ++ .xres_virtual = 8, ++ .yres_virtual = 8, ++ .bits_per_pixel = 16, ++ .red = {11, 5, 0}, ++ .green = {5, 6, 0}, ++ .blue = {0, 5, 0}, ++}; ++ ++static ssize_t rpisense_fb_write(struct fb_info *info, ++ const char __user *buf, size_t count, ++ loff_t *ppos) ++{ ++ ssize_t res = fb_sys_write(info, buf, count, ppos); ++ ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return res; ++} ++ ++static void rpisense_fb_fillrect(struct fb_info *info, ++ const struct fb_fillrect *rect) ++{ ++ sys_fillrect(info, rect); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_copyarea(struct fb_info *info, ++ const struct fb_copyarea *area) ++{ ++ sys_copyarea(info, area); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_imageblit(struct fb_info *info, ++ const struct fb_image *image) ++{ ++ sys_imageblit(info, image); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++} ++ ++static void rpisense_fb_deferred_io(struct fb_info *info, ++ struct list_head *pagelist) ++{ ++ int i; ++ int j; ++ u8 *vmem_work = rpisense_fb_param.vmem_work; ++ u16 *mem = (u16 *)rpisense_fb_param.vmem; ++ u8 *gamma = rpisense_fb_param.gamma; ++ ++ vmem_work[0] = 0; ++ for (j = 0; j < 8; j++) { ++ for (i = 0; i < 8; i++) { ++ vmem_work[(j * 24) + i + 1] = ++ gamma[(mem[(j * 8) + i] >> 11) & 0x1F]; ++ vmem_work[(j * 24) + (i + 8) + 1] = ++ gamma[(mem[(j * 8) + i] >> 6) & 0x1F]; ++ vmem_work[(j * 24) + (i + 16) + 1] = ++ gamma[(mem[(j * 8) + i]) & 0x1F]; ++ } ++ } ++ rpisense_block_write(rpisense, vmem_work, 193); ++} ++ ++static struct fb_deferred_io rpisense_fb_defio = { ++ .delay = HZ/100, ++ .deferred_io = rpisense_fb_deferred_io, ++}; ++ ++static struct fb_ops rpisense_fb_ops = { ++ .owner = THIS_MODULE, ++ .fb_read = fb_sys_read, ++ .fb_write = rpisense_fb_write, ++ .fb_fillrect = rpisense_fb_fillrect, ++ .fb_copyarea = rpisense_fb_copyarea, ++ .fb_imageblit = rpisense_fb_imageblit, ++}; ++ ++static int rpisense_fb_probe(struct platform_device *pdev) ++{ ++ struct fb_info *info; ++ int ret = -ENOMEM; ++ struct rpisense_fb *rpisense_fb; ++ ++ rpisense = rpisense_get_dev(); ++ rpisense_fb = &rpisense->framebuffer; ++ ++ rpisense_fb_param.vmem = vzalloc(rpisense_fb_param.vmemsize); ++ if (!rpisense_fb_param.vmem) ++ return ret; ++ ++ rpisense_fb_param.vmem_work = devm_kmalloc(&pdev->dev, 193, GFP_KERNEL); ++ if (!rpisense_fb_param.vmem_work) ++ goto err_malloc; ++ ++ info = framebuffer_alloc(0, &pdev->dev); ++ if (!info) { ++ dev_err(&pdev->dev, "Could not allocate framebuffer.\n"); ++ goto err_malloc; ++ } ++ rpisense_fb->info = info; ++ ++ rpisense_fb_fix.smem_start = (unsigned long)rpisense_fb_param.vmem; ++ rpisense_fb_fix.smem_len = rpisense_fb_param.vmemsize; ++ ++ info->fbops = &rpisense_fb_ops; ++ info->fix = rpisense_fb_fix; ++ info->var = rpisense_fb_var; ++ info->fbdefio = &rpisense_fb_defio; ++ info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; ++ info->screen_base = rpisense_fb_param.vmem; ++ info->screen_size = rpisense_fb_param.vmemsize; ++ ++ fb_deferred_io_init(info); ++ ++ ret = register_framebuffer(info); ++ if (ret < 0) { ++ dev_err(&pdev->dev, "Could not register framebuffer.\n"); ++ goto err_fballoc; ++ } ++ ++ fb_info(info, "%s frame buffer device\n", info->fix.id); ++ schedule_delayed_work(&info->deferred_work, rpisense_fb_defio.delay); ++ return 0; ++err_fballoc: ++ framebuffer_release(info); ++err_malloc: ++ vfree(rpisense_fb_param.vmem); ++ return ret; ++} ++ ++static int rpisense_fb_remove(struct platform_device *pdev) ++{ ++ struct rpisense_fb *rpisense_fb = &rpisense->framebuffer; ++ struct fb_info *info = rpisense_fb->info; ++ ++ if (info) { ++ unregister_framebuffer(info); ++ fb_deferred_io_cleanup(info); ++ framebuffer_release(info); ++ vfree(rpisense_fb_param.vmem); ++ } ++ ++ return 0; ++} ++ ++#ifdef CONFIG_OF ++static const struct of_device_id rpisense_fb_id[] = { ++ { .compatible = "rpi,rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(of, rpisense_fb_id); ++#endif ++ ++static struct platform_device_id rpisense_fb_device_id[] = { ++ { .name = "rpi-sense-fb" }, ++ { }, ++}; ++MODULE_DEVICE_TABLE(platform, rpisense_fb_device_id); ++ ++static struct platform_driver rpisense_fb_driver = { ++ .probe = rpisense_fb_probe, ++ .remove = rpisense_fb_remove, ++ .driver = { ++ .name = "rpi-sense-fb", ++ .owner = THIS_MODULE, ++ }, ++}; ++ ++module_platform_driver(rpisense_fb_driver); ++ ++MODULE_DESCRIPTION("Raspberry Pi Sense HAT framebuffer driver"); ++MODULE_AUTHOR("Serge Schneider "); ++MODULE_LICENSE("GPL"); ++ +diff --git a/include/linux/mfd/rpisense/core.h b/include/linux/mfd/rpisense/core.h +new file mode 100644 +index 0000000..4856aa3 +--- /dev/null ++++ b/include/linux/mfd/rpisense/core.h +@@ -0,0 +1,47 @@ ++/* ++ * Raspberry Pi Sense HAT core driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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. ++ * ++ */ ++ ++#ifndef __LINUX_MFD_RPISENSE_CORE_H_ ++#define __LINUX_MFD_RPISENSE_CORE_H_ ++ ++#include ++#include ++ ++/* ++ * Register values. ++ */ ++#define RPISENSE_FB 0x00 ++#define RPISENSE_WAI 0xF0 ++#define RPISENSE_VER 0xF1 ++#define RPISENSE_KEYS 0xF2 ++#define RPISENSE_EE_WP 0xF3 ++ ++#define RPISENSE_ID 's' ++ ++struct rpisense { ++ struct device *dev; ++ struct i2c_client *i2c_client; ++ ++ /* Client devices */ ++ struct rpisense_js joystick; ++ struct rpisense_fb framebuffer; ++}; ++ ++struct rpisense *rpisense_get_dev(void); ++s32 rpisense_reg_read(struct rpisense *rpisense, int reg); ++int rpisense_reg_write(struct rpisense *rpisense, int reg, u16 val); ++int rpisense_block_write(struct rpisense *rpisense, const char *buf, int count); ++ ++#endif +diff --git a/include/linux/mfd/rpisense/framebuffer.h b/include/linux/mfd/rpisense/framebuffer.h +new file mode 100644 +index 0000000..c4c1118 +--- /dev/null ++++ b/include/linux/mfd/rpisense/framebuffer.h +@@ -0,0 +1,28 @@ ++/* ++ * Raspberry Pi Sense HAT framebuffer driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_FB_H_ ++#define __LINUX_RPISENSE_FB_H_ ++ ++#include ++ ++struct rpisense; ++ ++struct rpisense_fb { ++ struct platform_device *pdev; ++ struct fb_info *info; ++}; ++ ++#endif +diff --git a/include/linux/mfd/rpisense/joystick.h b/include/linux/mfd/rpisense/joystick.h +new file mode 100644 +index 0000000..56196dc +--- /dev/null ++++ b/include/linux/mfd/rpisense/joystick.h +@@ -0,0 +1,35 @@ ++/* ++ * Raspberry Pi Sense HAT joystick driver ++ * http://raspberrypi.org ++ * ++ * Copyright (C) 2015 Raspberry Pi ++ * ++ * Author: Serge Schneider ++ * ++ * 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. ++ * ++ */ ++ ++#ifndef __LINUX_RPISENSE_JOYSTICK_H_ ++#define __LINUX_RPISENSE_JOYSTICK_H_ ++ ++#include ++#include ++#include ++#include ++ ++struct rpisense; ++ ++struct rpisense_js { ++ struct platform_device *pdev; ++ struct input_dev *keys_dev; ++ struct gpio_desc *keys_desc; ++ struct work_struct keys_work_s; ++ int keys_irq; ++}; ++ ++ ++#endif + +From dd0a5a6a6e441335df951679f1ee27bb8d35cdae Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 15 Jul 2015 13:46:08 +0100 +Subject: [PATCH 123/131] leds-gpio: Implement the brightness_get method + +The power LED uses some clever logic that means it is driven +by a voltage measuring circuit when configured as input, otherwise +it is driven by the GPIO output value. This patch wires up the +brightness_get method for leds-gpio so that user-space can monitor +the LED value via /sys/class/gpio/led1/brightness. Using the input +trigger this returns an indication of the system power health, +otherwise it is just whatever value the trigger has written most +recently. + +See: https://github.com/raspberrypi/linux/issues/1064 +--- + drivers/leds/leds-gpio.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c +index 3cfbd6a..4e4e132 100644 +--- a/drivers/leds/leds-gpio.c ++++ b/drivers/leds/leds-gpio.c +@@ -82,6 +82,13 @@ static void gpio_led_set(struct led_classdev *led_cdev, + } + } + ++static enum led_brightness gpio_led_get(struct led_classdev *led_cdev) ++{ ++ struct gpio_led_data *led_dat = ++ container_of(led_cdev, struct gpio_led_data, cdev); ++ return gpiod_get_value_cansleep(led_dat->gpiod) ? LED_FULL : LED_OFF; ++} ++ + static int gpio_blink_set(struct led_classdev *led_cdev, + unsigned long *delay_on, unsigned long *delay_off) + { +@@ -138,6 +145,7 @@ static int create_gpio_led(const struct gpio_led *template, + led_dat->cdev.blink_set = gpio_blink_set; + } + led_dat->cdev.brightness_set = gpio_led_set; ++ led_dat->cdev.brightness_get = gpio_led_get; + if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) + state = !!gpiod_get_value_cansleep(led_dat->gpiod); + else + +From 232cca59a44a424f60e8af0517a3fb98c076393f Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Fri, 17 Jul 2015 09:50:55 +0200 +Subject: [PATCH 124/131] dmaengine: bcm2708-dmaengine: Fix memory leak when + stopping a running transfer + +--- + drivers/dma/bcm2708-dmaengine.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/dma/bcm2708-dmaengine.c b/drivers/dma/bcm2708-dmaengine.c +index 987ed53..73c6c00 100644 +--- a/drivers/dma/bcm2708-dmaengine.c ++++ b/drivers/dma/bcm2708-dmaengine.c +@@ -964,6 +964,7 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) + * c->desc is NULL and exit.) + */ + if (c->desc) { ++ bcm2835_dma_desc_free(&c->desc->vd); + c->desc = NULL; + bcm2835_dma_abort(c->chan_base); + + +From bc216042289449e4f8c07cea409a3d775d685a85 Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Mon, 20 Jul 2015 11:01:13 +0200 +Subject: [PATCH 125/131] BCM270X_DT: Fix I2S register map + +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 2dd25f7..728e14a 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -117,8 +117,8 @@ + + i2s: i2s@7e203000 { + compatible = "brcm,bcm2708-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + //dmas = <&dma 2>, + // <&dma 3>; + +From a4c38fc82dc02bbf1bfdef2627c2ed1ed522611e Mon Sep 17 00:00:00 2001 +From: Robert Tiemann +Date: Mon, 20 Jul 2015 11:01:25 +0200 +Subject: [PATCH 126/131] BCM2835_DT: Fix I2S register map + +--- + Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- + Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt | 4 ++-- + arch/arm/boot/dts/bcm2835.dtsi | 4 ++-- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +index 1396078..2db8294 100644 +--- a/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt ++++ b/Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt +@@ -48,8 +48,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = < 0x7e203000 0x20>, +- < 0x7e101098 0x02>; ++ reg = < 0x7e203000 0x24>, ++ < 0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +index 65783de..a89fe42 100644 +--- a/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt ++++ b/Documentation/devicetree/bindings/sound/brcm,bcm2835-i2s.txt +@@ -16,8 +16,8 @@ Example: + + bcm2835_i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; +diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi +index 4a63704..1135120 100644 +--- a/arch/arm/boot/dts/bcm2835.dtsi ++++ b/arch/arm/boot/dts/bcm2835.dtsi +@@ -101,8 +101,8 @@ + + i2s: i2s@7e203000 { + compatible = "brcm,bcm2835-i2s"; +- reg = <0x7e203000 0x20>, +- <0x7e101098 0x02>; ++ reg = <0x7e203000 0x24>, ++ <0x7e101098 0x08>; + + dmas = <&dma 2>, + <&dma 3>; + +From 76a6fde3d0ec48b42cc12cde51bb5713f8a8ee80 Mon Sep 17 00:00:00 2001 +From: David Frey +Date: Tue, 14 Jul 2015 15:57:36 +0200 +Subject: [PATCH 127/131] config: Enable SHT drivers for raspberry pi + +The SHT temperature and humidity sensors are often used in weather +station projects. + +Signed-off-by: David Frey +--- + arch/arm/configs/bcm2709_defconfig | 4 +++- + arch/arm/configs/bcmrpi_defconfig | 4 +++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index f78a483..dd00e7c 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -611,7 +611,9 @@ CONFIG_W1_SLAVE_BQ27000=m + CONFIG_BATTERY_DS2760=m + CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_GPIO=y +-# CONFIG_HWMON is not set ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index b9b5bdf..7b24274 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -604,7 +604,9 @@ CONFIG_W1_SLAVE_BQ27000=m + CONFIG_BATTERY_DS2760=m + CONFIG_POWER_RESET=y + CONFIG_POWER_RESET_GPIO=y +-# CONFIG_HWMON is not set ++CONFIG_HWMON=m ++CONFIG_SENSORS_SHT21=m ++CONFIG_SENSORS_SHTC1=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y + +From 49158f0283abf882fd4497394729fe8e03349ca8 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 14:07:14 +0100 +Subject: [PATCH 128/131] BCM270X_DT: Correct typo in overlays/README + +--- + 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 8792f98..ed484ae 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -78,7 +78,7 @@ Name: + Info: Configures the base Raspberry Pi hardware + Load: + Params: +- audio Set to "on" to disable the onboard ALSA audio ++ 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 + +From a5b4fabbfc1a60ae0cb13710b3084d62e6d1b27a Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 10:53:26 +0100 +Subject: [PATCH 129/131] bcm2835-sdhost: Add the ERASE capability + +See: https://github.com/raspberrypi/linux/issues/1076 +--- + drivers/mmc/host/bcm2835-sdhost.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index d65870a..57a6ad3 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -1675,7 +1675,7 @@ int bcm2835_sdhost_add_host(struct bcm2835_host *host) + /* host controller capabilities */ + mmc->caps |= /* MMC_CAP_SDIO_IRQ |*/ MMC_CAP_4_BIT_DATA | + MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | +- MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | ++ MMC_CAP_NEEDS_POLL | MMC_CAP_HW_RESET | MMC_CAP_ERASE | + (ALLOW_CMD23 * MMC_CAP_CMD23); + + spin_lock_init(&host->lock); + +From 48d4fef9df7f4d04ff6d7f37ab3b1c9b1737bdb3 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 17:32:18 +0100 +Subject: [PATCH 130/131] bcm2835-sdhost: Ignore CRC7 for MMC CMD1 + +It seems that the sdhost interface returns CRC7 errors for CMD1, +which is the MMC-specific SEND_OP_COND. Returning these errors to +the MMC layer causes a downward spiral, but ignoring them seems +to be harmless. +--- + drivers/mmc/host/bcm2835-sdhost.c | 39 +++++++++++++++++++++++---------------- + 1 file changed, 23 insertions(+), 16 deletions(-) + +diff --git a/drivers/mmc/host/bcm2835-sdhost.c b/drivers/mmc/host/bcm2835-sdhost.c +index 57a6ad3..84f645f 100644 +--- a/drivers/mmc/host/bcm2835-sdhost.c ++++ b/drivers/mmc/host/bcm2835-sdhost.c +@@ -959,25 +959,32 @@ static void bcm2835_sdhost_finish_command(struct bcm2835_host *host) + mmc_hostname(host->mmc), sdcmd, sdhsts, + bcm2835_sdhost_read(host, SDEDM)); + +- if (sdhsts & SDHSTS_CMD_TIME_OUT) { +- switch (host->cmd->opcode) { +- case 5: case 52: case 53: +- /* Don't warn about SDIO commands */ +- break; +- default: +- pr_err("%s: command timeout\n", ++ if ((sdhsts & SDHSTS_CRC7_ERROR) && ++ (host->cmd->opcode == 1)) { ++ if (host->debug) ++ pr_info("%s: ignoring CRC7 error for CMD1\n", ++ mmc_hostname(host->mmc)); ++ } else { ++ if (sdhsts & SDHSTS_CMD_TIME_OUT) { ++ switch (host->cmd->opcode) { ++ case 5: case 52: case 53: ++ /* Don't warn about SDIO commands */ ++ break; ++ default: ++ pr_err("%s: command timeout\n", ++ mmc_hostname(host->mmc)); ++ break; ++ } ++ host->cmd->error = -ETIMEDOUT; ++ } else { ++ pr_err("%s: unexpected command error\n", + mmc_hostname(host->mmc)); +- break; ++ bcm2835_sdhost_dumpregs(host); ++ host->cmd->error = -EIO; + } +- host->cmd->error = -ETIMEDOUT; +- } else { +- pr_err("%s: unexpected command error\n", +- mmc_hostname(host->mmc)); +- bcm2835_sdhost_dumpregs(host); +- host->cmd->error = -EIO; ++ tasklet_schedule(&host->finish_tasklet); ++ return; + } +- tasklet_schedule(&host->finish_tasklet); +- return; + } + + if (host->cmd->flags & MMC_RSP_PRESENT) { + +From e6a77a6da2720d0687e9cdd0e9656712f1317d55 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 20 Jul 2015 14:48:21 +0100 +Subject: [PATCH 131/131] BCM270X_DT: Add unit address to gpio node name + +--- + arch/arm/boot/dts/bcm2708_common.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi +index 728e14a..cb608df 100644 +--- a/arch/arm/boot/dts/bcm2708_common.dtsi ++++ b/arch/arm/boot/dts/bcm2708_common.dtsi +@@ -92,7 +92,7 @@ + status = "disabled"; + }; + +- gpio: gpio { ++ gpio: gpio@7e200000 { + compatible = "brcm,bcm2835-gpio"; + reg = <0x7e200000 0xb4>; + interrupts = <2 17>, <2 18>;