Commit f0f52afb60f57f31c099dc849c6757fea5664e89

Authored by LCPD Auto Merger

Merge branch 'ti-linux-4.1.y' of git.ti.com:ti-linux-kernel/ti-linux-kernel into ti-lsk-linux-4.1.y

TI-Feature: ti_linux_base_lsk
TI-Tree: git@git.ti.com:ti-linux-kernel/ti-linux-kernel.git
TI-Branch: ti-linux-4.1.y

* 'ti-linux-4.1.y' of git.ti.com:ti-linux-kernel/ti-linux-kernel:
  remoteproc/keystone: ensure the DSPs are in reset in probe
  TEMP: ARM: dts: k2g-evm: Reserve some DDR for MPM usecases
  ARM: dts: k2g-evm: Add a common DSP shared memory CMA pool
  TEMP: ARM: dts: k2g-evm: Add dspmem node
  ARM: dts: k2g: Add DSP node
  remoteproc/keystone: add support for Keystone 2 Galileo SOCs
  remoteproc/keystone: drop ti,syscon-psc fallback support
  ARM: dts: k2e: Replace 'ti,syscon-psc' property in DSP node
  ARM: dts: k2l: Replace 'ti,syscon-psc' property in DSP nodes
  ARM: dts: k2hk: Replace 'ti,syscon-psc' property in DSP nodes
  remoteproc/keystone: add support for using reset framework

Signed-off-by: LCPD Auto Merger <lcpd_integration@list.ti.com>

Showing 8 changed files Side-by-side Diff

Documentation/devicetree/bindings/remoteproc/ti,keystone-rproc.txt
1 1 TI Keystone DSP devices
2 2 =======================
3 3  
4   -Binding status: Unstable - Subject to changes for Keystone2 Galileo SoCs
  4 +Binding status: Unstable - Subject to changes for using common shared memories
5 5  
6 6 The TI Keystone 2 family of SoCs usually have one or more (upto 8) TI DSP Core
7 7 sub-systems that are used to offload some of the processor-intensive tasks or
... ... @@ -27,6 +27,7 @@
27 27 "ti,k2hk-dsp" for DSPs on Keystone2 Hawking/Kepler SoCs
28 28 "ti,k2l-dsp" for DSPs on Keystone2 Lamarr SoCs
29 29 "ti,k2e-dsp" for DSPs on Keystone2 Edison SoCs
  30 + "ti,k2g-dsp" for DSPs on Keystone2 Galileo SoCs
30 31  
31 32 - reg: Should contain an entry for each value in 'reg-names'.
32 33 Each entry should have the memory region's start address
33 34  
... ... @@ -41,15 +42,24 @@
41 42 - clocks: Should contain the device's input clock, and should be
42 43 defined as per the bindings in,
43 44 Documentation/devicetree/bindings/clock/keystone-gate.txt
  45 + for K2HK/K2L/K2E SoCs or,
  46 + Documentation/devicetree/bindings/clock/ti,sci-clk.txt
  47 + for K2G SoC
44 48  
45 49 - ti,syscon-dev: Should be a pair of the phandle to the Keystone Device
46 50 State Control node, and the register offset of the DSP
47 51 boot address register within that node's address space.
48 52  
49   -- ti,syscon-psc: Should contain the phandle to the Keystone Power and
50   - Sleep Controller (PSC) node, followed by two register
51   - offsets within the PSC module to the DSP's module
52   - control (MDCTL) and module status (MDSTAT) registers.
  53 +- resets: Should contain the phandle to the reset controller node
  54 + managing the resets for this device, and an array of
  55 + cells for the reset argument specifier as defined by
  56 + the selected reset controller node's binding. Please
  57 + also refer to either of the following reset bindings
  58 + for the reset argument specifier as per SoC,
  59 + Documentation/devicetree/bindings/reset/reset/syscon-reset.txt
  60 + for K2HK/K2L/K2E SoCs or,
  61 + Documentation/devicetree/bindings/reset/reset/ti,sci-reset.txt
  62 + for K2G SoC
