Skip to contentSkip to conversation

arm64: Initial SoC support (ARMv8 RTSM model)

PATCH Superseded Catalin Marinas 4 participants 19 messages Dec 7, 2012 – Dec 19, 2012

Subsystems (17)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Catalin Marinas

author maintainer
#0 lore raw

cover arm64: Initial SoC support (ARMv8 RTSM model)

Hi,

This series adds support for the ARMv8 RTSM model. It is based on linux-next (it requires Pawel's patches for vexpress) and does not yet use GIC (waiting for the GICv2 move from arch/arm to drivers/irqchip to complete).

The aim is to have minimal or no SoC support at all. On vexpress, because the clocks must be initialised before populating the AMBA devices, I added an arch_initcall(). Platforms that rely solely on device driver probing don't need any platform code.

Still to be done is Documentation/arm64/soc.txt with requirements for SoC support on AArch64.

Comments welcome. Thanks.

Catalin Marinas (6):
arm: Move sp810.h to include/linux/amba/
arm64: Add dtbs target for building all the enabled dtb files
arm64: SoC infrastructure preparation
arm64: Populate the platform devices
arm64: ARMv8 RTSM model (SoC) support
arm64: Add simple earlyprintk support

Pawel Moll (1):
arm64: Add dts files for the ARMv8 RTSM model

 Documentation/arm64/memory.txt                     |   2 +
 arch/arm/plat-spear/restart.c                      |   2 +-
 arch/arm64/Kconfig                                 |   7 +-
 arch/arm64/Kconfig.debug                           |   9 +
 arch/arm64/Makefile                                |  20 +-
 arch/arm64/boot/.gitignore                         |   1 +
 arch/arm64/boot/Makefile                           |   8 +-
 arch/arm64/boot/dts/Makefile                       |   1 +
 arch/arm64/boot/dts/rtsm_ve-aemv8a.dts             | 154 ++++++++++++++
 arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi       | 234 +++++++++++++++++++++
 arch/arm64/boot/dts/skeleton.dtsi                  |  13 ++
 arch/arm64/configs/vexpress_defconfig              |  90 ++++++++
 arch/arm64/include/asm/io.h                        |   3 +
 arch/arm64/include/asm/memory.h                    |   1 +
 arch/arm64/include/asm/mmu.h                       |   1 +
 arch/arm64/kernel/Makefile                         |   1 +
 arch/arm64/kernel/early_printk.c                   | 118 +++++++++++
 arch/arm64/kernel/head.S                           |  12 +-
 arch/arm64/kernel/setup.c                          |   8 +
 arch/arm64/mm/mmu.c                                |  42 ++++
 arch/arm64/platforms/Kconfig                       |  11 +
 arch/arm64/platforms/Makefile                      |   1 +
 arch/arm64/platforms/vexpress.c                    |  38 ++++
 drivers/clk/versatile/clk-vexpress.c               |   3 +-
 drivers/net/ethernet/smsc/Kconfig                  |   4 +-
 .../asm/hardware => include/linux/amba}/sp810.h    |   0
 26 files changed, 768 insertions(+), 16 deletions(-)
 create mode 100644 arch/arm64/boot/dts/Makefile
 create mode 100644 arch/arm64/boot/dts/rtsm_ve-aemv8a.dts
 create mode 100644 arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
 create mode 100644 arch/arm64/boot/dts/skeleton.dtsi
 create mode 100644 arch/arm64/configs/vexpress_defconfig
 create mode 100644 arch/arm64/kernel/early_printk.c
 create mode 100644 arch/arm64/platforms/Kconfig
 create mode 100644 arch/arm64/platforms/Makefile
 create mode 100644 arch/arm64/platforms/vexpress.c
 rename {arch/arm/include/asm/hardware => include/linux/amba}/sp810.h (100%)
author maintainer
#1 lore raw

PATCH 1/7 arm: Move sp810.h to include/linux/amba/

Since it is now used by code under drivers/clk/ it makes sense for this file to be in a more generic location. This is required for building vexpress support on arm64.

---
 arch/arm/plat-spear/restart.c                                 | 2 +-
 drivers/clk/versatile/clk-vexpress.c                          | 3 +--
 {arch/arm/include/asm/hardware => include/linux/amba}/sp810.h | 0
 3 files changed, 2 insertions(+), 3 deletions(-)
 rename {arch/arm/include/asm/hardware => include/linux/amba}/sp810.h (100%)
arch/arm/plat-spear/restart.c +1 -1
index 4f99011..7d4616d 100644
@@ -11,8 +11,8 @@
  * warranty of any kind, whether express or implied.
  */
 #include <linux/io.h>
+#include <linux/amba/sp810.h>
 #include <asm/system_misc.h>
-#include <asm/hardware/sp810.h>
 #include <mach/spear.h>
 #include <mach/generic.h>
 
drivers/clk/versatile/clk-vexpress.c +1 -2
index c742ac7..4f83ff9 100644
@@ -11,6 +11,7 @@
  * Copyright (C) 2012 ARM Limited
  */
 
+#include <linux/amba/sp810.h>
 #include <linux/clkdev.h>
 #include <linux/clk-provider.h>
 #include <linux/err.h>
@@ -18,8 +19,6 @@
 #include <linux/of_address.h>
 #include <linux/vexpress.h>
 
-#include <asm/hardware/sp810.h>
-
 static struct clk *vexpress_sp810_timerclken[4];
 static DEFINE_SPINLOCK(vexpress_sp810_lock);
 
include/linux/amba/sp810.h renamed from arch/arm/include/asm/hardware/sp810.h +0 -0
similarity index 100%
rename from arch/arm/include/asm/hardware/sp810.h
rename to include/linux/amba/sp810.h
author maintainer
#2 lore raw

PATCH 2/7 arm64: Add dtbs target for building all the enabled dtb files

In reply to Catalin Marinas

Based on Rob Herring's patches for arch/arm, this patch adds a dtbs target to arch/arm64/boot/Makefile. In the process, also clean up the unused MACHINE variable.

---

I'll drop this patch once Rob pushes his version into linux-next (or mainline).

 arch/arm64/Makefile        | 17 +++++++++++------
 arch/arm64/boot/.gitignore |  1 +
 arch/arm64/boot/Makefile   |  8 +++++++-
 3 files changed, 19 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm64/boot/dts/Makefile
arch/arm64/Makefile +11 -6
index 364191f..64089bc 100644
@@ -41,20 +41,24 @@ libs-y		:= arch/arm64/lib/ $(libs-y)
 libs-y		+= $(LIBGCC)
 
 # Default target when executing plain make
-KBUILD_IMAGE := Image.gz
+KBUILD_IMAGE	:= Image.gz
+KBUILD_DTBS	:= dtbs
 
-all:	$(KBUILD_IMAGE)
+all:	$(KBUILD_IMAGE) $(KBUILD_DTBS)
 
 boot := arch/arm64/boot
 
 Image Image.gz: vmlinux
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
 zinstall install: vmlinux
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
+	$(Q)$(MAKE) $(build)=$(boot) $@
 
-%.dtb:
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
+%.dtb: scripts
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
+
+dtbs: scripts
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
@@ -63,6 +67,7 @@ archclean:
 define archhelp
   echo  '* Image.gz      - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
+  echo  '* dtbs          - Build device tree blobs for enabled boards'
   echo  '  install       - Install uncompressed kernel'
   echo  '  zinstall      - Install compressed kernel'
   echo  '                  Install using (your) ~/bin/installkernel or'
arch/arm64/boot/.gitignore +1 -0
index 8dab0bb..98af90a 100644
@@ -1,2 +1,3 @@
 Image
 Image.gz
+*.dtb
arch/arm64/boot/Makefile +7 -1
index eca209b..1ab9bf1 100644
@@ -14,6 +14,8 @@
 # Based on the ia64 boot/Makefile.
 #
 
+include $(srctree)/arch/arm64/boot/dts/Makefile
+
 targets := Image Image.gz
 
 $(obj)/Image: vmlinux FORCE
@@ -22,9 +24,13 @@ $(obj)/Image: vmlinux FORCE
 $(obj)/Image.gz: $(obj)/Image FORCE
 	$(call if_changed,gzip)
 
-$(obj)/%.dtb: $(src)/dts/%.dts
+targets += $(dtb-y)
+
+$(obj)/%.dtb: $(src)/dts/%.dts FORCE
 	$(call cmd,dtc)
 
+$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
+
 install: $(obj)/Image
 	$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
 	$(obj)/Image System.map "$(INSTALL_PATH)"
arch/arm64/boot/dts/Makefile new file +0 -0
new file mode 100644
index 0000000..e69de29
#3 lore raw

PATCH 2/7 arm64: Add dtbs target for building all the enabled dtb files

Quoted 9 lines · Catalin Marinas

Based on Rob Herring's patches for arch/arm, this patch adds a dtbs target to arch/arm64/boot/Makefile. In the process, also clean up the unused MACHINE variable.

---

I'll drop this patch once Rob pushes his version into linux-next (or mainline).

This and Stephen's dtb rule series are in linux-next now.

Rob

Quoted 96 lines
 arch/arm64/Makefile        | 17 +++++++++++------
 arch/arm64/boot/.gitignore |  1 +
 arch/arm64/boot/Makefile   |  8 +++++++-
 3 files changed, 19 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm64/boot/dts/Makefile
arch/arm64/Makefile +11 -6
index 364191f..64089bc 100644
@@ -41,20 +41,24 @@ libs-y		:= arch/arm64/lib/ $(libs-y)
 libs-y		+= $(LIBGCC)
 
 # Default target when executing plain make
-KBUILD_IMAGE := Image.gz
+KBUILD_IMAGE	:= Image.gz
+KBUILD_DTBS	:= dtbs
 
-all:	$(KBUILD_IMAGE)
+all:	$(KBUILD_IMAGE) $(KBUILD_DTBS)
 
 boot := arch/arm64/boot
 
 Image Image.gz: vmlinux
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
 zinstall install: vmlinux
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
+	$(Q)$(MAKE) $(build)=$(boot) $@
 
-%.dtb:
-	$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $(boot)/$@
+%.dtb: scripts
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
+
+dtbs: scripts
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
@@ -63,6 +67,7 @@ archclean:
 define archhelp
   echo  '* Image.gz      - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
   echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
+  echo  '* dtbs          - Build device tree blobs for enabled boards'
   echo  '  install       - Install uncompressed kernel'
   echo  '  zinstall      - Install compressed kernel'
   echo  '                  Install using (your) ~/bin/installkernel or'
arch/arm64/boot/.gitignore +1 -0
index 8dab0bb..98af90a 100644
@@ -1,2 +1,3 @@
 Image
 Image.gz
+*.dtb
arch/arm64/boot/Makefile +7 -1
index eca209b..1ab9bf1 100644
@@ -14,6 +14,8 @@
 # Based on the ia64 boot/Makefile.
 #
 
+include $(srctree)/arch/arm64/boot/dts/Makefile
+
 targets := Image Image.gz
 
 $(obj)/Image: vmlinux FORCE
@@ -22,9 +24,13 @@ $(obj)/Image: vmlinux FORCE
 $(obj)/Image.gz: $(obj)/Image FORCE
 	$(call if_changed,gzip)
 
-$(obj)/%.dtb: $(src)/dts/%.dts
+targets += $(dtb-y)
+
+$(obj)/%.dtb: $(src)/dts/%.dts FORCE
 	$(call cmd,dtc)
 
+$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
+
 install: $(obj)/Image
 	$(CONFIG_SHELL) $(srctree)/$(src)/install.sh $(KERNELRELEASE) \
 	$(obj)/Image System.map "$(INSTALL_PATH)"
arch/arm64/boot/dts/Makefile new file +0 -0
new file mode 100644
index 0000000..e69de29

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author maintainer
#4 lore raw

PATCH 2/7 arm64: Add dtbs target for building all the enabled dtb files

Quoted 5 lines · Rob Herring
Quoted 4 lines · Catalin Marinas

Based on Rob Herring's patches for arch/arm, this patch adds a dtbs target to arch/arm64/boot/Makefile. In the process, also clean up the unused MACHINE variable.

Quoted 7 lines
Quoted 5 lines

---

I'll drop this patch once Rob pushes his version into linux-next (or mainline).

This and Stephen's dtb rule series are in linux-next now.

One minor fix needed. Please merge or fold it, whatever is easier. Thanks.

-----------------------8<------------------------------

Quoted 1 line

From addc6b45f915f6bbab238a2edd2072f3b474e673 Mon Sep 17 00:00:00 2001

From: Catalin Marinas <[email protected]>
Date: Wed, 21 Nov 2012 11:44:59 +0000
Subject: [PATCH] arm64: Fix the dtbs target building

The arch/arm64/Makefile was not passing the right target to the boot/dts/Makefile.

---
 arch/arm64/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Makefile +1 -1
index 11c3599..c95c5cb 100644
@@ -58,7 +58,7 @@ zinstall install: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
 
 dtbs: scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
+	$(Q)$(MAKE) $(build)=$(boot)/dts dtbs
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
Applied
#5 lore raw

PATCH 2/7 arm64: Add dtbs target for building all the enabled dtb files

Quoted 24 lines · Catalin Marinas
Quoted 5 lines · Rob Herring
Quoted 4 lines · Catalin Marinas

