From c2ed0f3615116654bfa181566dc6a1cdec1f05c3 Mon Sep 17 00:00:00 2001 From: Barry Song Date: Tue, 18 Feb 2014 14:46:27 +0800 Subject: ARM: prima2: l2x0: fix checkpatch issues Fix the below checkpatch issues: ERROR: open brace '{' following struct go on the same line 15: FILE: l2x0.c:15: +struct l2x0_aux +{ ERROR: Use of __initconst requires a separate use of const 20: FILE: l2x0.c:20: +static struct l2x0_aux prima2_l2x0_aux __initconst = { ERROR: Use of __initconst requires a separate use of const 25: FILE: l2x0.c:25: +static struct l2x0_aux marco_l2x0_aux __initconst = { ERROR: Use of __initconst requires a separate use of const 31: FILE: l2x0.c:31: +static struct of_device_id sirf_l2x0_ids[] __initconst = { Signed-off-by: Barry Song diff --git a/arch/arm/mach-prima2/l2x0.c b/arch/arm/mach-prima2/l2x0.c index cbcbe9c..c710253 100644 --- a/arch/arm/mach-prima2/l2x0.c +++ b/arch/arm/mach-prima2/l2x0.c @@ -11,24 +11,23 @@ #include #include -struct l2x0_aux -{ +struct l2x0_aux { u32 val; u32 mask; }; -static struct l2x0_aux prima2_l2x0_aux __initconst = { +static const struct l2x0_aux prima2_l2x0_aux __initconst = { .val = 2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT, .mask = 0, }; -static struct l2x0_aux marco_l2x0_aux __initconst = { +static const struct l2x0_aux marco_l2x0_aux __initconst = { .val = (2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | (1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT), .mask = L2X0_AUX_CTRL_MASK, }; -static struct of_device_id sirf_l2x0_ids[] __initconst = { +static const struct of_device_id sirf_l2x0_ids[] __initconst = { { .compatible = "sirf,prima2-pl310-cache", .data = &prima2_l2x0_aux, }, { .compatible = "sirf,marco-pl310-cache", .data = &marco_l2x0_aux, }, {}, -- cgit v0.10.2 From 661bfe23a16dec9ce64a5eb9ed3b4702d536cda7 Mon Sep 17 00:00:00 2001 From: Barry Song Date: Tue, 18 Feb 2014 14:46:28 +0800 Subject: ARM: prima2: platsmp: fix checkpatch issues fix the below checkpatch issues: ERROR: code indent should use tabs where possible 141: FILE: platsmp.c:141: + .smp_prepare_cpus = sirfsoc_smp_prepare_cpus,$ WARNING: please, no spaces at the start of a line 141: FILE: platsmp.c:141: + .smp_prepare_cpus = sirfsoc_smp_prepare_cpus,$ ERROR: code indent should use tabs where possible 142: FILE: platsmp.c:142: + .smp_secondary_init = sirfsoc_secondary_init,$ WARNING: please, no spaces at the start of a line 142: FILE: platsmp.c:142: + .smp_secondary_init = sirfsoc_secondary_init,$ ERROR: code indent should use tabs where possible 143: FILE: platsmp.c:143: + .smp_boot_secondary = sirfsoc_boot_secondary,$ WARNING: please, no spaces at the start of a line 143: FILE: platsmp.c:143: + .smp_boot_secondary = sirfsoc_boot_secondary,$ Signed-off-by: Barry Song diff --git a/arch/arm/mach-prima2/platsmp.c b/arch/arm/mach-prima2/platsmp.c index e358b07..335c12e 100644 --- a/arch/arm/mach-prima2/platsmp.c +++ b/arch/arm/mach-prima2/platsmp.c @@ -138,9 +138,9 @@ static void __init sirfsoc_smp_prepare_cpus(unsigned int max_cpus) } struct smp_operations sirfsoc_smp_ops __initdata = { - .smp_prepare_cpus = sirfsoc_smp_prepare_cpus, - .smp_secondary_init = sirfsoc_secondary_init, - .smp_boot_secondary = sirfsoc_boot_secondary, + .smp_prepare_cpus = sirfsoc_smp_prepare_cpus, + .smp_secondary_init = sirfsoc_secondary_init, + .smp_boot_secondary = sirfsoc_boot_secondary, #ifdef CONFIG_HOTPLUG_CPU .cpu_die = sirfsoc_cpu_die, #endif -- cgit v0.10.2 From 8ccf166cef274c4e16bc2965115fb53469f32939 Mon Sep 17 00:00:00 2001 From: Barry Song Date: Tue, 18 Feb 2014 14:46:29 +0800 Subject: ARM: prima2: common: fix checkpatch issues fix the below checkpatch issues: ERROR: Use of const init definition must use __initconst 30: FILE: common.c:30: +static const char *atlas6_dt_match[] __initdata = { ERROR: Use of const init definition must use __initconst 45: FILE: common.c:45: +static const char *prima2_dt_match[] __initdata = { ERROR: Use of const init definition must use __initconst 61: FILE: common.c:61: +static const char *marco_dt_match[] __initdata = { Signed-off-by: Barry Song diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c index d49aff7..6926dbc 100644 --- a/arch/arm/mach-prima2/common.c +++ b/arch/arm/mach-prima2/common.c @@ -27,7 +27,7 @@ static __init void sirfsoc_map_io(void) } #ifdef CONFIG_ARCH_ATLAS6 -static const char *atlas6_dt_match[] __initdata = { +static const char *atlas6_dt_match[] __initconst = { "sirf,atlas6", NULL }; @@ -42,7 +42,7 @@ MACHINE_END #endif #ifdef CONFIG_ARCH_PRIMA2 -static const char *prima2_dt_match[] __initdata = { +static const char *prima2_dt_match[] __initconst = { "sirf,prima2", NULL }; @@ -58,7 +58,7 @@ MACHINE_END #endif #ifdef CONFIG_ARCH_MARCO -static const char *marco_dt_match[] __initdata = { +static const char *marco_dt_match[] __initconst = { "sirf,marco", NULL }; -- cgit v0.10.2 From 5b7356bb3eb88b54af80ecd2207a9335f48a3677 Mon Sep 17 00:00:00 2001 From: Barry Song Date: Tue, 18 Feb 2014 14:46:30 +0800 Subject: ARM: prima2: rtciobrg: fix the typo about license we are marking GPL v2 in head comments, but MODULE_LICENSE is declaring GPL. Signed-off-by: Barry Song diff --git a/arch/arm/mach-prima2/rtciobrg.c b/arch/arm/mach-prima2/rtciobrg.c index 9f2da2e..a17c88b 100644 --- a/arch/arm/mach-prima2/rtciobrg.c +++ b/arch/arm/mach-prima2/rtciobrg.c @@ -137,4 +137,4 @@ postcore_initcall(sirfsoc_rtciobrg_init); MODULE_AUTHOR("Zhiwu Song , " "Barry Song "); MODULE_DESCRIPTION("CSR SiRFprimaII rtc io bridge"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); -- cgit v0.10.2 From 951ec0909c2ef3b617fe4b03045f396528c8a55f Mon Sep 17 00:00:00 2001 From: Barry Song Date: Tue, 18 Feb 2014 14:46:31 +0800 Subject: ARM: prima2: staticize sirfsoc_init_late function sirfsoc_init_late() is a local function not an extern interface to anyone. Signed-off-by: Barry Song diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c index 6926dbc..3b8865a 100644 --- a/arch/arm/mach-prima2/common.c +++ b/arch/arm/mach-prima2/common.c @@ -15,7 +15,7 @@ #include #include "common.h" -void __init sirfsoc_init_late(void) +static void __init sirfsoc_init_late(void) { sirfsoc_pm_init(); } -- cgit v0.10.2 From e7eda91f6323bd7dc85598c639f5e4709efc2309 Mon Sep 17 00:00:00 2001 From: Barry Song Date: Fri, 10 Jan 2014 03:15:42 +0000 Subject: ARM: prima2: move to generic reset controller driver framework this moves to generic IP module reset framework, and make other drivers use common device_reset() API. Cc: Srinivas Kandagatla Signed-off-by: Barry Song Signed-off-by: Bin Shi Acked-by: Philipp Zabel diff --git a/Documentation/devicetree/bindings/reset/sirf,rstc.txt b/Documentation/devicetree/bindings/reset/sirf,rstc.txt new file mode 100644 index 0000000..0505de7 --- /dev/null +++ b/Documentation/devicetree/bindings/reset/sirf,rstc.txt @@ -0,0 +1,42 @@ +CSR SiRFSoC Reset Controller +====================================== + +Please also refer to reset.txt in this directory for common reset +controller binding usage. + +Required properties: +- compatible: Should be "sirf,prima2-rstc" or "sirf,marco-rstc" +- reg: should be register base and length as documented in the + datasheet +- #reset-cells: 1, see below + +example: + +rstc: reset-controller@88010000 { + compatible = "sirf,prima2-rstc"; + reg = <0x88010000 0x1000>; + #reset-cells = <1>; +}; + +Specifying reset lines connected to IP modules +============================================== + +The reset controller(rstc) manages various reset sources. This module provides +reset signals for most blocks in system. Those device nodes should specify the +reset line on the rstc in their resets property, containing a phandle to the +rstc device node and a RESET_INDEX specifying which module to reset, as described +in reset.txt. + +For SiRFSoC, RESET_INDEX is just reset_bit defined in SW_RST0 and SW_RST1 registers. +For modules whose rest_bit is in SW_RST0, its RESET_INDEX is 0~31. For modules whose +rest_bit is in SW_RST1, its RESET_INDEX is 32~63. + +example: + +vpp@90020000 { + compatible = "sirf,prima2-vpp"; + reg = <0x90020000 0x10000>; + interrupts = <31>; + clocks = <&clks 35>; + resets = <&rstc 6>; +}; diff --git a/arch/arm/boot/dts/atlas6.dtsi b/arch/arm/boot/dts/atlas6.dtsi index f8674bc..f7f9caf 100644 --- a/arch/arm/boot/dts/atlas6.dtsi +++ b/arch/arm/boot/dts/atlas6.dtsi @@ -65,9 +65,10 @@ #clock-cells = <1>; }; - reset-controller@88010000 { + rstc: reset-controller@88010000 { compatible = "sirf,prima2-rstc"; reg = <0x88010000 0x1000>; + #reset-cells = <1>; }; rsc-controller@88020000 { diff --git a/arch/arm/boot/dts/marco.dtsi b/arch/arm/boot/dts/marco.dtsi index 1579c34..0c9647d 100644 --- a/arch/arm/boot/dts/marco.dtsi +++ b/arch/arm/boot/dts/marco.dtsi @@ -58,9 +58,10 @@ #size-cells = <1>; ranges = <0xc2000000 0xc2000000 0x1000000>; - reset-controller@c2000000 { + rstc: reset-controller@c2000000 { compatible = "sirf,marco-rstc"; reg = <0xc2000000 0x10000>; + #reset-cells = <1>; }; }; diff --git a/arch/arm/boot/dts/prima2.dtsi b/arch/arm/boot/dts/prima2.dtsi index 0e21993..0ca0d7f 100644 --- a/arch/arm/boot/dts/prima2.dtsi +++ b/arch/arm/boot/dts/prima2.dtsi @@ -76,9 +76,10 @@ #clock-cells = <1>; }; - reset-controller@88010000 { + rstc: reset-controller@88010000 { compatible = "sirf,prima2-rstc"; reg = <0x88010000 0x1000>; + #reset-cells = <1>; }; rsc-controller@88020000 { diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig index 6988b11..f37a1de 100644 --- a/arch/arm/mach-prima2/Kconfig +++ b/arch/arm/mach-prima2/Kconfig @@ -1,5 +1,6 @@ config ARCH_SIRF bool "CSR SiRF" if ARCH_MULTI_V7 + select ARCH_HAS_RESET_CONTROLLER select ARCH_REQUIRE_GPIOLIB select GENERIC_CLOCKEVENTS select GENERIC_IRQ_CHIP diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c index ccb5339..a599767 100644 --- a/arch/arm/mach-prima2/rstc.c +++ b/arch/arm/mach-prima2/rstc.c @@ -13,57 +13,36 @@ #include #include #include +#include #include +#include + +#define SIRFSOC_RSTBIT_NUM 64 void __iomem *sirfsoc_rstc_base; static DEFINE_MUTEX(rstc_lock); -static struct of_device_id rstc_ids[] = { - { .compatible = "sirf,prima2-rstc" }, - { .compatible = "sirf,marco-rstc" }, - {}, -}; - -static int __init sirfsoc_of_rstc_init(void) -{ - struct device_node *np; - - np = of_find_matching_node(NULL, rstc_ids); - if (!np) { - pr_err("unable to find compatible sirf rstc node in dtb\n"); - return -ENOENT; - } - - sirfsoc_rstc_base = of_iomap(np, 0); - if (!sirfsoc_rstc_base) - panic("unable to map rstc cpu registers\n"); - - of_node_put(np); - - return 0; -} -early_initcall(sirfsoc_of_rstc_init); - -int sirfsoc_reset_device(struct device *dev) +static int sirfsoc_reset_module(struct reset_controller_dev *rcdev, + unsigned long sw_reset_idx) { - u32 reset_bit; + u32 reset_bit = sw_reset_idx; - if (of_property_read_u32(dev->of_node, "reset-bit", &reset_bit)) + if (reset_bit >= SIRFSOC_RSTBIT_NUM) return -EINVAL; mutex_lock(&rstc_lock); - if (of_device_is_compatible(dev->of_node, "sirf,prima2-rstc")) { + if (of_device_is_compatible(rcdev->of_node, "sirf,prima2-rstc")) { /* * Writing 1 to this bit resets corresponding block. Writing 0 to this * bit de-asserts reset signal of the corresponding block. * datasheet doesn't require explicit delay between the set and clear * of reset bit. it could be shorter if tests pass. */ - writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) | reset_bit, + writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) | (1 << reset_bit), sirfsoc_rstc_base + (reset_bit / 32) * 4); msleep(10); - writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) & ~reset_bit, + writel(readl(sirfsoc_rstc_base + (reset_bit / 32) * 4) & ~(1 << reset_bit), sirfsoc_rstc_base + (reset_bit / 32) * 4); } else { /* @@ -73,9 +52,9 @@ int sirfsoc_reset_device(struct device *dev) * datasheet doesn't require explicit delay between the set and clear * of reset bit. it could be shorter if tests pass. */ - writel(reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8); + writel(1 << reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8); msleep(10); - writel(reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8 + 4); + writel(1 << reset_bit, sirfsoc_rstc_base + (reset_bit / 32) * 8 + 4); } mutex_unlock(&rstc_lock); @@ -83,6 +62,52 @@ int sirfsoc_reset_device(struct device *dev) return 0; } +static struct reset_control_ops sirfsoc_rstc_ops = { + .reset = sirfsoc_reset_module, +}; + +static struct reset_controller_dev sirfsoc_reset_controller = { + .ops = &sirfsoc_rstc_ops, + .nr_resets = SIRFSOC_RSTBIT_NUM, +}; + +static int sirfsoc_rstc_probe(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + sirfsoc_rstc_base = of_iomap(np, 0); + if (!sirfsoc_rstc_base) { + dev_err(&pdev->dev, "unable to map rstc cpu registers\n"); + return -ENOMEM; + } + + sirfsoc_reset_controller.of_node = np; + + reset_controller_register(&sirfsoc_reset_controller); + + return 0; +} + +static const struct of_device_id rstc_ids[] = { + { .compatible = "sirf,prima2-rstc" }, + { .compatible = "sirf,marco-rstc" }, + {}, +}; + +static struct platform_driver sirfsoc_rstc_driver = { + .probe = sirfsoc_rstc_probe, + .driver = { + .name = "sirfsoc_rstc", + .owner = THIS_MODULE, + .of_match_table = rstc_ids, + }, +}; + +static int __init sirfsoc_rstc_init(void) +{ + return platform_driver_register(&sirfsoc_rstc_driver); +} +subsys_initcall(sirfsoc_rstc_init); + #define SIRFSOC_SYS_RST_BIT BIT(31) void sirfsoc_restart(enum reboot_mode mode, const char *cmd) -- cgit v0.10.2