53 63  
54 64 - interrupt-parent: Should contain a phandle to the Keystone 2 IRQ controller
55 65 IP node that is used by the ARM CorePac processor to
... ... @@ -77,6 +87,11 @@
77 87 Optional properties:
78 88 --------------------
79 89  
  90 +- power-domains : _required_ property only for Keystone 2 Galileo SoC.
  91 + Should contain a phandle to a PM domain provider node,
  92 + and a PM domain specifier as defined by the binding,
  93 + Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt
  94 +
80 95 - memory-region : phandle to the reserved memory node to be associated
81 96 with the remoteproc device. The reserved memory node
82 97 can be a CMA memory node, and should be defined as
83 98  
... ... @@ -84,9 +99,10 @@
84 99 Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
85 100  
86 101  
87   -Example:
88   ---------
  102 +Examples:
  103 +---------
89 104  
  105 +1.
90 106 /* K2HK DSP node in SoC DTS file */
91 107 soc {
92 108 dsp0: dsp0 {
... ... @@ -97,7 +113,7 @@
97 113 reg-names = "l2sram", "l1pram", "l1dram";
98 114 clocks = <&clkgem0>;
99 115 ti,syscon-dev = <&devctrl 0x40>;
100   - ti,syscon-psc = <&psc 0xa3c 0x83c>;
  116 + resets = < &pscrst 0xa3c 8 0 0x83c 8 0>;
101 117 interrupt-parent = <&kirq0>;
102 118 interrupts = <0 8>;
103 119 interrupt-names = "vring", "exception";
... ... @@ -107,6 +123,32 @@
107 123 };
108 124  
109 125 /* K2HK EVM Board file */
  126 + &dsp0 {
  127 + memory-region = <&dsp_common_cma_pool>;
  128 + };
  129 +
  130 +2.
  131 + /* K2G DSP node in SoC DTS file */
  132 + soc {
  133 + dsp0: dsp0 {
  134 + compatible = "ti,k2g-dsp";
  135 + reg = <0x10800000 0x00100000>,
  136 + <0x10e00000 0x00008000>,
  137 + <0x10f00000 0x00008000>;
  138 + reg-names = "l2sram", "l1pram", "l1dram";
  139 + power-domains = <&k2g_pds K2G_DEV_CGEM0>;
  140 + clocks = <&k2g_clks K2G_DEV_CGEM0 0>;
  141 + ti,syscon-dev = <&devctrl 0x40>;
  142 + resets = <&k2g_reset K2G_DEV_CGEM0 K2G_DEV_CGEM0_DSP0_RESET>;
  143 + interrupt-parent = <&kirq0>;
  144 + interrupts = <0 8>;
  145 + interrupt-names = "vring", "exception";
  146 + kick-gpio = <&dspgpio0 27 0>;
  147 + };
  148 +
  149 + };
  150 +
  151 + /* K2G EVM Board file */
110 152 &dsp0 {
111 153 memory-region = <&dsp_common_cma_pool>;
112 154 };
arch/arm/boot/dts/k2e.dtsi
... ... @@ -110,7 +110,7 @@
110 110 reg-names = "l2sram", "l1pram", "l1dram";
111 111 clocks = <&clkgem0>;
112 112 ti,syscon-dev = <&devctrl 0x844>;
113   - ti,syscon-psc = <&psc 0xa3c 0x83c>;
  113 + resets = <&pscrst 0xa3c 8 0 0x83c 8 0>;
114 114 interrupt-parent = <&kirq0>;
115 115 interrupts = <0 8>;
116 116 interrupt-names = "vring", "exception";
arch/arm/boot/dts/k2g-evm.dts
... ... @@ -25,6 +25,25 @@
25 25 reg = <0x00000008 0x00000000 0x00000000 0x80000000>;
26 26 };
27 27  
  28 + reserved-memory {
  29 + #address-cells = <2>;
  30 + #size-cells = <2>;
  31 + ranges;
  32 +
  33 + dsp_common_cma_pool: dsp_common_cma_pool {
  34 + compatible = "shared-dma-pool";
  35 + reg = <0x00000008 0x1f800000 0x00000000 0x800000>;
  36 + reusable;
  37 + };
  38 +
  39 + dsp_common_mpm_area: dsp_reserved_mpm_area {
  40 + compatible = "shared-dma-pool";
  41 + reg = <0x00000008 0x20000000 0x00000000 0x20000000>;
  42 + no-map;
  43 + status = "okay";
  44 + };
  45 + };
  46 +