Based on Rob Herring's patches for arch/arm, this patch adds a dtbs target to arch/arm64/boot/Makefile. In the process, also clean up the unused MACHINE variable.

Quoted 7 lines
Quoted 5 lines

---

I'll drop this patch once Rob pushes his version into linux-next (or mainline).

This and Stephen's dtb rule series are in linux-next now.

One minor fix needed. Please merge or fold it, whatever is easier. Thanks.

-----------------------8<------------------------------

From addc6b45f915f6bbab238a2edd2072f3b474e673 Mon Sep 17 00:00:00 2001
From: Catalin Marinas <[email protected]>
Date: Wed, 21 Nov 2012 11:44:59 +0000
Subject: [PATCH] arm64: Fix the dtbs target building

Quoted 4 lines

The arch/arm64/Makefile was not passing the right target to the boot/dts/Makefile.

Applied. Thanks.

Rob

Quoted 18 lines
---
 arch/arm64/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/Makefile +1 -1
index 11c3599..c95c5cb 100644
@@ -58,7 +58,7 @@ zinstall install: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
 
 dtbs: scripts
-	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
+	$(Q)$(MAKE) $(build)=$(boot)/dts dtbs
 
 # We use MRPROPER_FILES and CLEAN_FILES now
 archclean:
author maintainer
#6 lore raw

PATCH 3/7 arm64: SoC infrastructure preparation

In reply to Catalin Marinas

This patch adds the necessary Kconfig and Makefile modifications together with skeleton.dtsi for SoC support.

---
 arch/arm64/Kconfig                |  4 +++-
 arch/arm64/Makefile               |  3 ++-
 arch/arm64/boot/dts/skeleton.dtsi | 13 +++++++++++++
 3 files changed, 18 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm64/boot/dts/skeleton.dtsi
 create mode 100644 arch/arm64/platforms/Kconfig
 create mode 100644 arch/arm64/platforms/Makefile
arch/arm64/Kconfig +3 -1
index 0f87a49..e58a35a 100644
@@ -95,7 +95,9 @@ source "init/Kconfig"
 
 source "kernel/Kconfig.freezer"
 
-menu "System Type"
+menu "Platform selection"
+
+source "arch/arm64/platforms/Kconfig"
 
 endmenu
 
arch/arm64/Makefile +2 -1
index 64089bc..ddadd27 100644
@@ -36,7 +36,8 @@ TEXT_OFFSET := 0x00080000
 
 export	TEXT_OFFSET GZFLAGS
 
-core-y		+= arch/arm64/kernel/ arch/arm64/mm/
+core-y		+= arch/arm64/kernel/ arch/arm64/mm/ \
+		   arch/arm64/platforms/
 libs-y		:= arch/arm64/lib/ $(libs-y)
 libs-y		+= $(LIBGCC)
 
arch/arm64/boot/dts/skeleton.dtsi new file +13 -0
new file mode 100644
index 0000000..38ead82
@@ -0,0 +1,13 @@
+/*
+ * Skeleton device tree; the bare minimum needed to boot; just include and
+ * add a compatible value.  The bootloader will typically populate the memory
+ * node.
+ */
+
+/ {
+	#address-cells = <2>;
+	#size-cells = <1>;
+	chosen { };
+	aliases { };
+	memory { device_type = "memory"; reg = <0 0 0>; };
+};
arch/arm64/platforms/Kconfig new file +0 -0
new file mode 100644
index 0000000..e69de29
arch/arm64/platforms/Makefile new file +0 -0
new file mode 100644
index 0000000..e69de29
author maintainer
#7 lore raw

PATCH 4/7 arm64: Populate the platform devices

In reply to Catalin Marinas

This patch add a device_initcall() to populate the platform devices (of_default_bus_match_table). This allows SoC implementations that do not require earlier initcalls to avoid any platform-specific code under arch/arm64.

GIC and generic timer initialisation is done via FDT and CPU notifiers independently of the SoC code.

---
 arch/arm64/kernel/setup.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/kernel/setup.c +8 -0
index 7665a9b..894c1e5 100644
@@ -39,6 +39,7 @@
 #include <linux/proc_fs.h>
 #include <linux/memblock.h>
 #include <linux/of_fdt.h>
+#include <linux/of_platform.h>
 
 #include <asm/cputype.h>
 #include <asm/elf.h>
@@ -289,6 +290,13 @@ static int __init topology_init(void)
 }
 subsys_initcall(topology_init);
 
