Skip to contentSkip to conversation

support Hisilicon SoC

PATCH Superseded Haojian Zhuang 5 participants 19 messages Jul 26, 2013 – Aug 15, 2013

Subsystems (5)

v6 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v6 cover support Hisilicon SoC

Changelog:
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.

#1 lore raw

PATCH v6 1/4 clk: hi3xxx: add clock support

Add clock support with device tree on Hisilicon SoC.

---
 .../devicetree/bindings/clock/hisilicon.txt        |  66 ++++
 drivers/clk/Makefile                               |   1 +
 drivers/clk/clk-hi3xxx.c                           | 398 +++++++++++++++++++++
 3 files changed, 465 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/hisilicon.txt
 create mode 100644 drivers/clk/clk-hi3xxx.c
Documentation/devicetree/bindings/clock/hisilicon.txt new file +66 -0
new file mode 100644
index 0000000..5d7a220
@@ -0,0 +1,66 @@
+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,hi3620-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.
+ - clkmux-reg : array of mux register offset & mask bits
+ - clkmux-table : array of mux select bits
+
+Required properties for Hi3620 gate clocks:
+ - compatible : Shall be "hisilicon,hi3620-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.
+ - hi3620-clkgate : array of enable register offset & enable bits
+ - hi3620-clkreset : array of reset register offset & enable bits
+
+Required properties for clock divider:
+ - compatible : Shall be "hisilicon,hi3620-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.
+ - #clock-cells : from common clock binding; shall be set to 0.
+ - #clkdiv-table-cells : the number of parameters after phandle in
+   clkdiv-table property.
+ - clkdiv-table : list of value that are used to configure clock
+   divider. They're value of phandle, index & divider value.
+ - clkdiv : array of divider register offset & mask bits.
+
+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.
+ - clkgate-inverted : bool value. True means that set-to-disable.
+
+For example:
+	timclk1: clkgate at 38 {
+		compatible = "hisilicon,clk-gate";
+		#clock-cells = <0>;
+		clocks = <&refclk_timer1>;
+		clock-output-names = "timclk1";
+		clkgate-inverted;
+		clkgate = <0 18>;
+	};
+
+	dtable: clkdiv at 0 {
+		#clkdiv-table-cells = <2>;
+	};
+
+	div_cfgaxi: clkdiv at 2 {
+		compatible = "hisilicon,hi3620-clk-div";
+		#clock-cells = <0>;
+		clocks = <&div_shareaxi>;
+		clock-output-names = "cfgAXI_div";
+		clkdiv-table = <&dtable 0x01 2>;
+		clkdiv = <0x100 0x60>;
+	};
drivers/clk/Makefile +1 -0
index 4038c2b..21076ee 100644
@@ -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)	+= clk-hi3xxx.o
 obj-$(CONFIG_ARCH_HIGHBANK)	+= clk-highbank.o
 obj-$(CONFIG_ARCH_NSPIRE)	+= clk-nspire.o
 obj-$(CONFIG_ARCH_MXS)		+= mxs/
drivers/clk/clk-hi3xxx.c new file +398 -0

398 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#2 lore raw

PATCH v6 1/4 clk: hi3xxx: add clock support

Quoted 21 lines · Haojian Zhuang

Add clock support with device tree on Hisilicon SoC.

---
 .../devicetree/bindings/clock/hisilicon.txt        |  66 ++++
 drivers/clk/Makefile                               |   1 +
 drivers/clk/clk-hi3xxx.c                           | 398 +++++++++++++++++++++
 3 files changed, 465 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/hisilicon.txt
 create mode 100644 drivers/clk/clk-hi3xxx.c
Documentation/devicetree/bindings/clock/hisilicon.txt new file +3 -0
new file mode 100644
index 0000000..5d7a220
@@ -0,0 +1,66 @@
+Device Tree Clock bindings for arch-hi3xxx
+
+This binding uses the common clock binding[1].