28 47 mmc0_reg: fixedregulator-mmc0 {
29 48 compatible = "regulator-fixed";
30 49 regulator-name = "mmc0_fixed";
... ... @@ -40,6 +59,14 @@
40 59 regulator-max-microvolt = <1800000>;
41 60 regulator-always-on;
42 61 };
  62 +
  63 + soc {
  64 + mpm_mem: dspmem {
  65 + compatible = "ti,keystone-dsp-mem";
  66 + reg = <0x0c000000 0x00100000>,
  67 + <0xa0000000 0x20000000>;
  68 + };
  69 + };
43 70 };
44 71  
45 72 &k2g_pinctrl {
... ... @@ -294,5 +321,9 @@
294 321  
295 322 &gbe0 {
296 323 phy-handle = <&ethphy0>;
  324 +};
  325 +
  326 +&dsp0 {
  327 + memory-region = <&dsp_common_cma_pool>;
297 328 };
arch/arm/boot/dts/k2g.dtsi
... ... @@ -40,6 +40,7 @@
40 40 phy1 = &usb1_phy;
41 41 d_can0 = &dcan0;
42 42 d_can1 = &dcan1;
  43 + rproc0 = &dsp0;
43 44 };
44 45  
45 46 cpus {
... ... @@ -500,6 +501,22 @@
500 501 gpio-controller;
501 502 #gpio-cells = <2>;
502 503 gpio,syscon-dev = <&devctrl 0x240>;
  504 + };
  505 +
  506 + dsp0: dsp0 {
  507 + compatible = "ti,k2g-dsp";
  508 + reg = <0x10800000 0x00100000>,
  509 + <0x10e00000 0x00008000>,
  510 + <0x10f00000 0x00008000>;
  511 + reg-names = "l2sram", "l1pram", "l1dram";
  512 + power-domains = <&k2g_pds K2G_DEV_CGEM0>;
  513 + clocks = <&k2g_clks K2G_DEV_CGEM0 0>;
  514 + ti,syscon-dev = <&devctrl 0x844>;
  515 + resets = <&k2g_reset K2G_DEV_CGEM0 K2G_DEV_CGEM0_DSP0_RESET>;
  516 + interrupt-parent = <&kirq0>;
  517 + interrupts = <0 8>;
  518 + interrupt-names = "vring", "exception";
  519 + kick-gpio = <&dspgpio0 27 0>;
503 520 };
504 521  
505 522 mdio: mdio@4200f00 {
arch/arm/boot/dts/k2hk.dtsi
... ... @@ -133,7 +133,7 @@
133 133 reg-names = "l2sram", "l1pram", "l1dram";
134 134 clocks = <&clkgem0>;
135 135 ti,syscon-dev = <&devctrl 0x40>;
136   - ti,syscon-psc = <&psc 0xa3c 0x83c>;
  136 + resets = <&pscrst 0xa3c 8 0 0x83c 8 0>;
137 137 interrupt-parent = <&kirq0>;
138 138 interrupts = <0 8>;
139 139 interrupt-names = "vring", "exception";
... ... @@ -148,7 +148,7 @@
148 148 reg-names = "l2sram", "l1pram", "l1dram";
149 149 clocks = <&clkgem1>;
150 150 ti,syscon-dev = <&devctrl 0x44>;
151   - ti,syscon-psc = <&psc 0xa40 0x840>;
  151 + resets = <&pscrst 0xa40 8 0 0x840 8 0>;
152 152 interrupt-parent = <&kirq0>;
153 153 interrupts = <1 9>;
154 154 interrupt-names = "vring", "exception";
... ... @@ -163,7 +163,7 @@
163 163 reg-names = "l2sram", "l1pram", "l1dram";
164 164 clocks = <&clkgem2>;
165 165 ti,syscon-dev = <&devctrl 0x48>;
166   - ti,syscon-psc = <&psc 0xa44 0x844>;
  166 + resets = <&pscrst 0xa44 8 0 0x844 8 0>;
167 167 interrupt-parent = <&kirq0>;
168 168 interrupts = <2 10>;
169 169 interrupt-names = "vring", "exception";
... ... @@ -178,7 +178,7 @@
178 178 reg-names = "l2sram", "l1pram", "l1dram";
179 179 clocks = <&clkgem3>;
180 180 ti,syscon-dev = <&devctrl 0x4c>;
181   - ti,syscon-psc = <&psc 0xa48 0x848>;
  181 + resets = <&pscrst 0xa48 8 0 0x848 8 0>;
182 182 interrupt-parent = <&kirq0>;
183 183 interrupts = <3 11>;
184 184 interrupt-names = "vring", "exception";
... ... @@ -193,7 +193,7 @@
193 193 reg-names = "l2sram", "l1pram", "l1dram";
194 194 clocks = <&clkgem4>;
195 195 ti,syscon-dev = <&devctrl 0x50>;
196   - ti,syscon-psc = <&psc 0xa4c 0x84c>;
  196 + resets = <&pscrst 0xa4c 8 0 0x84c 8 0>;
197 197 interrupt-parent = <&kirq0>;
198 198 interrupts = <4 12>;
199 199 interrupt-names = "vring", "exception";
... ... @@ -208,7 +208,7 @@
208 208 reg-names = "l2sram", "l1pram", "l1dram";
209 209 clocks = <&clkgem5>;
210 210 ti,syscon-dev = <&devctrl 0x54>;
211   - ti,syscon-psc = <&psc 0xa50 0x850>;
  211 + resets = <&pscrst 0xa50 8 0 0x850 8 0>;
212 212 interrupt-parent = <&kirq0>;
213 213 interrupts = <5 13>;
214 214 interrupt-names = "vring", "exception";
... ... @@ -223,7 +223,7 @@
223 223 reg-names = "l2sram", "l1pram", "l1dram";
224 224 clocks = <&clkgem6>;
225 225 ti,syscon-dev = <&devctrl 0x58>;
226   - ti,syscon-psc = <&psc 0xa54 0x854>;
  226 + resets = <&pscrst 0xa54 8 0 0x854 8 0>;
227 227 interrupt-parent = <&kirq0>;
228 228 interrupts = <6 14>;
229 229 interrupt-names = "vring", "exception";
... ... @@ -238,7 +238,7 @@
238 238 reg-names = "l2sram", "l1pram", "l1dram";
239 239 clocks = <&clkgem7>;
240 240 ti,syscon-dev = <&devctrl 0x5c>;
241   - ti,syscon-psc = <&psc 0xa58 0x858>;
  241 + resets = <&pscrst 0xa58 8 0 0x858 8 0>;
242 242 interrupt-parent = <&kirq0>;
243 243 interrupts = <7 15>;
244 244 interrupt-names = "vring", "exception";
arch/arm/boot/dts/k2l.dtsi
... ... @@ -109,7 +109,7 @@
109 109 reg-names = "l2sram", "l1pram", "l1dram";
110 110 clocks = <&clkgem0>;
111 111 ti,syscon-dev = <&devctrl 0x844>;
112   - ti,syscon-psc = <&psc 0xa3c 0x83c>;
  112 + resets = <&pscrst 0xa3c 8 0 0x83c 8 0>;
113 113 interrupt-parent = <&kirq0>;
114 114 interrupts = <0 8>;
115 115 interrupt-names = "vring", "exception";
... ... @@ -124,7 +124,7 @@
124 124 reg-names = "l2sram", "l1pram", "l1dram";
125 125 clocks = <&clkgem1>;
126 126 ti,syscon-dev = <&devctrl 0x848>;
127   - ti,syscon-psc = <&psc 0xa40 0x840>;
  127 + resets = <&pscrst 0xa40 8 0 0x840 8 0>;
128 128 interrupt-parent = <&kirq0>;
129 129 interrupts = <1 9>;
130 130 interrupt-names = "vring", "exception";
... ... @@ -139,7 +139,7 @@
139 139 reg-names = "l2sram", "l1pram", "l1dram";
140 140 clocks = <&clkgem2>;
141 141 ti,syscon-dev = <&devctrl 0x84c>;
142   - ti,syscon-psc = <&psc 0xa44 0x844>;
  142 + resets = <&pscrst 0xa44 8 0 0x844 8 0>;
143 143 interrupt-parent = <&kirq0>;
144 144 interrupts = <2 10>;
145 145 interrupt-names = "vring", "exception";
... ... @@ -154,7 +154,7 @@
154 154 reg-names = "l2sram", "l1pram", "l1dram";
155 155 clocks = <&clkgem3>;
156 156 ti,syscon-dev = <&devctrl 0x850>;
157   - ti,syscon-psc = <&psc 0xa48 0x848>;
  157 + resets = <&pscrst 0xa48 8 0 0x848 8 0>;
158 158 interrupt-parent = <&kirq0>;
159 159 interrupts = <3 11>;
160 160 interrupt-names = "vring", "exception";
drivers/remoteproc/Kconfig
... ... @@ -112,6 +112,7 @@
112 112 config KEYSTONE_REMOTEPROC
113 113 tristate "Keystone Remoteproc support"
114 114 depends on ARCH_KEYSTONE
  115 + depends on RESET_CONTROLLER
115 116 depends on UIO
116 117 select REMOTEPROC
117 118 select RPMSG
drivers/remoteproc/keystone_remoteproc.c
... ... @@ -29,6 +29,7 @@
29 29 #include <linux/remoteproc.h>
30 30 #include <linux/miscdevice.h>
31 31 #include <linux/uio_driver.h>
  32 +#include <linux/reset.h>
32 33  
33 34 #include <uapi/linux/keystone_remoteproc.h>
34 35  
... ... @@ -40,8 +41,6 @@
40 41 #define KEYSTONE_RPROC_MAX_RSC_TABLE SZ_1K
41 42 #define KEYSTONE_RPROC_LOCAL_ADDRESS_MASK (SZ_16M - 1)
42 43  
43   -#define MD_CTRL_LRST BIT(8)
44   -
45 44 /*
46 45 * XXX: make this a sysfs param so that the switch between userspace
47 46 * and remoteproc core loaders can be controlled per device.
... ... @@ -72,6 +71,7 @@
72 71 * @num_mems: number of internal memory regions
73 72 * @dev_ctrl: device control regmap handle
74 73 * @psc_ctrl: power sleep controller regmap handle
  74 + * @reset: reset control handle
75 75 * @boot_offset: boot register offset in @dev_ctrl regmap
76 76 * @mdctl_offset: module control register offset in @psc_ctrl regmap
77 77 * @mdstat_offset: module status register offset in @psc_ctrl regmap
... ... @@ -96,7 +96,7 @@
96 96 struct keystone_rproc_mem *mem;
97 97 int num_mems;
98 98 struct regmap *dev_ctrl;
99   - struct regmap *psc_ctrl;
  99 + struct reset_control *reset;
100 100 u32 boot_offset;
101 101 u32 mdctl_offset;
102 102 u32 mdstat_offset;
... ... @@ -275,10 +275,7 @@
275 275 /* Put the DSP processor into reset */
276 276 static void keystone_rproc_dsp_reset(struct keystone_rproc *ksproc)
277 277 {
278   - u32 val = 0;
279   - u32 mask = MD_CTRL_LRST;
280   -
281   - regmap_update_bits(ksproc->psc_ctrl, ksproc->mdctl_offset, mask, val);
  278 + reset_control_assert(ksproc->reset);
282 279 }
283 280  
284 281 /* Configure the boot address and boot the DSP processor */
... ... @@ -286,7 +283,6 @@
286 283 uint32_t boot_addr)
287 284 {
288 285 int ret;
289   - u32 mask = MD_CTRL_LRST;
290 286  
291 287 if (boot_addr & (SZ_1K - 1)) {
292 288 dev_err(ksproc->dev, "invalid boot address 0x%x, must be aligned on a 1KB boundary\n",
... ... @@ -301,7 +297,7 @@
301 297 return ret;
302 298 }
303 299  
304   - regmap_update_bits(ksproc->psc_ctrl, ksproc->mdctl_offset, mask, mask);
  300 + reset_control_deassert(ksproc->reset);
305 301  
306 302 return 0;
307 303 }
... ... @@ -799,40 +795,6 @@
799 795 return 0;
800 796 }
801 797  
802   -static int keystone_rproc_of_get_psc_syscon(struct platform_device *pdev,
803   - struct keystone_rproc *ksproc)
804   -{
805   - struct device_node *np = pdev->dev.of_node;
806   - struct device *dev = &pdev->dev;
807   - int ret;
808   -
809   - if (!of_property_read_bool(np, "ti,syscon-psc")) {
810   - dev_err(dev, "ti,syscon-psc property is absent\n");
811   - return -EINVAL;
812   - }
813   -
814   - ksproc->psc_ctrl =
815   - syscon_regmap_lookup_by_phandle(np, "ti,syscon-psc");
816   - if (IS_ERR(ksproc->psc_ctrl)) {
817   - ret = PTR_ERR(ksproc->psc_ctrl);
818   - return ret;
819   - }
820   -
821   - if (of_property_read_u32_index(np, "ti,syscon-psc", 1,
822   - &ksproc->mdctl_offset)) {
823   - dev_err(dev, "couldn't read the module control register offset\n");
824   - return -EINVAL;
825   - }
826   -
827   - if (of_property_read_u32_index(np, "ti,syscon-psc", 2,
828   - &ksproc->mdstat_offset)) {
829   - dev_err(dev, "couldn't read the module status register offset\n");
830   - return -EINVAL;
831   - }
832   -
833   - return 0;
834   -}
835   -
836 798 static int keystone_rproc_probe(struct platform_device *pdev)
837 799 {
838 800 struct device *dev = &pdev->dev;
839 801  
... ... @@ -891,9 +853,11 @@
891 853 if (ret)
892 854 goto free_rproc;
893 855  
894   - ret = keystone_rproc_of_get_psc_syscon(pdev, ksproc);
895   - if (ret)
  856 + ksproc->reset = devm_reset_control_get(dev, NULL);
  857 + if (IS_ERR(ksproc->reset)) {
  858 + ret = PTR_ERR(ksproc->reset);
896 859 goto free_rproc;
  860 + }
897 861  
898 862 ksproc->clk = devm_clk_get(dev, NULL);
899 863 if (IS_ERR(ksproc->clk)) {
... ... @@ -943,6 +907,16 @@
943 907 if (rproc_get_alias_id(rproc) < 0)
944 908 dev_warn(&pdev->dev, "device does not have an alias id\n");
945 909  
  910 + /* ensure the DSP is in reset before loading firmware */
  911 + ret = reset_control_status(ksproc->reset);
  912 + if (ret < 0) {
  913 + dev_err(dev, "failed to get reset status, status = %d\n", ret);
  914 + goto release_mem;
  915 + } else if (ret == 0) {
  916 + WARN(1, "device is not in reset\n");
  917 + keystone_rproc_dsp_reset(ksproc);
  918 + }
  919 +
946 920 ret = rproc_add(rproc);
947 921 if (ret) {
948 922 dev_err(dev, "failed to add register device with remoteproc core, status = %d\n",
... ... @@ -1018,6 +992,7 @@
1018 992 { .compatible = "ti,k2hk-dsp", },
1019 993 { .compatible = "ti,k2l-dsp", },
1020 994 { .compatible = "ti,k2e-dsp", },
  995 + { .compatible = "ti,k2g-dsp", },
1021 996 { /* sentinel */ },
1022 997 };
1023 998 MODULE_DEVICE_TABLE(of, keystone_rproc_of_match);