+static int __init arm64_device_probe(void)
+{
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+	return 0;
+}
+device_initcall(arm64_device_probe);
+
 static const char *hwcap_str[] = {
 	"fp",
 	"asimd",
author maintainer
#8 lore raw

PATCH 5/7 arm64: ARMv8 RTSM model (SoC) support

In reply to Catalin Marinas

This patch introduces support for the ARMv8 software model (Versatile Express platform). The aim is to reduce the SoC code to a single file and pass the driver specific data in FDT. Single kernel Image file for multiple SoCs is mandatory.

---
 arch/arm64/Kconfig                    |  3 ++
 arch/arm64/configs/vexpress_defconfig | 90 +++++++++++++++++++++++++++++++++++
 arch/arm64/platforms/Kconfig          | 11 +++++
 arch/arm64/platforms/Makefile         |  1 +
 arch/arm64/platforms/vexpress.c       | 38 +++++++++++++++
 drivers/net/ethernet/smsc/Kconfig     |  4 +-
 6 files changed, 145 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm64/configs/vexpress_defconfig
 create mode 100644 arch/arm64/platforms/vexpress.c
arch/arm64/Kconfig +3 -0
index e58a35a..d66a444 100644
@@ -91,6 +91,9 @@ config SWIOTLB
 config IOMMU_HELPER
 	def_bool SWIOTLB
 
+config GENERIC_GPIO
+	bool
+
 source "init/Kconfig"
 
 source "kernel/Kconfig.freezer"
arch/arm64/configs/vexpress_defconfig new file +90 -0

90 lines not on this page · raw message

arch/arm64/platforms/Kconfig +11 -0
index e69de29..3533d71 100644
@@ -0,0 +1,11 @@
+config ARCH_VEXPRESS
+	bool "ARMv8 software model (Versatile Express)"
+	select ARCH_REQUIRE_GPIOLIB
+	select ARM_AMBA
+	select ARM_GIC
+	select COMMON_CLK_VERSATILE
+	select GENERIC_GPIO
+	select VEXPRESS_CONFIG
+	help
+	  This enables support for the ARMv8 software model (Versatile
+	  Express).
arch/arm64/platforms/Makefile +1 -0
index e69de29..2e3fcba 100644
@@ -0,0 +1 @@
+obj-$(CONFIG_ARCH_VEXPRESS)	:= vexpress.o
arch/arm64/platforms/vexpress.c new file +38 -0
new file mode 100644
index 0000000..a484aac
@@ -0,0 +1,38 @@
+/*
+ * ARMv8 software model (Versatile Express) support
+ *
+ * Copyright (C) 2012 ARM Ltd.
+ *
+ * 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 program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/init.h>
+#include <linux/of_fdt.h>
+#include <linux/vexpress.h>
+
+static const char *vexpress_dt_match[] __initdata = {
+	"arm,vexpress",
+	NULL,
+};
+
+static int __init vexpress_init(void)
+{
+	if (!of_flat_dt_match(of_get_flat_dt_root(), vexpress_dt_match))
+		return 0;
+
+	vexpress_sysreg_of_early_init();
+	vexpress_clk_of_init();
+
+	return 0;
+}
+arch_initcall(vexpress_init);
drivers/net/ethernet/smsc/Kconfig +2 -2
index 5a689af..bb4c167 100644
@@ -5,7 +5,7 @@
 config NET_VENDOR_SMSC
 	bool "SMC (SMSC)/Western Digital devices"
 	default y
-	depends on ARM || ISA || MAC || ARM || MIPS || M32R || SUPERH || \
+	depends on ARM || ISA || MAC || ARM64 || MIPS || M32R || SUPERH || \
 		BLACKFIN || MN10300 || COLDFIRE || PCI || PCMCIA
 	---help---
 	  If you have a network (Ethernet) card belonging to this class, say Y
@@ -40,7 +40,7 @@ config SMC91X
 	select NET_CORE
 	select MII
 	depends on (ARM || M32R || SUPERH || MIPS || BLACKFIN || \
-		    MN10300 || COLDFIRE)
+		    MN10300 || COLDFIRE || ARM64)
 	---help---
 	  This is a driver for SMC's 91x series of Ethernet chipsets,
 	  including the SMC91C94 and the SMC91C111. Say Y if you want it
maintainer
#9 lore raw

PATCH 5/7 arm64: ARMv8 RTSM model (SoC) support

arch/arm64/platforms/Kconfig line 8

Quoted 13 lines · Catalin Marinas
arch/arm64/platforms/Kconfig +8 -0
index e69de29..3533d71 100644
@@ -0,0 +1,11 @@
+config ARCH_VEXPRESS
+       bool "ARMv8 software model (Versatile Express)"
+       select ARCH_REQUIRE_GPIOLIB
+       select ARM_AMBA
+       select ARM_GIC
+       select COMMON_CLK_VERSATILE
+       select GENERIC_GPIO
+       select VEXPRESS_CONFIG

I would expect that we can always select ARCH_REQUIRE_GPIOLIB, ARM_AMBA, ARM_GIC and GENERIC_GPIO for ARM64. Do you expect to see systems that don't have all of those?

Quoted 7 lines
arch/arm64/platforms/vexpress.c new file +6 -0
+static const char *vexpress_dt_match[] __initdata = {
+       "arm,vexpress",
+       NULL,
+};
+
+static int __init vexpress_init(void)

arch/arm64/platforms/vexpress.c line 38

Quoted 10 lines
arch/arm64/platforms/vexpress.c new file +10 -0
+{
+       if (!of_flat_dt_match(of_get_flat_dt_root(), vexpress_dt_match))
+               return 0;
+
+       vexpress_sysreg_of_early_init();
+       vexpress_clk_of_init();
+
+       return 0;
+}
+arch_initcall(vexpress_init);

I think it would be more appropriate for these two to check the presence of the individual devices, and move the caller into the actual device driver, rather than checking for the root node of the device tree.

There may be cases where we want to check the root node, but both the clock setup and the sysreg should both be detectable.

Arnd

author maintainer
#10 lore raw

PATCH 5/7 arm64: ARMv8 RTSM model (SoC) support

Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · Catalin Marinas
arch/arm64/platforms/Kconfig +4 -0
index e69de29..3533d71 100644
@@ -0,0 +1,11 @@
+config ARCH_VEXPRESS
+       bool "ARMv8 software model (Versatile Express)"
+       select ARCH_REQUIRE_GPIOLIB
+       select ARM_AMBA
Quoted 8 lines

arch/arm64/platforms/Kconfig line 8

Quoted 4 lines
arch/arm64/platforms/Kconfig +4 -0
+       select ARM_GIC
+       select COMMON_CLK_VERSATILE
+       select GENERIC_GPIO
+       select VEXPRESS_CONFIG

I would expect that we can always select ARCH_REQUIRE_GPIOLIB, ARM_AMBA, ARM_GIC and GENERIC_GPIO for ARM64. Do you expect to see systems that don't have all of those?

I'm not entirely sure about ARM_AMBA though we can probably leave it on. As for the GIC, that's GICv2 and we'll get a new version with a new driver (too different to share the same code).

So we can either select all GICs or allow interrupt controllers to be selectable but I only see this useful if we don't have any ARCH_* Kconfig entries, just defconfigs for various platforms. The latter would be nice but current vexpress support defines ARCH_VEXPRESS under arch/arm/.

Quoted 22 lines
Quoted 7 lines
arch/arm64/platforms/vexpress.c new file +6 -0
+static const char *vexpress_dt_match[] __initdata = {
+       "arm,vexpress",
+       NULL,
+};
+
+static int __init vexpress_init(void)

arch/arm64/platforms/vexpress.c line 38

Quoted 10 lines
arch/arm64/platforms/vexpress.c new file +10 -0
+{
+       if (!of_flat_dt_match(of_get_flat_dt_root(), vexpress_dt_match))
+               return 0;
+
+       vexpress_sysreg_of_early_init();
+       vexpress_clk_of_init();
+
+       return 0;
+}
+arch_initcall(vexpress_init);

I think it would be more appropriate for these two to check the presence of the individual devices, and move the caller into the actual device driver, rather than checking for the root node of the device tree.

Quoted 2 lines

There may be cases where we want to check the root node, but both the clock setup and the sysreg should both be detectable.

I cc'ed Pawel as well since it's touching his code. We've been through several versions internally and didn't find a clear winner. Currently, vexpress_clk_of_init() requires vexpress_sysreg_of_early_init() to be called first. Pawel has a patch to allow sysreg self-initialisation when called from vexpress_clk_of_init().

This leaves us with a way to call vexpress_clk_of_init() directly from clk-vexpress.c. There are two ways:

1. arch_initcall() in clk-vexpress.c, checking for the DT match.
2. driver registration (arch_initcall) and later probing when of_platform_populate() is called from the arch/arm64 code.

The 2nd option above relies on the DT order since the clocks must be registered before any AMBA device is registered, so I'm not too keen. This leaves us with option 1 or any other suggestion you may have.

Signature · 1 line
Catalin
#11 lore raw

PATCH 5/7 arm64: ARMv8 RTSM model (SoC) support

Quoted 34 lines · Catalin Marinas
Quoted 22 lines
Quoted 7 lines
(quoted diff) +6 -0
+static const char *vexpress_dt_match[] __initdata = {
+       "arm,vexpress",
+       NULL,
+};
+
+static int __init vexpress_init(void)

Review

Quoted 10 lines
(quoted diff) +10 -0
+{
+       if (!of_flat_dt_match(of_get_flat_dt_root(), vexpress_dt_match))
+               return 0;
+
+       vexpress_sysreg_of_early_init();
+       vexpress_clk_of_init();
+
+       return 0;
+}
+arch_initcall(vexpress_init);

I think it would be more appropriate for these two to check the presence of the individual devices, and move the caller into the actual device driver, rather than checking for the root node of the device tree.

Quoted 2 lines

There may be cases where we want to check the root node, but both the clock setup and the sysreg should both be detectable.

I cc'ed Pawel as well since it's touching his code. We've been through several versions internally and didn't find a clear winner. Currently, vexpress_clk_of_init() requires vexpress_sysreg_of_early_init() to be called first. Pawel has a patch to allow sysreg self-initialisation when called from vexpress_clk_of_init().

This leaves us with a way to call vexpress_clk_of_init() directly from clk-vexpress.c. There are two ways:

Quoted 7 lines

1. arch_initcall() in clk-vexpress.c, checking for the DT match.
2. driver registration (arch_initcall) and later probing when of_platform_populate() is called from the arch/arm64 code.

The 2nd option above relies on the DT order since the clocks must be registered before any AMBA device is registered, so I'm not too keen. This leaves us with option 1 or any other suggestion you may have.

The idea I had was to associate the root of the device tree with the "platform" device, see below. This makes it possible to write a platform driver for the particular platform, so the code for the vexpress could look more or less like this...

static int __devinit vexpress_probe(struct platform_device *dev)

{
        vexpress_sysreg_of_early_init();
        vexpress_clk_of_init();

        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);

        return 0;
}
static const struct of_device_id vexpress_match[] = {
        { .compatible = "arm,vexpress", },
        {}
};
static struct platform_driver vexpress_driver = {
        .driver = {
                .name = "vexpress",
                .of_match_table = vexpress_match,
        },
        .probe = vexpress_probe,
};

static int __init vexpress_init(void)

{
        return platform_driver_register(&vexpress_driver);
}

arch_initcall(vexpress_init);

... and live, for example, in drivers/platforms/vexpress.c. I think it would neatly fit the device model - a platform driver for the "platform" platform device ;-)

Pawe?

8<---------------------------

Quoted 1 line

From a19b22ed4d5042a2249f0aa41633cbbc7310d5f3 Mon Sep 17 00:00:00 2001

From: Pawel Moll <[email protected]>
Date: Mon, 26 Nov 2012 12:35:10 +0000
Subject: [PATCH] platform: Make platform_bus device a platform device

... describing the root of the device tree, so one can write a platform driver initializing the platform.

---
 arch/arm/mach-imx/devices/devices.c |    4 ++--
 arch/unicore32/kernel/puv3-core.c   |    2 +-
 arch/unicore32/kernel/puv3-nb0916.c |    6 +++---
 drivers/base/platform.c             |   18 ++++++++++++------
 drivers/char/tile-srom.c            |    2 +-
 drivers/mmc/host/sdhci-pltfm.c      |    2 +-
 drivers/scsi/hosts.c                |    2 +-
 include/linux/platform_device.h     |    2 +-
 8 files changed, 22 insertions(+), 16 deletions(-)
arch/arm/mach-imx/devices/devices.c +2 -2
index 1b37482..ac68960 100644
@@ -24,12 +24,12 @@
 
 struct device mxc_aips_bus = {
 	.init_name	= "mxc_aips",
-	.parent		= &platform_bus,
+	.parent		= &platform_bus.dev,
 };
 
 struct device mxc_ahb_bus = {
 	.init_name	= "mxc_ahb",
-	.parent		= &platform_bus,
+	.parent		= &platform_bus.dev,
 };
 
 int __init mxc_device_init(void)
arch/unicore32/kernel/puv3-core.c +1 -1
index 254adee..28d1387 100644
@@ -272,7 +272,7 @@ void __init puv3_core_init(void)
 	platform_device_register_simple("PKUnity-v3-UART", 1,
 			puv3_uart1_resources, ARRAY_SIZE(puv3_uart1_resources));
 	platform_device_register_simple("PKUnity-v3-AC97", -1, NULL, 0);
-	platform_device_register_resndata(&platform_bus, "musb_hdrc", -1,
+	platform_device_register_resndata(&platform_bus.dev, "musb_hdrc", -1,
 			puv3_usb_resources, ARRAY_SIZE(puv3_usb_resources),
 			&puv3_usb_plat, sizeof(puv3_usb_plat));
 }
arch/unicore32/kernel/puv3-nb0916.c +3 -3
index 181108b..b8f6fb3 100644
@@ -111,13 +111,13 @@ int __init mach_nb0916_init(void)
 	platform_device_register_simple("PKUnity-v3-I2C", -1,
 			puv3_i2c_resources, ARRAY_SIZE(puv3_i2c_resources));
 
-	platform_device_register_data(&platform_bus, "pwm-backlight", -1,
+	platform_device_register_data(&platform_bus.dev, "pwm-backlight", -1,
 			&nb0916_backlight_data, sizeof(nb0916_backlight_data));
 
-	platform_device_register_data(&platform_bus, "gpio-keys", -1,
+	platform_device_register_data(&platform_bus.dev, "gpio-keys", -1,
 			&nb0916_gpio_button_data, sizeof(nb0916_gpio_button_data));
 
-	platform_device_register_resndata(&platform_bus, "physmap-flash", -1,
+	platform_device_register_resndata(&platform_bus.dev, "physmap-flash", -1,
 			&physmap_flash_resource, 1,
 			&physmap_flash_data, sizeof(physmap_flash_data));
 
drivers/base/platform.c +12 -6
index 9c16b6f..28e1f86 100644
@@ -32,8 +32,8 @@ static DEFINE_IDA(platform_devid_ida);
 #define to_platform_driver(drv)	(container_of((drv), struct platform_driver, \
 				 driver))
 
-struct device platform_bus = {
-	.init_name	= "platform",
+struct platform_device platform_bus = {
+	.name	= "platform",
 };
 EXPORT_SYMBOL_GPL(platform_bus);
 
@@ -285,7 +285,7 @@ int platform_device_add(struct platform_device *pdev)
 		return -EINVAL;
 
 	if (!pdev->dev.parent)
-		pdev->dev.parent = &platform_bus;
+		pdev->dev.parent = &platform_bus.dev;
 
 	pdev->dev.bus = &platform_bus_type;
 
@@ -888,12 +888,18 @@ int __init platform_bus_init(void)
 
 	early_platform_cleanup();
 
-	error = device_register(&platform_bus);
+	dev_set_name(&platform_bus.dev, "%s", platform_bus.name);
+	error = device_register(&platform_bus.dev);
 	if (error)
 		return error;
 	error =  bus_register(&platform_bus_type);
-	if (error)
-		device_unregister(&platform_bus);
+	if (!error) {
+		platform_bus.dev.of_node = allnodes;
+		platform_bus.dev.bus = &platform_bus_type;
+		bus_add_device(&platform_bus.dev);
+	} else {
+		device_unregister(&platform_bus.dev);
+	}
 	return error;
 }
 
drivers/char/tile-srom.c +1 -1
index 3b22a60..9e7ffdc 100644
@@ -369,7 +369,7 @@ static int srom_setup_minor(struct srom_dev *srom, int index)
 		       SROM_PAGE_SIZE_OFF, sizeof(srom->page_size)) < 0)
 		return -EIO;
 
-	dev = device_create(srom_class, &platform_bus,
+	dev = device_create(srom_class, &platform_bus.dev,
 			    MKDEV(srom_major, index), srom, "%d", index);
 	return IS_ERR(dev) ? PTR_ERR(dev) : 0;
 }
drivers/mmc/host/sdhci-pltfm.c +1 -1
index 2716445..246b702 100644
@@ -115,7 +115,7 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev,
 		dev_err(&pdev->dev, "Invalid iomem size!\n");
 
 	/* Some PCI-based MFD need the parent here */
-	if (pdev->dev.parent != &platform_bus && !np)
+	if (pdev->dev.parent != &platform_bus.dev && !np)
 		host = sdhci_alloc_host(pdev->dev.parent, sizeof(*pltfm_host));
 	else
 		host = sdhci_alloc_host(&pdev->dev, sizeof(*pltfm_host));
drivers/scsi/hosts.c +1 -1
index 593085a..bb4be31 100644
@@ -217,7 +217,7 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 		goto fail;
 
 	if (!shost->shost_gendev.parent)
-		shost->shost_gendev.parent = dev ? dev : &platform_bus;
+		shost->shost_gendev.parent = dev ? dev : &platform_bus.dev;
 	if (!dma_dev)
 		dma_dev = shost->shost_gendev.parent;
 
include/linux/platform_device.h +1 -1
index 5711e95..06738a0 100644
@@ -44,7 +44,7 @@ extern int platform_device_register(struct platform_device *);
 extern void platform_device_unregister(struct platform_device *);
 
 extern struct bus_type platform_bus_type;
-extern struct device platform_bus;
+extern struct platform_device platform_bus;
 
 extern void arch_setup_pdev_archdata(struct platform_device *);
 extern struct resource *platform_get_resource(struct platform_device *, unsigned int, unsigned int);
Signature · 1 line
1.7.10.4
author maintainer
#12 lore raw

PATCH 5/7 arm64: ARMv8 RTSM model (SoC) support

Quoted 49 lines · Pawel Moll
Quoted 34 lines · Catalin Marinas
Quoted 22 lines
Quoted 7 lines
(quoted diff) +6 -0
+static const char *vexpress_dt_match[] __initdata = {
+       "arm,vexpress",
+       NULL,
+};
+
+static int __init vexpress_init(void)

Review

Quoted 10 lines
(quoted diff) +10 -0
+{
+       if (!of_flat_dt_match(of_get_flat_dt_root(), vexpress_dt_match))
+               return 0;
+
+       vexpress_sysreg_of_early_init();
+       vexpress_clk_of_init();
+
+       return 0;
+}
+arch_initcall(vexpress_init);

I think it would be more appropriate for these two to check the presence of the individual devices, and move the caller into the actual device driver, rather than checking for the root node of the device tree.

Quoted 2 lines

There may be cases where we want to check the root node, but both the clock setup and the sysreg should both be detectable.

I cc'ed Pawel as well since it's touching his code. We've been through several versions internally and didn't find a clear winner. Currently, vexpress_clk_of_init() requires vexpress_sysreg_of_early_init() to be called first. Pawel has a patch to allow sysreg self-initialisation when called from vexpress_clk_of_init().

This leaves us with a way to call vexpress_clk_of_init() directly from clk-vexpress.c. There are two ways:

Quoted 7 lines

1. arch_initcall() in clk-vexpress.c, checking for the DT match.
2. driver registration (arch_initcall) and later probing when of_platform_populate() is called from the arch/arm64 code.

The 2nd option above relies on the DT order since the clocks must be registered before any AMBA device is registered, so I'm not too keen. This leaves us with option 1 or any other suggestion you may have.

The idea I had was to associate the root of the device tree with the "platform" device, see below. This makes it possible to write a platform driver for the particular platform, so the code for the vexpress could look more or less like this...

static int __devinit vexpress_probe(struct platform_device *dev)

Quoted 8 lines
{
        vexpress_sysreg_of_early_init();
        vexpress_clk_of_init();

        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);

        return 0;
}

