enable hi3xxx SoC
Subsystems (5)
v10 cover enable hi3xxx SoC
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 v10 1/7 clk: hi3xxx: add clock support
Add clock support with device tree on Hisilicon SoC.
--- .../devicetree/bindings/clock/hisilicon.txt | 99 +++++++++ drivers/clk/Makefile | 1 + drivers/clk/hisilicon/Makefile | 2 + drivers/clk/hisilicon/clk-hi3xxx.c | 221 +++++++++++++++++++++ drivers/clk/hisilicon/clk-hi3xxx.h | 34 ++++ drivers/clk/hisilicon/clkgate-seperated.c | 129 ++++++++++++ 6 files changed, 486 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/hisilicon.txt create mode 100644 drivers/clk/hisilicon/Makefile create mode 100644 drivers/clk/hisilicon/clk-hi3xxx.c create mode 100644 drivers/clk/hisilicon/clk-hi3xxx.h create mode 100644 drivers/clk/hisilicon/clkgate-seperated.c
Documentation/devicetree/bindings/clock/hisilicon.txt new file +99 -0
@@ -0,0 +1,99 @@ +Device Tree Clock bindings for arch-hi3xxx + +This binding uses the common clock binding[1]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt + +Required properties for mux clocks: + - compatible : shall be "hisilicon,clk-mux". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - #clock-cells : from common clock binding; shall be set to 0. + - reg : the mux register address. It should be the offset of the container. + - clkmux-mask : mask bits of the mux register. + - clkmux-table : array of mux select bits. + +Optional properties for mux clocks: + - clkmux-hiword-mask : indicates that the bit[31:16] are the hiword mask + of mux selected bits (bit[15:0]). The bit[15:0] is valid only when + bit[31:16] is set. + + + +Required properties for gate clocks: + - compatible : shall be "hisilicon,clk-gate". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - #clock-cells : from common clock binding; shall be set to 0. + - reg : the mux register address. It should be the offset of the container. + - clkgate : bit index to control the clock gate in the gate register. + +Optional properties for gate clocks: + - clkgate-inverted : it indicates that setting 0 could enable the clock gate + and setting 1 could disable the clock gate. + - clkgate-seperated-reg : it indicates that there're three continuous + registers (enable, disable & status) for the same clock gate. + + + +Required properties for divider clocks: + - compatible : shall be "hisilicon,clk-div". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - reg : the divider register address. It should be the offset of the + container. + - clkdiv-mask : mask bits of the divider register. + - clkdiv-min : the minimum divider of the clock divider. + - clkdiv-max : the maximum divider of the clock divider. + +Optional properties for divider clocks: + - clkdiv-hiword-mask : indicates that the bit[31:16] are the hiword mask + of divider selected bits (bit[15:0]). The bit[15:0] is valid only when + bit[31:16] is set. + + + +For example: + timer0_mux: timer0_mux at fc802000 { + compatible = "hisilicon,clk-mux"; + #clock-cells = <0>; + clocks = <&osc32k &timerclk01>; + clock-output-names = "timer0_mux"; + reg = <0xfc802000 0x4>; + clkmux-mask = <0x8000>; + clkmux-table = <0 0x8000>; + }; + uart0_mux: uart0_mux at fc802100 { + compatible = "hisilicon,clk-mux"; + #clock-cells = <0>; + clocks = <&osc26m &pclk>; + clock-output-names = "uart0_mux"; + reg = <0xfc802100 0x4>; + clkmux-mask = <0x80>; + /* each item value */ + clkmux-table = <0 0x80>; + clkmux-hiword-mask; + }; + timerclk01: timerclk01 at fc802020 { + compatible = "hisilicon,clk-gate"; + #clock-cells = <0>; + clocks = <&timer_rclk01>; + clock-output-names = "timerclk01"; + reg = <0xfc802020 0x4>; + clkgate = <0>; + clkgate-seperated-reg; + }; + mmc1_div: mmc1_div at fc802108 { + compatible = "hisilicon,clk-div"; + #clock-cells = <0>; + clocks = <&mmc1_mux>; + clock-output-names = "mmc1_div"; + reg = <0xfc802108 0x4>; + clkdiv-mask = <0x1e0>; + clkdiv-min = <1>; + clkdiv-max = <16>; + clkdiv-hiword-mask; + };
drivers/clk/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_COMMON_CLK) += clk-composite.o # SoCs specific obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o +obj-$(CONFIG_ARCH_HI3xxx) += hisilicon/ obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o obj-$(CONFIG_ARCH_NSPIRE) += clk-nspire.o obj-$(CONFIG_ARCH_MXS) += mxs/
drivers/clk/hisilicon/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-y += clk-hi3xxx.o clkgate-seperated.o
drivers/clk/hisilicon/clk-hi3xxx.c new file +221 -0
221 lines not on this page · raw message
drivers/clk/hisilicon/clk-hi3xxx.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* Hisilicon Hi3620 clock gate driver +* +* Copyright (c) 2012-2013 Hisilicon Limited. +* Copyright (c) 2012-2013 Linaro Limited. +* +* Author: Haojian Zhuang <[email protected]> +* Xin Li <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +* +* This 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, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +* +*/ + +#ifndef __HI3XXX_CLKGATE_SEPERATED +#define __HI3XXX_CLKGATE_SEPERATED + +extern struct clk *hi3xxx_register_clkgate_sep (struct device *,const char *, +const char *,unsigned long , +void __iomem *,u8 , +u8 ,spinlock_t *); + +#endif /* __HI3XXX_CLKGATE_SEPERATED */
drivers/clk/hisilicon/clkgate-seperated.c new file +129 -0
129 lines not on this page · raw message
Signature · 1 line
1.8.1.2
PATCH v10 1/7 clk: hi3xxx: add clock support
Quoting Haojian Zhuang (2013-10-15 02:16:11)
Quoted 4 lines
Add clock support with device tree on Hisilicon SoC.
Signed-off-by Haojian Zhuang <[email protected]>Cc Mike Turquette <[email protected]>
Hello Haojian,
This patch looks mostly good to me but I have a few comments on the binding below.
Quoted 30 lines
--- .../devicetree/bindings/clock/hisilicon.txt | 99 +++++++++ drivers/clk/Makefile | 1 + drivers/clk/hisilicon/Makefile | 2 + drivers/clk/hisilicon/clk-hi3xxx.c | 221 +++++++++++++++++++++ drivers/clk/hisilicon/clk-hi3xxx.h | 34 ++++ drivers/clk/hisilicon/clkgate-seperated.c | 129 ++++++++++++ 6 files changed, 486 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/hisilicon.txt create mode 100644 drivers/clk/hisilicon/Makefile create mode 100644 drivers/clk/hisilicon/clk-hi3xxx.c create mode 100644 drivers/clk/hisilicon/clk-hi3xxx.h create mode 100644 drivers/clk/hisilicon/clkgate-seperated.cDocumentation/devicetree/bindings/clock/hisilicon.txt new file +10
-0@@ -0,0 +1,99 @@ +Device Tree Clock bindings for arch-hi3xxx + +This binding uses the common clock binding[1]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt + +Required properties for mux clocks: + - compatible : shall be "hisilicon,clk-mux". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock.
Documentation/devicetree/bindings/clock/hisilicon.txt line 20
Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10
-0+ - clock-output-names : shall be reference name. + - #clock-cells : from common clock binding; shall be set to 0. + - reg : the mux register address. It should be the offset of the container. + - clkmux-mask : mask bits of the mux register. + - clkmux-table : array of mux select bits. + +Optional properties for mux clocks: + - clkmux-hiword-mask : indicates that the bit[31:16] are the hiword mask + of mux selected bits (bit[15:0]). The bit[15:0] is valid only when + bit[31:16] is set.
The masks are enumerated in clkmux-table. Can these masks include the hiword-mask bits as well? This will mean that you can eliminate the clkmux-hiword-mask property entirely. As an example:
reg = <0xfc802000 0x4>; clkmux-table = <0x80000000 0x80008000>;
Quoted 37 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +37
-0+ + + +Required properties for gate clocks: + - compatible : shall be "hisilicon,clk-gate". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - #clock-cells : from common clock binding; shall be set to 0. + - reg : the mux register address. It should be the offset of the container. + - clkgate : bit index to control the clock gate in the gate register. + +Optional properties for gate clocks: + - clkgate-inverted : it indicates that setting 0 could enable the clock gate + and setting 1 could disable the clock gate. + - clkgate-seperated-reg : it indicates that there're three continuous + registers (enable, disable & status) for the same clock gate. + + + +Required properties for divider clocks: + - compatible : shall be "hisilicon,clk-div". + - clocks : shall be the input parent clock phandle for the clock. This should + be the reference clock. + - clock-output-names : shall be reference name. + - reg : the divider register address. It should be the offset of the + container. + - clkdiv-mask : mask bits of the divider register. + - clkdiv-min : the minimum divider of the clock divider. + - clkdiv-max : the maximum divider of the clock divider. + +Optional properties for divider clocks: + - clkdiv-hiword-mask : indicates that the bit[31:16] are the hiword mask + of divider selected bits (bit[15:0]). The bit[15:0] is valid only when + bit[31:16] is set. + +
Documentation/devicetree/bindings/clock/hisilicon.txt line 67
Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10
-0+ +For example: + timer0_mux: timer0_mux at fc802000 { + compatible = "hisilicon,clk-mux"; + #clock-cells = <0>; + clocks = <&osc32k &timerclk01>; + clock-output-names = "timer0_mux"; + reg = <0xfc802000 0x4>; + clkmux-mask = <0x8000>; + clkmux-table = <0 0x8000>;
Can you eliminate the clkmux-mask property as well? Since you enumerate the clkmux-table property you should be able to derive the mask from the entries in that table.
Regards,
Mike
PATCH v10 2/7 ARM: hi3xxx: add board support with device tree
In reply to Haojian ZhuangAdd board support with device tree for Hisilicon Hi3620 SoC platform.
Changelog:
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 | 52 ++++++++++++++++++++++ 6 files changed, 82 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 +52 -0
52 lines not on this page · raw message
Signature · 1 line
1.8.1.2
Arnd Bergmann
maintainerPATCH v10 2/7 ARM: hi3xxx: add board support with device tree
Quoted 9 lines · Haojian Zhuang
Add board support with device tree for Hisilicon Hi3620 SoC platform.
Changelog:
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.
This seems like a step in the wrong direction. Why would you want to use a static I/O mapping in the clock driver?
Arnd
PATCH v10 2/7 ARM: hi3xxx: add board support with device tree
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Haojian Zhuang
Add board support with device tree for Hisilicon Hi3620 SoC platform.
Changelog:
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.
Quoted 4 lines
This seems like a step in the wrong direction. Why would you want to use a static I/O mapping in the clock driver?
Arnd
Because Stephen & Kevin asked me to use unit address in DTS file. They also require me to use reg property to present real hardware address in DTS file.
Regards
Haojian
Arnd Bergmann
maintainerPATCH v10 2/7 ARM: hi3xxx: add board support with device tree
Quoted 12 lines · Haojian Zhuang
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Haojian Zhuang
Add board support with device tree for Hisilicon Hi3620 SoC platform.
Changelog:
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.
Quoted 7 lines
Quoted 3 lines
This seems like a step in the wrong direction. Why would you want to use a static I/O mapping in the clock driver?
Because Stephen & Kevin asked me to use unit address in DTS file. They also require me to use reg property to present real hardware address in DTS file.
Ah, so it's just an optimization, not required to make the clock driver work, I misread that. Can you add a comment near the hi3620_io_desc definition and verify that it still works without it?
I would also recommend to extend that static mapping to the entire 0xfc800000-0xfcbfffff range, or whatever you can use to get the most I/O devices with a small number of TLB entries.
Arnd
PATCH v10 2/7 ARM: hi3xxx: add board support with device tree
Quoted 17 lines · Arnd Bergmann
Quoted 16 lines · Haojian Zhuang
Quoted 14 lines · Arnd Bergmann
Quoted 9 lines · Haojian Zhuang
Add board support with device tree for Hisilicon Hi3620 SoC platform.
Changelog:
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.This seems like a step in the wrong direction. Why would you want to use a static I/O mapping in the clock driver?
Quoted 8 lines
Quoted 3 lines
Because Stephen & Kevin asked me to use unit address in DTS file. They also require me to use reg property to present real hardware address in DTS file.
Ah, so it's just an optimization, not required to make the clock driver work, I misread that. Can you add a comment near the
hi3620_io_descdefinition and verify that it still works without it?
Yes, it can work without the IO table. The IO table could save a lot of virtual address space for IO mapping.
Quoted 5 lines
I would also recommend to extend that static mapping to the entire 0xfc800000-0xfcbfffff range, or whatever you can use to get the most I/O devices with a small number of TLB entries.
Arnd
OK. I'll extend the static mapping to the entire range.
Regards
Haojian
PATCH v10 2/7 ARM: hi3xxx: add board support with device tree
Quoted 33 lines · Haojian Zhuang
Quoted 17 lines · Arnd Bergmann
Quoted 16 lines · Haojian Zhuang
Quoted 14 lines · Arnd Bergmann
Quoted 9 lines · Haojian Zhuang
Add board support with device tree for Hisilicon Hi3620 SoC platform.
Changelog:
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.This seems like a step in the wrong direction. Why would you want to use a static I/O mapping in the clock driver?
Quoted 8 lines
Quoted 3 lines
Because Stephen & Kevin asked me to use unit address in DTS file. They also require me to use reg property to present real hardware address in DTS file.
Ah, so it's just an optimization, not required to make the clock driver work, I misread that. Can you add a comment near the
hi3620_io_descdefinition and verify that it still works without it?Yes, it can work without the IO table. The IO table could save a lot of virtual address space for IO mapping.
Quoted 4 lines
I would also recommend to extend that static mapping to the entire 0xfc800000-0xfcbfffff range, or whatever you can use to get the most I/O devices with a small number of TLB entries.
Quoted 6 lines
Quoted 1 line
Arnd
OK. I'll extend the static mapping to the entire range.
Regards
Haojian
Oh, no. I shouldn't extend the static mapping table to the entire range.
Most of the registers only need to map once in the probe() function of the driver. Whether it's using static mapping or dynamic mapping, there's no difference.
The sysctrl register bank is used in both clock & platform
driver. Each clock node contains reg property, it needs to be parsed by of_iomap(). Hotplug & SMP platform driver needs to parse sysctrl register bank also. If I don't choose the static IO mapping for sysctrl register bank, I have to define some global variable to store the virtual address mapping. Or I have to cost lots of redundant virtual address space for the same IO mapping.
So I'll only keep the static IO mapping for sysctrl.
Regards
Haojian
Arnd Bergmann
maintainerPATCH v10 2/7 ARM: hi3xxx: add board support with device tree
Quoted 5 lines · Haojian Zhuang
Oh, no. I shouldn't extend the static mapping table to the entire range.
Most of the registers only need to map once in the
probe()function of the driver. Whether it's using static mapping or dynamic mapping, there's no difference.
There is a small difference in that having a megabyte-sized mapping will reduce the number of TLB entries required for I/O access, which can improve performance slightly. Other platforms do it for this reason.
Quoted 7 lines
The sysctrl register bank is used in both clock & platform
driver. Each clock node contains reg property, it needs to be parsed byof_iomap(). Hotplug & SMP platform driver needs to parse sysctrl register bank also. If I don't choose the static IO mapping for sysctrl register bank, I have to define some global variable to store the virtual address mapping. Or I have to cost lots of redundant virtual address space for the same IO mapping.
It's a small cost, but your approach makes sense, just make sure you have a comment in the map_io code explaining it.
Quoted 1 line
So I'll only keep the static IO mapping for sysctrl.
I'd still choose the larger mapping, but I'll leave the decision to you.
Arnd
PATCH v10 3/7 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-clk.dtsi | 1052 +++++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/hi3620.dtsi | 513 ++++++++++++++++++ arch/arm/boot/dts/hi4511.dts | 648 +++++++++++++++++++++++ 4 files changed, 2214 insertions(+) create mode 100644 arch/arm/boot/dts/hi3620-clk.dtsi 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-clk.dtsi new file +1052 -0
1,052 lines not on this page · raw message
arch/arm/boot/dts/hi3620.dtsi new file +513 -0
513 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.1.2
Arnd Bergmann
maintainerPATCH v10 3/7 ARM: dts: enable hi4511 with device tree
Quoted 3 lines · Haojian Zhuang
Enable Hisilicon Hi4511 development platform with device tree support.
Signed-off-by Haojian Zhuang <[email protected]>
Based on my other mail, some more comments here:
arch/arm/boot/dts/hi3620-clk.dtsi line 18
Quoted 5 lines
arch/arm/boot/dts/hi3620-clk.dtsi new file +5
-0+/ { + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges;
Since all clocks are in the fc802000 page, I would prefer using a non-empty ranges to map the clocks into their own address space, like
ranges = <0 0xfc802000 0x1000>;
arch/arm/boot/dts/hi3620-clk.dtsi line 143
Quoted 9 lines
arch/arm/boot/dts/hi3620-clk.dtsi new file +9
-0+ timer4_mux: timer4_mux at fc802018 { + compatible = "hisilicon,clk-mux"; + #clock-cells = <0>; + clocks = <&osc32k &timerclk45>; + clock-output-names = "timer4_mux"; + reg = <0xfc802018 0x4>; + clkmux-mask = <0x3>; + clkmux-table = <0 0x1>; + };
which would turn this into
timer4_mux: timer4_mux at 18 {
...
reg = <0x18 0x4>;
...
};The code would not be impacted by this.
On a related note, I find it strange that you have multiple devices with the same register. Normally, we try to have device node names be generic, e.g. 'clock at 18' rather than 'timer4_mux at 18', but that won't work if the register is the same for all of them. Maybe some DT expert can comment on this.
Quoted 5 lines
arch/arm/boot/dts/hi3620.dtsi new file +5
-0+ + amba { + #address-cells = <1>; + #size-cells = <1>; + compatible = "arm,amba-bus";
arch/arm/boot/dts/hi3620.dtsi line 52
Quoted 10 lines
arch/arm/boot/dts/hi3620.dtsi new file +10
-0+ interrupt-parent = <&gic>; + ranges; + + L2: l2-cache { + compatible = "arm,pl310-cache"; + reg = <0xfc10000 0x100000>; + interrupts = <0 15 4>; + cache-unified; + cache-level = <2>; + };
For this node, we could use the same trick with the non-empty ranges, since all amba devices seem to be in the 0xfc000000 range.
If you do that, it probably makes sense to move the clock controller under here as well.
Arnd
PATCH v10 3/7 ARM: dts: enable hi4511 with device tree
Quoted 13 lines · Arnd Bergmann
Quoted 3 lines · Haojian Zhuang
Enable Hisilicon Hi4511 development platform with device tree support.
Signed-off-by Haojian Zhuang <[email protected]>Based on my other mail, some more comments here:
arch/arm/boot/dts/hi3620-clk.dtsi line 18
Quoted 5 lines
arch/arm/boot/dts/hi3620-clk.dtsi new file +5
-0+/ { + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges;
Quoted 6 lines
Since all clocks are in the
fc802000page, I would prefer using a non-empty ranges to map the clocks into their own address space, likeranges = <0 0xfc802000 0x1000>;
OK.
Quoted 18 lines
arch/arm/boot/dts/hi3620-clk.dtsi line 143
Quoted 9 lines
arch/arm/boot/dts/hi3620-clk.dtsi new file +9
-0+ timer4_mux: timer4_mux at fc802018 { + compatible = "hisilicon,clk-mux"; + #clock-cells = <0>; + clocks = <&osc32k &timerclk45>; + clock-output-names = "timer4_mux"; + reg = <0xfc802018 0x4>; + clkmux-mask = <0x3>; + clkmux-table = <0 0x1>; + };which would turn this into
timer4_mux: timer4_mux at 18 { ... reg = <0x18 0x4>; ... };
Quoted 8 lines
The code would not be impacted by this.
On a related note, I find it strange that you have multiple devices with the same register. Normally, we try to have device node names be generic, e.g. 'clock at 18' rather than '
timer4_muxat 18', but that won't work if the register is the same for all of them. Maybe some DT expert can comment on this.
Because multiple clock nodes (clock mux/clock gate/clock divider) are sharing the same register. I think that it's common on ARM SoC. At least, I can find this in both Hisilicon & Marvell PXA/MMP SoC.
If I force to merge multiple clock nodes into the same device node, it'll become mess. Different clock nodes have different properties. The property won't work any more if they are merged into the same device node.
Quoted 10 lines
Quoted 10 lines
arch/arm/boot/dts/hi3620.dtsi new file +10
-0+ + amba { + #address-cells = <1>; + #size-cells = <1>; + compatible = "arm,amba-bus"; + interrupt-parent = <&gic>; + ranges; + + L2: l2-cache { + compatible = "arm,pl310-cache";
Quoted 9 lines
arch/arm/boot/dts/hi3620.dtsi line 52
Quoted 5 lines
arch/arm/boot/dts/hi3620.dtsi new file +5
-0+ reg = <0xfc10000 0x100000>; + interrupts = <0 15 4>; + cache-unified; + cache-level = <2>; + };For this node, we could use the same trick with the non-empty ranges, since all amba devices seem to be in the
0xfc000000range.
OK.
Quoted 2 lines
If you do that, it probably makes sense to move the clock controller under here as well.
Could I keep them into hi3620-clk.dtsi? Since both hi3620.dtsi & hi3620-clk.dtsi are not small, merge them together only make people reading hard.
Quoted 2 lines
Arnd
Best Regards
Haojian
Arnd Bergmann
maintainerPATCH v10 3/7 ARM: dts: enable hi4511 with device tree
Quoted 5 lines · Haojian Zhuang
Quoted 2 lines
If you do that, it probably makes sense to move the clock controller under here as well.
Could I keep them into
hi3620-clk.dtsi? Since bothhi3620.dtsi&hi3620-clk.dtsiare not small, merge them together only make people reading hard.
Yes, of course. The location in the tree is independent of what file they are in. I was just suggesting to have the "clocks" node under "amba".
Arnd
PATCH v10 3/7 ARM: dts: enable hi4511 with device tree
In reply to Arnd BergmannQuoted 20 lines · Arnd Bergmann
On Tuesday 15 October 2013, Haojian Zhuang wrote:
Since all clocks are in the
fc802000page, I would prefer using a non-empty ranges to map the clocks into their own address space, likeranges = <0 0xfc802000 0x1000>;arch/arm/boot/dts/hi3620-clk.dtsi line 143
Quoted 9 lines
arch/arm/boot/dts/hi3620-clk.dtsi new file +9
-0+ timer4_mux: timer4_mux at fc802018 { + compatible = "hisilicon,clk-mux"; + #clock-cells = <0>; + clocks = <&osc32k &timerclk45>; + clock-output-names = "timer4_mux"; + reg = <0xfc802018 0x4>; + clkmux-mask = <0x3>; + clkmux-table = <0 0x1>; + };which would turn this into
Quoted 7 lines
timer4_mux: timer4_mux at 18 { ... reg = <0x18 0x4>; ... };The code would not be impacted by this.
I'd rather question the addition of a reg =<>; specifier for each and every clock.
Knowing the offsets of each and every register in a memory-mapped device is usually overdesign, and goes from specifying register base to specifying register offsets and to me that is overspecifying.
I'd rather give each clock a unique ID or something, then let the driver know the offsets, and specify the base and size in the top node.
This becomes more obvious with a second silicon revision moving the registers around - with this design all of the clocks need updating, but if you're lucky with less knowledge in the DTS you only need a new compatible string and the knowledge of the new whereabout for the regs is kept in the driver.
Yours,
Linus Walleij
PATCH v10 4/7 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.1.2
PATCH v10 5/7 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.1.2
PATCH v10 6/7 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
@@ -34,6 +34,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 {
@@ -60,6 +81,17 @@ reg = <0xfc001000 0x1000>, <0xfc000100 0x100>; }; + sysctrl: system-controller at fc802000 { + compatible = "hisilicon,sysctrl"; + reg = <0xfc802000 0x1000>; + #address-cells = <1>; + #size-cells = <0>; + + smp-offset = <0x31c>; + resume-offset = <0x308>; + reboot-offset = <0x4>; + }; + dual_timer0: dual_timer at fc800000 { compatible = "arm,sp804", "arm,primecell"; reg = <0xfc800000 0x1000>;
@@ -110,6 +142,12 @@ status = "disabled"; }; + timer5: timer at fc000600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0xfc000600 0x20>; + interrupts = <1 13 0xf01>; + }; + uart0: uart at fcb00000 { compatible = "arm,pl011", "arm,primecell"; reg = <0xfcb00000 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,13 +14,19 @@#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" +static struct map_desc hi3620_io_desc[]__initdata = { { +/* sysctrl */ .pfn =__phys_to_pfn (0xfc802000 ), .virtual =0xfe802000 , .length =0x1000 ,
@@ -40,6 +46,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 ,
@@ -49,4 +81,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.1.2
PATCH v10 7/7 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.1.2