enable hi3xxx SoC
Subsystems (4)
v11 cover enable hi3xxx SoC
v11:
1. Add comments on iotable.
2. Use dummy clock in DTS. Remove common clock binding in DTS file. Clock driver will be in another patchset.
v10:
1. Use static IO mapping in Hi3xxx.
2. Totally drop to support of Hi3716.
3. Rename smp-off property to smp-offset.
4. Remove hardcoding in hotplug driver.
v9:
1. Clean code in DTS file according to Olof's comments.
2. Since debug ll patch is going through Russell's tree, remove it from this patch set.
v8:
1. Drop to support CLK_GATE_SEPERATED_REG in common clock gate driver. Support this feature in hi3xxx clock driver.
2. Clean unnecessary device node in DTS.
3. Define all clocks in hi3620-clk.dtsi. And all clock nodes are defined in the clocks node.
4. Fix the clock gate & clock mux for timer.
5. Rename timer0~4 to dual_timer0~4 in DTS file. It's used to make name clearer.
v7:
1. Add hi3xxx_defconfig.
2. Use reg property in clock node.
3. Drop origin clock divider table.
4. Reuse clock divider register helper.
5. Reuse clock gate register helper.
6. Append CLK_GATE_SEPERATED_REG flag in order to support Hisilicon
Hi3620 SoC.
7. Rebase DEBUG_LL for Hi3xxx.
8. Add more clock node in DTS file.
v6:
1. Remove hisilicon string from properties in clock driver.
2. Replace array by pointer in clock driver. Since only sctrl parent node exists at this time.
v5:
1. Remove HIWORD clk patches since they're merged into clk git tree.
2. Set hisilicon,clk-reset property of clkgate node is optional.
3. Update on commandline args in DTS file. Remove earlyprintk, mem, nfs.
4. Move gpio-keys out of amba node in DTS file.
v4:
1. Add clk gate with HIWORD mask for Rockchip.
2. Update comments and code of HIWORD flags for mux/divider.
3. Append a mux without HIWORD mask in Hisilicon 3620.
4. Fix the pinmux setting in Hi4511.
v3:
1. Use clk_register_mux_table().
v2:
1. Reuse mux & divider driver. So append CLK_MUX_HIWORD_MASK & CLK_DIVIDER_HIWORD_MASK for Hi3620 SoC.
2. Fix system timer running too fast because wrong divider is choosen.
3. Remove .init_irq in DT machine descriptor.
PATCH v11 1/6 ARM: hi3xxx: add board support with device tree
Add board support with device tree for Hisilicon Hi3620 SoC platform.
Changelog:
v11:
1. Add comments for iotable.
v10:
1. Add .map_io() & debug_ll_io_init() back. Since debug_ll_io_init() is only called if .map_io() isn't assigned. Use .map_io() to setup static IO mapping that is used in clock driver.
v3:
1. Remove .map_io() in DT machine descriptor. Since debug_ll_io_init() is called by default.
2. Remove .init_machine() in DT machine descriptor. Since of_platform_populate() is called by default in DT mode.
v2:
1. Remove .init_irq() in DT machine descriptor. Since irqchip_init() is called by default in DT mode.
--- .../bindings/arm/hisilicon/hisilicon.txt | 10 ++++ arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/mach-hi3xxx/Kconfig | 12 +++++ arch/arm/mach-hi3xxx/Makefile | 5 ++ arch/arm/mach-hi3xxx/hi3xxx.c | 60 ++++++++++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt create mode 100644 arch/arm/mach-hi3xxx/Kconfig create mode 100644 arch/arm/mach-hi3xxx/Makefile create mode 100644 arch/arm/mach-hi3xxx/hi3xxx.c
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt new file +10 -0
@@ -0,0 +1,10 @@ +Hisilicon Platforms Device Tree Bindings +---------------------------------------------------- + +Hi3716 Development Board +Required root node properties: + - compatible = "hisilicon,hi3716-dkb"; + +Hi4511 Board +Required root node properties: + - compatible = "hisilicon,hi3620-hi4511";
arch/arm/Kconfig +2 -0
@@ -946,6 +946,8 @@ source "arch/arm/mach-footbridge/Kconfig" source "arch/arm/mach-gemini/Kconfig" +source "arch/arm/mach-hi3xxx/Kconfig" + source "arch/arm/mach-highbank/Kconfig" source "arch/arm/mach-integrator/Kconfig"
arch/arm/Makefile +1 -0
@@ -155,6 +155,7 @@ machine-$(CONFIG_ARCH_EBSA110) += ebsa110 machine-$(CONFIG_ARCH_EP93XX) += ep93xx machine-$(CONFIG_ARCH_EXYNOS) += exynos machine-$(CONFIG_ARCH_GEMINI) += gemini +machine-$(CONFIG_ARCH_HI3xxx) += hi3xxx machine-$(CONFIG_ARCH_HIGHBANK) += highbank machine-$(CONFIG_ARCH_INTEGRATOR) += integrator machine-$(CONFIG_ARCH_IOP13XX) += iop13xx
arch/arm/mach-hi3xxx/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +config ARCH_HI3xxx + bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7 + select ARM_AMBA + select ARM_GIC + select ARM_TIMER_SP804 + select CACHE_L2X0 + select CLKSRC_OF + select GENERIC_CLOCKEVENTS + select PINCTRL + select PINCTRL_SINGLE + help + Support for Hisilicon Hi36xx/Hi37xx processor family
arch/arm/mach-hi3xxx/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# +# Makefile for Hisilicon Hi36xx/Hi37xx processors line +# + +obj-y += hi3xxx.o
arch/arm/mach-hi3xxx/hi3xxx.c new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v11 1/6 ARM: hi3xxx: add board support with device tree
Quoted 82 lines · Haojian Zhuang
Add board support with device tree for Hisilicon Hi3620 SoC platform.
Changelog:
v11:
1. Add comments for iotable.v10:
1. Add .map_io() &debug_ll_io_init()back. Sincedebug_ll_io_init()is only called if .map_io() isn't assigned. Use .map_io() to setup static IO mapping that is used in clock driver.v3:
1. Remove .map_io() in DT machine descriptor. Sincedebug_ll_io_init()is called by default.
2. Remove .init_machine() in DT machine descriptor. Sinceof_platform_populate()is called by default in DT mode.v2:
1. Remove .init_irq() in DT machine descriptor. Sinceirqchip_init()is called by default in DT mode.Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 10 ++++ arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/mach-hi3xxx/Kconfig | 12 +++++ arch/arm/mach-hi3xxx/Makefile | 5 ++ arch/arm/mach-hi3xxx/hi3xxx.c | 60 ++++++++++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt create mode 100644 arch/arm/mach-hi3xxx/Kconfig create mode 100644 arch/arm/mach-hi3xxx/Makefile create mode 100644 arch/arm/mach-hi3xxx/hi3xxx.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt new file +10
-0@@ -0,0 +1,10 @@ +Hisilicon Platforms Device Tree Bindings +---------------------------------------------------- + +Hi3716 Development Board +Required root node properties: + - compatible = "hisilicon,hi3716-dkb"; + +Hi4511 Board +Required root node properties: + - compatible = "hisilicon,hi3620-hi4511";arch/arm/Kconfig +2
-0@@ -946,6 +946,8 @@ source "arch/arm/mach-footbridge/Kconfig" source "arch/arm/mach-gemini/Kconfig" +source "arch/arm/mach-hi3xxx/Kconfig" + source "arch/arm/mach-highbank/Kconfig" source "arch/arm/mach-integrator/Kconfig"arch/arm/Makefile +1
-0@@ -155,6 +155,7 @@ machine-$(CONFIG_ARCH_EBSA110) += ebsa110 machine-$(CONFIG_ARCH_EP93XX) += ep93xx machine-$(CONFIG_ARCH_EXYNOS) += exynos machine-$(CONFIG_ARCH_GEMINI) += gemini +machine-$(CONFIG_ARCH_HI3xxx) += hi3xxx machine-$(CONFIG_ARCH_HIGHBANK) += highbank machine-$(CONFIG_ARCH_INTEGRATOR) += integrator machine-$(CONFIG_ARCH_IOP13XX) += iop13xxarch/arm/mach-hi3xxx/Kconfig new file +0
-0
arch/arm/mach-hi3xxx/Kconfig line 7
Quoted 7 lines
arch/arm/mach-hi3xxx/Kconfig new file +7
-0@@ -0,0 +1,12 @@ +config ARCH_HI3xxx + bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7 + select ARM_AMBA + select ARM_GIC + select ARM_TIMER_SP804 + select CACHE_L2X0 + select CLKSRC_OF
I think you need COMMON_CLK here.
Quoted 61 lines
arch/arm/mach-hi3xxx/Kconfig new file +5
-0+ select GENERIC_CLOCKEVENTS + select PINCTRL + select PINCTRL_SINGLE + help + Support for Hisilicon Hi36xx/Hi37xx processor familyarch/arm/mach-hi3xxx/Makefile new file +5
-0@@ -0,0 +1,5 @@ +# +# Makefile for Hisilicon Hi36xx/Hi37xx processors line +# + +obj-y += hi3xxx.oarch/arm/mach-hi3xxx/hi3xxx.c new file +39
-0@@ -0,0 +1,60 @@ +/* +* (Hisilicon's Hi36xx/Hi37xx SoC based) flattened device tree enabled machine +* +* Copyright (c) 2012-2013 Hisilicon Ltd. +* Copyright (c) 2012-2013 Linaro Ltd. +* +* Author: Haojian Zhuang <[email protected]> +* +* 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. +*/ + +#include <linux/clk-provider.h> +#include <linux/clocksource.h> +#include <linux/irqchip.h> +#include <linux/of_platform.h> + +#include <asm/mach/arch.h> +#include <asm/mach/map.h> + +/* +* This table is only for optimization. Since ioremap() could always share +* the same mapping if it's defined as static IO mapping. +* +* Without this table, system could also work. The cost is some virtual address +* spaces wasted since ioremap() may be called multi times for the same +* IO space. +*/ +static struct map_desc hi3620_io_desc[]__initdata = { + { + .pfn =__phys_to_pfn (0xfc802000 ), + .virtual =0xfe802000 , + .length =0x1000 , + .type =MT_DEVICE , + }, +}; + +static void __init hi3620_map_io (void )
arch/arm/mach-hi3xxx/hi3xxx.c line 49
Quoted 10 lines
arch/arm/mach-hi3xxx/hi3xxx.c new file +10
-0+{ +debug_ll_io_init (); +iotable_init (hi3620_io_desc,ARRAY_SIZE (hi3620_io_desc)); +} + +static void __init hi3xxx_timer_init (void ) +{ +of_clk_init (NULL ); +clocksource_of_init (); +}
Once you have COMMON_CLK, then this function can go away.
arch/arm/mach-hi3xxx/hi3xxx.c line 58
Quoted 9 lines
arch/arm/mach-hi3xxx/hi3xxx.c new file +9
-0+ +static const char *hi3xxx_compat[]__initdata = { +"hisilicon,hi3620-hi4511" , +NULL , +}; + +DT_MACHINE_START (HI3620 ,"Hisilicon Hi3620 (Flattened Device Tree)" ) + .map_io = hi3620_map_io, + .init_time = hi3xxx_timer_init,
.init_time can go away if you have COMMON_CLK.
Dinh
Quoted 2 lines
arch/arm/mach-hi3xxx/hi3xxx.c new file +2
-0+ .dt_compat = hi3xxx_compat, +MACHINE_END
PATCH v11 1/6 ARM: hi3xxx: add board support with device tree
Quoted 84 lines · Dinh Nguyen
Quoted 82 lines · Haojian Zhuang
Add board support with device tree for Hisilicon Hi3620 SoC platform.
Changelog:
v11:
1. Add comments for iotable.v10:
1. Add .map_io() &debug_ll_io_init()back. Sincedebug_ll_io_init()is only called if .map_io() isn't assigned. Use .map_io() to setup static IO mapping that is used in clock driver.v3:
1. Remove .map_io() in DT machine descriptor. Sincedebug_ll_io_init()is called by default.
2. Remove .init_machine() in DT machine descriptor. Sinceof_platform_populate()is called by default in DT mode.v2:
1. Remove .init_irq() in DT machine descriptor. Sinceirqchip_init()is called by default in DT mode.Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 10 ++++ arch/arm/Kconfig | 2 + arch/arm/Makefile | 1 + arch/arm/mach-hi3xxx/Kconfig | 12 +++++ arch/arm/mach-hi3xxx/Makefile | 5 ++ arch/arm/mach-hi3xxx/hi3xxx.c | 60 ++++++++++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt create mode 100644 arch/arm/mach-hi3xxx/Kconfig create mode 100644 arch/arm/mach-hi3xxx/Makefile create mode 100644 arch/arm/mach-hi3xxx/hi3xxx.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt new file +10
-0@@ -0,0 +1,10 @@ +Hisilicon Platforms Device Tree Bindings +---------------------------------------------------- + +Hi3716 Development Board +Required root node properties: + - compatible = "hisilicon,hi3716-dkb"; + +Hi4511 Board +Required root node properties: + - compatible = "hisilicon,hi3620-hi4511";arch/arm/Kconfig +2
-0@@ -946,6 +946,8 @@ source "arch/arm/mach-footbridge/Kconfig" source "arch/arm/mach-gemini/Kconfig" +source "arch/arm/mach-hi3xxx/Kconfig" + source "arch/arm/mach-highbank/Kconfig" source "arch/arm/mach-integrator/Kconfig"arch/arm/Makefile +1
-0@@ -155,6 +155,7 @@ machine-$(CONFIG_ARCH_EBSA110) += ebsa110 machine-$(CONFIG_ARCH_EP93XX) += ep93xx machine-$(CONFIG_ARCH_EXYNOS) += exynos machine-$(CONFIG_ARCH_GEMINI) += gemini +machine-$(CONFIG_ARCH_HI3xxx) += hi3xxx machine-$(CONFIG_ARCH_HIGHBANK) += highbank machine-$(CONFIG_ARCH_INTEGRATOR) += integrator machine-$(CONFIG_ARCH_IOP13XX) += iop13xxarch/arm/mach-hi3xxx/Kconfig new file +0
-0@@ -0,0 +1,12 @@
Quoted 8 lines
arch/arm/mach-hi3xxx/Kconfig line 7
Quoted 7 lines
arch/arm/mach-hi3xxx/Kconfig new file +7
-0+config ARCH_HI3xxx + bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7 + select ARM_AMBA + select ARM_GIC + select ARM_TIMER_SP804 + select CACHE_L2X0 + select CLKSRC_OFI think you need
COMMON_CLKhere.
Why? COMMON_CLK will be selected if ARCH_MULTIPLATFORM is enabled. Why do I need to choose it again?
Quoted 64 lines
Quoted 64 lines
arch/arm/mach-hi3xxx/Kconfig new file +5
-0+ select GENERIC_CLOCKEVENTS + select PINCTRL + select PINCTRL_SINGLE + help + Support for Hisilicon Hi36xx/Hi37xx processor familyarch/arm/mach-hi3xxx/Makefile new file +5
-0@@ -0,0 +1,5 @@ +# +# Makefile for Hisilicon Hi36xx/Hi37xx processors line +# + +obj-y += hi3xxx.oarch/arm/mach-hi3xxx/hi3xxx.c new file +42
-0@@ -0,0 +1,60 @@ +/* +* (Hisilicon's Hi36xx/Hi37xx SoC based) flattened device tree enabled machine +* +* Copyright (c) 2012-2013 Hisilicon Ltd. +* Copyright (c) 2012-2013 Linaro Ltd. +* +* Author: Haojian Zhuang <[email protected]> +* +* 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. +*/ + +#include <linux/clk-provider.h> +#include <linux/clocksource.h> +#include <linux/irqchip.h> +#include <linux/of_platform.h> + +#include <asm/mach/arch.h> +#include <asm/mach/map.h> + +/* +* This table is only for optimization. Since ioremap() could always share +* the same mapping if it's defined as static IO mapping. +* +* Without this table, system could also work. The cost is some virtual address +* spaces wasted since ioremap() may be called multi times for the same +* IO space. +*/ +static struct map_desc hi3620_io_desc[]__initdata = { + { + .pfn =__phys_to_pfn (0xfc802000 ), + .virtual =0xfe802000 , + .length =0x1000 , + .type =MT_DEVICE , + }, +}; + +static void __init hi3620_map_io (void ) +{ +debug_ll_io_init (); +iotable_init (hi3620_io_desc,ARRAY_SIZE (hi3620_io_desc));
Quoted 8 lines
arch/arm/mach-hi3xxx/hi3xxx.c line 49
Quoted 7 lines
arch/arm/mach-hi3xxx/hi3xxx.c new file +7
-0+} + +static void __init hi3xxx_timer_init (void ) +{ +of_clk_init (NULL ); +clocksource_of_init (); +}Once you have
COMMON_CLK, then this function can go away.
On v3.12-rcx, of_clk_init() must be called by platform driver. Now v3.13-rcx doesn't announce yet. This function will be removed in additional patch, not in this patch.
Quoted 15 lines
arch/arm/mach-hi3xxx/hi3xxx.c line 58
Quoted 9 lines
arch/arm/mach-hi3xxx/hi3xxx.c new file +9
-0+ +static const char *hi3xxx_compat[]__initdata = { +"hisilicon,hi3620-hi4511" , +NULL , +}; + +DT_MACHINE_START (HI3620 ,"Hisilicon Hi3620 (Flattened Device Tree)" ) + .map_io = hi3620_map_io, + .init_time = hi3xxx_timer_init,.init_time can go away if you have
COMMON_CLK.Dinh
Quoted 2 lines
arch/arm/mach-hi3xxx/hi3xxx.c new file +2
-0+ .dt_compat = hi3xxx_compat, +MACHINE_END
PATCH v11 2/6 ARM: dts: enable hi4511 with device tree
In reply to Haojian ZhuangEnable Hisilicon Hi4511 development platform with device tree support.
--- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/hi3620.dtsi | 518 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/hi4511.dts | 648 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1167 insertions(+) create mode 100644 arch/arm/boot/dts/hi3620.dtsi create mode 100644 arch/arm/boot/dts/hi4511.dts
arch/arm/boot/dts/Makefile +1 -0
@@ -64,6 +64,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \ exynos5420-smdk5420.dtb \ exynos5440-sd5v1.dtb \ exynos5440-ssdk5440.dtb +dtb-$(CONFIG_ARCH_HI3xxx) += hi4511.dtb dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \ ecx-2000.dtb dtb-$(CONFIG_ARCH_INTEGRATOR) += integratorap.dtb \
arch/arm/boot/dts/hi3620.dtsi new file +518 -0
518 lines not on this page · raw message
arch/arm/boot/dts/hi4511.dts new file +648 -0
648 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v11 3/6 ARM: config: enable hi3xxx in multi_v7_defconfig
In reply to Haojian ZhuangEnable ARCH_HI3xxx in multi_v7_defconfig.
--- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/multi_v7_defconfig +1 -0
@@ -8,6 +8,7 @@ CONFIG_MACH_ARMADA_XP=y CONFIG_ARCH_BCM=y CONFIG_GPIO_PCA953X=y CONFIG_ARCH_HIGHBANK=y +CONFIG_ARCH_HI3xxx=y CONFIG_ARCH_KEYSTONE=y CONFIG_ARCH_MXC=y CONFIG_MACH_IMX51_DT=y
Signature · 1 line
1.8.3.2
PATCH v11 4/6 ARM: config: add defconfig for Hi3xxx
In reply to Haojian ZhuangAdd default config for arch-hi3xxx. It's used for Hisilicon Hi3xxx SoC.
--- arch/arm/configs/hi3xxx_defconfig | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 arch/arm/configs/hi3xxx_defconfig
arch/arm/configs/hi3xxx_defconfig new file +56 -0
@@ -0,0 +1,56 @@ +CONFIG_IRQ_DOMAIN_DEBUG=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_RD_LZMA=y +CONFIG_ARCH_HI3xxx=y +CONFIG_SMP=y +CONFIG_PREEMPT=y +CONFIG_AEABI=y +CONFIG_ARM_APPENDED_DTB=y +CONFIG_NET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_BLK_DEV_SD=y +CONFIG_ATA=y +CONFIG_SATA_AHCI_PLATFORM=y +CONFIG_NETDEVICES=y +CONFIG_SERIAL_AMBA_PL011=y +CONFIG_SERIAL_AMBA_PL011_CONSOLE=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_I2C_DESIGNWARE_PLATFORM=y +CONFIG_SPI=y +CONFIG_SPI_PL022=y +CONFIG_PINCTRL_SINGLE=y +CONFIG_GPIO_GENERIC_PLATFORM=y +CONFIG_REGULATOR_GPIO=y +CONFIG_DRM=y +CONFIG_FB_SIMPLE=y +CONFIG_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_MXC=y +CONFIG_USB_EHCI_HCD_PLATFORM=y +CONFIG_USB_STORAGE=y +CONFIG_NOP_USB_XCEIV=y +CONFIG_MMC=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_PL031=y +CONFIG_DMADEVICES=y +CONFIG_DW_DMAC=y +CONFIG_PL330_DMA=y +CONFIG_PWM=y +CONFIG_EXT4_FS=y +CONFIG_TMPFS=y +CONFIG_NFS_FS=y +CONFIG_NFS_V3_ACL=y +CONFIG_NFS_V4=y +CONFIG_ROOT_NFS=y +CONFIG_PRINTK_TIME=y +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_KERNEL=y +CONFIG_LOCKUP_DETECTOR=y
Signature · 1 line
1.8.3.2
PATCH v11 5/6 ARM: hi3xxx: add smp support
In reply to Haojian ZhuangFrom: Zhangfei Gao <[email protected]>
Enable SMP support on hi3xxx platform
--- .../bindings/arm/hisilicon/hisilicon.txt | 30 ++++++-- arch/arm/boot/dts/hi3620.dtsi | 38 ++++++++++ arch/arm/mach-hi3xxx/Kconfig | 3 + arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 11 +++ arch/arm/mach-hi3xxx/hi3xxx.c | 34 +++++++++ arch/arm/mach-hi3xxx/platsmp.c | 84 ++++++++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-hi3xxx/core.h create mode 100644 arch/arm/mach-hi3xxx/platsmp.c
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +26 -4
@@ -1,10 +1,32 @@ Hisilicon Platforms Device Tree Bindings ---------------------------------------------------- -Hi3716 Development Board -Required root node properties: - - compatible = "hisilicon,hi3716-dkb"; - Hi4511 Board Required root node properties: - compatible = "hisilicon,hi3620-hi4511"; + +Hisilicon system controller + +Required properties: +- compatible : "hisilicon,sysctrl" +- reg : Register address and size + +Optional properties: +- smp-offset : offset in sysctrl for notifying slave cpu booting + cpu 1, reg; + cpu 2, reg + 0x4; + cpu 3, reg + 0x8; + If reg value is not zero, cpun exit wfi and go +- resume-offset : offset in sysctrl for notifying cpu0 when resume +- reboot-offset : offset in sysctrl for system reboot + +Example: + + /* for Hi3620 */ + sysctrl: system-controller at fc802000 { + compatible = "hisilicon,sysctrl"; + reg = <0xfc802000 0x1000>; + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + };
arch/arm/boot/dts/hi3620.dtsi +38 -0
@@ -39,6 +39,27 @@ reg = <0x0>; next-level-cache = <&L2>; }; + + cpu at 1 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <1>; + next-level-cache = <&L2>; + }; + + cpu at 2 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <2>; + next-level-cache = <&L2>; + }; + + cpu at 3 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <3>; + next-level-cache = <&L2>; + }; }; amba {
@@ -65,6 +86,17 @@ reg = <0x1000 0x1000>, <0x100 0x100>; }; + sysctrl: system-controller at 802000 { + compatible = "hisilicon,sysctrl"; + reg = <0x802000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + }; + dual_timer0: dual_timer at 800000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x800000 0x1000>;
@@ -115,6 +147,12 @@ status = "disabled"; }; + timer5: timer at 600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0x600 0x20>; + interrupts = <1 13 0xf01>; + }; + uart0: uart at b00000 { compatible = "arm,pl011", "arm,primecell"; reg = <0xb00000 0x1000>;
arch/arm/mach-hi3xxx/Kconfig +3 -0
@@ -6,6 +6,9 @@ config ARCH_HI3xxx select CACHE_L2X0 select CLKSRC_OF select GENERIC_CLOCKEVENTS + select HAVE_ARM_SCU + select HAVE_ARM_TWD + select HAVE_SMP select PINCTRL select PINCTRL_SINGLE help
arch/arm/mach-hi3xxx/Makefile +1 -0
@@ -3,3 +3,4 @@ # obj-y += hi3xxx.o +obj-$(CONFIG_SMP) += platsmp.o
arch/arm/mach-hi3xxx/core.h new file +11 -0
@@ -0,0 +1,11 @@ +#ifndef __HISILICON_CORE_H +#define __HISILICON_CORE_H + +#include <linux/reboot.h> + +extern void hi3xxx_set_cpu_jump (int cpu,void *jump_addr); +extern int hi3xxx_get_cpu_jump (int cpu); +extern void secondary_startup (void ); +extern struct smp_operations hi3xxx_smp_ops; + +#endif
arch/arm/mach-hi3xxx/hi3xxx.c +34 -0
@@ -14,11 +14,16 @@#include <linux/clk-provider.h> #include <linux/clocksource.h> #include <linux/irqchip.h> +#include <linux/of_address.h> #include <linux/of_platform.h> +#include <asm/proc-fns.h> +#include <asm/mach/arch.h> #include <asm/mach/map.h> +#include "core.h" +/* * This table is only for optimization. Since ioremap() could always share * the same mapping if it's defined as static IO mapping.
@@ -29,6 +34,7 @@*/ static struct map_desc hi3620_io_desc[]__initdata = { { +/* sysctrl */ .pfn =__phys_to_pfn (0xfc802000 ), .virtual =0xfe802000 , .length =0x1000 ,
@@ -48,6 +54,32 @@ static void __init hi3xxx_timer_init(void)clocksource_of_init (); } +static void hi3xxx_restart (enum reboot_mode mode,const char *cmd) +{ +struct device_node *np; +void __iomem *base; +int offset; + + np =of_find_compatible_node (NULL ,NULL ,"hisilicon,sysctrl" ); +if (!np) { +pr_err ("failed to find hisilicon,sysctrl node\n" ); +return ; + } + base =of_iomap (np,0 ); +if (!base) { +pr_err ("failed to map address in hisilicon,sysctrl node\n" ); +return ; + } +if (of_property_read_u32 (np,"reboot-offset" , &offset) <0 ) { +pr_err ("failed to find reboot-offset property\n" ); +return ; + } +writel_relaxed (0xdeadbeef , base + offset); + +while (1 ) +cpu_do_idle (); +} +static const char *hi3xxx_compat[]__initdata = {"hisilicon,hi3620-hi4511" ,NULL ,
@@ -57,4 +89,6 @@ DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)") .map_io = hi3620_map_io, .init_time = hi3xxx_timer_init, .dt_compat = hi3xxx_compat, + .smp = smp_ops(hi3xxx_smp_ops), + .restart = hi3xxx_restart,MACHINE_END
arch/arm/mach-hi3xxx/platsmp.c new file +84 -0
84 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v11 5/6 ARM: hi3xxx: add smp support
Quoted 112 lines · Haojian Zhuang
From: Zhangfei Gao <[email protected]>
Enable SMP support on hi3xxx platform
Signed-off-by Zhangfei Gao <[email protected]>Tested-by Zhang Mingjun <[email protected]>Tested-by Li Xin <[email protected]>Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 30 ++++++-- arch/arm/boot/dts/hi3620.dtsi | 38 ++++++++++ arch/arm/mach-hi3xxx/Kconfig | 3 + arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 11 +++ arch/arm/mach-hi3xxx/hi3xxx.c | 34 +++++++++ arch/arm/mach-hi3xxx/platsmp.c | 84 ++++++++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-hi3xxx/core.h create mode 100644 arch/arm/mach-hi3xxx/platsmp.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +26
-4@@ -1,10 +1,32 @@ Hisilicon Platforms Device Tree Bindings ---------------------------------------------------- -Hi3716 Development Board -Required root node properties: - - compatible = "hisilicon,hi3716-dkb"; - Hi4511 Board Required root node properties: - compatible = "hisilicon,hi3620-hi4511"; + +Hisilicon system controller + +Required properties: +- compatible : "hisilicon,sysctrl" +- reg : Register address and size + +Optional properties: +- smp-offset : offset in sysctrl for notifying slave cpu booting + cpu 1, reg; + cpu 2, reg + 0x4; + cpu 3, reg + 0x8; + If reg value is not zero, cpun exit wfi and go +- resume-offset : offset in sysctrl for notifying cpu0 when resume +- reboot-offset : offset in sysctrl for system reboot + +Example: + + /* for Hi3620 */ + sysctrl: system-controller at fc802000 { + compatible = "hisilicon,sysctrl"; + reg = <0xfc802000 0x1000>; + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + };arch/arm/boot/dts/hi3620.dtsi +32
-0@@ -39,6 +39,27 @@ reg = <0x0>; next-level-cache = <&L2>; }; + + cpu at 1 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <1>; + next-level-cache = <&L2>; + }; + + cpu at 2 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <2>; + next-level-cache = <&L2>; + }; + + cpu at 3 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <3>; + next-level-cache = <&L2>; + }; }; amba {@@ -65,6 +86,17 @@ reg = <0x1000 0x1000>, <0x100 0x100>; }; + sysctrl: system-controller at 802000 { + compatible = "hisilicon,sysctrl"; + reg = <0x802000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + }; + dual_timer0: dual_timer at 800000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x800000 0x1000>;
arch/arm/boot/dts/hi3620.dtsi line 154
Quoted 8 lines
arch/arm/boot/dts/hi3620.dtsi +5
-0@@ -115,6 +147,12 @@ status = "disabled"; }; + timer5: timer at 600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0x600 0x20>; + interrupts = <1 13 0xf01>; + };
Do you have a clocks node for this timer?
Quoted 9 lines
arch/arm/boot/dts/hi3620.dtsi +1
-0+ uart0: uart at b00000 { compatible = "arm,pl011", "arm,primecell"; reg = <0xb00000 0x1000>;arch/arm/mach-hi3xxx/Kconfig +0
-0
arch/arm/mach-hi3xxx/Kconfig config ARCH_HI3xxx · line 10
Quoted 5 lines
arch/arm/mach-hi3xxx/Kconfig +2
-0@@ -6,6 +6,9 @@ config ARCH_HI3xxx select CACHE_L2X0 select CLKSRC_OF select GENERIC_CLOCKEVENTS + select HAVE_ARM_SCU + select HAVE_ARM_TWD
Need "if SMP" to avoid a build failure for a non-smp kernel.
Dinh
Quoted 52 lines
arch/arm/mach-hi3xxx/Kconfig +1
-0+ select HAVE_SMP select PINCTRL select PINCTRL_SINGLE helparch/arm/mach-hi3xxx/Makefile +1
-0@@ -3,3 +3,4 @@ # obj-y += hi3xxx.o +obj-$(CONFIG_SMP) += platsmp.oarch/arm/mach-hi3xxx/core.h new file +11
-0@@ -0,0 +1,11 @@ +#ifndef __HISILICON_CORE_H +#define __HISILICON_CORE_H + +#include <linux/reboot.h> + +extern void hi3xxx_set_cpu_jump (int cpu,void *jump_addr); +extern int hi3xxx_get_cpu_jump (int cpu); +extern void secondary_startup (void ); +extern struct smp_operations hi3xxx_smp_ops; + +#endif arch/arm/mach-hi3xxx/hi3xxx.c +5
-0@@ -14,11 +14,16 @@#include <linux/clk-provider.h> #include <linux/clocksource.h> #include <linux/irqchip.h> +#include <linux/of_address.h> #include <linux/of_platform.h> +#include <asm/proc-fns.h> +#include <asm/mach/arch.h> #include <asm/mach/map.h> +#include "core.h" +/* * This table is only for optimization. Since ioremap() could always share * the same mapping if it's defined as static IO mapping.
arch/arm/mach-hi3xxx/hi3xxx.c line 37
Quoted 4 lines
arch/arm/mach-hi3xxx/hi3xxx.c +1
-0@@ -29,6 +34,7 @@*/ static struct map_desc hi3620_io_desc[]__initdata = { { +/* sysctrl */
What's this comment for?
Quoted 133 lines
arch/arm/mach-hi3xxx/hi3xxx.c +28
-0.pfn = __phys_to_pfn(0xfc802000), .virtual = 0xfe802000, .length = 0x1000,@@ -48,6 +54,32 @@ static void __init hi3xxx_timer_init(void)clocksource_of_init (); } +static void hi3xxx_restart (enum reboot_mode mode,const char *cmd) +{ +struct device_node *np; +void __iomem *base; +int offset; + + np =of_find_compatible_node (NULL ,NULL ,"hisilicon,sysctrl" ); +if (!np) { +pr_err ("failed to find hisilicon,sysctrl node\n" ); +return ; + } + base =of_iomap (np,0 ); +if (!base) { +pr_err ("failed to map address in hisilicon,sysctrl node\n" ); +return ; + } +if (of_property_read_u32 (np,"reboot-offset" , &offset) <0 ) { +pr_err ("failed to find reboot-offset property\n" ); +return ; + } +writel_relaxed (0xdeadbeef , base + offset); + +while (1 ) +cpu_do_idle (); +} +static const char *hi3xxx_compat[]__initdata = {"hisilicon,hi3620-hi4511" ,NULL ,@@ -57,4 +89,6 @@ DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)") .map_io = hi3620_map_io, .init_time = hi3xxx_timer_init, .dt_compat = hi3xxx_compat, + .smp = smp_ops(hi3xxx_smp_ops), + .restart = hi3xxx_restart,MACHINE_END arch/arm/mach-hi3xxx/platsmp.c new file +84
-0@@ -0,0 +1,84 @@ +/* +* Copyright (c) 2013 Linaro Ltd. +* Copyright (c) 2013 Hisilicon Limited. +* Based on platsmp.c, Copyright (C) 2002 ARM Ltd. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +*/ +#include <linux/smp.h> +#include <linux/io.h> +#include <linux/of_address.h> + +#include <asm/cacheflush.h> +#include <asm/smp_plat.h> +#include <asm/smp_scu.h> + +#include "core.h" + +static void __iomem *ctrl_base =NULL ; + +void hi3xxx_set_cpu_jump (int cpu,void *jump_addr) +{ + cpu =cpu_logical_map (cpu); +if (!cpu || !ctrl_base) +return ; +writel_relaxed (virt_to_phys (jump_addr), ctrl_base + ((cpu -1 ) <<2 )); +} + +int hi3xxx_get_cpu_jump (int cpu) +{ + cpu =cpu_logical_map (cpu); +if (!cpu || !ctrl_base) +return 0 ; +return readl_relaxed (ctrl_base + ((cpu -1 ) <<2 )); +} + +static void __init hi3xxx_smp_prepare_cpus (unsigned int max_cpus) +{ +struct device_node *np =NULL ; +unsigned long base =0 ; +u32 offset =0 ; +void __iomem *scu_base =NULL ; + +if (scu_a9_has_base ()) { + base =scu_a9_get_base (); + scu_base =ioremap (base,SZ_4K ); +if (!scu_base) { +pr_err ("ioremap(scu_base) failed\n" ); +return ; + } +scu_enable (scu_base); +iounmap (scu_base); + } +if (!ctrl_base) { + np =of_find_compatible_node (NULL ,NULL ,"hisilicon,sysctrl" ); +if (!np) { +pr_err ("failed to find hisilicon,sysctrl node\n" ); +return ; + } + ctrl_base =of_iomap (np,0 ); +if (!ctrl_base) { +pr_err ("failed to map address\n" ); +return ; + } +if (of_property_read_u32 (np,"smp-offset" , &offset) <0 ) { +pr_err ("failed to find smp-offset property\n" ); +return ; + } + ctrl_base += offset; + } +} + +static int hi3xxx_boot_secondary (unsigned int cpu,struct task_struct *idle) +{ +hi3xxx_set_cpu_jump (cpu, secondary_startup); +arch_send_wakeup_ipi_mask (cpumask_of (cpu)); +return 0 ; +} + +struct smp_operations hi3xxx_smp_ops__initdata = { + .smp_prepare_cpus = hi3xxx_smp_prepare_cpus, + .smp_boot_secondary = hi3xxx_boot_secondary, +};
PATCH v11 5/6 ARM: hi3xxx: add smp support
Quoted 117 lines · Dinh Nguyen
Quoted 115 lines · Haojian Zhuang
From: Zhangfei Gao <[email protected]>
Enable SMP support on hi3xxx platform
Signed-off-by Zhangfei Gao <[email protected]>Tested-by Zhang Mingjun <[email protected]>Tested-by Li Xin <[email protected]>Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 30 ++++++-- arch/arm/boot/dts/hi3620.dtsi | 38 ++++++++++ arch/arm/mach-hi3xxx/Kconfig | 3 + arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 11 +++ arch/arm/mach-hi3xxx/hi3xxx.c | 34 +++++++++ arch/arm/mach-hi3xxx/platsmp.c | 84 ++++++++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-hi3xxx/core.h create mode 100644 arch/arm/mach-hi3xxx/platsmp.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +26
-4@@ -1,10 +1,32 @@ Hisilicon Platforms Device Tree Bindings ---------------------------------------------------- -Hi3716 Development Board -Required root node properties: - - compatible = "hisilicon,hi3716-dkb"; - Hi4511 Board Required root node properties: - compatible = "hisilicon,hi3620-hi4511"; + +Hisilicon system controller + +Required properties: +- compatible : "hisilicon,sysctrl" +- reg : Register address and size + +Optional properties: +- smp-offset : offset in sysctrl for notifying slave cpu booting + cpu 1, reg; + cpu 2, reg + 0x4; + cpu 3, reg + 0x8; + If reg value is not zero, cpun exit wfi and go +- resume-offset : offset in sysctrl for notifying cpu0 when resume +- reboot-offset : offset in sysctrl for system reboot + +Example: + + /* for Hi3620 */ + sysctrl: system-controller at fc802000 { + compatible = "hisilicon,sysctrl"; + reg = <0xfc802000 0x1000>; + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + };arch/arm/boot/dts/hi3620.dtsi +32
-0@@ -39,6 +39,27 @@ reg = <0x0>; next-level-cache = <&L2>; }; + + cpu at 1 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <1>; + next-level-cache = <&L2>; + }; + + cpu at 2 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <2>; + next-level-cache = <&L2>; + }; + + cpu at 3 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <3>; + next-level-cache = <&L2>; + }; }; amba {@@ -65,6 +86,17 @@ reg = <0x1000 0x1000>, <0x100 0x100>; }; + sysctrl: system-controller at 802000 { + compatible = "hisilicon,sysctrl"; + reg = <0x802000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + }; + dual_timer0: dual_timer at 800000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x800000 0x1000>;@@ -115,6 +147,12 @@ status = "disabled"; };
Quoted 6 lines
arch/arm/boot/dts/hi3620.dtsi line 154
Quoted 5 lines
arch/arm/boot/dts/hi3620.dtsi +5
-0+ timer5: timer at 600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0x600 0x20>; + interrupts = <1 13 0xf01>; + };Do you have a clocks node for this timer?
As I mentioned in the 0th patch, clock binding are totally removed in this patch. And clock driver will be append in another patch set.
Quoted 7 lines
Quoted 7 lines
arch/arm/boot/dts/hi3620.dtsi +1
-0+ uart0: uart at b00000 { compatible = "arm,pl011", "arm,primecell"; reg = <0xb00000 0x1000>;arch/arm/mach-hi3xxx/Kconfig +0
-1--- a/arch/arm/mach-hi3xxx/Kconfig
Quoted 9 lines
arch/arm/mach-hi3xxx/Kconfig config ARCH_HI3xxx · line 10
Quoted 7 lines
+++ b/arch/arm/mach-hi3xxx/Kconfig
arch/arm/mach-hi3xxx/Kconfig +2
-0@@ -6,6 +6,9 @@ config ARCH_HI3xxx select CACHE_L2X0 select CLKSRC_OF select GENERIC_CLOCKEVENTS + select HAVE_ARM_SCU + select HAVE_ARM_TWDNeed "if SMP" to avoid a build failure for a non-smp kernel.
ARCH_HI3xxx always need SMP configuration. HAVE_SMP is already required. So it's impossible to build a non-smp kernel with this kernel configuration.
Quoted 192 lines
Dinh
Quoted 52 lines
arch/arm/mach-hi3xxx/Kconfig +1
-0+ select HAVE_SMP select PINCTRL select PINCTRL_SINGLE helparch/arm/mach-hi3xxx/Makefile +1
-0@@ -3,3 +3,4 @@ # obj-y += hi3xxx.o +obj-$(CONFIG_SMP) += platsmp.oarch/arm/mach-hi3xxx/core.h new file +11
-0@@ -0,0 +1,11 @@ +#ifndef __HISILICON_CORE_H +#define __HISILICON_CORE_H + +#include <linux/reboot.h> + +extern void hi3xxx_set_cpu_jump (int cpu,void *jump_addr); +extern int hi3xxx_get_cpu_jump (int cpu); +extern void secondary_startup (void ); +extern struct smp_operations hi3xxx_smp_ops; + +#endif arch/arm/mach-hi3xxx/hi3xxx.c +5
-0@@ -14,11 +14,16 @@#include <linux/clk-provider.h> #include <linux/clocksource.h> #include <linux/irqchip.h> +#include <linux/of_address.h> #include <linux/of_platform.h> +#include <asm/proc-fns.h> +#include <asm/mach/arch.h> #include <asm/mach/map.h> +#include "core.h" +/* * This table is only for optimization. Since ioremap() could always share * the same mapping if it's defined as static IO mapping. arch/arm/mach-hi3xxx/hi3xxx.c line 37
Quoted 4 lines
arch/arm/mach-hi3xxx/hi3xxx.c +1
-0@@ -29,6 +34,7 @@*/ static struct map_desc hi3620_io_desc[]__initdata = { { +/* sysctrl */ What's this comment for?
Quoted 133 lines
arch/arm/mach-hi3xxx/hi3xxx.c +28
-0.pfn = __phys_to_pfn(0xfc802000), .virtual = 0xfe802000, .length = 0x1000,@@ -48,6 +54,32 @@ static void __init hi3xxx_timer_init(void)clocksource_of_init (); } +static void hi3xxx_restart (enum reboot_mode mode,const char *cmd) +{ +struct device_node *np; +void __iomem *base; +int offset; + + np =of_find_compatible_node (NULL ,NULL ,"hisilicon,sysctrl" ); +if (!np) { +pr_err ("failed to find hisilicon,sysctrl node\n" ); +return ; + } + base =of_iomap (np,0 ); +if (!base) { +pr_err ("failed to map address in hisilicon,sysctrl node\n" ); +return ; + } +if (of_property_read_u32 (np,"reboot-offset" , &offset) <0 ) { +pr_err ("failed to find reboot-offset property\n" ); +return ; + } +writel_relaxed (0xdeadbeef , base + offset); + +while (1 ) +cpu_do_idle (); +} +static const char *hi3xxx_compat[]__initdata = {"hisilicon,hi3620-hi4511" ,NULL ,@@ -57,4 +89,6 @@ DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)") .map_io = hi3620_map_io, .init_time = hi3xxx_timer_init, .dt_compat = hi3xxx_compat, + .smp = smp_ops(hi3xxx_smp_ops), + .restart = hi3xxx_restart,MACHINE_END arch/arm/mach-hi3xxx/platsmp.c new file +84
-0@@ -0,0 +1,84 @@ +/* +* Copyright (c) 2013 Linaro Ltd. +* Copyright (c) 2013 Hisilicon Limited. +* Based on platsmp.c, Copyright (C) 2002 ARM Ltd. +* +* This program is free software; you can redistribute it and/or modify it +* under the terms and conditions of the GNU General Public License, +* version 2, as published by the Free Software Foundation. +*/ +#include <linux/smp.h> +#include <linux/io.h> +#include <linux/of_address.h> + +#include <asm/cacheflush.h> +#include <asm/smp_plat.h> +#include <asm/smp_scu.h> + +#include "core.h" + +static void __iomem *ctrl_base =NULL ; + +void hi3xxx_set_cpu_jump (int cpu,void *jump_addr) +{ + cpu =cpu_logical_map (cpu); +if (!cpu || !ctrl_base) +return ; +writel_relaxed (virt_to_phys (jump_addr), ctrl_base + ((cpu -1 ) <<2 )); +} + +int hi3xxx_get_cpu_jump (int cpu) +{ + cpu =cpu_logical_map (cpu); +if (!cpu || !ctrl_base) +return 0 ; +return readl_relaxed (ctrl_base + ((cpu -1 ) <<2 )); +} + +static void __init hi3xxx_smp_prepare_cpus (unsigned int max_cpus) +{ +struct device_node *np =NULL ; +unsigned long base =0 ; +u32 offset =0 ; +void __iomem *scu_base =NULL ; + +if (scu_a9_has_base ()) { + base =scu_a9_get_base (); + scu_base =ioremap (base,SZ_4K ); +if (!scu_base) { +pr_err ("ioremap(scu_base) failed\n" ); +return ; + } +scu_enable (scu_base); +iounmap (scu_base); + } +if (!ctrl_base) { + np =of_find_compatible_node (NULL ,NULL ,"hisilicon,sysctrl" ); +if (!np) { +pr_err ("failed to find hisilicon,sysctrl node\n" ); +return ; + } + ctrl_base =of_iomap (np,0 ); +if (!ctrl_base) { +pr_err ("failed to map address\n" ); +return ; + } +if (of_property_read_u32 (np,"smp-offset" , &offset) <0 ) { +pr_err ("failed to find smp-offset property\n" ); +return ; + } + ctrl_base += offset; + } +} + +static int hi3xxx_boot_secondary (unsigned int cpu,struct task_struct *idle) +{ +hi3xxx_set_cpu_jump (cpu, secondary_startup); +arch_send_wakeup_ipi_mask (cpumask_of (cpu)); +return 0 ; +} + +struct smp_operations hi3xxx_smp_ops__initdata = { + .smp_prepare_cpus = hi3xxx_smp_prepare_cpus, + .smp_boot_secondary = hi3xxx_boot_secondary, +};
PATCH v11 5/6 ARM: hi3xxx: add smp support
Quoted 125 lines · Haojian Zhuang
Quoted 117 lines · Dinh Nguyen
Quoted 115 lines · Haojian Zhuang
From: Zhangfei Gao <[email protected]>
Enable SMP support on hi3xxx platform
Signed-off-by Zhangfei Gao <[email protected]>Tested-by Zhang Mingjun <[email protected]>Tested-by Li Xin <[email protected]>Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 30 ++++++-- arch/arm/boot/dts/hi3620.dtsi | 38 ++++++++++ arch/arm/mach-hi3xxx/Kconfig | 3 + arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 11 +++ arch/arm/mach-hi3xxx/hi3xxx.c | 34 +++++++++ arch/arm/mach-hi3xxx/platsmp.c | 84 ++++++++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-hi3xxx/core.h create mode 100644 arch/arm/mach-hi3xxx/platsmp.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +26
-4@@ -1,10 +1,32 @@ Hisilicon Platforms Device Tree Bindings ---------------------------------------------------- -Hi3716 Development Board -Required root node properties: - - compatible = "hisilicon,hi3716-dkb"; - Hi4511 Board Required root node properties: - compatible = "hisilicon,hi3620-hi4511"; + +Hisilicon system controller + +Required properties: +- compatible : "hisilicon,sysctrl" +- reg : Register address and size + +Optional properties: +- smp-offset : offset in sysctrl for notifying slave cpu booting + cpu 1, reg; + cpu 2, reg + 0x4; + cpu 3, reg + 0x8; + If reg value is not zero, cpun exit wfi and go +- resume-offset : offset in sysctrl for notifying cpu0 when resume +- reboot-offset : offset in sysctrl for system reboot + +Example: + + /* for Hi3620 */ + sysctrl: system-controller at fc802000 { + compatible = "hisilicon,sysctrl"; + reg = <0xfc802000 0x1000>; + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + };arch/arm/boot/dts/hi3620.dtsi +32
-0@@ -39,6 +39,27 @@ reg = <0x0>; next-level-cache = <&L2>; }; + + cpu at 1 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <1>; + next-level-cache = <&L2>; + }; + + cpu at 2 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <2>; + next-level-cache = <&L2>; + }; + + cpu at 3 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <3>; + next-level-cache = <&L2>; + }; }; amba {@@ -65,6 +86,17 @@ reg = <0x1000 0x1000>, <0x100 0x100>; }; + sysctrl: system-controller at 802000 { + compatible = "hisilicon,sysctrl"; + reg = <0x802000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + }; + dual_timer0: dual_timer at 800000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x800000 0x1000>;@@ -115,6 +147,12 @@ status = "disabled"; };Quoted 6 lines
arch/arm/boot/dts/hi3620.dtsi line 154
Quoted 5 lines
arch/arm/boot/dts/hi3620.dtsi +5
-0+ timer5: timer at 600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0x600 0x20>; + interrupts = <1 13 0xf01>; + };Do you have a clocks node for this timer?
Quoted 2 lines
As I mentioned in the 0th patch, clock binding are totally removed in this patch. And clock driver will be append in another patch set.
Still, won't this timer still need a dummy fixed-rate clock until the real clocks are in place? Otherwise it seems twd_get_clock() is going to fail.
Kevin
PATCH v11 5/6 ARM: hi3xxx: add smp support
Quoted 125 lines · Kevin Hilman
Quoted 123 lines · Haojian Zhuang
Quoted 122 lines · Dinh Nguyen
Quoted 112 lines · Haojian Zhuang
From: Zhangfei Gao <[email protected]>
Enable SMP support on hi3xxx platform
Signed-off-by Zhangfei Gao <[email protected]>Tested-by Zhang Mingjun <[email protected]>Tested-by Li Xin <[email protected]>Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 30 ++++++-- arch/arm/boot/dts/hi3620.dtsi | 38 ++++++++++ arch/arm/mach-hi3xxx/Kconfig | 3 + arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 11 +++ arch/arm/mach-hi3xxx/hi3xxx.c | 34 +++++++++ arch/arm/mach-hi3xxx/platsmp.c | 84 ++++++++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-)create mode 100644
arch/arm/mach-hi3xxx/core.hcreate mode 100644arch/arm/mach-hi3xxx/platsmp.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +26
-4@@ -1,10 +1,32 @@ Hisilicon Platforms Device Tree Bindings ---------------------------------------------------- -Hi3716 Development Board -Required root node properties: - - compatible = "hisilicon,hi3716-dkb"; - Hi4511 Board Required root node properties: - compatible = "hisilicon,hi3620-hi4511"; + +Hisilicon system controller + +Required properties: +- compatible : "hisilicon,sysctrl" +- reg : Register address and size + +Optional properties: +- smp-offset : offset in sysctrl for notifying slave cpu booting + cpu 1, reg; + cpu 2, reg + 0x4; + cpu 3, reg + 0x8; + If reg value is not zero, cpun exit wfi and go +- resume-offset : offset in sysctrl for notifying cpu0 when resume +- reboot-offset : offset in sysctrl for system reboot + +Example: + + /* for Hi3620 */ + sysctrl: system-controller at fc802000 { + compatible = "hisilicon,sysctrl"; + reg = <0xfc802000 0x1000>; + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + };arch/arm/boot/dts/hi3620.dtsi +32
-0@@ -39,6 +39,27 @@ reg = <0x0>; next-level-cache = <&L2>; }; + + cpu at 1 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <1>; + next-level-cache = <&L2>; + }; + + cpu at 2 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <2>; + next-level-cache = <&L2>; + }; + + cpu at 3 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <3>; + next-level-cache = <&L2>; + }; }; amba {@@ -65,6 +86,17 @@ reg = <0x1000 0x1000>, <0x100 0x100>; }; + sysctrl: system-controller at 802000 { + compatible = "hisilicon,sysctrl"; + reg = <0x802000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + }; + dual_timer0: dual_timer at 800000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x800000 0x1000>;arch/arm/boot/dts/hi3620.dtsi line 154
Quoted 8 lines
arch/arm/boot/dts/hi3620.dtsi +5
-0@@ -115,6 +147,12 @@ status = "disabled"; }; + timer5: timer at 600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0x600 0x20>; + interrupts = <1 13 0xf01>; + };Do you have a clocks node for this timer?
Quoted 7 lines
Quoted 2 lines
As I mentioned in the 0th patch, clock binding are totally removed in this patch. And clock driver will be append in another patch set.
Still, won't this timer still need a dummy fixed-rate clock until the real clocks are in place? Otherwise it seems
twd_get_clock()is going to fail.Kevin
sp804 is working. twd_get_clock() fails but it could calculate rate. I tested on my platform. With this dummy fixed-rate clock, it could work.
Regards
Haojian
PATCH v11 5/6 ARM: hi3xxx: add smp support
In reply to Haojian ZhuangQuoted 145 lines · Haojian Zhuang
Quoted 117 lines · Dinh Nguyen
Quoted 115 lines · Haojian Zhuang
From: Zhangfei Gao <[email protected]>
Enable SMP support on hi3xxx platform
Signed-off-by Zhangfei Gao <[email protected]>Tested-by Zhang Mingjun <[email protected]>Tested-by Li Xin <[email protected]>Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 30 ++++++-- arch/arm/boot/dts/hi3620.dtsi | 38 ++++++++++ arch/arm/mach-hi3xxx/Kconfig | 3 + arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 11 +++ arch/arm/mach-hi3xxx/hi3xxx.c | 34 +++++++++ arch/arm/mach-hi3xxx/platsmp.c | 84 ++++++++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-hi3xxx/core.h create mode 100644 arch/arm/mach-hi3xxx/platsmp.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +26
-4@@ -1,10 +1,32 @@ Hisilicon Platforms Device Tree Bindings ---------------------------------------------------- -Hi3716 Development Board -Required root node properties: - - compatible = "hisilicon,hi3716-dkb"; - Hi4511 Board Required root node properties: - compatible = "hisilicon,hi3620-hi4511"; + +Hisilicon system controller + +Required properties: +- compatible : "hisilicon,sysctrl" +- reg : Register address and size + +Optional properties: +- smp-offset : offset in sysctrl for notifying slave cpu booting + cpu 1, reg; + cpu 2, reg + 0x4; + cpu 3, reg + 0x8; + If reg value is not zero, cpun exit wfi and go +- resume-offset : offset in sysctrl for notifying cpu0 when resume +- reboot-offset : offset in sysctrl for system reboot + +Example: + + /* for Hi3620 */ + sysctrl: system-controller at fc802000 { + compatible = "hisilicon,sysctrl"; + reg = <0xfc802000 0x1000>; + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + };arch/arm/boot/dts/hi3620.dtsi +32
-0@@ -39,6 +39,27 @@ reg = <0x0>; next-level-cache = <&L2>; }; + + cpu at 1 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <1>; + next-level-cache = <&L2>; + }; + + cpu at 2 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <2>; + next-level-cache = <&L2>; + }; + + cpu at 3 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <3>; + next-level-cache = <&L2>; + }; }; amba {@@ -65,6 +86,17 @@ reg = <0x1000 0x1000>, <0x100 0x100>; }; + sysctrl: system-controller at 802000 { + compatible = "hisilicon,sysctrl"; + reg = <0x802000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + }; + dual_timer0: dual_timer at 800000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x800000 0x1000>;@@ -115,6 +147,12 @@ status = "disabled"; };Quoted 6 lines
arch/arm/boot/dts/hi3620.dtsi line 154
Quoted 5 lines
arch/arm/boot/dts/hi3620.dtsi +5
-0+ timer5: timer at 600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0x600 0x20>; + interrupts = <1 13 0xf01>; + };Do you have a clocks node for this timer?
As I mentioned in the 0th patch, clock binding are totally removed in this patch. And clock driver will be append in another patch set.
Quoted 7 lines
Quoted 7 lines
arch/arm/boot/dts/hi3620.dtsi +1
-0+ uart0: uart at b00000 { compatible = "arm,pl011", "arm,primecell"; reg = <0xb00000 0x1000>;arch/arm/mach-hi3xxx/Kconfig +0
-1--- a/arch/arm/mach-hi3xxx/KconfigQuoted 9 lines
arch/arm/mach-hi3xxx/Kconfig config ARCH_HI3xxx · line 10
Quoted 7 lines
+++ b/arch/arm/mach-hi3xxx/Kconfig
arch/arm/mach-hi3xxx/Kconfig +2
-0@@ -6,6 +6,9 @@ config ARCH_HI3xxx select CACHE_L2X0 select CLKSRC_OF select GENERIC_CLOCKEVENTS + select HAVE_ARM_SCU + select HAVE_ARM_TWDNeed "if SMP" to avoid a build failure for a non-smp kernel.
Quoted 3 lines
ARCH_HI3xxxalways need SMP configuration.HAVE_SMPis already required. So it's impossible to build a non-smp kernel with this kernel configuration.
Then you need to have appropriate dependencies in Kconfig.
Right now, someone can do:
make hi3xxx_defconfig
edit .config, disable CONFIG_SMP
make
and get errors both from Kconfig:
warning: (ARCH_HI3xxx && SOC_OMAP5 && ARCH_SHMOBILE_MULTI) selects HAVE_ARM_TWD which has unmet direct dependencies (SMP)
and from the make:
arch/arm/kernel/smp_twd.c: In function 'twd_local_timer_of_register':arch/arm/kernel/smp_twd.c:391:20: error: 'setup_max_cpus' undeclared (first use in this function)
if (!is_smp() || !setup_max_cpus)
... etc.
I.e. omap and shmobile have similar issues but we'll sort them out in separate patches. You should still fix the hisilicon one.
Quoted 9 lines
Quoted 9 lines
arch/arm/mach-hi3xxx/Kconfig line 37
Quoted 8 lines
arch/arm/mach-hi3xxx/Kconfig +1
-0/* * This table is only for optimization. Since ioremap() could always share * the same mapping if it's defined as static IO mapping.@@ -29,6 +34,7 @@ */ static struct map_desc hi3620_io_desc[] __initdata = { { + /* sysctrl */What's this comment for?
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-hi3xxx/Kconfig static void __init hi3xxx_timer_init(void) · line 55
Quoted 6 lines
arch/arm/mach-hi3xxx/Kconfig +0
-0.pfn = __phys_to_pfn(0xfc802000), .virtual = 0xfe802000, .length = 0x1000,@@ -48,6 +54,32 @@ static void __init hi3xxx_timer_init(void) clocksource_of_init(); }
I know the code was added in a different patch, but I don't like the lack of using constants here.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-hi3xxx/Kconfig +4
-0+static void hi3xxx_restart(enum reboot_mode mode, const char *cmd) +{ + struct device_node *np; + void __iomem *base;
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-hi3xxx/Kconfig static void __init hi3xxx_timer_init(void) · line 67
Quoted 8 lines
arch/arm/mach-hi3xxx/Kconfig +8
-0+ int offset; + + np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl"); + if (!np) { + pr_err("failed to find hisilicon,sysctrl node\n"); + return; + } + base = of_iomap(np, 0);
You can't do this ioremap at restart time, since you can't rely on things being up enough for that when you're panicking, for example. Please set up the ioremap beforehand so you can just do the writel_relaxed, etc.
Quoted 10 lines
Quoted 10 lines
arch/arm/mach-hi3xxx/platsmp.c line 4
Quoted 10 lines
arch/arm/mach-hi3xxx/platsmp.c new file +4
-0@@ -0,0 +1,84 @@ +/* +* Copyright (c) 2013 Linaro Ltd. +* Copyright (c) 2013 Hisilicon Limited. +* Based on platsmp.c, Copyright (C) 2002 ARM Ltd.
Based on what platsmp? There are a lot of them under arch/arm. :)
-Olof
PATCH v11 5/6 ARM: hi3xxx: add smp support
Quoted 164 lines · Olof Johansson
Quoted 145 lines · Haojian Zhuang
Quoted 117 lines · Dinh Nguyen
Quoted 115 lines · Haojian Zhuang
From: Zhangfei Gao <[email protected]>
Enable SMP support on hi3xxx platform
Signed-off-by Zhangfei Gao <[email protected]>Tested-by Zhang Mingjun <[email protected]>Tested-by Li Xin <[email protected]>Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 30 ++++++-- arch/arm/boot/dts/hi3620.dtsi | 38 ++++++++++ arch/arm/mach-hi3xxx/Kconfig | 3 + arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 11 +++ arch/arm/mach-hi3xxx/hi3xxx.c | 34 +++++++++ arch/arm/mach-hi3xxx/platsmp.c | 84 ++++++++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-hi3xxx/core.h create mode 100644 arch/arm/mach-hi3xxx/platsmp.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +26
-4@@ -1,10 +1,32 @@ Hisilicon Platforms Device Tree Bindings ---------------------------------------------------- -Hi3716 Development Board -Required root node properties: - - compatible = "hisilicon,hi3716-dkb"; - Hi4511 Board Required root node properties: - compatible = "hisilicon,hi3620-hi4511"; + +Hisilicon system controller + +Required properties: +- compatible : "hisilicon,sysctrl" +- reg : Register address and size + +Optional properties: +- smp-offset : offset in sysctrl for notifying slave cpu booting + cpu 1, reg; + cpu 2, reg + 0x4; + cpu 3, reg + 0x8; + If reg value is not zero, cpun exit wfi and go +- resume-offset : offset in sysctrl for notifying cpu0 when resume +- reboot-offset : offset in sysctrl for system reboot + +Example: + + /* for Hi3620 */ + sysctrl: system-controller at fc802000 { + compatible = "hisilicon,sysctrl"; + reg = <0xfc802000 0x1000>; + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + };arch/arm/boot/dts/hi3620.dtsi +32
-0@@ -39,6 +39,27 @@ reg = <0x0>; next-level-cache = <&L2>; }; + + cpu at 1 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <1>; + next-level-cache = <&L2>; + }; + + cpu at 2 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <2>; + next-level-cache = <&L2>; + }; + + cpu at 3 { + compatible = "arm,cortex-a9"; + device_type = "cpu"; + reg = <3>; + next-level-cache = <&L2>; + }; }; amba {@@ -65,6 +86,17 @@ reg = <0x1000 0x1000>, <0x100 0x100>; }; + sysctrl: system-controller at 802000 { + compatible = "hisilicon,sysctrl"; + reg = <0x802000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + }; + dual_timer0: dual_timer at 800000 { compatible = "arm,sp804", "arm,primecell"; reg = <0x800000 0x1000>;@@ -115,6 +147,12 @@ status = "disabled"; };Quoted 6 lines
arch/arm/boot/dts/hi3620.dtsi line 154
Quoted 5 lines
arch/arm/boot/dts/hi3620.dtsi +5
-0+ timer5: timer at 600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0x600 0x20>; + interrupts = <1 13 0xf01>; + };Do you have a clocks node for this timer?
As I mentioned in the 0th patch, clock binding are totally removed in this patch. And clock driver will be append in another patch set.
Quoted 7 lines
Quoted 7 lines
arch/arm/boot/dts/hi3620.dtsi +1
-0+ uart0: uart at b00000 { compatible = "arm,pl011", "arm,primecell"; reg = <0xb00000 0x1000>;arch/arm/mach-hi3xxx/Kconfig +0
-1--- a/arch/arm/mach-hi3xxx/KconfigQuoted 9 lines
arch/arm/mach-hi3xxx/Kconfig config ARCH_HI3xxx · line 10
Quoted 7 lines
+++ b/arch/arm/mach-hi3xxx/Kconfig
arch/arm/mach-hi3xxx/Kconfig +2
-0@@ -6,6 +6,9 @@ config ARCH_HI3xxx select CACHE_L2X0 select CLKSRC_OF select GENERIC_CLOCKEVENTS + select HAVE_ARM_SCU + select HAVE_ARM_TWDNeed "if SMP" to avoid a build failure for a non-smp kernel.
Quoted 3 lines
ARCH_HI3xxxalways need SMP configuration.HAVE_SMPis already required. So it's impossible to build a non-smp kernel with this kernel configuration.Then you need to have appropriate dependencies in
Kconfig.Right now, someone can do:
make
hi3xxx_defconfig
edit .config, disableCONFIG_SMP
makeand get errors both from
Kconfig:warning: (
ARCH_HI3xxx&&SOC_OMAP5&&ARCH_SHMOBILE_MULTI) selectsHAVE_ARM_TWDwhich has unmet direct dependencies (SMP)
Quoted 9 lines
and from the make:
arch/arm/kernel/smp_twd.c: In function 'twd_local_timer_of_register':arch/arm/kernel/smp_twd.c:391:20: error: 'setup_max_cpus' undeclared (first use in this function)
if (!is_smp() || !setup_max_cpus)... etc.
OK. I'll update the Kconfig.
Quoted 12 lines
I.e. omap and shmobile have similar issues but we'll sort them out in separate patches. You should still fix the hisilicon one.
Quoted 9 lines
Quoted 9 lines
arch/arm/mach-hi3xxx/Kconfig line 37
Quoted 8 lines
arch/arm/mach-hi3xxx/Kconfig +1
-0/* * This table is only for optimization. Since ioremap() could always share * the same mapping if it's defined as static IO mapping.@@ -29,6 +34,7 @@ */ static struct map_desc hi3620_io_desc[] __initdata = { { + /* sysctrl */What's this comment for?
Quoted 11 lines
Quoted 6 lines
Quoted 6 lines
arch/arm/mach-hi3xxx/Kconfig static void __init hi3xxx_timer_init(void) · line 55
Quoted 6 lines
arch/arm/mach-hi3xxx/Kconfig +0
-0.pfn = __phys_to_pfn(0xfc802000), .virtual = 0xfe802000, .length = 0x1000,@@ -48,6 +54,32 @@ static void __init hi3xxx_timer_init(void) clocksource_of_init(); }I know the code was added in a different patch, but I don't like the lack of using constants here.
OK. I'll use macro instead.
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-hi3xxx/Kconfig +10
-0+static void hi3xxx_restart(enum reboot_mode mode, const char *cmd) +{ + struct device_node *np; + void __iomem *base; + int offset; + + np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl"); + if (!np) { + pr_err("failed to find hisilicon,sysctrl node\n"); + return;
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
arch/arm/mach-hi3xxx/Kconfig static void __init hi3xxx_timer_init(void) · line 67
Quoted 2 lines
arch/arm/mach-hi3xxx/Kconfig +2
-0+ } + base = of_iomap(np, 0);You can't do this ioremap at restart time, since you can't rely on things being up enough for that when you're panicking, for example. Please set up the ioremap beforehand so you can just do the
writel_relaxed, etc.
Since the sysctrl register mapping is already defined, the ioremap will reuse the static mapping instead. It won't add the new mapping in page table & flush cache.
Quoted 14 lines
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-hi3xxx/platsmp.c line 4
Quoted 11 lines
arch/arm/mach-hi3xxx/platsmp.c new file +4
-0@@ -0,0 +1,84 @@ +/* +* Copyright (c) 2013 Linaro Ltd. +* Copyright (c) 2013 Hisilicon Limited. +* Based on platsmp.c, Copyright (C) 2002 ARM Ltd. Based on what platsmp? There are a lot of them under
arch/arm. :)
OK. I'll add more comments.
Quoted 2 lines
-Olof
PATCH v11 5/6 ARM: hi3xxx: add smp support
In reply to Haojian ZhuangQuoted 25 lines · Haojian Zhuang
From: Zhangfei Gao <[email protected]>
Enable SMP support on hi3xxx platform
Signed-off-by Zhangfei Gao <[email protected]>Tested-by Zhang Mingjun <[email protected]>Tested-by Li Xin <[email protected]>Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 30 ++++++-- arch/arm/boot/dts/hi3620.dtsi | 38 ++++++++++ arch/arm/mach-hi3xxx/Kconfig | 3 + arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 11 +++ arch/arm/mach-hi3xxx/hi3xxx.c | 34 +++++++++ arch/arm/mach-hi3xxx/platsmp.c | 84 ++++++++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-hi3xxx/core.h create mode 100644 arch/arm/mach-hi3xxx/platsmp.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +0
-0
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt line 7
Quoted 7 lines
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +0
-4@@ -1,10 +1,32 @@ Hisilicon Platforms Device Tree Bindings ---------------------------------------------------- -Hi3716 Development Board -Required root node properties: - - compatible = "hisilicon,hi3716-dkb"; -
This was added in patch 1/6, then removed here. If it's not needed/used, just drop it from patch 1 please.
Kevin
PATCH v11 5/6 ARM: hi3xxx: add smp support
Quoted 30 lines · Kevin Hilman
Quoted 28 lines · Haojian Zhuang
From: Zhangfei Gao <[email protected]>
Enable SMP support on hi3xxx platform
Signed-off-by Zhangfei Gao <[email protected]>Tested-by Zhang Mingjun <[email protected]>Tested-by Li Xin <[email protected]>Signed-off-by Haojian Zhuang <[email protected]>--- .../bindings/arm/hisilicon/hisilicon.txt | 30 ++++++-- arch/arm/boot/dts/hi3620.dtsi | 38 ++++++++++ arch/arm/mach-hi3xxx/Kconfig | 3 + arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 11 +++ arch/arm/mach-hi3xxx/hi3xxx.c | 34 +++++++++ arch/arm/mach-hi3xxx/platsmp.c | 84 ++++++++++++++++++++++ 7 files changed, 197 insertions(+), 4 deletions(-)create mode 100644
arch/arm/mach-hi3xxx/core.hcreate mode 100644arch/arm/mach-hi3xxx/platsmp.cDocumentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +0
-0@@ -1,10 +1,32 @@ Hisilicon Platforms Device Tree Bindings ----------------------------------------------------
Quoted 8 lines
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt line 7
Quoted 4 lines
Documentation/devicetree/bindings/arm/hisilicon/hisilicon.txt +0
-4-Hi3716 Development Board -Required root node properties: - - compatible = "hisilicon,hi3716-dkb"; -This was added in patch 1/6, then removed here. If it's not needed/used, just drop it from patch 1 please.
Kevin
OK
PATCH v11 6/6 ARM: hi3xxx: add hotplug support
In reply to Haojian ZhuangFrom: Zhangfei Gao <[email protected]>
Enable hotplug support on hi3xxx platform
How to test:
cat proc/interrupts
echo 0 > /sys/devices/system/cpu/cpuX/online
cat proc/interrupts
echo 1 > /sys/devices/system/cpu/cpuX/online
--- arch/arm/mach-hi3xxx/Makefile | 1 + arch/arm/mach-hi3xxx/core.h | 4 + arch/arm/mach-hi3xxx/hotplug.c | 200 +++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-hi3xxx/platsmp.c | 5 ++ 4 files changed, 210 insertions(+) create mode 100644 arch/arm/mach-hi3xxx/hotplug.c
arch/arm/mach-hi3xxx/Makefile +1 -0
@@ -4,3 +4,4 @@ obj-y += hi3xxx.o obj-$(CONFIG_SMP) += platsmp.o +obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
arch/arm/mach-hi3xxx/core.h +4 -0
@@ -8,4 +8,8 @@ extern int hi3xxx_get_cpu_jump(int cpu);extern void secondary_startup (void );extern struct smp_operations hi3xxx_smp_ops; +extern void hi3xxx_cpu_die (unsigned int cpu); +extern int hi3xxx_cpu_kill (unsigned int cpu); +extern void hi3xxx_set_cpu (int cpu,bool enable); +#endif
arch/arm/mach-hi3xxx/hotplug.c new file +200 -0
200 lines not on this page · raw message
arch/arm/mach-hi3xxx/platsmp.c +5 -0
@@ -73,6 +73,7 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)static int hi3xxx_boot_secondary (unsigned int cpu,struct task_struct *idle) { +hi3xxx_set_cpu (cpu, true);hi3xxx_set_cpu_jump (cpu, secondary_startup);arch_send_wakeup_ipi_mask (cpumask_of (cpu));return 0 ;
@@ -81,4 +82,8 @@ static int hi3xxx_boot_secondary(unsigned int cpu, struct task_struct *idle)struct smp_operations hi3xxx_smp_ops__initdata = { .smp_prepare_cpus = hi3xxx_smp_prepare_cpus, .smp_boot_secondary = hi3xxx_boot_secondary, +#ifdef CONFIG_HOTPLUG_CPU + .cpu_die = hi3xxx_cpu_die, + .cpu_kill = hi3xxx_cpu_kill, +#endif };
Signature · 1 line
1.8.3.2