This changes the way vexpress_probe() is done. Either direct DT match check or platform device probing work for me. But I think Arnd's suggestion was to get rid of the platform file entirely and just get the clocks register/probe themselves. Unfortunately, the clocks subsystem doesn't really follow the device/driver model and they need to be initialised before registering any AMBA device. I don't really have a clean solution here.

Signature · 1 line
Catalin
author maintainer
#13 lore raw

PATCH 5/7 arm64: ARMv8 RTSM model (SoC) support

In reply to Catalin Marinas
Quoted 33 lines · Catalin Marinas
Quoted 23 lines · Arnd Bergmann
Quoted 7 lines · Catalin Marinas
arch/arm64/platforms/vexpress.c new file +6 -0
+static const char *vexpress_dt_match[] __initdata = {
+       "arm,vexpress",
+       NULL,
+};
+
+static int __init vexpress_init(void)

arch/arm64/platforms/vexpress.c line 38

Quoted 10 lines
arch/arm64/platforms/vexpress.c new file +10 -0
+{
+       if (!of_flat_dt_match(of_get_flat_dt_root(), vexpress_dt_match))
+               return 0;
+
+       vexpress_sysreg_of_early_init();
+       vexpress_clk_of_init();
+
+       return 0;
+}
+arch_initcall(vexpress_init);

I think it would be more appropriate for these two to check the presence of the individual devices, and move the caller into the actual device driver, rather than checking for the root node of the device tree.

Quoted 2 lines

There may be cases where we want to check the root node, but both the clock setup and the sysreg should both be detectable.

I cc'ed Pawel as well since it's touching his code. We've been through several versions internally and didn't find a clear winner. Currently, vexpress_clk_of_init() requires vexpress_sysreg_of_early_init() to be called first. Pawel has a patch to allow sysreg self-initialisation when called from vexpress_clk_of_init().

Quoted 6 lines

This leaves us with a way to call vexpress_clk_of_init() directly from clk-vexpress.c. There are two ways:

1. arch_initcall() in clk-vexpress.c, checking for the DT match.
2. driver registration (arch_initcall) and later probing when of_platform_populate() is called from the arch/arm64 code.

After some more thinking, none of these would work for arch/arm since vexpress_clk_of_init() is called very early via the time_init() ... v2m_dt_timer_init(). On arm64 we rely on the architected timers to be always present but this assumption is not valid on arm where clocks would need to be initialised early.

While I'd really like to get rid of the SoC code in arch/arm64, the best place I see for the vexpress_clk_of_init() call is still the arch code (unless we add #ifdefs in the clk-vexpress.c code).

