* [RFC v3 PATCH 02/25] ARM: NOMMU: define debug_ll_io_ini
From: Vladimir Murzin @ 2016-12-02 15:05 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480691143-19845-1-git-send-email-vladimir.murzin@arm.com>
We do not need to do anything in debug_ll_io_init in case of NOMMU.
Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
arch/arm/include/asm/mach/map.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
index 9b7c328..6b86b9c 100644
--- a/arch/arm/include/asm/mach/map.h
+++ b/arch/arm/include/asm/mach/map.h
@@ -62,6 +62,8 @@ extern int ioremap_page(unsigned long virt, unsigned long phys,
#else
#define iotable_init(map,num) do { } while (0)
#define vm_reserve_area_early(a,s,c) do { } while (0)
+#define debug_ll_io_init() do { } while (0)
+
#endif
#endif
--
1.7.9.5
^ permalink raw reply related
* [RFC v3 PATCH 01/25] ARM: NOMMU: define stubs for fixup
From: Vladimir Murzin @ 2016-12-02 15:05 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480691143-19845-1-git-send-email-vladimir.murzin@arm.com>
When build for NOMMU following errors show up:
arch/arm/kernel/patch.c: In function 'patch_map':
arch/arm/kernel/patch.c:39:2: error: implicit declaration of function 'set_fixmap' [-Werror=implicit-function-declaration]
set_fixmap(fixmap, page_to_phys(page));
^
arch/arm/kernel/patch.c:41:2: error: implicit declaration of function '__fix_to_virt' [-Werror=implicit-function-declaration]
return (void *) (__fix_to_virt(fixmap) + (uintaddr & ~PAGE_MASK));
^
arch/arm/kernel/patch.c: In function 'patch_unmap':
arch/arm/kernel/patch.c:47:2: error: implicit declaration of function 'clear_fixmap' [-Werror=implicit-function-declaration]
clear_fixmap(fixmap);
^
cc1: some warnings being treated as errors
Fixup does not make much sense in NOMMU configurations, so provide
stub definitions.
Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
---
arch/arm/include/asm/fixmap.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/include/asm/fixmap.h b/arch/arm/include/asm/fixmap.h
index 5c17d2d..0bfc2e3 100644
--- a/arch/arm/include/asm/fixmap.h
+++ b/arch/arm/include/asm/fixmap.h
@@ -59,6 +59,12 @@ enum fixed_addresses {
#else
+#define set_fixmap(idx, phys)
+#define clear_fixmap(idx)
+
+#define __fix_to_virt(x) (x)
+#define __virt_to_fix(x) (x)
+
static inline void early_fixmap_init(void) { }
#endif
--
1.7.9.5
^ permalink raw reply related
* [RFC v3 PATCH 00/25] Allow NOMMU for MULTIPLATFORM
From: Vladimir Murzin @ 2016-12-02 15:05 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
With transition to MULTIPLATFORM we lost capability to build NOMMU
configurations. Maybe not a big deal, but there is still interest in
building NOMMU configuration apart from M-class cores. Basically, I'm
talking about R-class cores which shares a lot with A-class except
MMU; there was little interest to run A-class with MMU disabled (or
1:1 MMU mapping) as well. By now it is not even possible to build
such configurations without extra patches on top. Another aspect is
that some portion of NOMMU code have been (build) untested for a
while. All these makes it even harder to involve more people in using
NOMMU and build community around that.
This series is trying to make it possible to build NOMMU
configurations. It is done in PATCH 25/25 which allows to select
ARCH_MULTIPLATFORM even for NOMMU. This is controlled with EXPERT
config option. All patches prior 25/25 is an attempt to fix build
failures for NOMMU case. I don't claim they are 100% correct, so I'm
open to suggestion how they can be done in a better way.
It was build tested with allmodconfig and defconfigs [1] with
!MMU. Additionally, I've been running randconfig, so two more patches
have been added compared to RFC v2.
I had to keep following diff on top:
diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index 40a7c4a..c737124 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -65,7 +65,7 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
*/
register uint64_t x asm ("r2");
- asm volatile ("ldrd\t%0, [%1]" : "=&r" (x) : "r" (io_base));
+// asm volatile ("ldrd\t%0, [%1]" : "=&r" (x) : "r" (io_base));
buf64[i++] = x;
}
i *= 8;
Not sure all cases are fixed yet, so keep running randconfig.
Patches can be pulled from Git tree:
git://linux-arm.org/linux-vm.git (branch: nommu-rfc-v3)
Cc: Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ryan Mallon <rmallon@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Alexander Shiyan <shc_work@mail.ru>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>
Thanks!
Vladimir Murzin (25):
ARM: NOMMU: define stubs for fixup
ARM: NOMMU: define debug_ll_io_ini
ARM: debug: allow debug_ll_addr for NOMMU
ARM: NOMMU: define SECTION_xxx macros
ARM: NOMMU: define dummy user structure for feroceon
ARM: NOMMU: define __arm_ioremap_exec and pci_ioremap functions
ARM: NOMMU: relax restriction on MPU existence
ARM: NOMMU: fix head-nommu build for pre-ARMv7 CPUs
ARM: NOMMU: fix load of CONFIG_VECTORS_BASE
ARM: NOMMU: implement secondary_startup_arm
ARM: move arm_heavy_mb to MMU/noMMU neutral place
ARM: tlbflush: drop dependency on CONFIG_SMP
ARM: sleep: allow it to be build for R-class
ARM: setup: move call to erratum_a15_798181_init under CONFIG_MMU
ARM: kexec: disallow kexec for NOMMU builds
ARM: ep93xx: select ARM_PATCH_PHYS_VIRT for MMU builds only
ARM: omap: do not select HIGHMEM explicitly
ARM: sa1100: move CPU specific copy code under its own config
ARM: sa11x0: assabet: add dependency on MMU
ARM: i.MX: remove map_io callback
PCI: tegra: limit to MMU build only
IB: add dependency on MMU
cnic: add dependency on MMU
scsi: bnx2i: bnx2fc: add dependency on MMU
ARM: Allow ARCH_MULTIPLATFORM to be selected for NOMMU
arch/arm/Kconfig | 25 +++++++++++++++++++----
arch/arm/include/asm/fixmap.h | 6 ++++++
arch/arm/include/asm/mach/map.h | 3 +++
arch/arm/include/asm/page.h | 2 +-
arch/arm/include/asm/pgtable-nommu.h | 6 ++++++
arch/arm/include/asm/tlbflush.h | 2 +-
arch/arm/kernel/Makefile | 5 +++++
arch/arm/kernel/debug.S | 6 ++++--
arch/arm/kernel/head-nommu.S | 30 +++++++++++++++++++++++-----
arch/arm/kernel/setup.c | 4 ++--
arch/arm/kernel/sleep.S | 8 ++++----
arch/arm/mach-imx/mach-imx1.c | 1 -
arch/arm/mach-omap2/Kconfig | 1 -
arch/arm/mach-sa1100/Kconfig | 1 +
arch/arm/mm/Kconfig | 4 ++++
arch/arm/mm/Makefile | 2 +-
arch/arm/mm/flush.c | 15 --------------
arch/arm/mm/iomap.c | 17 ++++++++++++++++
arch/arm/mm/nommu.c | 35 +++++++++++++++++++++++++++++++++
drivers/infiniband/Kconfig | 1 +
drivers/net/ethernet/broadcom/Kconfig | 1 +
drivers/pci/host/Kconfig | 2 +-
drivers/scsi/bnx2fc/Kconfig | 1 +
drivers/scsi/bnx2i/Kconfig | 1 +
24 files changed, 141 insertions(+), 38 deletions(-)
[1] List of errors/warnings from defconfigs:
acs5k_defconfig
arch/arm/mach-ks8695/cpu.c:37:24: warning: 'ks8695_io_desc' defined but not used [-Wunused-variable]
static struct map_desc ks8695_io_desc[] __initdata = {
^
acs5k_tiny_defconfig
arch/arm/mach-ks8695/cpu.c:37:24: warning: 'ks8695_io_desc' defined but not used [-Wunused-variable]
static struct map_desc ks8695_io_desc[] __initdata = {
^
am200epdkit_defconfig
aspeed_g4_defconfig
aspeed_g5_defconfig
assabet_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
/work/tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: no machine record defined
make: *** [vmlinux] Error 1
at91_dt_defconfig
axm55xx_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
badge4_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
arch/arm/mach-sa1100/badge4.c:295:24: warning: 'badge4_io_desc' defined but not used [-Wunused-variable]
static struct map_desc badge4_io_desc[] __initdata = {
^
bcm2835_defconfig
cerfcube_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
arch/arm/mach-sa1100/cerf.c:137:24: warning: 'cerf_io_desc' defined but not used [-Wunused-variable]
static struct map_desc cerf_io_desc[] __initdata = {
^
clps711x_defconfig
cm_x2xx_defconfig
cm_x300_defconfig
cns3420vb_defconfig
arch/arm/mach-cns3xxx/core.c:29:24: warning: 'cns3xxx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc cns3xxx_io_desc[] __initdata = {
^
arch/arm/mach-cns3xxx/cns3420vb.c:230:24: warning: 'cns3420_io_desc' defined but not used [-Wunused-variable]
static struct map_desc cns3420_io_desc[] __initdata = {
^
colibri_pxa270_defconfig
colibri_pxa300_defconfig
collie_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
arch/arm/mach-sa1100/collie.c:403:24: warning: 'collie_io_desc' defined but not used [-Wunused-variable]
static struct map_desc collie_io_desc[] __initdata = {
^
corgi_defconfig
davinci_all_defconfig
dove_defconfig
arch/arm/mach-dove/common.c:50:24: warning: 'dove_io_desc' defined but not used [-Wunused-variable]
static struct map_desc dove_io_desc[] __initdata = {
^
ebsa110_defconfig
arch/arm/mach-ebsa110/core.c:72:24: warning: 'ebsa110_io_desc' defined but not used [-Wunused-variable]
static struct map_desc ebsa110_io_desc[] __initdata = {
^
efm32_defconfig
em_x270_defconfig
ep93xx_defconfig
arch/arm/mach-ep93xx/core.c:56:24: warning: 'ep93xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc ep93xx_io_desc[] __initdata = {
^
arch/arm/mach-ep93xx/ts72xx.c:32:24: warning: 'ts72xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc ts72xx_io_desc[] __initdata = {
^
arch/arm/mach-ep93xx/vision_ep9307.c:51:24: warning: 'vision_io_desc' defined but not used [-Wunused-variable]
static struct map_desc vision_io_desc[] __initdata = {
^
eseries_pxa_defconfig
exynos_defconfig
arch/arm/mach-exynos/exynos.c:31:24: warning: 'exynos4_iodesc' defined but not used [-Wunused-variable]
static struct map_desc exynos4_iodesc[] __initdata = {
^
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
ezx_defconfig
footbridge_defconfig
arch/arm/mach-footbridge/common.c:140:24: warning: 'fb_common_io_desc' defined but not used [-Wunused-variable]
static struct map_desc fb_common_io_desc[] __initdata = {
^
arch/arm/mach-footbridge/common.c:153:24: warning: 'ebsa285_host_io_desc' defined but not used [-Wunused-variable]
static struct map_desc ebsa285_host_io_desc[] __initdata = {
^
h3600_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
arch/arm/mach-sa1100/h3xxx.c:274:24: warning: 'h3600_io_desc' defined but not used [-Wunused-variable]
static struct map_desc h3600_io_desc[] __initdata = {
^
h5000_defconfig
hackkit_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
arch/arm/mach-sa1100/hackkit.c:64:24: warning: 'hackkit_io_desc' defined but not used [-Wunused-variable]
static struct map_desc hackkit_io_desc[] __initdata = {
^
hisi_defconfig
arch/arm/mach-hisi/hisilicon.c:31:24: warning: 'hi3620_io_desc' defined but not used [-Wunused-variable]
static struct map_desc hi3620_io_desc[] __initdata = {
^
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
imote2_defconfig
imx_v4_v5_defconfig
arch/arm/mach-imx/mm-imx21.c:33:24: warning: 'imx21_io_desc' defined but not used [-Wunused-variable]
static struct map_desc imx21_io_desc[] __initdata = {
^
arch/arm/mach-imx/mm-imx27.c:33:24: warning: 'imx27_io_desc' defined but not used [-Wunused-variable]
static struct map_desc imx27_io_desc[] __initdata = {
^
arch/arm/mach-imx/mach-mx27ads.c:381:24: warning: 'mx27ads_io_desc' defined but not used [-Wunused-variable]
static struct map_desc mx27ads_io_desc[] __initdata = {
^
imx_v6_v7_defconfig
arch/arm/mach-imx/mm-imx3.c:119:24: warning: 'mx31_io_desc' defined but not used [-Wunused-variable]
static struct map_desc mx31_io_desc[] __initdata = {
^
arch/arm/mach-imx/mm-imx3.c:216:24: warning: 'mx35_io_desc' defined but not used [-Wunused-variable]
static struct map_desc mx35_io_desc[] __initdata = {
^
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
arch/arm/mach-imx/mach-mx31ads.c:542:24: warning: 'mx31ads_io_desc' defined but not used [-Wunused-variable]
static struct map_desc mx31ads_io_desc[] __initdata = {
^
arch/arm/mach-imx/mach-mx31lite.c:236:24: warning: 'mx31lite_io_desc' defined but not used [-Wunused-variable]
static struct map_desc mx31lite_io_desc[] __initdata = {
^
arch/arm/mach-imx/mach-kzm_arm11_01.c:262:24: warning: 'kzm_io_desc' defined but not used [-Wunused-variable]
static struct map_desc kzm_io_desc[] __initdata = {
^
integrator_defconfig
iop13xx_defconfig
iop32x_defconfig
iop33x_defconfig
ixp4xx_defconfig
jornada720_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
arch/arm/mach-sa1100/jornada720.c:277:24: warning: 'jornada720_io_desc' defined but not used [-Wunused-variable]
static struct map_desc jornada720_io_desc[] __initdata = {
^
keystone_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
ks8695_defconfig
arch/arm/mach-ks8695/cpu.c:37:24: warning: 'ks8695_io_desc' defined but not used [-Wunused-variable]
static struct map_desc ks8695_io_desc[] __initdata = {
^
lart_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
arch/arm/mach-sa1100/lart.c:115:24: warning: 'lart_io_desc' defined but not used [-Wunused-variable]
static struct map_desc lart_io_desc[] __initdata = {
^
lpc18xx_defconfig
lpc32xx_defconfig
arch/arm/mach-lpc32xx/common.c:70:24: warning: 'lpc32xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc lpc32xx_io_desc[] __initdata = {
^
lpd270_defconfig
lubbock_defconfig
magician_defconfig
mainstone_defconfig
mini2440_defconfig
arch/arm/mach-s3c24xx/common.c:155:24: warning: 's3c_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c_iodesc[] __initdata = {
^
arch/arm/mach-s3c24xx/s3c244x.c:49:24: warning: 's3c244x_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c244x_iodesc[] __initdata = {
^
mmp2_defconfig
arch/arm/mach-mmp/common.c:28:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
moxart_defconfig
mps2_defconfig
multi_v4t_defconfig
arch/arm/mach-clps711x/board-dt.c:33:24: warning: 'clps711x_io_desc' defined but not used [-Wunused-variable]
static struct map_desc clps711x_io_desc __initdata = {
^
multi_v5_defconfig
arch/arm/mach-imx/mm-imx21.c:33:24: warning: 'imx21_io_desc' defined but not used [-Wunused-variable]
static struct map_desc imx21_io_desc[] __initdata = {
^
arch/arm/mach-imx/mm-imx27.c:33:24: warning: 'imx27_io_desc' defined but not used [-Wunused-variable]
static struct map_desc imx27_io_desc[] __initdata = {
^
arch/arm/mach-imx/mach-mx27ads.c:381:24: warning: 'mx27ads_io_desc' defined but not used [-Wunused-variable]
static struct map_desc mx27ads_io_desc[] __initdata = {
^
multi_v7_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
arch/arm/mach-exynos/exynos.c:31:24: warning: 'exynos4_iodesc' defined but not used [-Wunused-variable]
static struct map_desc exynos4_iodesc[] __initdata = {
^
arch/arm/mach-hisi/hisilicon.c:31:24: warning: 'hi3620_io_desc' defined but not used [-Wunused-variable]
static struct map_desc hi3620_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:141:24: warning: 'omap34xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omap34xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:188:24: warning: 'omapti81xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omapti81xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:199:24: warning: 'omapam33xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omapam33xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:216:24: warning: 'omap44xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omap44xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:239:24: warning: 'omap54xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omap54xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:268:24: warning: 'dra7xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc dra7xx_io_desc[] __initdata = {
^
arch/arm/mach-tegra/io.c:33:24: warning: 'tegra_io_desc' defined but not used [-Wunused-variable]
static struct map_desc tegra_io_desc[] __initdata = {
^
arch/arm/mach-vt8500/vt8500.c:52:24: warning: 'vt8500_io_desc' defined but not used [-Wunused-variable]
static struct map_desc vt8500_io_desc[] __initdata = {
^
arch/arm/mach-spear/spear13xx.c:60:24: warning: 'spear13xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc spear13xx_io_desc[] __initdata = {
^
arch/arm/mach-spear/spear1310.c:43:24: warning: 'spear1310_io_desc' defined but not used [-Wunused-variable]
static struct map_desc spear1310_io_desc[] __initdata = {
^
mv78xx0_defconfig
mvebu_v5_defconfig
mvebu_v7_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
mxs_defconfig
neponset_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
/work/tools/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: no machine record defined
make: *** [vmlinux] Error 1
netwinder_defconfig
arch/arm/mach-footbridge/common.c:140:24: warning: 'fb_common_io_desc' defined but not used [-Wunused-variable]
static struct map_desc fb_common_io_desc[] __initdata = {
^
arch/arm/mach-footbridge/common.c:153:24: warning: 'ebsa285_host_io_desc' defined but not used [-Wunused-variable]
static struct map_desc ebsa285_host_io_desc[] __initdata = {
^
In file included from sound/oss/os.h:20:0,
from sound/oss/sound_config.h:20,
from sound/oss/midibuf.c:21:
sound/oss/midibuf.c: In function 'MIDIbuf_read':
./arch/arm/include/asm/uaccess.h:530:38: warning: 'tmp_data' may be used uninitialized in this function [-Wmaybe-uninitialized]
#define __copy_to_user(to, from, n) (memcpy((void __force *)to, from, n), 0)
^
sound/oss/midibuf.c:316:16: note: 'tmp_data' was declared here
unsigned char tmp_data;
^
netx_defconfig
arch/arm/mach-netx/generic.c:33:24: warning: 'netx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc netx_io_desc[] __initdata = {
^
nhk8815_defconfig
arch/arm/mach-nomadik/cpu-8815.c:86:24: warning: 'cpu8815_io_desc' defined but not used [-Wunused-variable]
static struct map_desc cpu8815_io_desc[] __initdata = {
^
nuc910_defconfig
arch/arm/mach-w90x900/cpu.c:45:24: warning: 'nuc900_iodesc' defined but not used [-Wunused-variable]
static struct map_desc nuc900_iodesc[] __initdata = {
^
nuc950_defconfig
arch/arm/mach-w90x900/cpu.c:45:24: warning: 'nuc900_iodesc' defined but not used [-Wunused-variable]
static struct map_desc nuc900_iodesc[] __initdata = {
^
nuc960_defconfig
arch/arm/mach-w90x900/cpu.c:45:24: warning: 'nuc900_iodesc' defined but not used [-Wunused-variable]
static struct map_desc nuc900_iodesc[] __initdata = {
^
omap1_defconfig
omap2plus_defconfig
arch/arm/mach-omap2/io.c:71:24: warning: 'omap24xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omap24xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:87:24: warning: 'omap242x_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omap242x_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:111:24: warning: 'omap243x_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omap243x_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:141:24: warning: 'omap34xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omap34xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:188:24: warning: 'omapti81xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omapti81xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:199:24: warning: 'omapam33xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omapam33xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:216:24: warning: 'omap44xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omap44xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:239:24: warning: 'omap54xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc omap54xx_io_desc[] __initdata = {
^
arch/arm/mach-omap2/io.c:268:24: warning: 'dra7xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc dra7xx_io_desc[] __initdata = {
^
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
orion5x_defconfig
palmz72_defconfig
pcm027_defconfig
pleb_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
prima2_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
pxa168_defconfig
arch/arm/mach-mmp/common.c:28:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
pxa255-idp_defconfig
pxa3xx_defconfig
pxa910_defconfig
arch/arm/mach-mmp/common.c:28:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
pxa_defconfig
qcom_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
raumfeld_defconfig
realview_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
rpc_defconfig
s3c2410_defconfig
arch/arm/mach-s3c24xx/common.c:155:24: warning: 's3c_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c_iodesc[] __initdata = {
^
arch/arm/mach-s3c24xx/s3c2410.c:54:24: warning: 's3c2410_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c2410_iodesc[] __initdata = {
^
arch/arm/mach-s3c24xx/s3c2412.c:64:24: warning: 's3c2412_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c2412_iodesc[] __initdata = {
^
arch/arm/mach-s3c24xx/s3c2416.c:69:24: warning: 's3c2416_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c2416_iodesc[] __initdata = {
^
arch/arm/mach-s3c24xx/s3c244x.c:49:24: warning: 's3c244x_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c244x_iodesc[] __initdata = {
^
arch/arm/mach-s3c24xx/s3c2443.c:50:24: warning: 's3c2443_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c2443_iodesc[] __initdata = {
^
s3c6400_defconfig
arch/arm/mach-s3c64xx/common.c:106:24: warning: 's3c_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c_iodesc[] __initdata = {
^
s5pv210_defconfig
sama5_defconfig
shannon_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
shmobile_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
simpad_defconfig
arch/arm/mach-sa1100/generic.c:350:24: warning: 'standard_io_desc' defined but not used [-Wunused-variable]
static struct map_desc standard_io_desc[] __initdata = {
^
arch/arm/mach-sa1100/simpad.c:121:24: warning: 'simpad_io_desc' defined but not used [-Wunused-variable]
static struct map_desc simpad_io_desc[] __initdata = {
^
socfpga_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
spear13xx_defconfig
arch/arm/mach-spear/spear13xx.c:60:24: warning: 'spear13xx_io_desc' defined but not used [-Wunused-variable]
static struct map_desc spear13xx_io_desc[] __initdata = {
^
arch/arm/mach-spear/spear1310.c:43:24: warning: 'spear1310_io_desc' defined but not used [-Wunused-variable]
static struct map_desc spear1310_io_desc[] __initdata = {
^
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
spear3xx_defconfig
spear6xx_defconfig
spitz_defconfig
stm32_defconfig
sunxi_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
tct_hammer_defconfig
arch/arm/mach-s3c24xx/common.c:155:24: warning: 's3c_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c_iodesc[] __initdata = {
^
arch/arm/mach-s3c24xx/s3c2410.c:54:24: warning: 's3c2410_iodesc' defined but not used [-Wunused-variable]
static struct map_desc s3c2410_iodesc[] __initdata = {
^
tegra_defconfig
arch/arm/mach-tegra/io.c:33:24: warning: 'tegra_io_desc' defined but not used [-Wunused-variable]
static struct map_desc tegra_io_desc[] __initdata = {
^
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
trizeps4_defconfig
u300_defconfig
u8500_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
versatile_defconfig
vexpress_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
^
vf610m4_defconfig
viper_defconfig
vt8500_v6_v7_defconfig
arch/arm/mach-vt8500/vt8500.c:52:24: warning: 'vt8500_io_desc' defined but not used [-Wunused-variable]
static struct map_desc vt8500_io_desc[] __initdata = {
^
xcep_defconfig
zeus_defconfig
zx_defconfig
arch/arm/kernel/smp.c:93:22: warning: 'get_arch_pgd' defined but not used [-Wunused-function]
static unsigned long get_arch_pgd(pgd_t *pgd)
--
1.7.9.5
^ permalink raw reply related
* [PATCH v3 -next 2/2] ARM: dts: sunxi: add support for Orange Pi Zero board
From: Icenowy Zheng @ 2016-12-02 15:05 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20161202150513.34691-1-icenowy@aosc.xyz>
Orange Pi Zero is a board that came with the new Allwinner H2+ SoC and a
SDIO Wi-Fi chip by Allwinner (XR819).
Add a device tree file for it.
Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
Changes since v2:
- Merged SDIO Wi-Fi patch into it.
- SDIO Wi-Fi: add a ethernet1 alias to it, as it has no internal NVRAM.
- SDIO Wi-Fi: changed pinctrl binding to generic pinconf
- removed all gpio pinctrl nodes
- changed h2plus to h2-plus
Changes since v1:
- Convert to generic pinconf bindings.
- SDIO Wi-Fi: add patch.
Some notes:
- The uart1 and uart2 is available on the unsoldered gpio header.
- The onboard USB connector has its Vbus directly connected to DCIN-5V (the
power jack)
arch/arm/boot/dts/Makefile | 1 +
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 159 ++++++++++++++++++++++
2 files changed, 160 insertions(+)
create mode 100644 arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 6447abc..59f6e86 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -844,6 +844,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
sun8i-a33-sinlinx-sina33.dtb \
sun8i-a83t-allwinner-h8homlet-v2.dtb \
sun8i-a83t-cubietruck-plus.dtb \
+ sun8i-h2-plus-orangepi-zero.dtb \
sun8i-h3-bananapi-m2-plus.dtb \
sun8i-h3-nanopi-neo.dtb \
sun8i-h3-orangepi-2.dtb \
diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
new file mode 100644
index 0000000..d18807f
--- /dev/null
+++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
+ *
+ * Based on sun8i-h3-orangepi-one.dts, which is:
+ * Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ * a) This file 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 file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ * b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun8i-h3.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/pinctrl/sun4i-a10.h>
+
+/ {
+ model = "Xunlong Orange Pi Zero";
+ compatible = "xunlong,orangepi-zero", "allwinner,sun8i-h2-plus";
+
+ aliases {
+ serial0 = &uart0;
+ /* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
+ ethernet1 = &xr819;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ pwr_led {
+ label = "orangepi:green:pwr";
+ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+
+ status_led {
+ label = "orangepi:red:status";
+ gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
+ };
+ };
+
+ reg_vcc_wifi: reg_vcc_wifi {
+ compatible = "regulator-fixed";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "vcc-wifi";
+ enable-active-high;
+ gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;
+ };
+
+ wifi_pwrseq: wifi_pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>;
+ };
+};
+
+&ehci1 {
+ status = "okay";
+};
+
+&mmc0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc0_pins_a>;
+ vmmc-supply = <®_vcc3v3>;
+ bus-width = <4>;
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
+ cd-inverted;
+ status = "okay";
+};
+
+&mmc1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc1_pins_a>;
+ vmmc-supply = <®_vcc_wifi>;
+ mmc-pwrseq = <&wifi_pwrseq>;
+ bus-width = <4>;
+ non-removable;
+ status = "okay";
+
+ /*
+ * Explicitly define the sdio device, so that we can add an ethernet
+ * alias for it (which e.g. makes u-boot set a mac-address).
+ */
+ xr819: sdio_wifi at 1 {
+ reg = <1>;
+ };
+};
+
+&mmc1_pins_a {
+ bias-pull-up;
+};
+
+&ohci1 {
+ status = "okay";
+};
+
+&uart0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart0_pins_a>;
+ status = "okay";
+};
+
+&uart1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pins>;
+ status = "disabled";
+};
+
+&uart2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart2_pins>;
+ status = "disabled";
+};
+
+&usbphy {
+ /* USB VBUS is always on */
+ status = "okay";
+};
--
2.10.2
^ permalink raw reply related
* [PATCH v3 -next 1/2] ARM: sunxi: add support for H2+ SoC
From: Icenowy Zheng @ 2016-12-02 15:05 UTC (permalink / raw)
To: linux-arm-kernel
Allwinner H2+ is a quad-core Cortex-A7 SoC.
It is very like H3, that they share the same SoC ID (0x1680), and H3
memory maps as well as drivers works well on the SoC.
Signed-off-by: Icenowy Zheng <icenowy@aosc.xyz>
---
Changes since v2:
- Changed compatible from allwinner,sun8i-h2plus to allwinner,sun8i-h2-plus.
Documentation/arm/sunxi/README | 4 ++++
Documentation/devicetree/bindings/arm/sunxi.txt | 1 +
arch/arm/mach-sunxi/sunxi.c | 1 +
3 files changed, 6 insertions(+)
diff --git a/Documentation/arm/sunxi/README b/Documentation/arm/sunxi/README
index cd02433..1fe4d99c 100644
--- a/Documentation/arm/sunxi/README
+++ b/Documentation/arm/sunxi/README
@@ -63,6 +63,10 @@ SunXi family
+ User Manual
http://dl.linux-sunxi.org/A33/A33%20user%20manual%20release%201.1.pdf
+ - Allwinner H2+ (sun8i)
+ + No document available now, but is known to be working properly with
+ H3 drivers and memory map.
+
- Allwinner H3 (sun8i)
+ Datasheet
http://dl.linux-sunxi.org/H3/Allwinner_H3_Datasheet_V1.0.pdf
diff --git a/Documentation/devicetree/bindings/arm/sunxi.txt b/Documentation/devicetree/bindings/arm/sunxi.txt
index 4d6467c..59b143f 100644
--- a/Documentation/devicetree/bindings/arm/sunxi.txt
+++ b/Documentation/devicetree/bindings/arm/sunxi.txt
@@ -13,6 +13,7 @@ using one of the following compatible strings:
allwinner,sun8i-a33
allwinner,sun8i-a83t
allwinner,sun8i-h3
+ allwinner,sun8i-h2-plus
allwinner,sun9i-a80
allwinner,sun50i-a64
nextthing,gr8
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 2e2bde2..320d2af 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -63,6 +63,7 @@ static const char * const sun8i_board_dt_compat[] = {
"allwinner,sun8i-a23",
"allwinner,sun8i-a33",
"allwinner,sun8i-a83t",
+ "allwinner,sun8i-h2-plus",
"allwinner,sun8i-h3",
NULL,
};
--
2.10.2
^ permalink raw reply related
* [PATCH] imx_v6_v7_defconfig: enable SPIDEV module
From: Gary Bisson @ 2016-12-02 14:56 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
Hi,
Seems that this configuration is missing, especially since many
device trees are already using "spidev" nodes.
Regards,
Gary
---
arch/arm/configs/imx_v6_v7_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig
index cd81bd0..f208ad5 100644
--- a/arch/arm/configs/imx_v6_v7_defconfig
+++ b/arch/arm/configs/imx_v6_v7_defconfig
@@ -192,6 +192,7 @@ CONFIG_I2C_IMX=y
CONFIG_SPI=y
CONFIG_SPI_IMX=y
CONFIG_SPI_FSL_DSPI=y
+CONFIG_SPI_SPIDEV=m
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_MC9S08DZ60=y
CONFIG_GPIO_PCA953X=y
--
2.9.3
^ permalink raw reply related
* [PATCH V6 6/6] iommu/arm-smmu: Set privileged attribute to 'default' instead of 'unprivileged'
From: Sricharan R @ 2016-12-02 14:55 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480690509-13490-1-git-send-email-sricharan@codeaurora.org>
Currently the driver sets all the device transactions privileges
to UNPRIVILEGED, but there are cases where the iommu masters wants
to isolate privileged supervisor and unprivileged user.
So don't override the privileged setting to unprivileged, instead
set it to default as incoming and let it be controlled by the pagetable
settings.
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
---
[V6] V5 was doing this with a 'revert'[1] patch, which no more
applies on this code base. So changed the same like this.
[1] https://patchwork.kernel.org/patch/9250493/
drivers/iommu/arm-smmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
index eaa8f44..8bb0eea 100644
--- a/drivers/iommu/arm-smmu.c
+++ b/drivers/iommu/arm-smmu.c
@@ -1213,7 +1213,7 @@ static int arm_smmu_domain_add_master(struct arm_smmu_domain *smmu_domain,
continue;
s2cr[idx].type = type;
- s2cr[idx].privcfg = S2CR_PRIVCFG_UNPRIV;
+ s2cr[idx].privcfg = S2CR_PRIVCFG_DEFAULT;
s2cr[idx].cbndx = cbndx;
arm_smmu_write_s2cr(smmu, idx);
}
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related
* [RESEND PATCH V6 5/6] dmaengine: pl330: Make sure microcode is privileged
From: Sricharan R @ 2016-12-02 14:55 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480690509-13490-1-git-send-email-sricharan@codeaurora.org>
From: Mitchel Humpherys <mitchelh@codeaurora.org>
The PL330 performs privileged instruction fetches. This can result in
SMMU permission faults on SMMUs that implement the ARMv8 VMSA, which
specifies that mappings that are writeable at one execution level shall
not be executable at any higher-privileged level. Fix this by using the
DMA_ATTR_PRIVILEGED attribute, which will ensure that the microcode
IOMMU mapping is only accessible to the privileged level.
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vinod Koul <vinod.koul@intel.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
---
[V6] No change
drivers/dma/pl330.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 030fe05..1a8bac2 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -1854,14 +1854,16 @@ static int dmac_alloc_resources(struct pl330_dmac *pl330)
{
int chans = pl330->pcfg.num_chan;
int ret;
+ unsigned long dma_attrs = DMA_ATTR_PRIVILEGED;
/*
* Alloc MicroCode buffer for 'chans' Channel threads.
* A channel's buffer offset is (Channel_Id * MCODE_BUFF_PERCHAN)
*/
- pl330->mcode_cpu = dma_alloc_coherent(pl330->ddma.dev,
+ pl330->mcode_cpu = dma_alloc_attrs(pl330->ddma.dev,
chans * pl330->mcbufsz,
- &pl330->mcode_bus, GFP_KERNEL);
+ &pl330->mcode_bus, GFP_KERNEL,
+ dma_attrs);
if (!pl330->mcode_cpu) {
dev_err(pl330->ddma.dev, "%s:%d Can't allocate memory!\n",
__func__, __LINE__);
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related
* [RESEND PATCH V6 4/6] arm64/dma-mapping: Implement DMA_ATTR_PRIVILEGED
From: Sricharan R @ 2016-12-02 14:55 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480690509-13490-1-git-send-email-sricharan@codeaurora.org>
From: Mitchel Humpherys <mitchelh@codeaurora.org>
The newly added DMA_ATTR_PRIVILEGED is useful for creating mappings that
are only accessible to privileged DMA engines. Implement it in
dma-iommu.c so that the ARM64 DMA IOMMU mapper can make use of it.
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
---
[V6] No change
arch/arm64/mm/dma-mapping.c | 6 +++---
drivers/iommu/dma-iommu.c | 10 ++++++++--
include/linux/dma-iommu.h | 3 ++-
3 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index 401f79a..ae76ead 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -557,7 +557,7 @@ static void *__iommu_alloc_attrs(struct device *dev, size_t size,
unsigned long attrs)
{
bool coherent = is_device_dma_coherent(dev);
- int ioprot = dma_direction_to_prot(DMA_BIDIRECTIONAL, coherent);
+ int ioprot = dma_info_to_prot(DMA_BIDIRECTIONAL, coherent, attrs);
size_t iosize = size;
void *addr;
@@ -711,7 +711,7 @@ static dma_addr_t __iommu_map_page(struct device *dev, struct page *page,
unsigned long attrs)
{
bool coherent = is_device_dma_coherent(dev);
- int prot = dma_direction_to_prot(dir, coherent);
+ int prot = dma_info_to_prot(dir, coherent, attrs);
dma_addr_t dev_addr = iommu_dma_map_page(dev, page, offset, size, prot);
if (!iommu_dma_mapping_error(dev, dev_addr) &&
@@ -769,7 +769,7 @@ static int __iommu_map_sg_attrs(struct device *dev, struct scatterlist *sgl,
__iommu_sync_sg_for_device(dev, sgl, nelems, dir);
return iommu_dma_map_sg(dev, sgl, nelems,
- dma_direction_to_prot(dir, coherent));
+ dma_info_to_prot(dir, coherent, attrs));
}
static void __iommu_unmap_sg_attrs(struct device *dev,
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index d2a7a46..756d5e0 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -182,16 +182,22 @@ int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
EXPORT_SYMBOL(iommu_dma_init_domain);
/**
- * dma_direction_to_prot - Translate DMA API directions to IOMMU API page flags
+ * dma_info_to_prot - Translate DMA API directions and attributes to IOMMU API
+ * page flags.
* @dir: Direction of DMA transfer
* @coherent: Is the DMA master cache-coherent?
+ * @attrs: DMA attributes for the mapping
*
* Return: corresponding IOMMU API page protection flags
*/
-int dma_direction_to_prot(enum dma_data_direction dir, bool coherent)
+int dma_info_to_prot(enum dma_data_direction dir, bool coherent,
+ unsigned long attrs)
{
int prot = coherent ? IOMMU_CACHE : 0;
+ if (attrs & DMA_ATTR_PRIVILEGED)
+ prot |= IOMMU_PRIV;
+
switch (dir) {
case DMA_BIDIRECTIONAL:
return prot | IOMMU_READ | IOMMU_WRITE;
diff --git a/include/linux/dma-iommu.h b/include/linux/dma-iommu.h
index 32c5890..a203181 100644
--- a/include/linux/dma-iommu.h
+++ b/include/linux/dma-iommu.h
@@ -34,7 +34,8 @@ int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
u64 size, struct device *dev);
/* General helpers for DMA-API <-> IOMMU-API interaction */
-int dma_direction_to_prot(enum dma_data_direction dir, bool coherent);
+int dma_info_to_prot(enum dma_data_direction dir, bool coherent,
+ unsigned long attrs);
/*
* These implement the bulk of the relevant DMA mapping callbacks, but require
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related
* [RESEND PATCH V6 3/6] common: DMA-mapping: add DMA_ATTR_PRIVILEGED attribute
From: Sricharan R @ 2016-12-02 14:55 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480690509-13490-1-git-send-email-sricharan@codeaurora.org>
From: Mitchel Humpherys <mitchelh@codeaurora.org>
This patch adds the DMA_ATTR_PRIVILEGED attribute to the DMA-mapping
subsystem.
Some advanced peripherals such as remote processors and GPUs perform
accesses to DMA buffers in both privileged "supervisor" and unprivileged
"user" modes. This attribute is used to indicate to the DMA-mapping
subsystem that the buffer is fully accessible at the elevated privilege
level (and ideally inaccessible or at least read-only at the
lesser-privileged levels).
Cc: linux-doc at vger.kernel.org
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
---
[V6] No change
Documentation/DMA-attributes.txt | 10 ++++++++++
include/linux/dma-mapping.h | 7 +++++++
2 files changed, 17 insertions(+)
diff --git a/Documentation/DMA-attributes.txt b/Documentation/DMA-attributes.txt
index 98bf7ac..44c6bc4 100644
--- a/Documentation/DMA-attributes.txt
+++ b/Documentation/DMA-attributes.txt
@@ -143,3 +143,13 @@ So, this provides a way for drivers to avoid those error messages on calls
where allocation failures are not a problem, and shouldn't bother the logs.
NOTE: At the moment DMA_ATTR_NO_WARN is only implemented on PowerPC.
+
+DMA_ATTR_PRIVILEGED
+------------------------------
+
+Some advanced peripherals such as remote processors and GPUs perform
+accesses to DMA buffers in both privileged "supervisor" and unprivileged
+"user" modes. This attribute is used to indicate to the DMA-mapping
+subsystem that the buffer is fully accessible at the elevated privilege
+level (and ideally inaccessible or at least read-only at the
+lesser-privileged levels).
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 6f3e6ca..ee31ea1 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -63,6 +63,13 @@
#define DMA_ATTR_NO_WARN (1UL << 8)
/*
+ * DMA_ATTR_PRIVILEGED: used to indicate that the buffer is fully
+ * accessible at an elevated privilege level (and ideally inaccessible or
+ * at least read-only@lesser-privileged levels).
+ */
+#define DMA_ATTR_PRIVILEGED (1UL << 8)
+
+/*
* A dma_addr_t can hold any valid DMA or bus address for the platform.
* It can be given to a device to use as a DMA source or target. A CPU cannot
* reference a dma_addr_t directly because there may be translation between
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related
* [RESEND PATCH V6 2/6] iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag
From: Sricharan R @ 2016-12-02 14:55 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480690509-13490-1-git-send-email-sricharan@codeaurora.org>
From: Jeremy Gebben <jgebben@codeaurora.org>
Allow the creation of privileged mode mappings, for stage 1 only.
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
---
[V6] No change
drivers/iommu/io-pgtable-arm.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/io-pgtable-arm.c b/drivers/iommu/io-pgtable-arm.c
index f5c90e1..69ba83a 100644
--- a/drivers/iommu/io-pgtable-arm.c
+++ b/drivers/iommu/io-pgtable-arm.c
@@ -350,11 +350,14 @@ static arm_lpae_iopte arm_lpae_prot_to_pte(struct arm_lpae_io_pgtable *data,
if (data->iop.fmt == ARM_64_LPAE_S1 ||
data->iop.fmt == ARM_32_LPAE_S1) {
- pte = ARM_LPAE_PTE_AP_UNPRIV | ARM_LPAE_PTE_nG;
+ pte = ARM_LPAE_PTE_nG;
if (!(prot & IOMMU_WRITE) && (prot & IOMMU_READ))
pte |= ARM_LPAE_PTE_AP_RDONLY;
+ if (!(prot & IOMMU_PRIV))
+ pte |= ARM_LPAE_PTE_AP_UNPRIV;
+
if (prot & IOMMU_MMIO)
pte |= (ARM_LPAE_MAIR_ATTR_IDX_DEV
<< ARM_LPAE_PTE_ATTRINDX_SHIFT);
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related
* [RESEND PATCH V6 1/6] iommu: add IOMMU_PRIV attribute
From: Sricharan R @ 2016-12-02 14:55 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480690509-13490-1-git-send-email-sricharan@codeaurora.org>
From: Mitchel Humpherys <mitchelh@codeaurora.org>
Add the IOMMU_PRIV attribute, which is used to indicate privileged
mappings.
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
---
[V6] No change
include/linux/iommu.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index f2960e4..bf22131 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -31,6 +31,7 @@
#define IOMMU_CACHE (1 << 2) /* DMA cache coherency */
#define IOMMU_NOEXEC (1 << 3)
#define IOMMU_MMIO (1 << 4) /* e.g. things like MSI doorbells */
+#define IOMMU_PRIV (1 << 5) /* privileged */
struct iommu_ops;
struct iommu_group;
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply related
* [RESEND PATCH V6 0/6] Add support for privileged mappings
From: Sricharan R @ 2016-12-02 14:55 UTC (permalink / raw)
To: linux-arm-kernel
This series is a resend of the V5 that Mitch sent sometime back [2]
All the patches are the same and i have just rebased. Not sure why this
finally did not make it last time. The last patch in the previous
series does not apply now [3], so just redid that. Also Copied the tags
that he had from last time as well.
The following patch to the ARM SMMU driver:
commit d346180e70b91b3d5a1ae7e5603e65593d4622bc
Author: Robin Murphy <robin.murphy@arm.com>
Date: Tue Jan 26 18:06:34 2016 +0000
iommu/arm-smmu: Treat all device transactions as unprivileged
started forcing all SMMU transactions to come through as "unprivileged".
The rationale given was that:
(1) There is no way in the IOMMU API to even request privileged
mappings.
(2) It's difficult to implement a DMA mapper that correctly models the
ARM VMSAv8 behavior of unprivileged-writeable =>
privileged-execute-never.
This series rectifies (1) by introducing an IOMMU API for privileged
mappings and implements it in io-pgtable-arm.
This series rectifies (2) by introducing a new dma attribute
(DMA_ATTR_PRIVILEGED) for users of the DMA API that need privileged
mappings which are inaccessible to lesser-privileged execution levels, and
implements it in the arm64 IOMMU DMA mapper. The one known user (pl330.c)
is converted over to the new attribute.
Jordan and Jeremy can provide more info on the use case if needed, but the
high level is that it's a security feature to prevent attacks such as [1].
[1] https://github.com/robclark/kilroy
[2] https://lkml.org/lkml/2016/7/27/590
[3] https://patchwork.kernel.org/patch/9250493/
Changelog:
v5..v6
- Rebased all the patches and redid 6/6 as it does not apply in
this code base.
v4..v5
- Simplified patch 4/6 (suggested by Robin Murphy).
v3..v4
- Rebased and reworked on linux next due to the dma attrs rework going
on over there. Patches changed: 3/6, 4/6, and 5/6.
v2..v3
- Incorporated feedback from Robin:
* Various comments and re-wordings.
* Use existing bit definitions for IOMMU_PRIV implementation
in io-pgtable-arm.
* Renamed and redocumented dma_direction_to_prot.
* Don't worry about executability in new DMA attr.
v1..v2
- Added a new DMA attribute to make executable privileged mappings
work, and use that in the pl330 driver (suggested by Will).
Jeremy Gebben (1):
iommu/io-pgtable-arm: add support for the IOMMU_PRIV flag
Mitchel Humpherys (4):
iommu: add IOMMU_PRIV attribute
common: DMA-mapping: add DMA_ATTR_PRIVILEGED attribute
arm64/dma-mapping: Implement DMA_ATTR_PRIVILEGED
dmaengine: pl330: Make sure microcode is privileged
Sricharan R (1):
iommu/arm-smmu: Set privileged attribute to 'default' instead of
'unprivileged'
Documentation/DMA-attributes.txt | 10 ++++++++++
arch/arm64/mm/dma-mapping.c | 6 +++---
drivers/dma/pl330.c | 6 ++++--
drivers/iommu/arm-smmu.c | 2 +-
drivers/iommu/dma-iommu.c | 10 ++++++++--
drivers/iommu/io-pgtable-arm.c | 5 ++++-
include/linux/dma-iommu.h | 3 ++-
include/linux/dma-mapping.h | 7 +++++++
include/linux/iommu.h | 1 +
9 files changed, 40 insertions(+), 10 deletions(-)
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
^ permalink raw reply
* [PATCH v4] ARM: davinci: da8xx: Fix sleeping function called from invalid context
From: Alexandre Bailon @ 2016-12-02 14:53 UTC (permalink / raw)
To: linux-arm-kernel
Everytime the usb20 phy is enabled, there is a
"sleeping function called from invalid context" BUG.
clk_enable() from arch/arm/mach-davinci/clock.c uses spin_lock_irqsave()
before to invoke the callback usb20_phy_clk_enable().
usb20_phy_clk_enable() uses clk_get() and clk_enable_prepapre()
which may sleep.
Move clk_get() to da8xx_register_usb20_phy_clk() and
replace clk_prepare_enable() by clk_enable().
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
---
arch/arm/mach-davinci/usb-da8xx.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c
index b010e5f..704f506 100644
--- a/arch/arm/mach-davinci/usb-da8xx.c
+++ b/arch/arm/mach-davinci/usb-da8xx.c
@@ -22,6 +22,8 @@
#define DA8XX_USB0_BASE 0x01e00000
#define DA8XX_USB1_BASE 0x01e25000
+static struct clk *usb20_clk;
+
static struct platform_device da8xx_usb_phy = {
.name = "da8xx-usb-phy",
.id = -1,
@@ -158,21 +160,14 @@ int __init da8xx_register_usb_refclkin(int rate)
static void usb20_phy_clk_enable(struct clk *clk)
{
- struct clk *usb20_clk;
int err;
u32 val;
u32 timeout = 500000; /* 500 msec */
val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
- usb20_clk = clk_get(&da8xx_usb20_dev.dev, "usb20");
- if (IS_ERR(usb20_clk)) {
- pr_err("could not get usb20 clk: %ld\n", PTR_ERR(usb20_clk));
- return;
- }
-
/* The USB 2.O PLL requires that the USB 2.O PSC is enabled as well. */
- err = clk_prepare_enable(usb20_clk);
+ err = clk_enable(usb20_clk);
if (err) {
pr_err("failed to enable usb20 clk: %d\n", err);
clk_put(usb20_clk);
@@ -197,8 +192,7 @@ static void usb20_phy_clk_enable(struct clk *clk)
pr_err("Timeout waiting for USB 2.0 PHY clock good\n");
done:
- clk_disable_unprepare(usb20_clk);
- clk_put(usb20_clk);
+ clk_disable(usb20_clk);
}
static void usb20_phy_clk_disable(struct clk *clk)
@@ -285,11 +279,19 @@ static struct clk_lookup usb20_phy_clk_lookup =
int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin)
{
struct clk *parent;
- int ret = 0;
+ int ret;
+
+ usb20_clk = clk_get(&da8xx_usb20_dev.dev, "usb20");
+ ret = PTR_ERR_OR_ZERO(usb20_clk);
+ if (ret)
+ return ret;
parent = clk_get(NULL, use_usb_refclkin ? "usb_refclkin" : "pll0_aux");
- if (IS_ERR(parent))
- return PTR_ERR(parent);
+ ret = PTR_ERR_OR_ZERO(parent);
+ if (ret) {
+ clk_put(usb20_clk);
+ return ret;
+ }
usb20_phy_clk.parent = parent;
ret = clk_register(&usb20_phy_clk);
--
2.7.3
^ permalink raw reply related
* [PATCH 2/2] arm64: hibernate: report nomap regions as being pfn_nosave
From: James Morse @ 2016-12-02 14:49 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20161202144909.18405-1-james.morse@arm.com>
pfn_valid() needs to be changed so that all struct pages in a numa
node have the same node-id. Currently 'nomap' pages are skipped, and
retain their pre-numa node-ids, which leads to a later BUG_ON().
Once this change happens, hibernate's code code will try and
save/restore the nomap pages.
Add the memblock nomap regions to the ranges reported as being
'pfn_nosave' to the hibernate core code. This only works if all
pages in the nomap region are also marked with PG_reserved.
Signed-off-by: James Morse <james.morse@arm.com>
---
arch/arm64/kernel/hibernate.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index d55a7b09959b..9e901658a123 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -17,6 +17,7 @@
#define pr_fmt(x) "hibernate: " x
#include <linux/cpu.h>
#include <linux/kvm_host.h>
+#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/pm.h>
#include <linux/sched.h>
@@ -105,7 +106,10 @@ int pfn_is_nosave(unsigned long pfn)
unsigned long nosave_begin_pfn = virt_to_pfn(&__nosave_begin);
unsigned long nosave_end_pfn = virt_to_pfn(&__nosave_end - 1);
- return (pfn >= nosave_begin_pfn) && (pfn <= nosave_end_pfn);
+ if ((pfn >= nosave_begin_pfn) && (pfn <= nosave_end_pfn))
+ return 1;
+
+ return !memblock_is_map_memory(pfn << PAGE_SHIFT);
}
void notrace save_processor_state(void)
--
2.10.1
^ permalink raw reply related
* [PATCH 1/2] arm64: mm: Mark nomap regions with the PG_reserved flag
From: James Morse @ 2016-12-02 14:49 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20161202144909.18405-1-james.morse@arm.com>
linux/page-flags.h has a flag for describing special pages:
> PG_reserved is set for special pages, which can never be swapped out.
> Some of them might not even exist (eg empty_bad_page)...
memblock nomap pages fall in the 'might not even exist' category,
set this bit on all the struct pages in the nomap regions.
This gives pfn walkers the necessary hint that the page might not
be accessible, allowing pfn_valid()s meaning to change slightly.
Signed-off-by: James Morse <james.morse@arm.com>
---
arch/arm64/mm/init.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 166911f4a2e6..5da9ff7d20f5 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -31,6 +31,7 @@
#include <linux/memblock.h>
#include <linux/sort.h>
#include <linux/of_fdt.h>
+#include <linux/page-flags.h>
#include <linux/dma-mapping.h>
#include <linux/dma-contiguous.h>
#include <linux/efi.h>
@@ -401,6 +402,8 @@ static void __init free_unused_memmap(void)
*/
void __init mem_init(void)
{
+ struct memblock_region *region;
+
if (swiotlb_force || max_pfn > (arm64_dma_phys_limit >> PAGE_SHIFT))
swiotlb_init(1);
@@ -479,6 +482,17 @@ void __init mem_init(void)
*/
sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
}
+
+ /* Mark struct pages for the memblock:nomap regions as reserved */
+ for_each_memblock(memory, region) {
+ u64 pfn;
+ u64 start_pfn = memblock_region_memory_base_pfn(region);
+ u64 end_pfn = memblock_region_memory_end_pfn(region);
+
+ if (memblock_is_nomap(region))
+ for (pfn = start_pfn; pfn < end_pfn; pfn++)
+ SetPageReserved(pfn_to_page(pfn));
+ }
}
void free_initmem(void)
--
2.10.1
^ permalink raw reply related
* [PATCH 0/2] Hibernate fixes for 'Fix memmap to be initialized for the entire section'
From: James Morse @ 2016-12-02 14:49 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480530091-1092-1-git-send-email-rrichter@cavium.com>
Patch "arm64: mm: Fix memmap to be initialized for the entire section"
changes pfn_valid() in a way that breaks hibernate. These patches fix
hibernate, and provided struct page's are allocated for nomap pages,
can be applied before [0].
Hibernate core code belives 'valid' to mean "I can access this". It
uses pfn_valid() to test the page if the page is 'valid'.
pfn_valid() needs to be changed so that all struct pages in a numa
node have the same node-id. Currently 'nomap' pages are skipped, and
retain their pre-numa node-ids, which leads to a later BUG_ON().
These patches make hibernate's savable_page() take its escape route
via 'if (PageReserved(page) && pfn_is_nosave(pfn))'.
[0] https://lkml.org/lkml/2016/11/30/566
James Morse (2):
arm64: mm: Mark nomap regions with the PG_reserved flag
arm64: hibernate: report nomap regions as being pfn_nosave
arch/arm64/kernel/hibernate.c | 6 +++++-
arch/arm64/mm/init.c | 14 ++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
--
2.10.1
^ permalink raw reply
* [PATCH v2] arm64: mm: Fix memmap to be initialized for the entire section
From: James Morse @ 2016-12-02 14:48 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20161202071157.GQ2213@rric.localdomain>
Hi Robert,
On 02/12/16 07:11, Robert Richter wrote:
> On 01.12.16 17:26:55, James Morse wrote:
>> On 01/12/16 16:45, Will Deacon wrote:
>>> Thanks for sending out the new patch. Whilst I'm still a bit worried about
>>> changing pfn_valid like this, I guess we'll just have to fix up any callers
>>> which suffer from this change.
>>
>> Hibernate's core code falls foul of this. This patch causes a panic when copying
>> memory to build the 'image'[0].
>> saveable_page() in kernel/power/snapshot.c broadly assumes that pfn_valid()
>> pages can be accessed.
>>
>> Fortunately the core code exposes pfn_is_nosave() which we can extend to catch
>> 'nomap' pages, but only if they are also marked as PageReserved().
>>
>> Are there any side-effects of marking all the nomap regions with
>> mark_page_reserved()? (it doesn't appear to be the case today).
>
> Reserving the page adds it to the memory management which is what we
> would like to avoid for NOMAP pages. I don't believe we should do
> this. Since NOMAP is to some degree now core functionality I would
> rather implement pfn_is_nomap() that defaults to pfn_is_valid() but
> calls memblock_is_nomap() for arm64 or does something equivalent.
I thought the adjust_managed_page_count() code was just fiddling with some
counters. I will change it to call SetPageReserved() directly which will just
set the bit in struct page's flags. I will post these shortly as the 'fixes' way
of solving the hibernate fallout.
I guess any arch that uses memblock nomap needs core code to take account of it,
but at the moment that is just arm/arm64. If we are adding new pfn_is_ calls, we
could try and clean up pfn_valid() users to use pfn_is_memory(), pfn_is_mapped()
or pfn_has_memmap(). Part of the problem is 'valid' means different things to
different people.
> The question arises what to do with that mem at all. There could be
> mappings by the kernel, e.g. of acpi tables. We can't assume the mem
> regions still come out the same from the BIOS during resume.
Unfortunately we have to assume this. If the firmware reserved regions move
around in memory we can't resume from hibernate. Other OS also require this not
to happen. ([0] 'firmware memory requirements')
Hibernate core code checks the number of pages of kernel memory is the same
before trying to resume. If you just move the allocations around this will panic
during resume as the resume kernel will have surprising holes in its linear map.
x86 recently grew an MD5sum check of the e820 memory map, I intend to do the
same for memblock.
The theory is this would only happen if you change the hardware in some way, and
that otherwise the firmware is entirely deterministic...
> Do we
> need to save the mem? I can't answer that as I don't know much about
> hibernation yet.
Hibernate only save/restores the linear map and CPU state. We expect firmware to
put equivalent data in the same places for its nomap regions. If the region
belongs to a device, its up to the device driver to tidy up. (It has
freeze/thaw/resume callbacks to do this).
Thanks,
James
[0]
https://msdn.microsoft.com/en-gb/windows/hardware/commercialize/manufacture/desktop/uefi-requirements-boot-time-runtime-hibernation-state--s4
^ permalink raw reply
* [PATCH 3/3] nvmem: imx-ocotp: Fix wrong register size
From: Daniel Schultz @ 2016-12-02 14:45 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480689949-17957-1-git-send-email-d.schultz@phytec.de>
All i.MX6 SoCs have an OCOTP Controller with 4kbit fuses. The i.MX6SL is
an exception and has only 2kbit fuses.
In the TRM for the i.MX6DQ (IMX6QDRM - Rev 2, 06/2014) the fuses size is
described in chapter 46.1.1 with:
"32-bit word restricted program and read to 4Kbits of eFuse OTP(512x8)."
In the TRM for the i.MX6SL (IMX6SLRM - Rev 2, 06/2015) the fuses size is
described in chapter 34.1.1 with:
"32-bit word restricted program and read to 2 kbit of eFuse OTP(128x8)."
Since the Freescale Linux kernel OCOTP driver works with a fuses size of
2 kbit for the i.MX6SL, it looks like the TRM is wrong and the formula
to calculate the correct fuses size has to be 256x8.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
drivers/nvmem/imx-ocotp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
index d2f78d3..8482c53 100644
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -72,7 +72,7 @@ static int imx_ocotp_read(void *context, unsigned int offset,
static const struct of_device_id imx_ocotp_dt_ids[] = {
{ .compatible = "fsl,imx6q-ocotp", (void *)128 },
{ .compatible = "fsl,imx6ul-ocotp", (void *)128 },
- { .compatible = "fsl,imx6sl-ocotp", (void *)32 },
+ { .compatible = "fsl,imx6sl-ocotp", (void *)64 },
{ .compatible = "fsl,imx6sx-ocotp", (void *)128 },
{ },
};
--
1.9.1
^ permalink raw reply related
* [PATCH 2/3] ARM: dts: imx6ul: Add OCOTP node
From: Daniel Schultz @ 2016-12-02 14:45 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480689949-17957-1-git-send-email-d.schultz@phytec.de>
This device node adds OCOTP for the i.MX6UL SoC.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
arch/arm/boot/dts/imx6ul.dtsi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi
index c5c05fd..ee53795 100644
--- a/arch/arm/boot/dts/imx6ul.dtsi
+++ b/arch/arm/boot/dts/imx6ul.dtsi
@@ -849,6 +849,12 @@
reg = <0x021b0000 0x4000>;
};
+ ocotp: ocotp at 021bc000 {
+ compatible = "fsl,imx6ul-ocotp";
+ reg = <0x021bc000 0x4000>;
+ clocks = <&clks IMX6UL_CLK_OCOTP>;
+ };
+
lcdif: lcdif at 021c8000 {
compatible = "fsl,imx6ul-lcdif", "fsl,imx28-lcdif";
reg = <0x021c8000 0x4000>;
--
1.9.1
^ permalink raw reply related
* [PATCH 1/3] nvmem: imx-ocotp: Add support for i.MX6UL
From: Daniel Schultz @ 2016-12-02 14:45 UTC (permalink / raw)
To: linux-arm-kernel
This patch adds OCOTP support for the i.MX6UL SoC.
Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
---
Documentation/devicetree/bindings/nvmem/imx-ocotp.txt | 5 +++--
drivers/nvmem/imx-ocotp.c | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt
index 383d588..fcb1a48 100644
--- a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt
+++ b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt
@@ -1,13 +1,14 @@
Freescale i.MX6 On-Chip OTP Controller (OCOTP) device tree bindings
This binding represents the on-chip eFuse OTP controller found on
-i.MX6Q/D, i.MX6DL/S, i.MX6SL, and i.MX6SX SoCs.
+i.MX6Q/D, i.MX6DL/S, i.MX6SL, i.MX6SX and i.MX6UL SoCs.
Required properties:
- compatible: should be one of
"fsl,imx6q-ocotp" (i.MX6Q/D/DL/S),
"fsl,imx6sl-ocotp" (i.MX6SL), or
- "fsl,imx6sx-ocotp" (i.MX6SX), followed by "syscon".
+ "fsl,imx6sx-ocotp" (i.MX6SX), or
+ "fsl,imx6ul-ocotp" (i.MX6UL), followed by "syscon".
- reg: Should contain the register base and length.
- clocks: Should contain a phandle pointing to the gated peripheral clock.
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
index ac27b9b..d2f78d3 100644
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -71,6 +71,7 @@ static int imx_ocotp_read(void *context, unsigned int offset,
static const struct of_device_id imx_ocotp_dt_ids[] = {
{ .compatible = "fsl,imx6q-ocotp", (void *)128 },
+ { .compatible = "fsl,imx6ul-ocotp", (void *)128 },
{ .compatible = "fsl,imx6sl-ocotp", (void *)32 },
{ .compatible = "fsl,imx6sx-ocotp", (void *)128 },
{ },
--
1.9.1
^ permalink raw reply related
* [PATCH] ARM: dts: imx6q-utilite-pro: enable 2nd display pipeline
From: christopher.spinrath at rwth-aachen.de @ 2016-12-02 14:37 UTC (permalink / raw)
To: linux-arm-kernel
From: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
Apart from the already enabled Designware HDMI port, the Utilite Pro
has a second display pipeline which has the following shape:
IPU1 DI0 --> Parallel display --> tfp410 rgb24 to DVI encoder
--> HDMI connector.
Enable support for it.
In addition, since this pipeline is hardwired to IPU1, sever the link
between IPU1 and the SoC-internal Designware HDMI encoder forcing the
latter to be connected to IPU2 instead of IPU1. Otherwise, it is not
possible to drive both displays at high resolution due to the bandwidth
limitations of a single IPU.
Signed-off-by: Christopher Spinrath <christopher.spinrath@rwth-aachen.de>
---
Hi all,
the removal of the link between IPU1 and the Designware HDMI encoder is the
result of a discussion I had with Philipp Zabel:
https://lists.freedesktop.org/archives/dri-devel/2016-November/125399.html .
Altough it is not possible to connect anything else to IPU1 on the Utilite, this
approach has at least one disadvantage: if the resolution is low enough such
that a single IPU can handle both displays then muxing both displays to IPU1
would reduce the power consumption.
However, IMHO omitting the link IPU1 <--> DW HDMI is still the preferrable
solution since I'm not aware of any OS/driver that is capable of switching IPUs
or can handle the bandwidth limitation in a sane way. In particular, Linux is
unusable when both displays are supposed to be driven at high resolution and
both muxing options for the DW HDMI are available (this is not a userspace
issue; the system becomes almost unresponsive as soon as the kernel sets the
initial resolution).
Cheers,
Christopher
P.S.: this patch depends on the tfp410 bridge driver which has recently been
merged into drm-next.
arch/arm/boot/dts/imx6q-utilite-pro.dts | 115 ++++++++++++++++++++++++++++++++
1 file changed, 115 insertions(+)
diff --git a/arch/arm/boot/dts/imx6q-utilite-pro.dts b/arch/arm/boot/dts/imx6q-utilite-pro.dts
index 2200994..69bdd82 100644
--- a/arch/arm/boot/dts/imx6q-utilite-pro.dts
+++ b/arch/arm/boot/dts/imx6q-utilite-pro.dts
@@ -59,6 +59,33 @@
rtc1 = &snvs_rtc;
};
+ encoder {
+ compatible = "ti,tfp410";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port at 0 {
+ reg = <0>;
+
+ tfp410_in: endpoint {
+ remote-endpoint = <¶llel_display_out>;
+ };
+ };
+
+ port at 1 {
+ reg = <1>;
+
+ tfp410_out: endpoint {
+ remote-endpoint = <&hdmi_connector_in>;
+ };
+ };
+ };
+ };
+
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
@@ -72,6 +99,19 @@
};
};
+ hdmi-connector {
+ compatible = "hdmi-connector";
+
+ type = "a";
+ ddc-i2c-bus = <&i2c_dvi_ddc>;
+
+ port {
+ hdmi_connector_in: endpoint {
+ remote-endpoint = <&tfp410_out>;
+ };
+ };
+ };
+
i2cmux {
compatible = "i2c-mux-gpio";
pinctrl-names = "default";
@@ -105,8 +145,46 @@
#size-cells = <0>;
};
};
+
+ parallel-display {
+ compatible = "fsl,imx-parallel-display";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_ipu1>;
+
+ interface-pix-fmt = "rgb24";
+
+ port at 0 {
+ reg = <0>;
+
+ parallel_display_in: endpoint {
+ remote-endpoint = <&ipu1_di0_disp0>;
+ };
+ };
+
+ port at 1 {
+ reg = <1>;
+
+ parallel_display_out: endpoint {
+ remote-endpoint = <&tfp410_in>;
+ };
+ };
+ };
};
+/*
+ * A single IPU is not able to drive both display interfaces available on the
+ * Utilite Pro at high resolution due to its bandwidth limitation. Since the
+ * tfp410 encoder is wired up to IPU1, sever the link between IPU1 and the
+ * SoC-internal Designware HDMI encoder forcing the latter to be connected to
+ * IPU2 instead of IPU1.
+ */
+/delete-node/&ipu1_di0_hdmi;
+/delete-node/&hdmi_mux_0;
+/delete-node/&ipu1_di1_hdmi;
+/delete-node/&hdmi_mux_1;
+
&hdmi {
ddc-i2c-bus = <&i2c2>;
status = "okay";
@@ -151,6 +229,39 @@
>;
};
+ pinctrl_ipu1: ipu1grp {
+ fsl,pins = <
+ MX6QDL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK 0x38
+ MX6QDL_PAD_DI0_PIN15__IPU1_DI0_PIN15 0x38
+ MX6QDL_PAD_DI0_PIN2__IPU1_DI0_PIN02 0x38
+ MX6QDL_PAD_DI0_PIN3__IPU1_DI0_PIN03 0x38
+ MX6QDL_PAD_DISP0_DAT0__IPU1_DISP0_DATA00 0x38
+ MX6QDL_PAD_DISP0_DAT1__IPU1_DISP0_DATA01 0x38
+ MX6QDL_PAD_DISP0_DAT2__IPU1_DISP0_DATA02 0x38
+ MX6QDL_PAD_DISP0_DAT3__IPU1_DISP0_DATA03 0x38
+ MX6QDL_PAD_DISP0_DAT4__IPU1_DISP0_DATA04 0x38
+ MX6QDL_PAD_DISP0_DAT5__IPU1_DISP0_DATA05 0x38
+ MX6QDL_PAD_DISP0_DAT6__IPU1_DISP0_DATA06 0x38
+ MX6QDL_PAD_DISP0_DAT7__IPU1_DISP0_DATA07 0x38
+ MX6QDL_PAD_DISP0_DAT8__IPU1_DISP0_DATA08 0x38
+ MX6QDL_PAD_DISP0_DAT9__IPU1_DISP0_DATA09 0x38
+ MX6QDL_PAD_DISP0_DAT10__IPU1_DISP0_DATA10 0x38
+ MX6QDL_PAD_DISP0_DAT11__IPU1_DISP0_DATA11 0x38
+ MX6QDL_PAD_DISP0_DAT12__IPU1_DISP0_DATA12 0x38
+ MX6QDL_PAD_DISP0_DAT13__IPU1_DISP0_DATA13 0x38
+ MX6QDL_PAD_DISP0_DAT14__IPU1_DISP0_DATA14 0x38
+ MX6QDL_PAD_DISP0_DAT15__IPU1_DISP0_DATA15 0x38
+ MX6QDL_PAD_DISP0_DAT16__IPU1_DISP0_DATA16 0x38
+ MX6QDL_PAD_DISP0_DAT17__IPU1_DISP0_DATA17 0x38
+ MX6QDL_PAD_DISP0_DAT18__IPU1_DISP0_DATA18 0x38
+ MX6QDL_PAD_DISP0_DAT19__IPU1_DISP0_DATA19 0x38
+ MX6QDL_PAD_DISP0_DAT20__IPU1_DISP0_DATA20 0x38
+ MX6QDL_PAD_DISP0_DAT21__IPU1_DISP0_DATA21 0x38
+ MX6QDL_PAD_DISP0_DAT22__IPU1_DISP0_DATA22 0x38
+ MX6QDL_PAD_DISP0_DAT23__IPU1_DISP0_DATA23 0x38
+ >;
+ };
+
pinctrl_uart2: uart2grp {
fsl,pins = <
MX6QDL_PAD_GPIO_7__UART2_TX_DATA 0x1b0b1
@@ -194,6 +305,10 @@
};
};
+&ipu1_di0_disp0 {
+ remote-endpoint = <¶llel_display_in>;
+};
+
&pcie {
pcie at 0,0 {
reg = <0x000000 0 0 0 0>;
--
2.10.2
^ permalink raw reply related
* [PATCH v2 2/3] ARM: dts: sunxi: add support for Orange Pi Zero board
From: Icenowy Zheng @ 2016-12-02 14:32 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <efb30303-b9bb-7a7c-4478-af485991dd86@redhat.com>
02.12.2016, 22:30, "Hans de Goede" <hdegoede@redhat.com>:
> Hi,
>
> On 02-12-16 15:22, Icenowy Zheng wrote:
>> ?01.12.2016, 17:36, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
>>> ?On Mon, Nov 28, 2016 at 12:29:07AM +0000, Andr? Przywara wrote:
>>>> ??> Something more interesting happened.
>>>> ??>
>>>> ??> Xunlong made a add-on board for Orange Pi Zero, which exposes the
>>>> ??> two USB Controllers exported at expansion bus as USB Type-A
>>>> ??> connectors.
>>>> ??>
>>>> ??> Also it exposes a analog A/V jack and a microphone.
>>>> ??>
>>>> ??> Should I enable {e,o}hci{2.3} in the device tree?
>>>>
>>>> ??Actually we should do this regardless of this extension board. The USB
>>>> ??pins are not multiplexed and are exposed on user accessible pins (just
>>>> ??not soldered, but that's a detail), so I think they qualify for DT
>>>> ??enablement. And even if a user can't use them, it doesn't hurt to have
>>>> ??them (since they are not multiplexed).
>>>
>>> ?My main concern about this is that we'll leave regulators enabled by
>>> ?default, for a minority of users. And that minority will prevent to do
>>> ?a proper power management when the times come since we'll have to keep
>>> ?that behaviour forever.
>>
>> ?I think these users can add a 'fdt set /xxx/xxx status "disabled" ' .
>
> I don't think that will be necessary I'm pretty sure these extra usb
> ports do not have a regulator for the Vbus, they just hook directly
> to the 5V rail, can someone with a schematic check ?
We seems to have still no schematics for the add-on board.
But something is sure is that there's no any regulator-related pins
on the add-on pinout. There's only USB DM and DP pins.
So the Vbus must be directly connected to +5V.
>
> Regards,
>
> Hans
^ permalink raw reply
* [PATCH v2 2/3] ARM: dts: sunxi: add support for Orange Pi Zero board
From: Hans de Goede @ 2016-12-02 14:30 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <11498641480688550@web2g.yandex.ru>
Hi,
On 02-12-16 15:22, Icenowy Zheng wrote:
>
>
> 01.12.2016, 17:36, "Maxime Ripard" <maxime.ripard@free-electrons.com>:
>> On Mon, Nov 28, 2016 at 12:29:07AM +0000, Andr? Przywara wrote:
>>> > Something more interesting happened.
>>> >
>>> > Xunlong made a add-on board for Orange Pi Zero, which exposes the
>>> > two USB Controllers exported at expansion bus as USB Type-A
>>> > connectors.
>>> >
>>> > Also it exposes a analog A/V jack and a microphone.
>>> >
>>> > Should I enable {e,o}hci{2.3} in the device tree?
>>>
>>> Actually we should do this regardless of this extension board. The USB
>>> pins are not multiplexed and are exposed on user accessible pins (just
>>> not soldered, but that's a detail), so I think they qualify for DT
>>> enablement. And even if a user can't use them, it doesn't hurt to have
>>> them (since they are not multiplexed).
>>
>> My main concern about this is that we'll leave regulators enabled by
>> default, for a minority of users. And that minority will prevent to do
>> a proper power management when the times come since we'll have to keep
>> that behaviour forever.
>
> I think these users can add a 'fdt set /xxx/xxx status "disabled" ' .
I don't think that will be necessary I'm pretty sure these extra usb
ports do not have a regulator for the Vbus, they just hook directly
to the 5V rail, can someone with a schematic check ?
Regards,
Hans
^ permalink raw reply
* [PATCH v3 2/7] MFD: add stm32 general purpose timer driver
From: Lee Jones @ 2016-12-02 14:29 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1480673842-20804-3-git-send-email-benjamin.gaignard@st.com>
On Fri, 02 Dec 2016, Benjamin Gaignard wrote:
> This hardware block could at used at same time for PWM generation
> and IIO timer for other IPs like DAC, ADC or other timers.
> PWM and IIO timer configuration are mixed in the same registers
> so we need a multi fonction driver to be able to share those registers.
>
> version 2:
> - rename driver "stm32-gptimer" to be align with SoC documentation
> - only keep one compatible
> - use of_platform_populate() instead of devm_mfd_add_devices()
>
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
> ---
> drivers/mfd/Kconfig | 10 ++++++
> drivers/mfd/Makefile | 2 ++
> drivers/mfd/stm32-gptimer.c | 73 +++++++++++++++++++++++++++++++++++++++
> include/linux/mfd/stm32-gptimer.h | 62 +++++++++++++++++++++++++++++++++
> 4 files changed, 147 insertions(+)
> create mode 100644 drivers/mfd/stm32-gptimer.c
> create mode 100644 include/linux/mfd/stm32-gptimer.h
>
> diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> index c6df644..e75abcb 100644
> --- a/drivers/mfd/Kconfig
> +++ b/drivers/mfd/Kconfig
> @@ -1607,6 +1607,15 @@ config MFD_STW481X
> in various ST Microelectronics and ST-Ericsson embedded
> Nomadik series.
>
> +config MFD_STM32_GP_TIMER
> + tristate "Support for STM32 General Purpose Timer"
> + select MFD_CORE
> + select REGMAP
> + depends on ARCH_STM32
> + depends on OF
"|| COMPILE_TEST"?
> + help
> + Select this option to enable stm32 general purpose timer
I can see that. Tell us more about the device and what it does.
s/stm32/STM32/
> menu "Multimedia Capabilities Port drivers"
> depends on ARCH_SA1100
>
> @@ -1644,4 +1653,5 @@ config MFD_VEXPRESS_SYSREG
> on the ARM Ltd. Versatile Express board.
>
> endmenu
> +
Please remove this change. It has nothing to do with the set.
> endif
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index 9834e66..86353b9 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -211,3 +211,5 @@ obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
> obj-$(CONFIG_MFD_MT6397) += mt6397-core.o
>
> obj-$(CONFIG_MFD_ALTERA_A10SR) += altera-a10sr.o
> +
> +obj-$(CONFIG_MFD_STM32_GP_TIMER) += stm32-gptimer.o
> diff --git a/drivers/mfd/stm32-gptimer.c b/drivers/mfd/stm32-gptimer.c
> new file mode 100644
> index 0000000..54fb95c
> --- /dev/null
> +++ b/drivers/mfd/stm32-gptimer.c
> @@ -0,0 +1,73 @@
> +/*
> + * stm32-gptimer.c
Swap this out for a description.
> + * Copyright (C) STMicroelectronics 2016
'\n'
> + * Author: Benjamin Gaignard <benjamin.gaignard@st.com> for STMicroelectronics.
> + * License terms: GNU General Public License (GPL), version 2
> + */
> +
> +#include <linux/module.h>
> +#include <linux/of_platform.h>
> +#include <linux/reset.h>
> +
> +#include <linux/mfd/stm32-gptimer.h>
> +
> +static const struct regmap_config stm32_gptimer_regmap_cfg = {
> + .reg_bits = 32,
> + .val_bits = 32,
> + .reg_stride = sizeof(u32),
> + .max_register = 0x400,
> + .fast_io = true,
> +};
> +
> +static int stm32_gptimer_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct stm32_gptimer_dev *mfd;
s/mfd/ddata/
> + struct resource *res;
> + void __iomem *mmio;
> +
> + mfd = devm_kzalloc(dev, sizeof(*mfd), GFP_KERNEL);
> + if (!mfd)
> + return -ENOMEM;
> +
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res)
> + return -ENOMEM;
> +
Remove this 3 lines.
devm_ioremap_resource() does the checking and error printing for you.
> + mmio = devm_ioremap_resource(dev, res);
> + if (IS_ERR(mmio))
> + return PTR_ERR(mmio);
> +
> + mfd->regmap = devm_regmap_init_mmio_clk(dev, "clk_int", mmio,
> + &stm32_gptimer_regmap_cfg);
> + if (IS_ERR(mfd->regmap))
> + return PTR_ERR(mfd->regmap);
> +
> + mfd->clk = devm_clk_get(dev, NULL);
> + if (IS_ERR(mfd->clk))
> + return PTR_ERR(mfd->clk);
> +
> + platform_set_drvdata(pdev, mfd);
> +
> + return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
> +}
> +
> +static const struct of_device_id stm32_gptimer_of_match[] = {
> + {
> + .compatible = "st,stm32-gptimer",
> + },
One line:
{ .compatible = "st,stm32-gptimer" },
> +};
> +MODULE_DEVICE_TABLE(of, stm32_gptimer_of_match);
> +
> +static struct platform_driver stm32_gptimer_driver = {
> + .probe = stm32_gptimer_probe,
> + .driver = {
> + .name = "stm32-gptimer",
> + .of_match_table = stm32_gptimer_of_match,
> + },
Remove tabs before the '='s.
> +module_platform_driver(stm32_gptimer_driver);
> +
> +MODULE_DESCRIPTION("STMicroelectronics STM32 general purpose timer");
"General Purpose Timer"
> +MODULE_LICENSE("GPL");
"GPL v2"
> diff --git a/include/linux/mfd/stm32-gptimer.h b/include/linux/mfd/stm32-gptimer.h
> new file mode 100644
> index 0000000..f8c92de
> --- /dev/null
> +++ b/include/linux/mfd/stm32-gptimer.h
> @@ -0,0 +1,62 @@
> +/*
> + * stm32-gptimer.h
> + *
> + * Copyright (C) STMicroelectronics 2016
> + * Author: Benjamin Gaignard <benjamin.gaignard@st.com> for STMicroelectronics.
> + * License terms: GNU General Public License (GPL), version 2
> + */
Same comments as before.
> +#ifndef _LINUX_STM32_GPTIMER_H_
> +#define _LINUX_STM32_GPTIMER_H_
> +
> +#include <linux/clk.h>
> +#include <linux/regmap.h>
> +
> +#define TIM_CR1 0x00 /* Control Register 1 */
> +#define TIM_CR2 0x04 /* Control Register 2 */
> +#define TIM_SMCR 0x08 /* Slave mode control reg */
> +#define TIM_DIER 0x0C /* DMA/interrupt register */
> +#define TIM_SR 0x10 /* Status register */
> +#define TIM_EGR 0x14 /* Event Generation Reg */
> +#define TIM_CCMR1 0x18 /* Capt/Comp 1 Mode Reg */
> +#define TIM_CCMR2 0x1C /* Capt/Comp 2 Mode Reg */
> +#define TIM_CCER 0x20 /* Capt/Comp Enable Reg */
> +#define TIM_PSC 0x28 /* Prescaler */
> +#define TIM_ARR 0x2c /* Auto-Reload Register */
> +#define TIM_CCR1 0x34 /* Capt/Comp Register 1 */
> +#define TIM_CCR2 0x38 /* Capt/Comp Register 2 */
> +#define TIM_CCR3 0x3C /* Capt/Comp Register 3 */
> +#define TIM_CCR4 0x40 /* Capt/Comp Register 4 */
> +#define TIM_BDTR 0x44 /* Break and Dead-Time Reg */
> +
> +#define TIM_CR1_CEN BIT(0) /* Counter Enable */
> +#define TIM_CR1_ARPE BIT(7) /* Auto-reload Preload Ena */
> +#define TIM_CR2_MMS (BIT(4) | BIT(5) | BIT(6)) /* Master mode selection */
> +#define TIM_SMCR_SMS (BIT(0) | BIT(1) | BIT(2)) /* Slave mode selection */
> +#define TIM_SMCR_TS (BIT(4) | BIT(5) | BIT(6)) /* Trigger selection */
> +#define TIM_DIER_UIE BIT(0) /* Update interrupt */
> +#define TIM_SR_UIF BIT(0) /* Update interrupt flag */
> +#define TIM_EGR_UG BIT(0) /* Update Generation */
> +#define TIM_CCMR_PE BIT(3) /* Channel Preload Enable */
> +#define TIM_CCMR_M1 (BIT(6) | BIT(5)) /* Channel PWM Mode 1 */
> +#define TIM_CCER_CC1E BIT(0) /* Capt/Comp 1 out Ena */
> +#define TIM_CCER_CC1P BIT(1) /* Capt/Comp 1 Polarity */
> +#define TIM_CCER_CC1NE BIT(2) /* Capt/Comp 1N out Ena */
> +#define TIM_CCER_CC1NP BIT(3) /* Capt/Comp 1N Polarity */
> +#define TIM_CCER_CCXE (BIT(0) | BIT(4) | BIT(8) | BIT(12))
> +#define TIM_BDTR_BKE BIT(12) /* Break input enable */
> +#define TIM_BDTR_BKP BIT(13) /* Break input polarity */
> +#define TIM_BDTR_AOE BIT(14) /* Automatic Output Enable */
> +#define TIM_BDTR_MOE BIT(15) /* Main Output Enable */
> +
> +#define MAX_TIM_PSC 0xFFFF
> +
> +struct stm32_gptimer_dev {
Drop the "_dev" or replace with ddata.
> + /* Device data */
No need for this.
> + struct clk *clk;
> +
> + /* Registers mapping */
No need for this.
> + struct regmap *regmap;
> +};
> +
> +#endif
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox