* [PATCH 0/7] arm64: Initial SoC support (ARMv8 RTSM model) @ 2012-12-07 21:06 Catalin Marinas 2012-12-07 21:06 ` [PATCH 1/7] arm: Move sp810.h to include/linux/amba/ Catalin Marinas ` (6 more replies) 0 siblings, 7 replies; 19+ messages in thread From: Catalin Marinas @ 2012-12-07 21:06 UTC (permalink / raw) To: linux-arm-kernel 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%) ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 1/7] arm: Move sp810.h to include/linux/amba/ 2012-12-07 21:06 [PATCH 0/7] arm64: Initial SoC support (ARMv8 RTSM model) Catalin Marinas @ 2012-12-07 21:06 ` Catalin Marinas 2012-12-07 21:06 ` [PATCH 2/7] arm64: Add dtbs target for building all the enabled dtb files Catalin Marinas ` (5 subsequent siblings) 6 siblings, 0 replies; 19+ messages in thread From: Catalin Marinas @ 2012-12-07 21:06 UTC (permalink / raw) To: linux-arm-kernel 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. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Pawel Moll <pawel.moll@arm.com> Cc: Shiraz Hashim <shiraz.hashim@st.com> Cc: Russell King <linux@arm.linux.org.uk> --- 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%) diff --git a/arch/arm/plat-spear/restart.c b/arch/arm/plat-spear/restart.c index 4f99011..7d4616d 100644 --- a/arch/arm/plat-spear/restart.c +++ b/arch/arm/plat-spear/restart.c @@ -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> diff --git a/drivers/clk/versatile/clk-vexpress.c b/drivers/clk/versatile/clk-vexpress.c index c742ac7..4f83ff9 100644 --- a/drivers/clk/versatile/clk-vexpress.c +++ b/drivers/clk/versatile/clk-vexpress.c @@ -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); diff --git a/arch/arm/include/asm/hardware/sp810.h b/include/linux/amba/sp810.h similarity index 100% rename from arch/arm/include/asm/hardware/sp810.h rename to include/linux/amba/sp810.h ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/7] arm64: Add dtbs target for building all the enabled dtb files 2012-12-07 21:06 [PATCH 0/7] arm64: Initial SoC support (ARMv8 RTSM model) Catalin Marinas 2012-12-07 21:06 ` [PATCH 1/7] arm: Move sp810.h to include/linux/amba/ Catalin Marinas @ 2012-12-07 21:06 ` Catalin Marinas 2012-12-07 21:47 ` Rob Herring 2012-12-07 21:06 ` [PATCH 3/7] arm64: SoC infrastructure preparation Catalin Marinas ` (4 subsequent siblings) 6 siblings, 1 reply; 19+ messages in thread From: Catalin Marinas @ 2012-12-07 21:06 UTC (permalink / raw) To: linux-arm-kernel 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. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- 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 diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 364191f..64089bc 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -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' diff --git a/arch/arm64/boot/.gitignore b/arch/arm64/boot/.gitignore index 8dab0bb..98af90a 100644 --- a/arch/arm64/boot/.gitignore +++ b/arch/arm64/boot/.gitignore @@ -1,2 +1,3 @@ Image Image.gz +*.dtb diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile index eca209b..1ab9bf1 100644 --- a/arch/arm64/boot/Makefile +++ b/arch/arm64/boot/Makefile @@ -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)" diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile new file mode 100644 index 0000000..e69de29 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/7] arm64: Add dtbs target for building all the enabled dtb files 2012-12-07 21:06 ` [PATCH 2/7] arm64: Add dtbs target for building all the enabled dtb files Catalin Marinas @ 2012-12-07 21:47 ` Rob Herring 2012-12-10 18:04 ` Catalin Marinas 0 siblings, 1 reply; 19+ messages in thread From: Rob Herring @ 2012-12-07 21:47 UTC (permalink / raw) To: linux-arm-kernel On 12/07/2012 03:06 PM, Catalin Marinas wrote: > 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. > > Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> > --- > > 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 > > 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 > > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 364191f..64089bc 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -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' > diff --git a/arch/arm64/boot/.gitignore b/arch/arm64/boot/.gitignore > index 8dab0bb..98af90a 100644 > --- a/arch/arm64/boot/.gitignore > +++ b/arch/arm64/boot/.gitignore > @@ -1,2 +1,3 @@ > Image > Image.gz > +*.dtb > diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile > index eca209b..1ab9bf1 100644 > --- a/arch/arm64/boot/Makefile > +++ b/arch/arm64/boot/Makefile > @@ -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)" > diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile > 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 > ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 2/7] arm64: Add dtbs target for building all the enabled dtb files 2012-12-07 21:47 ` Rob Herring @ 2012-12-10 18:04 ` Catalin Marinas 2012-12-11 2:30 ` Rob Herring 0 siblings, 1 reply; 19+ messages in thread From: Catalin Marinas @ 2012-12-10 18:04 UTC (permalink / raw) To: linux-arm-kernel On Fri, Dec 07, 2012 at 09:47:24PM +0000, Rob Herring wrote: > On 12/07/2012 03:06 PM, Catalin Marinas wrote: > > 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. > > > > Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> > > --- > > > > 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 <catalin.marinas@arm.com> 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. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- arch/arm64/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 11c3599..c95c5cb 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -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: ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 2/7] arm64: Add dtbs target for building all the enabled dtb files 2012-12-10 18:04 ` Catalin Marinas @ 2012-12-11 2:30 ` Rob Herring 0 siblings, 0 replies; 19+ messages in thread From: Rob Herring @ 2012-12-11 2:30 UTC (permalink / raw) To: linux-arm-kernel On 12/10/2012 12:04 PM, Catalin Marinas wrote: > On Fri, Dec 07, 2012 at 09:47:24PM +0000, Rob Herring wrote: >> On 12/07/2012 03:06 PM, Catalin Marinas wrote: >>> 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. >>> >>> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> >>> --- >>> >>> 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 <catalin.marinas@arm.com> > 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. > > Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Applied. Thanks. Rob > --- > arch/arm64/Makefile | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile > index 11c3599..c95c5cb 100644 > --- a/arch/arm64/Makefile > +++ b/arch/arm64/Makefile > @@ -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: > ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 3/7] arm64: SoC infrastructure preparation 2012-12-07 21:06 [PATCH 0/7] arm64: Initial SoC support (ARMv8 RTSM model) Catalin Marinas 2012-12-07 21:06 ` [PATCH 1/7] arm: Move sp810.h to include/linux/amba/ Catalin Marinas 2012-12-07 21:06 ` [PATCH 2/7] arm64: Add dtbs target for building all the enabled dtb files Catalin Marinas @ 2012-12-07 21:06 ` Catalin Marinas 2012-12-07 21:06 ` [PATCH 4/7] arm64: Populate the platform devices Catalin Marinas ` (3 subsequent siblings) 6 siblings, 0 replies; 19+ messages in thread From: Catalin Marinas @ 2012-12-07 21:06 UTC (permalink / raw) To: linux-arm-kernel This patch adds the necessary Kconfig and Makefile modifications together with skeleton.dtsi for SoC support. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- 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 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 0f87a49..e58a35a 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -95,7 +95,9 @@ source "init/Kconfig" source "kernel/Kconfig.freezer" -menu "System Type" +menu "Platform selection" + +source "arch/arm64/platforms/Kconfig" endmenu diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile index 64089bc..ddadd27 100644 --- a/arch/arm64/Makefile +++ b/arch/arm64/Makefile @@ -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) diff --git a/arch/arm64/boot/dts/skeleton.dtsi b/arch/arm64/boot/dts/skeleton.dtsi new file mode 100644 index 0000000..38ead82 --- /dev/null +++ b/arch/arm64/boot/dts/skeleton.dtsi @@ -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>; }; +}; diff --git a/arch/arm64/platforms/Kconfig b/arch/arm64/platforms/Kconfig new file mode 100644 index 0000000..e69de29 diff --git a/arch/arm64/platforms/Makefile b/arch/arm64/platforms/Makefile new file mode 100644 index 0000000..e69de29 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 4/7] arm64: Populate the platform devices 2012-12-07 21:06 [PATCH 0/7] arm64: Initial SoC support (ARMv8 RTSM model) Catalin Marinas ` (2 preceding siblings ...) 2012-12-07 21:06 ` [PATCH 3/7] arm64: SoC infrastructure preparation Catalin Marinas @ 2012-12-07 21:06 ` Catalin Marinas 2012-12-07 21:06 ` [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support Catalin Marinas ` (2 subsequent siblings) 6 siblings, 0 replies; 19+ messages in thread From: Catalin Marinas @ 2012-12-07 21:06 UTC (permalink / raw) To: linux-arm-kernel 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. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- arch/arm64/kernel/setup.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 7665a9b..894c1e5 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -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", ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support 2012-12-07 21:06 [PATCH 0/7] arm64: Initial SoC support (ARMv8 RTSM model) Catalin Marinas ` (3 preceding siblings ...) 2012-12-07 21:06 ` [PATCH 4/7] arm64: Populate the platform devices Catalin Marinas @ 2012-12-07 21:06 ` Catalin Marinas 2012-12-11 15:41 ` Arnd Bergmann 2012-12-07 21:06 ` [PATCH 6/7] arm64: Add dts files for the ARMv8 RTSM model Catalin Marinas 2012-12-07 21:06 ` [PATCH 7/7] arm64: Add simple earlyprintk support Catalin Marinas 6 siblings, 1 reply; 19+ messages in thread From: Catalin Marinas @ 2012-12-07 21:06 UTC (permalink / raw) To: linux-arm-kernel 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. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- 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 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index e58a35a..d66a444 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -91,6 +91,9 @@ config SWIOTLB config IOMMU_HELPER def_bool SWIOTLB +config GENERIC_GPIO + bool + source "init/Kconfig" source "kernel/Kconfig.freezer" diff --git a/arch/arm64/configs/vexpress_defconfig b/arch/arm64/configs/vexpress_defconfig new file mode 100644 index 0000000..c1ee86d --- /dev/null +++ b/arch/arm64/configs/vexpress_defconfig @@ -0,0 +1,90 @@ +# CONFIG_LOCALVERSION_AUTO is not set +# CONFIG_SWAP is not set +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_BSD_PROCESS_ACCT_V3=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=14 +# CONFIG_UTS_NS is not set +# CONFIG_IPC_NS is not set +# CONFIG_PID_NS is not set +# CONFIG_NET_NS is not set +CONFIG_SCHED_AUTOGROUP=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_KALLSYMS_ALL=y +# CONFIG_COMPAT_BRK is not set +CONFIG_PROFILING=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_IOSCHED_DEADLINE is not set +CONFIG_ARCH_VEXPRESS=y +CONFIG_SMP=y +CONFIG_PREEMPT_VOLUNTARY=y +CONFIG_CMDLINE="console=ttyAMA0" +# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set +CONFIG_COMPAT=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +# CONFIG_INET_LRO is not set +# CONFIG_IPV6 is not set +# CONFIG_WIRELESS is not set +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +# CONFIG_BLK_DEV is not set +CONFIG_SCSI=y +# CONFIG_SCSI_PROC_FS is not set +CONFIG_BLK_DEV_SD=y +# CONFIG_SCSI_LOWLEVEL is not set +CONFIG_NETDEVICES=y +# CONFIG_NET_CADENCE is not set +CONFIG_SMC91X=y +# CONFIG_WLAN is not set +CONFIG_INPUT_EVDEV=y +# CONFIG_SERIO_I8042 is not set +# CONFIG_SERIO_SERPORT is not set +CONFIG_SERIO_AMBAKMI=y +CONFIG_LEGACY_PTY_COUNT=16 +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +# CONFIG_HW_RANDOM is not set +# CONFIG_HWMON is not set +CONFIG_FB=y +# CONFIG_VGA_CONSOLE is not set +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_LOGO=y +# CONFIG_LOGO_LINUX_MONO is not set +# CONFIG_LOGO_LINUX_VGA16 is not set +# CONFIG_USB_SUPPORT is not set +# CONFIG_IOMMU_SUPPORT is not set +CONFIG_EXT2_FS=y +CONFIG_EXT3_FS=y +# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set +# CONFIG_EXT3_FS_XATTR is not set +CONFIG_FUSE_FS=y +CONFIG_CUSE=y +CONFIG_VFAT_FS=y +CONFIG_TMPFS=y +# CONFIG_MISC_FILESYSTEMS is not set +CONFIG_NFS_FS=y +CONFIG_ROOT_NFS=y +CONFIG_NLS_CODEPAGE_437=y +CONFIG_NLS_ISO8859_1=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_KERNEL=y +# CONFIG_SCHED_DEBUG is not set +CONFIG_DEBUG_INFO=y +CONFIG_RCU_CPU_STALL_TIMEOUT=60 +# CONFIG_FTRACE is not set +CONFIG_ATOMIC64_SELFTEST=y +CONFIG_DEBUG_ERRORS=y diff --git a/arch/arm64/platforms/Kconfig b/arch/arm64/platforms/Kconfig index e69de29..3533d71 100644 --- a/arch/arm64/platforms/Kconfig +++ b/arch/arm64/platforms/Kconfig @@ -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). diff --git a/arch/arm64/platforms/Makefile b/arch/arm64/platforms/Makefile index e69de29..2e3fcba 100644 --- a/arch/arm64/platforms/Makefile +++ b/arch/arm64/platforms/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_ARCH_VEXPRESS) := vexpress.o diff --git a/arch/arm64/platforms/vexpress.c b/arch/arm64/platforms/vexpress.c new file mode 100644 index 0000000..a484aac --- /dev/null +++ b/arch/arm64/platforms/vexpress.c @@ -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); diff --git a/drivers/net/ethernet/smsc/Kconfig b/drivers/net/ethernet/smsc/Kconfig index 5a689af..bb4c167 100644 --- a/drivers/net/ethernet/smsc/Kconfig +++ b/drivers/net/ethernet/smsc/Kconfig @@ -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 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support 2012-12-07 21:06 ` [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support Catalin Marinas @ 2012-12-11 15:41 ` Arnd Bergmann 2012-12-11 16:39 ` Catalin Marinas 0 siblings, 1 reply; 19+ messages in thread From: Arnd Bergmann @ 2012-12-11 15:41 UTC (permalink / raw) To: linux-arm-kernel On Friday 07 December 2012, Catalin Marinas wrote: > diff --git a/arch/arm64/platforms/Kconfig b/arch/arm64/platforms/Kconfig > index e69de29..3533d71 100644 > --- a/arch/arm64/platforms/Kconfig > +++ b/arch/arm64/platforms/Kconfig > @@ -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? > diff --git a/arch/arm6 > +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); 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support 2012-12-11 15:41 ` Arnd Bergmann @ 2012-12-11 16:39 ` Catalin Marinas 2012-12-11 17:21 ` Pawel Moll 2012-12-18 16:29 ` Catalin Marinas 0 siblings, 2 replies; 19+ messages in thread From: Catalin Marinas @ 2012-12-11 16:39 UTC (permalink / raw) To: linux-arm-kernel On Tue, Dec 11, 2012 at 03:41:15PM +0000, Arnd Bergmann wrote: > On Friday 07 December 2012, Catalin Marinas wrote: > > diff --git a/arch/arm64/platforms/Kconfig b/arch/arm64/platforms/Kconfig > > index e69de29..3533d71 100644 > > --- a/arch/arm64/platforms/Kconfig > > +++ b/arch/arm64/platforms/Kconfig > > @@ -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? 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/. > > diff --git a/arch/arm6 > > +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); > > 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. 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. -- Catalin ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support 2012-12-11 16:39 ` Catalin Marinas @ 2012-12-11 17:21 ` Pawel Moll 2012-12-11 17:45 ` Catalin Marinas 2012-12-18 16:29 ` Catalin Marinas 1 sibling, 1 reply; 19+ messages in thread From: Pawel Moll @ 2012-12-11 17:21 UTC (permalink / raw) To: linux-arm-kernel On Tue, 2012-12-11 at 16:39 +0000, Catalin Marinas wrote: > > > diff --git a/arch/arm6 > > > +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); > > > > 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. > > 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. 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<--------------------------- >From a19b22ed4d5042a2249f0aa41633cbbc7310d5f3 Mon Sep 17 00:00:00 2001 From: Pawel Moll <pawel.moll@arm.com> 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. Signed-off-by: Pawel Moll <pawel.moll@arm.com> --- 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(-) diff --git a/arch/arm/mach-imx/devices/devices.c b/arch/arm/mach-imx/devices/devices.c index 1b37482..ac68960 100644 --- a/arch/arm/mach-imx/devices/devices.c +++ b/arch/arm/mach-imx/devices/devices.c @@ -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) diff --git a/arch/unicore32/kernel/puv3-core.c b/arch/unicore32/kernel/puv3-core.c index 254adee..28d1387 100644 --- a/arch/unicore32/kernel/puv3-core.c +++ b/arch/unicore32/kernel/puv3-core.c @@ -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)); } diff --git a/arch/unicore32/kernel/puv3-nb0916.c b/arch/unicore32/kernel/puv3-nb0916.c index 181108b..b8f6fb3 100644 --- a/arch/unicore32/kernel/puv3-nb0916.c +++ b/arch/unicore32/kernel/puv3-nb0916.c @@ -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)); diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 9c16b6f..28e1f86 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -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; } diff --git a/drivers/char/tile-srom.c b/drivers/char/tile-srom.c index 3b22a60..9e7ffdc 100644 --- a/drivers/char/tile-srom.c +++ b/drivers/char/tile-srom.c @@ -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; } diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index 2716445..246b702 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -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)); diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 593085a..bb4be31 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -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; diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 5711e95..06738a0 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -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); -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support 2012-12-11 17:21 ` Pawel Moll @ 2012-12-11 17:45 ` Catalin Marinas 0 siblings, 0 replies; 19+ messages in thread From: Catalin Marinas @ 2012-12-11 17:45 UTC (permalink / raw) To: linux-arm-kernel On Tue, Dec 11, 2012 at 05:21:59PM +0000, Pawel Moll wrote: > On Tue, 2012-12-11 at 16:39 +0000, Catalin Marinas wrote: > > > > diff --git a/arch/arm6 > > > > +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); > > > > > > 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. > > > > 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. > > 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; > } 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. -- Catalin ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support 2012-12-11 16:39 ` Catalin Marinas 2012-12-11 17:21 ` Pawel Moll @ 2012-12-18 16:29 ` Catalin Marinas 2012-12-18 17:59 ` Arnd Bergmann 1 sibling, 1 reply; 19+ messages in thread From: Catalin Marinas @ 2012-12-18 16:29 UTC (permalink / raw) To: linux-arm-kernel On Tue, Dec 11, 2012 at 04:39:32PM +0000, Catalin Marinas wrote: > On Tue, Dec 11, 2012 at 03:41:15PM +0000, Arnd Bergmann wrote: > > On Friday 07 December 2012, Catalin Marinas wrote: > > > diff --git a/arch/arm6 > > > +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); > > > > 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. > > 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. 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). -- Catalin ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support 2012-12-18 16:29 ` Catalin Marinas @ 2012-12-18 17:59 ` Arnd Bergmann 2012-12-19 15:28 ` Pawel Moll 0 siblings, 1 reply; 19+ messages in thread From: Arnd Bergmann @ 2012-12-18 17:59 UTC (permalink / raw) To: linux-arm-kernel On Tuesday 18 December 2012, Catalin Marinas wrote: > 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 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support 2012-12-18 17:59 ` Arnd Bergmann @ 2012-12-19 15:28 ` Pawel Moll 2012-12-19 15:52 ` Catalin Marinas 0 siblings, 1 reply; 19+ messages in thread From: Pawel Moll @ 2012-12-19 15:28 UTC (permalink / raw) To: linux-arm-kernel On Tue, 2012-12-18 at 17:59 +0000, Arnd Bergmann wrote: > On Tuesday 18 December 2012, Catalin Marinas wrote: > > 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. 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? ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support 2012-12-19 15:28 ` Pawel Moll @ 2012-12-19 15:52 ` Catalin Marinas 0 siblings, 0 replies; 19+ messages in thread From: Catalin Marinas @ 2012-12-19 15:52 UTC (permalink / raw) To: linux-arm-kernel On Wed, Dec 19, 2012 at 03:28:06PM +0000, Pawel Moll wrote: > On Tue, 2012-12-18 at 17:59 +0000, Arnd Bergmann wrote: > > On Tuesday 18 December 2012, Catalin Marinas wrote: > > > 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. > > 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. diff --git a/drivers/clk/versatile/clk-vexpress.c b/drivers/clk/versatile/clk-vexpress.c index 4f83ff9..11f2da6 100644 --- a/drivers/clk/versatile/clk-vexpress.c +++ b/drivers/clk/versatile/clk-vexpress.c @@ -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 -- Catalin ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 6/7] arm64: Add dts files for the ARMv8 RTSM model 2012-12-07 21:06 [PATCH 0/7] arm64: Initial SoC support (ARMv8 RTSM model) Catalin Marinas ` (4 preceding siblings ...) 2012-12-07 21:06 ` [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support Catalin Marinas @ 2012-12-07 21:06 ` Catalin Marinas 2012-12-07 21:06 ` [PATCH 7/7] arm64: Add simple earlyprintk support Catalin Marinas 6 siblings, 0 replies; 19+ messages in thread From: Catalin Marinas @ 2012-12-07 21:06 UTC (permalink / raw) To: linux-arm-kernel From: Pawel Moll <Pawel.Moll@arm.com> Signed-off-by: Pawel Moll <Pawel.Moll@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- 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 diff --git a/arch/arm64/boot/dts/Makefile b/arch/arm64/boot/dts/Makefile index e69de29..d7837c0 100644 --- a/arch/arm64/boot/dts/Makefile +++ b/arch/arm64/boot/dts/Makefile @@ -0,0 +1 @@ +dtb-$(CONFIG_ARCH_VEXPRESS) += rtsm_ve-aemv8a.dtb diff --git a/arch/arm64/boot/dts/rtsm_ve-aemv8a.dts b/arch/arm64/boot/dts/rtsm_ve-aemv8a.dts new file mode 100644 index 0000000..15df04c --- /dev/null +++ b/arch/arm64/boot/dts/rtsm_ve-aemv8a.dts @@ -0,0 +1,154 @@ +/* + * ARM Ltd. Fast Models + * + * Architecture Envelope Model (AEM) ARMv8-A + * ARMAEMv8AMPCT + * + * RTSM_VE_AEMv8A.lisa + */ + +/dts-v1/; + +/memreserve/ 0x80000000 0x00010000; + +/ { + model = "RTSM_VE_AEMv8A"; + compatible = "arm,rtsm_ve,aemv8a", "arm,vexpress"; + interrupt-parent = <&gic>; + #address-cells = <2>; + #size-cells = <2>; + + chosen { }; + + aliases { + serial0 = &v2m_serial0; + serial1 = &v2m_serial1; + serial2 = &v2m_serial2; + serial3 = &v2m_serial3; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu at 0 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <0>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + cpu at 1 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <1>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + cpu at 2 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <2>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + cpu at 3 { + device_type = "cpu"; + compatible = "arm,armv8"; + reg = <3>; + enable-method = "spin-table"; + cpu-release-addr = <0x0 0x8000fff8>; + }; + }; + + memory at 80000000 { + device_type = "memory"; + reg = <0x00000000 0x80000000 0 0x80000000>, + <0x00000008 0x80000000 0 0x80000000>; + }; + + gic: interrupt-controller at 2c001000 { + compatible = "arm,cortex-a15-gic", "arm,cortex-a9-gic"; + #interrupt-cells = <3>; + #address-cells = <0>; + interrupt-controller; + reg = <0 0x2c001000 0 0x1000>, + <0 0x2c002000 0 0x100>; + }; + + timer { + compatible = "arm,armv8-timer"; + interrupts = <1 14 0xff01>; + clock-frequency = <100000000>; + }; + + pmu { + compatible = "arm,armv8-pmuv3"; + interrupts = <0 60 4>, + <0 61 4>, + <0 62 4>, + <0 63 4>; + }; + + smb { + compatible = "simple-bus"; + + #address-cells = <2>; + #size-cells = <1>; + ranges = <0 0 0 0x08000000 0x04000000>, + <1 0 0 0x14000000 0x04000000>, + <2 0 0 0x18000000 0x04000000>, + <3 0 0 0x1c000000 0x04000000>, + <4 0 0 0x0c000000 0x04000000>, + <5 0 0 0x10000000 0x04000000>; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 63>; + interrupt-map = <0 0 0 &gic 0 0 4>, + <0 0 1 &gic 0 1 4>, + <0 0 2 &gic 0 2 4>, + <0 0 3 &gic 0 3 4>, + <0 0 4 &gic 0 4 4>, + <0 0 5 &gic 0 5 4>, + <0 0 6 &gic 0 6 4>, + <0 0 7 &gic 0 7 4>, + <0 0 8 &gic 0 8 4>, + <0 0 9 &gic 0 9 4>, + <0 0 10 &gic 0 10 4>, + <0 0 11 &gic 0 11 4>, + <0 0 12 &gic 0 12 4>, + <0 0 13 &gic 0 13 4>, + <0 0 14 &gic 0 14 4>, + <0 0 15 &gic 0 15 4>, + <0 0 16 &gic 0 16 4>, + <0 0 17 &gic 0 17 4>, + <0 0 18 &gic 0 18 4>, + <0 0 19 &gic 0 19 4>, + <0 0 20 &gic 0 20 4>, + <0 0 21 &gic 0 21 4>, + <0 0 22 &gic 0 22 4>, + <0 0 23 &gic 0 23 4>, + <0 0 24 &gic 0 24 4>, + <0 0 25 &gic 0 25 4>, + <0 0 26 &gic 0 26 4>, + <0 0 27 &gic 0 27 4>, + <0 0 28 &gic 0 28 4>, + <0 0 29 &gic 0 29 4>, + <0 0 30 &gic 0 30 4>, + <0 0 31 &gic 0 31 4>, + <0 0 32 &gic 0 32 4>, + <0 0 33 &gic 0 33 4>, + <0 0 34 &gic 0 34 4>, + <0 0 35 &gic 0 35 4>, + <0 0 36 &gic 0 36 4>, + <0 0 37 &gic 0 37 4>, + <0 0 38 &gic 0 38 4>, + <0 0 39 &gic 0 39 4>, + <0 0 40 &gic 0 40 4>, + <0 0 41 &gic 0 41 4>, + <0 0 42 &gic 0 42 4>; + + /include/ "rtsm_ve-motherboard.dtsi" + }; +}; + diff --git a/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi new file mode 100644 index 0000000..62a20d1 --- /dev/null +++ b/arch/arm64/boot/dts/rtsm_ve-motherboard.dtsi @@ -0,0 +1,234 @@ +/* + * ARM Ltd. Fast Models + * + * Versatile Express (VE) system model + * Motherboard component + * + * VEMotherBoard.lisa + */ + + motherboard { + arm,v2m-memory-map = "rs1"; + compatible = "arm,vexpress,v2m-p1", "simple-bus"; + #address-cells = <2>; /* SMB chipselect number and offset */ + #size-cells = <1>; + #interrupt-cells = <1>; + ranges; + + flash at 0,00000000 { + compatible = "arm,vexpress-flash", "cfi-flash"; + reg = <0 0x00000000 0x04000000>, + <4 0x00000000 0x04000000>; + bank-width = <4>; + }; + + vram at 2,00000000 { + compatible = "arm,vexpress-vram"; + reg = <2 0x00000000 0x00800000>; + }; + + ethernet at 2,02000000 { + compatible = "smsc,lan91c111"; + reg = <2 0x02000000 0x10000>; + interrupts = <15>; + }; + + iofpga at 3,00000000 { + compatible = "arm,amba-bus", "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 3 0 0x200000>; + + v2m_sysreg: sysreg at 010000 { + compatible = "arm,vexpress-sysreg"; + reg = <0x010000 0x1000>; + gpio-controller; + #gpio-cells = <2>; + }; + + v2m_sysctl: sysctl at 020000 { + compatible = "arm,sp810", "arm,primecell"; + reg = <0x020000 0x1000>; + clocks = <&v2m_refclk32khz>, <&v2m_refclk1mhz>, <&v2m_clk24mhz>; + clock-names = "refclk", "timclk", "apb_pclk"; + #clock-cells = <1>; + clock-output-names = "timerclken0", "timerclken1", "timerclken2", "timerclken3"; + }; + + aaci at 040000 { + compatible = "arm,pl041", "arm,primecell"; + reg = <0x040000 0x1000>; + interrupts = <11>; + clocks = <&v2m_clk24mhz>; + clock-names = "apb_pclk"; + }; + + mmci at 050000 { + compatible = "arm,pl180", "arm,primecell"; + reg = <0x050000 0x1000>; + interrupts = <9 10>; + cd-gpios = <&v2m_sysreg 0 0>; + wp-gpios = <&v2m_sysreg 1 0>; + max-frequency = <12000000>; + vmmc-supply = <&v2m_fixed_3v3>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "mclk", "apb_pclk"; + }; + + kmi at 060000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x060000 0x1000>; + interrupts = <12>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "KMIREFCLK", "apb_pclk"; + }; + + kmi at 070000 { + compatible = "arm,pl050", "arm,primecell"; + reg = <0x070000 0x1000>; + interrupts = <13>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "KMIREFCLK", "apb_pclk"; + }; + + v2m_serial0: uart at 090000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x090000 0x1000>; + interrupts = <5>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + v2m_serial1: uart at 0a0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0a0000 0x1000>; + interrupts = <6>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + v2m_serial2: uart at 0b0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0b0000 0x1000>; + interrupts = <7>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + v2m_serial3: uart at 0c0000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x0c0000 0x1000>; + interrupts = <8>; + clocks = <&v2m_clk24mhz>, <&v2m_clk24mhz>; + clock-names = "uartclk", "apb_pclk"; + }; + + wdt at 0f0000 { + compatible = "arm,sp805", "arm,primecell"; + reg = <0x0f0000 0x1000>; + interrupts = <0>; + clocks = <&v2m_refclk32khz>, <&v2m_clk24mhz>; + clock-names = "wdogclk", "apb_pclk"; + }; + + v2m_timer01: timer at 110000 { + compatible = "arm,sp804", "arm,primecell"; + reg = <0x110000 0x1000>; + interrupts = <2>; + clocks = <&v2m_sysctl 0>, <&v2m_sysctl 1>, <&v2m_clk24mhz>; + clock-names = "timclken1", "timclken2", "apb_pclk"; + }; + + v2m_timer23: timer at 120000 { + compatible = "arm,sp804", "arm,primecell"; + reg = <0x120000 0x1000>; + interrupts = <3>; + clocks = <&v2m_sysctl 2>, <&v2m_sysctl 3>, <&v2m_clk24mhz>; + clock-names = "timclken1", "timclken2", "apb_pclk"; + }; + + rtc at 170000 { + compatible = "arm,pl031", "arm,primecell"; + reg = <0x170000 0x1000>; + interrupts = <4>; + clocks = <&v2m_clk24mhz>; + clock-names = "apb_pclk"; + }; + + clcd at 1f0000 { + compatible = "arm,pl111", "arm,primecell"; + reg = <0x1f0000 0x1000>; + interrupts = <14>; + clocks = <&v2m_oscclk1>, <&v2m_clk24mhz>; + clock-names = "clcdclk", "apb_pclk"; + }; + }; + + v2m_fixed_3v3: fixedregulator at 0 { + compatible = "regulator-fixed"; + regulator-name = "3V3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + }; + + v2m_clk24mhz: clk24mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <24000000>; + clock-output-names = "v2m:clk24mhz"; + }; + + v2m_refclk1mhz: refclk1mhz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <1000000>; + clock-output-names = "v2m:refclk1mhz"; + }; + + v2m_refclk32khz: refclk32khz { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <32768>; + clock-output-names = "v2m:refclk32khz"; + }; + + mcc { + compatible = "arm,vexpress,config-bus", "simple-bus"; + arm,vexpress,config-bridge = <&v2m_sysreg>; + + v2m_oscclk1: osc at 1 { + /* CLCD clock */ + compatible = "arm,vexpress-osc"; + arm,vexpress-sysreg,func = <1 1>; + freq-range = <23750000 63500000>; + #clock-cells = <0>; + clock-output-names = "v2m:oscclk1"; + }; + + reset at 0 { + compatible = "arm,vexpress-reset"; + arm,vexpress-sysreg,func = <5 0>; + }; + + muxfpga at 0 { + compatible = "arm,vexpress-muxfpga"; + arm,vexpress-sysreg,func = <7 0>; + }; + + shutdown at 0 { + compatible = "arm,vexpress-shutdown"; + arm,vexpress-sysreg,func = <8 0>; + }; + + reboot at 0 { + compatible = "arm,vexpress-reboot"; + arm,vexpress-sysreg,func = <9 0>; + }; + + dvimode at 0 { + compatible = "arm,vexpress-dvimode"; + arm,vexpress-sysreg,func = <11 0>; + }; + }; + }; ^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 7/7] arm64: Add simple earlyprintk support 2012-12-07 21:06 [PATCH 0/7] arm64: Initial SoC support (ARMv8 RTSM model) Catalin Marinas ` (5 preceding siblings ...) 2012-12-07 21:06 ` [PATCH 6/7] arm64: Add dts files for the ARMv8 RTSM model Catalin Marinas @ 2012-12-07 21:06 ` Catalin Marinas 6 siblings, 0 replies; 19+ messages in thread From: Catalin Marinas @ 2012-12-07 21:06 UTC (permalink / raw) To: linux-arm-kernel 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. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> --- 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 diff --git a/Documentation/arm64/memory.txt b/Documentation/arm64/memory.txt index d758702..5f583af 100644 --- a/Documentation/arm64/memory.txt +++ b/Documentation/arm64/memory.txt @@ -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] diff --git a/arch/arm64/Kconfig.debug b/arch/arm64/Kconfig.debug index d7553f2..79871cd 100644 --- a/arch/arm64/Kconfig.debug +++ b/arch/arm64/Kconfig.debug @@ -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 diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index d2f05a6..57f12c9 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -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> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 1cac16a..381f556 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -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) diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index d4f7fd5..2494fc0 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -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 diff --git a/arch/arm64/kernel/Makefile b/arch/arm64/kernel/Makefile index e2caff1..623c098 100644 --- a/arch/arm64/kernel/Makefile +++ b/arch/arm64/kernel/Makefile @@ -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) diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c new file mode 100644 index 0000000..7e320a2 --- /dev/null +++ b/arch/arm64/kernel/early_printk.c @@ -0,0 +1,118 @@ +/* + * Earlyprintk support. + * + * Copyright (C) 2012 ARM Ltd. + * Author: Catalin Marinas <catalin.marinas@arm.com> + * + * 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/kernel.h> +#include <linux/console.h> +#include <linux/init.h> +#include <linux/string.h> +#include <linux/mm.h> +#include <linux/io.h> + +#include <linux/amba/serial.h> + +static void __iomem *early_base; +static void (*printch)(char ch); + +/* + * PL011 single character TX. + */ +static void pl011_printch(char ch) +{ + while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_TXFF) + ; + writeb_relaxed(ch, early_base + UART01x_DR); + while (readl_relaxed(early_base + UART01x_FR) & UART01x_FR_BUSY) + ; +} + +struct earlycon_match { + const char *name; + void (*printch)(char ch); +}; + +static const struct earlycon_match earlycon_match[] __initconst = { + { .name = "pl011", .printch = pl011_printch, }, + {} +}; + +static void early_write(struct console *con, const char *s, unsigned n) +{ + while (n-- > 0) { + if (*s == '\n') + printch('\r'); + printch(*s); + s++; + } +} + +static struct console early_console = { + .name = "earlycon", + .write = early_write, + .flags = CON_PRINTBUFFER | CON_BOOT, + .index = -1, +}; + +/* + * Parse earlyprintk=... parameter in the format: + * + * <name>[,<addr>][,<options>] + * + * and register the early console. It is assumed that the UART has been + * initialised by the bootloader already. + */ +static int __init setup_early_printk(char *buf) +{ + const struct earlycon_match *match = earlycon_match; + phys_addr_t paddr = 0; + + if (!buf) { + pr_warning("No earlyprintk arguments passed.\n"); + return 0; + } + + while (match->name) { + size_t len = strlen(match->name); + if (!strncmp(buf, match->name, len)) { + buf += len; + break; + } + match++; + } + if (!match->name) { + pr_warning("Unknown earlyprintk arguments: %s\n", buf); + return 0; + } + + /* I/O address */ + if (!strncmp(buf, ",0x", 3)) { + char *e; + paddr = simple_strtoul(buf + 1, &e, 16); + buf = e; + } + /* no options parsing yet */ + + if (paddr) + early_base = early_io_map(paddr, EARLYCON_IOBASE); + + printch = match->printch; + register_console(&early_console); + + return 0; +} + +early_param("earlyprintk", setup_early_printk); diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index a2f02b6..4fcc379 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -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 diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index a6885d8..f4dd585 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -25,6 +25,7 @@ #include <linux/nodemask.h> #include <linux/memblock.h> #include <linux/fs.h> +#include <linux/io.h> #include <asm/cputype.h> #include <asm/sections.h> @@ -251,6 +252,47 @@ static void __init create_mapping(phys_addr_t phys, unsigned long virt, } while (pgd++, addr = next, addr != end); } +#ifdef CONFIG_EARLY_PRINTK +/* + * Create an early I/O mapping using the pgd/pmd entries already populated + * in head.S as this function is called too early to allocated any memory. The + * mapping size is 2MB with 4KB pages or 64KB or 64KB pages. + */ +void __iomem * __init early_io_map(phys_addr_t phys, unsigned long virt) +{ + unsigned long size, mask; + bool page64k = IS_ENABLED(ARM64_64K_PAGES); + pgd_t *pgd; + pud_t *pud; + pmd_t *pmd; + pte_t *pte; + + /* + * No early pte entries with !ARM64_64K_PAGES configuration, so using + * sections (pmd). + */ + size = page64k ? PAGE_SIZE : SECTION_SIZE; + mask = ~(size - 1); + + pgd = pgd_offset_k(virt); + pud = pud_offset(pgd, virt); + if (pud_none(*pud)) + return NULL; + pmd = pmd_offset(pud, virt); + + if (page64k) { + if (pmd_none(*pmd)) + return NULL; + pte = pte_offset_kernel(pmd, virt); + set_pte(pte, __pte((phys & mask) | PROT_DEVICE_nGnRE)); + } else { + set_pmd(pmd, __pmd((phys & mask) | PROT_SECT_DEVICE_nGnRE)); + } + + return (void __iomem *)((virt & mask) + (phys & ~mask)); +} +#endif + static void __init map_mem(void) { struct memblock_region *reg; ^ permalink raw reply related [flat|nested] 19+ messages in thread
end of thread, other threads:[~2012-12-19 15:52 UTC | newest] Thread overview: 19+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-12-07 21:06 [PATCH 0/7] arm64: Initial SoC support (ARMv8 RTSM model) Catalin Marinas 2012-12-07 21:06 ` [PATCH 1/7] arm: Move sp810.h to include/linux/amba/ Catalin Marinas 2012-12-07 21:06 ` [PATCH 2/7] arm64: Add dtbs target for building all the enabled dtb files Catalin Marinas 2012-12-07 21:47 ` Rob Herring 2012-12-10 18:04 ` Catalin Marinas 2012-12-11 2:30 ` Rob Herring 2012-12-07 21:06 ` [PATCH 3/7] arm64: SoC infrastructure preparation Catalin Marinas 2012-12-07 21:06 ` [PATCH 4/7] arm64: Populate the platform devices Catalin Marinas 2012-12-07 21:06 ` [PATCH 5/7] arm64: ARMv8 RTSM model (SoC) support Catalin Marinas 2012-12-11 15:41 ` Arnd Bergmann 2012-12-11 16:39 ` Catalin Marinas 2012-12-11 17:21 ` Pawel Moll 2012-12-11 17:45 ` Catalin Marinas 2012-12-18 16:29 ` Catalin Marinas 2012-12-18 17:59 ` Arnd Bergmann 2012-12-19 15:28 ` Pawel Moll 2012-12-19 15:52 ` Catalin Marinas 2012-12-07 21:06 ` [PATCH 6/7] arm64: Add dts files for the ARMv8 RTSM model Catalin Marinas 2012-12-07 21:06 ` [PATCH 7/7] arm64: Add simple earlyprintk support Catalin Marinas
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).