Signature · 1 line
Catalin
maintainer
#14 lore raw

PATCH 5/7 arm64: ARMv8 RTSM model (SoC) support

Quoted 9 lines · Catalin Marinas

After some more thinking, none of these would work for arch/arm since vexpress_clk_of_init() is called very early via the time_init() ... v2m_dt_timer_init(). On arm64 we rely on the architected timers to be always present but this assumption is not valid on arm where clocks would need to be initialised early.

While I'd really like to get rid of the SoC code in arch/arm64, the best place I see for the vexpress_clk_of_init() call is still the arch code (unless we add #ifdefs in the clk-vexpress.c code).

I think I'd prefer the #ifdef in this case. Ideally, we would get rid of most of the early init functions in ARM as well, but that is a different battle for now. Getting the arch/arm64 to look nice IMHO is more important in this case, and we can fix the 32 bit version later.

Arnd

#15 lore raw

PATCH 5/7 arm64: ARMv8 RTSM model (SoC) support

Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Catalin Marinas

After some more thinking, none of these would work for arch/arm since vexpress_clk_of_init() is called very early via the time_init() ... v2m_dt_timer_init(). On arm64 we rely on the architected timers to be always present but this assumption is not valid on arm where clocks would need to be initialised early.

While I'd really like to get rid of the SoC code in arch/arm64, the best place I see for the vexpress_clk_of_init() call is still the arch code (unless we add #ifdefs in the clk-vexpress.c code).

Quoted 5 lines

I think I'd prefer the #ifdef in this case. Ideally, we would get rid of most of the early init functions in ARM as well, but that is a different battle for now. Getting the arch/arm64 to look nice IMHO is more important in this case, and we can fix the 32 bit version later.

I'm sure we'll be able to make the vexpress_clk_* functions behave correctly, either with a help of #ifdef or in some other way - don't concern yourself with this detail.

The bigger fish to fry is the generic initialization of the clocks (as
in: when to call the of_clk_init() and how to gather all possible of_match-es)...

Pawe?

author maintainer
#16 lore raw

PATCH 5/7 arm64: ARMv8 RTSM model (SoC) support

Quoted 18 lines · Pawel Moll
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Catalin Marinas

After some more thinking, none of these would work for arch/arm since vexpress_clk_of_init() is called very early via the time_init() ... v2m_dt_timer_init(). On arm64 we rely on the architected timers to be always present but this assumption is not valid on arm where clocks would need to be initialised early.

While I'd really like to get rid of the SoC code in arch/arm64, the best place I see for the vexpress_clk_of_init() call is still the arch code (unless we add #ifdefs in the clk-vexpress.c code).

Quoted 5 lines

I think I'd prefer the #ifdef in this case. Ideally, we would get rid of most of the early init functions in ARM as well, but that is a different battle for now. Getting the arch/arm64 to look nice IMHO is more important in this case, and we can fix the 32 bit version later.

Quoted 7 lines

I'm sure we'll be able to make the vexpress_clk_* functions behave correctly, either with a help of #ifdef or in some other way - don't concern yourself with this detail.

The bigger fish to fry is the generic initialization of the clocks (as
in: when to call the of_clk_init() and how to gather all possible of_match-es)...

Some code I was just trying below. But I have to sort out some initialisation order and can do an arch_initcall(vexpress_clk_of_init) in clk-vexpress.c together with your patch for the self-initialising vexpress sysregs.

drivers/clk/versatile/clk-vexpress.c +13 -11
index 4f83ff9..11f2da6 100644
@@ -98,21 +98,11 @@ struct clk *vexpress_sp810_of_get(struct of_phandle_args *clkspec, void *data)
 	return vexpress_sp810_timerclken[clkspec->args[0]];
 }
 
-static const __initconst struct of_device_id vexpress_fixed_clk_match[] = {
-	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
-	{ .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
-	{}
-};
-
-void __init vexpress_clk_of_init(void)
+static void __init vexpress_sp810_of_setup(struct device_node *node)
 {
-	struct device_node *node;
 	struct clk *clk;
 	struct clk *refclk, *timclk;
 
-	of_clk_init(vexpress_fixed_clk_match);
-
-	node = of_find_compatible_node(NULL, NULL, "arm,sp810");
 	vexpress_sp810_init(of_iomap(node, 0));
 	of_clk_add_provider(node, vexpress_sp810_of_get, NULL);
 
@@ -138,4 +128,16 @@ void __init vexpress_clk_of_init(void)
 				"v2m-timer1", "sp804"));
 }
 