Documentation/devicetree/bindings/clock/hisilicon.txt line 13

Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10 -0
+
+[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+Required properties for mux clocks:
+ - compatible : Shall be "hisilicon,hi3620-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.
+ - clkmux-reg : array of mux register offset & mask bits

Offset from what base address? There's no reg property listed, the binding document doesn't refer to a container, and the example doesn't show one.

Do these offsets within the parent's address space vary, or is a known set of clocks a known offsets always going to exist?

If all the clocks are a component of a parent block of IP, is that parent block not better described as a provider of multiple clocks?

Documentation/devicetree/bindings/clock/hisilicon.txt line 23

Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10 -0
+ - clkmux-table : array of mux select bits
+
+Required properties for Hi3620 gate clocks:
+ - compatible : Shall be "hisilicon,hi3620-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.
+ - hi3620-clkgate : array of enable register offset & enable bits
+ - hi3620-clkreset : array of reset register offset & enable bits

Similarly, offset from where?

Documentation/devicetree/bindings/clock/hisilicon.txt line 34

Quoted 11 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +11 -0
+
+Required properties for clock divider:
+ - compatible : Shall be "hisilicon,hi3620-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.
+ - #clock-cells : from common clock binding; shall be set to 0.
+ - #clkdiv-table-cells : the number of parameters after phandle in
+   clkdiv-table property.
+ - clkdiv-table : list of value that are used to configure clock
+   divider. They're value of phandle, index & divider value.

I'm having some difficulty understanding what the properties above actually represent.

Documentation/devicetree/bindings/clock/hisilicon.txt line 35

Quoted 1 line
Documentation/devicetree/bindings/clock/hisilicon.txt new file +1 -0
+ - clkdiv : array of divider register offset & mask bits.

Offset from...?

Documentation/devicetree/bindings/clock/hisilicon.txt line 43

Quoted 8 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +8 -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.
+ - clkgate-inverted : bool value. True means that set-to-disable.

Is that a generic property, or only valid for hisilicon,clk-gate?

Quoted 23 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +23 -0
+
+For example:
+       timclk1: clkgate at 38 {
+               compatible = "hisilicon,clk-gate";
+               #clock-cells = <0>;
+               clocks = <&refclk_timer1>;
+               clock-output-names = "timclk1";
+               clkgate-inverted;
+               clkgate = <0 18>;
+       };
+
+       dtable: clkdiv at 0 {
+               #clkdiv-table-cells = <2>;
+       };
+
+       div_cfgaxi: clkdiv at 2 {
+               compatible = "hisilicon,hi3620-clk-div";
+               #clock-cells = <0>;
+               clocks = <&div_shareaxi>;
+               clock-output-names = "cfgAXI_div";
+               clkdiv-table = <&dtable 0x01 2>;
+               clkdiv = <0x100 0x60>;
+       };

[...]

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 3 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +3 -0
+static const struct of_device_id hi3xxx_of_match[] = {
+       { .compatible = "hisilicon,sctrl" },
+};

This parent wasn't mentioned in the binding. Is it documented elsewhere?

Quoted 12 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +11 -0
+
+static void __iomem __init *hi3xxx_init_clocks(struct device_node *np)
+{
+       struct device_node *parent;
+       const struct of_device_id *match;
+       void __iomem *ret = NULL;
+
+       parent = of_get_parent(np);
+       if (!parent) {
+               pr_warn("Can't find parent node of these clocks\n");
+               goto out;
Quoted 1 line

From out you only seem to return. Why not just return?

Does this leave the of_node refcounts balanced? (as a more general question, does most code?).

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 5 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +5 -0
+       }
+       match = of_match_node(hi3xxx_of_match, parent);
+       if (!match) {
+               pr_warn("Can't find the right parent\n");
+               goto out;

Why not just return?

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 8 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +8 -0
+       }
+
+       if (!hi3xxx_clk_base) {
+               ret = of_iomap(parent, 0);
+               WARN_ON(!ret);
+               hi3xxx_clk_base = ret;
+       } else {
+               ret = hi3xxx_clk_base;

Necessarily, ret = NULL in this case.

Why not rearrange the whole block:

	if (!hi3xx_clk_base)
		return NULL;
	
	/*
	 * do stuff assuming hi3xx_clk_base here
	 */

Even better, the mapping of the registers should be centralised and done at the start - no need to fail repeatedly for each child. You already seemed to have a compatible string for the parent node...

[...]

Quoted 14 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +14 -0
+static void __init hi3620_clkgate_setup(struct device_node *np)
+{
+       struct hi3620_periclk *pclk;
+       struct clk_init_data *init;
+       struct clk *clk;
+       const char *clk_name, *name, **parent_names;
+       u32 rdata[2], gdata[2];
+       void __iomem *base;
+
+       base = hi3xxx_init_clocks(np);
+       if (!base)
+               return;
+
+       if (of_property_read_string(np, "clock-output-names", &clk_name))

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10 -0
+               return;
+       if (of_property_read_u32_array(np, "hi3620-clkgate",
+                                      &gdata[0], 2))
+               return;
+
+       /* gate only has the fixed parent */
+       parent_names = kzalloc(sizeof(char *), GFP_KERNEL);
+       if (!parent_names)
+               return;
+       parent_names[0] = of_clk_get_parent_name(np, 0);

It seems odd to allocate a single pointer, surely there has to be a better way? Could this single pointer not be stored in a wrapper of clk_init_data?

Is it possible for of_clk_get_parent_name to fail?

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 9 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +9 -0
+
+       pclk = kzalloc(sizeof(*pclk), GFP_KERNEL);
+       if (!pclk)
+               goto err_pclk;
+
+       init = kzalloc(sizeof(*init), GFP_KERNEL);
+       if (!init)
+               goto err_init;
+       init->name = kstrdup(clk_name, GFP_KERNEL);

You're happy to refer to the parent name embedded in the dt, but kstrdup the child name?

Quoted 33 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +33 -0
+       init->ops = &hi3620_clkgate_ops;
+       init->flags = CLK_SET_RATE_PARENT;
+       init->parent_names = parent_names;
+       init->num_parents = 1;
+
+       if (!of_property_read_u32_array(np, "hi3620-clkreset",
+                                       &rdata[0], 2)) {
+               pclk->reset = base + rdata[0];
+               pclk->rbits = rdata[1];
+       }
+       pclk->enable = base + gdata[0];
+       pclk->ebits = gdata[1];
+       pclk->lock = &hi3xxx_clk_lock;
+       pclk->hw.init = init;
+
+       clk = clk_register(NULL, &pclk->hw);
+       if (IS_ERR(clk))
+               goto err_clk;
+       if (!of_property_read_string(np, "clock-names", &name))
+               clk_register_clkdev(clk, name, NULL);
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+       return;
+err_clk:
+       kfree(init);
+err_init:
+       kfree(pclk);
+err_pclk:
+       kfree(parent_names);
+}
+CLK_OF_DECLARE(hi3620_gate, "hisilicon,hi3620-clk-gate", hi3620_clkgate_setup)
+
+static int __init hi3xxx_parse_mux(struct device_node *np,
+                                  u8 *num_parents,

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10 -0
+                                  u32 *table)
+{
+       int i, cnt, ret;
+
+       /* get the count of items in mux */
+       for (i = 0, cnt = 0; ; i++, cnt++) {
+               /* parent's #clock-cells property is always 0 */
+               if (!of_parse_phandle(np, "clocks", i))
+                       break;
+       }

Remove the references to cnt in this loop. Afterwards add:

	cnt = i;
Quoted 7 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +7 -0
+
+       for (i = 0; i < cnt; i++) {
+               if (!of_clk_get_parent_name(np, i))
+                       return -ENOENT;
+       }
+       *num_parents = cnt;
+       table = kzalloc(sizeof(u32 *) * cnt, GFP_KERNEL);

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10 -0
+       if (!table)
+               return -ENOMEM;
+       ret = of_property_read_u32_array(np, "clkmux-table",
+                                        table, cnt);
+       if (ret)
+               goto err;
+       return 0;
+err:
+       kfree(table);
+       return ret;

The err case is only used at the end of the function. Why not:

        if (!ret)
                return 0;

        kfree(table);
        return ret;

[...]

Quoted 25 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +25 -0
+static void __init hs_clkgate_setup(struct device_node *np)
+{
+       struct clk *clk;
+       const char *clk_name, **parent_names, *name;
+       unsigned long flags = 0;
+       u32 data[2];
+       void __iomem *base;
+
+       base = hi3xxx_init_clocks(np);
+       if (!base)
+               return;
+       if (of_property_read_string(np, "clock-output-names", &clk_name))
+               return;
+       if (of_property_read_u32_array(np, "clkgate",
+                                      &data[0], 2))
+               return;
+       if (of_property_read_bool(np, "clkgate-inverted"))
+               flags = CLK_GATE_SET_TO_DISABLE;
+       /* gate only has the fixed parent */
+       parent_names = kzalloc(sizeof(char *), GFP_KERNEL);
+       if (!parent_names)
+               return;
+       parent_names[0] = of_clk_get_parent_name(np, 0);
+
+       clk = clk_register_gate(NULL, clk_name, parent_names[0], 0,

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10 -0
+                               base + data[0], (u8)data[1], flags,
+                               &hi3xxx_clk_lock);
+       if (IS_ERR(clk))
+               goto err;
+       if (!of_property_read_string(np, "clock-names", &name))
+               clk_register_clkdev(clk, name, NULL);
+       of_clk_add_provider(np, of_clk_src_simple_get, clk);
+       return;
+err:
+       kfree(parent_names);

Why shift the err case out of line if it's only referred to once?

Quoted 25 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +25 -0
+}
+CLK_OF_DECLARE(hs_gate, "hisilicon,clk-gate", hs_clkgate_setup)
+
+void __init hi3620_clkdiv_setup(struct device_node *np)
+{
+       struct clk *clk;
+       const char *clk_name, **parent_names;
+       struct clk_div_table *table;
+       unsigned int table_num;
+       int i;
+       u32 data[2];
+       u8 shift, width;
+       const char *propname = "clkdiv-table";
+       const char *cellname = "#clkdiv-table-cells";
+       struct of_phandle_args div_table;
+       void __iomem *reg, *base;
+
+       base = hi3xxx_init_clocks(np);
+       if (!base)
+               return;
+
+       if (of_property_read_string(np, "clock-output-names", &clk_name))
+               return;
+       if (of_property_read_u32_array(np, "clkdiv", &data[0], 2))
+               return;

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10 -0
+
+       /*process the div_table*/
+       for (i = 0; ; i++) {
+               if (of_parse_phandle_with_args(np, propname, cellname,
+                                              i, &div_table))
+                       break;
+       }
+
+       /*table ends with <0, 0>, so plus one to table_num*/
+       table_num = i + 1;

That certainly wasn't described in the binding (and the example doesn't match).

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 4 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +4 -0
+
+       table = kzalloc(sizeof(struct clk_div_table) * table_num, GFP_KERNEL);
+       if (!table)
+               return ;

Unnecessary space.

Quoted 5 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +5 -0
+
+       for (i = 0; ; i++) {
+               if (of_parse_phandle_with_args(np, propname, cellname,
+                                              i, &div_table))
+                       break;

Documentation/devicetree/bindings/clock/hisilicon.txt

Quoted 10 lines
Documentation/devicetree/bindings/clock/hisilicon.txt new file +10 -0
+
+               table[i].val = div_table.args[0];
+               table[i].div = div_table.args[1];
+       }
+
+       /* gate only has the fixed parent */
+       parent_names = kzalloc(sizeof(char *), GFP_KERNEL);
+       if (!parent_names)
+               goto err_par;
+       parent_names[0] = of_clk_get_parent_name(np, 0);

Similarly to my earlier comment, I suspect there's a better way of handling this.

Thanks,
Mark.

#3 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

In reply to Haojian Zhuang

Support UART0 debug ll on hisilicon Hi3620 SoC.

---
 arch/arm/Kconfig.debug             | 15 +++++++++++++++
 arch/arm/include/debug/hisilicon.S | 30 ++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 arch/arm/include/debug/hisilicon.S
arch/arm/Kconfig.debug +15 -0
index e401a76..289a248 100644
@@ -272,6 +272,20 @@ choice
 		  Say Y here if you want the debug print routines to direct
 		  their output to UART1 serial port on KEYSTONE2 devices.
 
+	config DEBUG_HI3620_UART
+		bool "Hisilicon HI3620 Debug UART"
+		depends on ARCH_HI3xxx
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on HI3620 UART.
+
+	config DEBUG_HI3716_UART
+		bool "Hisilicon Hi3716 Debug UART"
+		depends on ARCH_HI3xxx
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on HI3716 UART.
+
 	config DEBUG_MMP_UART2
 		bool "Kernel low-level debugging message via MMP UART2"
 		depends on ARCH_MMP
@@ -765,6 +779,7 @@ config DEBUG_LL_INCLUDE
 	default "debug/cns3xxx.S" if DEBUG_CNS3XXX
 	default "debug/exynos.S" if DEBUG_EXYNOS_UART
 	default "debug/highbank.S" if DEBUG_HIGHBANK_UART
+	default "debug/hisilicon.S" if DEBUG_HI3620_UART || DEBUG_HI3716_UART
 	default "debug/icedcc.S" if DEBUG_ICEDCC
 	default "debug/imx.S" if DEBUG_IMX1_UART || \
 				 DEBUG_IMX25_UART || \
arch/arm/include/debug/hisilicon.S new file +30 -0
new file mode 100644
index 0000000..47ad019
@@ -0,0 +1,30 @@
+/*
+ * Early serial output macro for Hisilicon SoC
+ *
+ * Copyright (C) 2012-2013 Hisilicon Technologies Co., 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.
+*/
+
+#if defined(CONFIG_DEBUG_HI3620_UART)
+#define HS_UART_PHYS_BASE	0xfcb00000
+#define HS_UART_VIRT_BASE	0xfeb00000
+#elif defined(CONFIG_DEBUG_HI3716_UART)
+#define HS_UART_PHYS_BASE	0xf8b00000
+#define HS_UART_VIRT_BASE	0xfeb00000
+#endif
+
+#if defined(CONFIG_DEBUG_HI3620_UART) || defined(CONFIG_DEBUG_HI3716_UART)
+		.macro	addruart,rp,rv,tmp
+		ldr	\rp, =HS_UART_PHYS_BASE
+		ldr	\rv, =HS_UART_VIRT_BASE
+		.endm
+
+#include <asm/hardware/debug-pl01x.S>
+
+#endif
Signature · 1 line
1.8.1.2
#5 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

Quoted 7 lines · Olof Johansson
Quoted 3 lines · Haojian Zhuang

Support UART0 debug ll on hisilicon Hi3620 SoC.

Applied, thanks.

Applied without reference to my debug cleanup series which has been sitting in linux-next for ages?

Whatever happened to encouraging people to do things in a manner compatible with the cleanups we're trying to do?

#6 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

Quoted 7 lines · Russell King - ARM Linux
Quoted 6 lines · Olof Johansson
Quoted 3 lines · Haojian Zhuang

Support UART0 debug ll on hisilicon Hi3620 SoC.

Quoted 7 lines
Quoted 1 line

Applied, thanks.

Applied without reference to my debug cleanup series which has been sitting in linux-next for ages?

Whatever happened to encouraging people to do things in a manner compatible with the cleanups we're trying to do?

I quite frankly forgot that this was pending for 3.12 in your tree.

Thanks for catching this, I'll revert the patch in arm-soc and let it go in through yours on top of your cleanups.

-Olof

#7 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

Quoted 13 lines · Olof Johansson
Quoted 12 lines · Russell King - ARM Linux
Quoted 7 lines · Olof Johansson
Quoted 3 lines · Haojian Zhuang

Support UART0 debug ll on hisilicon Hi3620 SoC.

Applied, thanks.

Applied without reference to my debug cleanup series which has been sitting in linux-next for ages?

Quoted 7 lines
Quoted 2 lines

Whatever happened to encouraging people to do things in a manner compatible with the cleanups we're trying to do?

I quite frankly forgot that this was pending for 3.12 in your tree.

Thanks for catching this, I'll revert the patch in arm-soc and let it go in through yours on top of your cleanups.

Has this been pushed out yet? I'm getting this new conflict:

++<<<<<<< HEAD
++=======
+ default "debug/keystone.S" if DEBUG_KEYSTONE_UART0 || \
+ DEBUG_KEYSTONE_UART1

+       default "debug/msm.S" if DEBUG_MSM_UART1 || \
+                                DEBUG_MSM_UART2 || \
+                                DEBUG_MSM_UART3 || \

+ DEBUG_MSM8660_UART || \
+ DEBUG_MSM8960_UART
+ default "debug/mvebu.S" if DEBUG_MVEBU_UART || \
+ DEBUG_MVEBU_UART_ALTERNATE

+       default "debug/mxs.S" if DEBUG_IMX23_UART || DEBUG_IMX28_UART
+       default "debug/nomadik.S" if DEBUG_NOMADIK_UART
+       default "debug/nspire.S" if     DEBUG_NSPIRE_CX_UART || \

+ DEBUG_NSPIRE_CLASSIC_UART
++>>>>>>> arm-soc/for-next

This seems to be due to the addition of MSM here. If stuff like this is going to go through arm-soc, I'm going to make no guarantees of getting this stuff anywhere close to being correct for the next merge window, because its too complicated to deal with properly in git merges.

Also:

CONFLICT (delete/modify): arch/arm/include/debug/highbank.S deleted in HEAD and modified in arm-soc/for-next. Version arm-soc/for-next of arch/arm/include/debug/highbank.S left in tree.

which seems to be a change in the virtual address of the port. This one is particularly nasty because it needs to be moved to a completely different file and therefore is not git rerere'able. Does it have any dependencies?

#8 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

Quoted 41 lines · Russell King - ARM Linux
Quoted 13 lines · Olof Johansson
Quoted 12 lines · Russell King - ARM Linux
Quoted 7 lines · Olof Johansson
Quoted 3 lines · Haojian Zhuang

Support UART0 debug ll on hisilicon Hi3620 SoC.

Applied, thanks.

Applied without reference to my debug cleanup series which has been sitting in linux-next for ages?

Quoted 7 lines
Quoted 2 lines

Whatever happened to encouraging people to do things in a manner compatible with the cleanups we're trying to do?

I quite frankly forgot that this was pending for 3.12 in your tree.

Thanks for catching this, I'll revert the patch in arm-soc and let it go in through yours on top of your cleanups.

Has this been pushed out yet? I'm getting this new conflict:

++<<<<<<< HEAD
++=======

(quoted diff) +14 -0
+       default "debug/keystone.S" if DEBUG_KEYSTONE_UART0 || \
+                                     DEBUG_KEYSTONE_UART1
+       default "debug/msm.S" if DEBUG_MSM_UART1 || \
+                                DEBUG_MSM_UART2 || \
+                                DEBUG_MSM_UART3 || \
+                                DEBUG_MSM8660_UART || \
+                                DEBUG_MSM8960_UART
+       default "debug/mvebu.S" if DEBUG_MVEBU_UART || \
+                                  DEBUG_MVEBU_UART_ALTERNATE
+       default "debug/mxs.S" if DEBUG_IMX23_UART || DEBUG_IMX28_UART
+       default "debug/nomadik.S" if DEBUG_NOMADIK_UART
+       default "debug/nspire.S" if     DEBUG_NSPIRE_CX_UART || \
+                                       DEBUG_NSPIRE_CLASSIC_UART
++>>>>>>> arm-soc/for-next
Quoted 5 lines

This seems to be due to the addition of MSM here. If stuff like this is going to go through arm-soc, I'm going to make no guarantees of getting this stuff anywhere close to being correct for the next merge window, because its too complicated to deal with properly in git merges.

Grmbl. Yeah, that was because of the move of debug headers as msm is moving closer to multiplatform. It was picked up yesterday and I didn't think to go back and look for other debug stuff after you pointed out the hisilicon patch on this thread.

We can either drop/refuse any change that touches debug serial stuff this release cycle and have people merge it through you, or we can hold off until your branch is stable enough that we can have that as a base and pick up new things on top. Do you have a preference of the two?

Quoted 8 lines

Also:

CONFLICT (delete/modify): arch/arm/include/debug/highbank.S deleted in HEAD and modified in arm-soc/for-next. Version arm-soc/for-next of arch/arm/include/debug/highbank.S left in tree.

which seems to be a change in the virtual address of the port. This one is particularly nasty because it needs to be moved to a completely different file and therefore is not git rerere'able. Does it have any dependencies?

I don't think so, we can likely move that patch over to your tree instead and drop it from arm-soc.

-Olof

#9 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

Quoted 2 lines · Olof Johansson

On Wed, Aug 14, 2013 at 3:54 PM, Russell King - ARM Linux <[email protected]> wrote:

[...]

Quoted 11 lines
Quoted 8 lines

CONFLICT (delete/modify): arch/arm/include/debug/highbank.S deleted in HEAD and modified in arm-soc/for-next. Version arm-soc/for-next of arch/arm/include/debug/highbank.S left in tree.

which seems to be a change in the virtual address of the port. This one is particularly nasty because it needs to be moved to a completely different file and therefore is not git rerere'able. Does it have any dependencies?

I don't think so, we can likely move that patch over to your tree instead and drop it from arm-soc.

The highbank change is now dropped from arm-soc and needs to be be rebased/reworked on your tree.

Kevin

#10 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

In reply to Haojian Zhuang

Hi,

Quoted 3 lines · Haojian Zhuang

Support UART0 debug ll on hisilicon Hi3620 SoC.

By the way, I ended up doing two fixups:

Quoted 19 lines
---
 arch/arm/Kconfig.debug             | 15 +++++++++++++++
 arch/arm/include/debug/hisilicon.S | 30 ++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 arch/arm/include/debug/hisilicon.S
arch/arm/Kconfig.debug +5 -0
index e401a76..289a248 100644
@@ -272,6 +272,20 @@ choice
 		  Say Y here if you want the debug print routines to direct
 		  their output to UART1 serial port on KEYSTONE2 devices.
 
+	config DEBUG_HI3620_UART
+		bool "Hisilicon HI3620 Debug UART"
+		depends on ARCH_HI3xxx
+		help
+		  Say Y here if you want kernel low-level debugging support

arch/arm/Kconfig.debug choice · line 289

Quoted 10 lines
arch/arm/Kconfig.debug +9 -0
+		  on HI3620 UART.
+
+	config DEBUG_HI3716_UART
+		bool "Hisilicon Hi3716 Debug UART"
+		depends on ARCH_HI3xxx
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on HI3716 UART.
+
 	config DEBUG_MMP_UART2

These are out of alphabetical order, not good. I moved them up right before highbank where they should be.

Quoted 16 lines
arch/arm/include/debug/hisilicon.S new file +10 -0
new file mode 100644
index 0000000..47ad019
@@ -0,0 +1,30 @@
+/*
+ * Early serial output macro for Hisilicon SoC
+ *
+ * Copyright (C) 2012-2013 Hisilicon Technologies Co., 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

arch/arm/include/debug/hisilicon.S line 20

Quoted 10 lines
arch/arm/include/debug/hisilicon.S new file +10 -0
+ * published by the Free Software Foundation.
+*/
+
+#if defined(CONFIG_DEBUG_HI3620_UART)
+#define HS_UART_PHYS_BASE	0xfcb00000
+#define HS_UART_VIRT_BASE	0xfeb00000
+#elif defined(CONFIG_DEBUG_HI3716_UART)
+#define HS_UART_PHYS_BASE	0xf8b00000
+#define HS_UART_VIRT_BASE	0xfeb00000
+#endif

HS_UART_VIRT_BASE is the same, so I moved it outside the ifdef.

-Olof

#11 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

Quoted 73 lines · Olof Johansson

Hi,

Quoted 3 lines · Haojian Zhuang

Support UART0 debug ll on hisilicon Hi3620 SoC.

By the way, I ended up doing two fixups:

Quoted 19 lines
---
 arch/arm/Kconfig.debug             | 15 +++++++++++++++
 arch/arm/include/debug/hisilicon.S | 30 ++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 arch/arm/include/debug/hisilicon.S
arch/arm/Kconfig.debug +5 -0
index e401a76..289a248 100644
@@ -272,6 +272,20 @@ choice
                Say Y here if you want the debug print routines to direct
                their output to UART1 serial port on KEYSTONE2 devices.
 
+     config DEBUG_HI3620_UART
+             bool "Hisilicon HI3620 Debug UART"
+             depends on ARCH_HI3xxx
+             help
+               Say Y here if you want kernel low-level debugging support

arch/arm/Kconfig.debug choice · line 289

Quoted 10 lines
arch/arm/Kconfig.debug +9 -0
+               on HI3620 UART.
+
+     config DEBUG_HI3716_UART
+             bool "Hisilicon Hi3716 Debug UART"
+             depends on ARCH_HI3xxx
+             help
+               Say Y here if you want kernel low-level debugging support
+               on HI3716 UART.
+
      config DEBUG_MMP_UART2

These are out of alphabetical order, not good. I moved them up right before highbank where they should be.

Quoted 16 lines
arch/arm/include/debug/hisilicon.S new file +10 -0
new file mode 100644
index 0000000..47ad019
@@ -0,0 +1,30 @@
+/*
+ * Early serial output macro for Hisilicon SoC
+ *
+ * Copyright (C) 2012-2013 Hisilicon Technologies Co., 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

arch/arm/include/debug/hisilicon.S line 20

Quoted 10 lines
arch/arm/include/debug/hisilicon.S new file +10 -0
+ * published by the Free Software Foundation.
+*/
+
+#if defined(CONFIG_DEBUG_HI3620_UART)
+#define HS_UART_PHYS_BASE    0xfcb00000
+#define HS_UART_VIRT_BASE    0xfeb00000
+#elif defined(CONFIG_DEBUG_HI3716_UART)
+#define HS_UART_PHYS_BASE    0xf8b00000
+#define HS_UART_VIRT_BASE    0xfeb00000
+#endif

HS_UART_VIRT_BASE is the same, so I moved it outside the ifdef.

Quoted 1 line

-Olof

Thanks a lot.

Regards
Haojian

#12 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

Quoted 74 lines · Haojian Zhuang
Quoted 73 lines · Olof Johansson

Hi,

Quoted 3 lines · Haojian Zhuang

Support UART0 debug ll on hisilicon Hi3620 SoC.

By the way, I ended up doing two fixups:

Quoted 19 lines
---
 arch/arm/Kconfig.debug             | 15 +++++++++++++++
 arch/arm/include/debug/hisilicon.S | 30 ++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 arch/arm/include/debug/hisilicon.S
arch/arm/Kconfig.debug +5 -0
index e401a76..289a248 100644
@@ -272,6 +272,20 @@ choice
                Say Y here if you want the debug print routines to direct
                their output to UART1 serial port on KEYSTONE2 devices.
 
+     config DEBUG_HI3620_UART
+             bool "Hisilicon HI3620 Debug UART"
+             depends on ARCH_HI3xxx
+             help
+               Say Y here if you want kernel low-level debugging support

arch/arm/Kconfig.debug choice · line 289

Quoted 10 lines
arch/arm/Kconfig.debug +9 -0
+               on HI3620 UART.
+
+     config DEBUG_HI3716_UART
+             bool "Hisilicon Hi3716 Debug UART"
+             depends on ARCH_HI3xxx
+             help
+               Say Y here if you want kernel low-level debugging support
+               on HI3716 UART.
+
      config DEBUG_MMP_UART2

These are out of alphabetical order, not good. I moved them up right before highbank where they should be.

Quoted 16 lines
arch/arm/include/debug/hisilicon.S new file +10 -0
new file mode 100644
index 0000000..47ad019
@@ -0,0 +1,30 @@
+/*
+ * Early serial output macro for Hisilicon SoC
+ *
+ * Copyright (C) 2012-2013 Hisilicon Technologies Co., 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

arch/arm/include/debug/hisilicon.S line 20

Quoted 10 lines
arch/arm/include/debug/hisilicon.S new file +10 -0
+ * published by the Free Software Foundation.
+*/
+
+#if defined(CONFIG_DEBUG_HI3620_UART)
+#define HS_UART_PHYS_BASE    0xfcb00000
+#define HS_UART_VIRT_BASE    0xfeb00000
+#elif defined(CONFIG_DEBUG_HI3716_UART)
+#define HS_UART_PHYS_BASE    0xf8b00000
+#define HS_UART_VIRT_BASE    0xfeb00000
+#endif

HS_UART_VIRT_BASE is the same, so I moved it outside the ifdef.

Quoted 3 lines
Quoted 1 line

-Olof

Thanks a lot.

Please send me a patch against the debug cleanup stuff which you can find in my tree (commit daf6d46c2467253af457b326e3299ea431dc2a94) so that I don't have to go back over this stuff after the next merge window to fix all the stuff people haven't noticed being queued for the upcoming merge window.

Thanks.

#13 lore raw

PATCH v6 2/4 ARM: debug: support debug ll on hisilicon soc

Quoted 79 lines · Russell King - ARM Linux
Quoted 74 lines · Haojian Zhuang
Quoted 73 lines · Olof Johansson

Hi,

Quoted 3 lines · Haojian Zhuang

Support UART0 debug ll on hisilicon Hi3620 SoC.

By the way, I ended up doing two fixups:

Quoted 19 lines
---
 arch/arm/Kconfig.debug             | 15 +++++++++++++++
 arch/arm/include/debug/hisilicon.S | 30 ++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 arch/arm/include/debug/hisilicon.S
arch/arm/Kconfig.debug +5 -0
index e401a76..289a248 100644
@@ -272,6 +272,20 @@ choice
                Say Y here if you want the debug print routines to direct
                their output to UART1 serial port on KEYSTONE2 devices.
 
+     config DEBUG_HI3620_UART
+             bool "Hisilicon HI3620 Debug UART"
+             depends on ARCH_HI3xxx
+             help
+               Say Y here if you want kernel low-level debugging support

arch/arm/Kconfig.debug choice · line 289

Quoted 10 lines
arch/arm/Kconfig.debug +9 -0
+               on HI3620 UART.
+
+     config DEBUG_HI3716_UART
+             bool "Hisilicon Hi3716 Debug UART"
+             depends on ARCH_HI3xxx
+             help
+               Say Y here if you want kernel low-level debugging support
+               on HI3716 UART.
+
      config DEBUG_MMP_UART2

These are out of alphabetical order, not good. I moved them up right before highbank where they should be.

Quoted 16 lines
arch/arm/include/debug/hisilicon.S new file +10 -0
new file mode 100644
index 0000000..47ad019
@@ -0,0 +1,30 @@
+/*
+ * Early serial output macro for Hisilicon SoC
+ *
+ * Copyright (C) 2012-2013 Hisilicon Technologies Co., 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

arch/arm/include/debug/hisilicon.S line 20

Quoted 10 lines
arch/arm/include/debug/hisilicon.S new file +10 -0
+ * published by the Free Software Foundation.
+*/
+
+#if defined(CONFIG_DEBUG_HI3620_UART)
+#define HS_UART_PHYS_BASE    0xfcb00000
+#define HS_UART_VIRT_BASE    0xfeb00000
+#elif defined(CONFIG_DEBUG_HI3716_UART)
+#define HS_UART_PHYS_BASE    0xf8b00000
+#define HS_UART_VIRT_BASE    0xfeb00000
+#endif

HS_UART_VIRT_BASE is the same, so I moved it outside the ifdef.

Quoted 3 lines
Quoted 1 line

-Olof

Thanks a lot.

Quoted 7 lines

Please send me a patch against the debug cleanup stuff which you can find in my tree (commit daf6d46c2467253af457b326e3299ea431dc2a94) so that I don't have to go back over this stuff after the next merge window to fix all the stuff people haven't noticed being queued for the upcoming merge window.

Thanks.

Sure. I'll send the new patch based on your tree.

Regards
Haojian

#14 lore raw

PATCH v6 3/4 ARM: hi3xxx: add board support with device tree

In reply to Haojian Zhuang

Add board support with device tree for Hisilicon Hi36xx/Hi37xx platform.

Changelog:
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                       | 13 ++++++++
 arch/arm/mach-hi3xxx/Makefile                      |  5 +++
 arch/arm/mach-hi3xxx/hi3xxx.c                      | 36 ++++++++++++++++++++++
 6 files changed, 67 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
new file mode 100644
index 0000000..3be60c8
@@ -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
index ba412e0..29e119d 100644
@@ -944,6 +944,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
index c0ac0f5..bc69205 100644
@@ -154,6 +154,7 @@ machine-$(CONFIG_ARCH_DOVE)		+= dove
 machine-$(CONFIG_ARCH_EBSA110)		+= ebsa110
 machine-$(CONFIG_ARCH_EP93XX)		+= ep93xx
 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 +13 -0
new file mode 100644
index 0000000..a991dee
@@ -0,0 +1,13 @@
+config ARCH_HI3xxx
+	bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7
+	select ARM_AMBA
+	select ARM_GIC
+	select CACHE_L2X0
+	select CACHE_PL310
+	select CLKSRC_OF
+	select PINCTRL
+	select PINCTRL_SINGLE
+	select SERIAL_AMBA_PL011
+	select SERIAL_AMBA_PL011_CONSOLE
+	help
+	  Support for Hisilicon Hi36xx/Hi37xx processor family
arch/arm/mach-hi3xxx/Makefile new file +5 -0
new file mode 100644
index 0000000..d68ebb3
@@ -0,0 +1,5 @@
+#
+# Makefile for Hisilicon Hi36xx/Hi37xx processors line
+#
+
+obj-y	+= hi3xxx.o
arch/arm/mach-hi3xxx/hi3xxx.c new file +36 -0
new file mode 100644
index 0000000..e7c54bc
@@ -0,0 +1,36 @@
+/*
+ * (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>
+
+static void __init hi3xxx_timer_init(void)
+{
+	of_clk_init(NULL);
+	clocksource_of_init();
+}
+
+static const char *hs_compat[] __initdata = {
+	"hisilicon,hi3620-hi4511",
+	NULL,
+};
+
+DT_MACHINE_START(HI3xxx, "Hisilicon Hi36xx/Hi37xx (Flattened Device Tree)")
+	.init_time	= hi3xxx_timer_init,
+	.dt_compat	= hs_compat,
+MACHINE_END
Signature · 1 line
1.8.1.2
#15 lore raw

PATCH v6 3/4 ARM: hi3xxx: add board support with device tree

Quoted 120 lines · Haojian Zhuang

Add board support with device tree for Hisilicon Hi36xx/Hi37xx platform.

Changelog:
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                       | 13 ++++++++
 arch/arm/mach-hi3xxx/Makefile                      |  5 +++
 arch/arm/mach-hi3xxx/hi3xxx.c                      | 36 ++++++++++++++++++++++
 6 files changed, 67 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
new file mode 100644
index 0000000..3be60c8
@@ -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
index ba412e0..29e119d 100644
@@ -944,6 +944,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
index c0ac0f5..bc69205 100644
@@ -154,6 +154,7 @@ machine-$(CONFIG_ARCH_DOVE)		+= dove
 machine-$(CONFIG_ARCH_EBSA110)		+= ebsa110
 machine-$(CONFIG_ARCH_EP93XX)		+= ep93xx
 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 +13 -0
new file mode 100644
index 0000000..a991dee
@@ -0,0 +1,13 @@
+config ARCH_HI3xxx
+	bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7
+	select ARM_AMBA
+	select ARM_GIC
+	select CACHE_L2X0
+	select CACHE_PL310
+	select CLKSRC_OF
+	select PINCTRL
+	select PINCTRL_SINGLE
+	select SERIAL_AMBA_PL011
+	select SERIAL_AMBA_PL011_CONSOLE
+	help
+	  Support for Hisilicon Hi36xx/Hi37xx processor family
arch/arm/mach-hi3xxx/Makefile new file +5 -0
new file mode 100644
index 0000000..d68ebb3
@@ -0,0 +1,5 @@
+#
+# Makefile for Hisilicon Hi36xx/Hi37xx processors line
+#
+
+obj-y	+= hi3xxx.o
arch/arm/mach-hi3xxx/hi3xxx.c new file +16 -0
new file mode 100644
index 0000000..e7c54bc
@@ -0,0 +1,36 @@
+/*
+ * (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>

arch/arm/mach-hi3xxx/hi3xxx.c line 26

Quoted 10 lines
arch/arm/mach-hi3xxx/hi3xxx.c new file +10 -0
+#include <linux/of_platform.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+static void __init hi3xxx_timer_init(void)
+{
+	of_clk_init(NULL);
+	clocksource_of_init();
+}

It's a shame there doesn't seem to be an of_clk_init(NULL) in common code. That would make this entire machine description unnecessary...

Thanks,
Mark.

Quoted 19 lines
arch/arm/mach-hi3xxx/hi3xxx.c new file +10 -0
+
+static const char *hs_compat[] __initdata = {
+	"hisilicon,hi3620-hi4511",
+	NULL,
+};
+
+DT_MACHINE_START(HI3xxx, "Hisilicon Hi36xx/Hi37xx (Flattened Device Tree)")
+	.init_time	= hi3xxx_timer_init,
+	.dt_compat	= hs_compat,
+MACHINE_END
Signature · 7 lines
1.8.1.2


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

PATCH v6 3/4 ARM: hi3xxx: add board support with device tree

In reply to Haojian Zhuang

Hi,

Quoted 1 line · Haojian Zhuang

Add board support with device tree for Hisilicon Hi36xx/Hi37xx platform.

How about a defconfig for build coverage, or enabling this platform in multi_v7_defconfig?

arch/arm/mach-hi3xxx/Kconfig line 6

Quoted 12 lines
arch/arm/mach-hi3xxx/Kconfig new file +6 -0
new file mode 100644
index 0000000..a991dee
@@ -0,0 +1,13 @@
+config ARCH_HI3xxx
+	bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7
+	select ARM_AMBA
+	select ARM_GIC
+	select CACHE_L2X0
+	select CACHE_PL310

No other platforms select CACHE_PL310 even if they have them.

arch/arm/mach-hi3xxx/Kconfig line 11

Quoted 5 lines
arch/arm/mach-hi3xxx/Kconfig new file +5 -0
+	select CLKSRC_OF
+	select PINCTRL
+	select PINCTRL_SINGLE
+	select SERIAL_AMBA_PL011
+	select SERIAL_AMBA_PL011_CONSOLE

It's not common to select the serial drivers here, only a couple of other platforms do.

-Olof

#17 lore raw

PATCH v6 4/4 ARM: hi3xxx: enable hi4511 with device tree

In reply to Haojian Zhuang

Enable Hisilicon Hi4511 development platform with device tree support.

---
 arch/arm/boot/dts/Makefile          |    1 +
 arch/arm/boot/dts/hi3620.dtsi       | 1147 +++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/hi4511.dts        |  648 ++++++++++++++++++++
 arch/arm/configs/multi_v7_defconfig |    1 +
 4 files changed, 1797 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
index 641b3c9..6e7c1ca 100644
@@ -61,6 +61,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
 	exynos5250-snow.dtb \
 	exynos5420-smdk5420.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 +1147 -0

1,147 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

arch/arm/configs/multi_v7_defconfig +1 -0
index fe0bdc3..c7b5247 100644
@@ -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
#18 lore raw

PATCH v6 4/4 ARM: hi3xxx: enable hi4511 with device tree

Quoted 43 lines · Haojian Zhuang

Enable Hisilicon Hi4511 development platform with device tree support.

---
 arch/arm/boot/dts/Makefile          |    1 +
 arch/arm/boot/dts/hi3620.dtsi       | 1147 +++++++++++++++++++++++++++++++++++
 arch/arm/boot/dts/hi4511.dts        |  648 ++++++++++++++++++++
 arch/arm/configs/multi_v7_defconfig |    1 +
 4 files changed, 1797 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
index 641b3c9..6e7c1ca 100644
@@ -61,6 +61,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
        exynos5250-snow.dtb \
        exynos5420-smdk5420.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 +13 -0
new file mode 100644
index 0000000..aca09ad
@@ -0,0 +1,1147 @@
+/*
+ * Hisilicon Ltd. Hi3620 SoC
+ *
+ * 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
+ * publishhed by the Free Software Foundation.
+ */
+

arch/arm/boot/dts/hi3620.dtsi line 23

Quoted 10 lines
arch/arm/boot/dts/hi3620.dtsi new file +10 -0
+/include/ "skeleton.dtsi"
+
+/ {
+       aliases {
+               serial0 = &uart0;
+               serial1 = &uart1;
+               serial2 = &uart2;
+               serial3 = &uart3;
+               serial4 = &uart4;
+       };

Missing /cpus/cpu at N nodes.

arch/arm/boot/dts/hi3620.dtsi line 30

Quoted 7 lines
arch/arm/boot/dts/hi3620.dtsi new file +7 -0
+
+       osc32k: osc at 0 {
+               compatible = "fixed-clock";
+               #clock-cells = <0>;
+               clock-frequency = <32768>;
+               clock-output-names = "osc32khz";
+       };

As these don't have reg values, the unit-address (the @N) should disappear, each node can simply be given a unique name.

Thanks,
Mark.