+static const __initconst struct of_device_id vexpress_clk_match[] = {
+	{ .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
+	{ .compatible = "arm,vexpress-osc", .data = vexpress_osc_of_setup, },
+	{ .compatible = "arm,sp810", .data = vexpress_sp810_of_setup, },
+	{}
+};
+
+void __init vexpress_clk_of_init(void)
+{
+	of_clk_init(vexpress_clk_match);
+}
+
 #endif
Signature · 1 line
Catalin
author maintainer
#17 lore raw

PATCH 6/7 arm64: Add dts files for the ARMv8 RTSM model

In reply to Catalin Marinas

From: Pawel Moll <[email protected]>

---
 arch/arm64/boot/dts/Makefile                 |   1 +
 arch/arm64/boot/dts/rtsm_ve-aemv8a.dts       | 154 ++++++++++++++++++
 arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi | 234 +++++++++++++++++++++++++++
 3 files changed, 389 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rtsm_ve-aemv8a.dts
 create mode 100644 arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi
arch/arm64/boot/dts/Makefile +1 -0
index e69de29..d7837c0 100644
@@ -0,0 +1 @@
+dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb
arch/arm64/boot/dts/rtsm_ve-aemv8a.dts new file +154 -0

154 lines not on this page · raw message

arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi new file +234 -0

234 lines not on this page · raw message

author maintainer
#18 lore raw

PATCH 7/7 arm64: Add simple earlyprintk support

In reply to Catalin Marinas

This patch adds support for "earlyprintk=" parameter on the kernel command line. The format is:

earlyprintk=<name>[,<addr>][,<options>]

where <name> is the name of the (UART) device, e.g. "pl011", <addr> is the I/O address. The <options> aren't currently used.

The mapping of the earlyprintk device is done very early during kernel boot and there are restrictions on which functions it can call. A special early_io_map() function is added which creates the mapping from the pre-defined EARLY_IOBASE to the device I/O address passed via the kernel parameter. The pgd entry corresponding to EARLY_IOBASE is pre-populated in head.S during kernel boot.

Only PL011 is currently supported and it is assumed that the interface is already initialised by the boot loader before the kernel is started.

---
 Documentation/arm64/memory.txt   |   2 +
 arch/arm64/Kconfig.debug         |   9 +++
 arch/arm64/include/asm/io.h      |   3 +
 arch/arm64/include/asm/memory.h  |   1 +
 arch/arm64/include/asm/mmu.h     |   1 +
 arch/arm64/kernel/Makefile       |   1 +
 arch/arm64/kernel/early_printk.c | 118 +++++++++++++++++++++++++++++++++++++++
 arch/arm64/kernel/head.S         |  12 +++-
 arch/arm64/mm/mmu.c              |  42 ++++++++++++++
 9 files changed, 187 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm64/kernel/early_printk.c
Documentation/arm64/memory.txt +2 -0
index d758702..5f583af 100644
@@ -35,6 +35,8 @@ ffffffbc00000000	ffffffbdffffffff	   8GB		vmemmap
 
 ffffffbe00000000	ffffffbffbbfffff	  ~8GB		[guard, future vmmemap]
 
+ffffffbffbc00000	ffffffbffbdfffff	   2MB		earlyprintk device
+
 ffffffbffbe00000	ffffffbffbe0ffff	  64KB		PCI I/O space
 
 ffffffbbffff0000	ffffffbcffffffff	  ~2MB		[guard]
arch/arm64/Kconfig.debug +9 -0
index d7553f2..79871cd 100644
@@ -24,4 +24,13 @@ config DEBUG_STACK_USAGE
 	  Enables the display of the minimum amount of free stack which each
 	  task has ever had available in the sysrq-T output.
 
+config EARLY_PRINTK
+	bool "Early printk support"
+	default y
+	help
+	  Say Y here if you want to have an early console using the
+	  earlyprintk=<name>[,<addr>][,<options>] kernel parameter. It
+	  is assumed that the early console device has been initialised
+	  by the boot loader prior to starting the Linux kernel.
+
 endmenu
arch/arm64/include/asm/io.h +3 -0
index d2f05a6..57f12c9 100644
@@ -230,6 +230,9 @@ extern void __iounmap(volatile void __iomem *addr);
 #define ioremap_wc(addr, size)		__ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
 #define iounmap				__iounmap
 
+#define PROT_SECT_DEFAULT	(PMD_TYPE_SECT | PMD_SECT_AF)
+#define PROT_SECT_DEVICE_nGnRE	(PROT_SECT_DEFAULT | PTE_PXN | PTE_UXN | PMD_ATTRINDX(MT_DEVICE_nGnRE))
+
 #define ARCH_HAS_IOREMAP_WC
 #include <asm-generic/iomap.h>
 
arch/arm64/include/asm/memory.h +1 -0
index 1cac16a..381f556 100644
@@ -43,6 +43,7 @@
 #define PAGE_OFFSET		UL(0xffffffc000000000)
 #define MODULES_END		(PAGE_OFFSET)
 #define MODULES_VADDR		(MODULES_END - SZ_64M)
+#define EARLYCON_IOBASE		(MODULES_VADDR - SZ_4M)
 #define VA_BITS			(39)
 #define TASK_SIZE_64		(UL(1) << VA_BITS)
 
arch/arm64/include/asm/mmu.h +1 -0
index d4f7fd5..2494fc0 100644
@@ -26,5 +26,6 @@ typedef struct {
 
 extern void paging_init(void);
 extern void setup_mm_for_reboot(void);
+extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt);
 
 #endif
arch/arm64/kernel/Makefile +1 -0
index e2caff1..623c098 100644
@@ -16,6 +16,7 @@ arm64-obj-$(CONFIG_MODULES)		+= arm64ksyms.o module.o
 arm64-obj-$(CONFIG_SMP)			+= smp.o
 arm64-obj-$(CONFIG_HW_PERF_EVENTS)	+= perf_event.o
 arm64-obj-$(CONFIG_HAVE_HW_BREAKPOINT)+= hw_breakpoint.o
+arm64-obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 
 obj-y					+= $(arm64-obj-y) vdso/
 obj-m					+= $(arm64-obj-m)
arch/arm64/kernel/early_printk.c new file +118 -0

118 lines not on this page · raw message

arch/arm64/kernel/head.S +10 -2
index a2f02b6..4fcc379 100644
@@ -81,10 +81,8 @@
 
 #ifdef CONFIG_ARM64_64K_PAGES
 #define MM_MMUFLAGS	PTE_ATTRINDX(MT_NORMAL) | PTE_FLAGS
-#define IO_MMUFLAGS	PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_XN | PTE_FLAGS
 #else
 #define MM_MMUFLAGS	PMD_ATTRINDX(MT_NORMAL) | PMD_FLAGS
-#define IO_MMUFLAGS	PMD_ATTRINDX(MT_DEVICE_nGnRE) | PMD_SECT_XN | PMD_FLAGS
 #endif
 
 /*
@@ -341,6 +339,7 @@ ENDPROC(__calc_phys_offset)
  *   - identity mapping to enable the MMU (low address, TTBR0)
  *   - first few MB of the kernel linear mapping to jump to once the MMU has
  *     been enabled, including the FDT blob (TTBR1)
+ *   - UART mapping if CONFIG_EARLY_PRINTK is enabled (TTBR1)
  */
 __create_page_tables:
 	pgtbl	x25, x26, x24			// idmap_pg_dir and swapper_pg_dir addresses
@@ -393,6 +392,15 @@ __create_page_tables:
 	sub	x6, x6, #1			// inclusive range
 	create_block_map x0, x7, x3, x5, x6
 1:
+#ifdef CONFIG_EARLY_PRINTK
+	/*
+	 * Create the pgd entry for the UART mapping. The full mapping is done
+	 * later based earlyprintk kernel parameter.
+	 */
+	ldr	x5, =EARLYCON_IOBASE		// UART virtual address
+	add	x0, x26, #2 * PAGE_SIZE		// section table address
+	create_pgd_entry x26, x0, x5, x6, x7
+#endif
 	ret
 ENDPROC(__create_page_tables)
 	.ltorg
arch/arm64/mm/mmu.c +42 -0

54 lines not on this page · raw message