Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull ARM SoC-related driver updates from Olof Johansson:
"Various driver updates for platforms. A bulk of this is smaller fixes
or cleanups, but some of the new material this time around is:

- Support for Nvidia Tegra234 SoC

- Ring accelerator support for TI AM65x

- PRUSS driver for TI platforms

- Renesas support for R-Car V3U SoC

- Reset support for Cortex-M4 processor on i.MX8MQ

There are also new socinfo entries for a handful of different SoCs and
platforms"

* tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (131 commits)
drm/mediatek: reduce clear event
soc: mediatek: cmdq: add clear option in cmdq_pkt_wfe api
soc: mediatek: cmdq: add jump function
soc: mediatek: cmdq: add write_s_mask value function
soc: mediatek: cmdq: add write_s value function
soc: mediatek: cmdq: add read_s function
soc: mediatek: cmdq: add write_s_mask function
soc: mediatek: cmdq: add write_s function
soc: mediatek: cmdq: add address shift in jump
soc: mediatek: mtk-infracfg: Fix kerneldoc
soc: amlogic: pm-domains: use always-on flag
reset: sti: reset-syscfg: fix struct description warnings
reset: imx7: add the cm4 reset for i.MX8MQ
dt-bindings: reset: imx8mq: add m4 reset
reset: Fix and extend kerneldoc
reset: reset-zynqmp: Added support for Versal platform
dt-bindings: reset: Updated binding for Versal reset driver
reset: imx7: Support module build
soc: fsl: qe: Remove unnessesary check in ucc_set_tdm_rxtx_clk
soc: fsl: qman: convert to use be32_add_cpu()
...

+3935 -946
+2 -1
Documentation/devicetree/bindings/bus/brcm,gisb-arb.txt
··· 10 10 "brcm,bcm7038-gisb-arb" for 130nm chips 11 11 - reg: specifies the base physical address and size of the registers 12 12 - interrupts: specifies the two interrupts (timeout and TEA) to be used from 13 - the parent interrupt controller 13 + the parent interrupt controller. A third optional interrupt may be specified 14 + for breakpoints. 14 15 15 16 Optional properties: 16 17
+2 -1
Documentation/devicetree/bindings/memory-controllers/mediatek,smi-common.txt
··· 5 5 Mediatek SMI have two generations of HW architecture, here is the list 6 6 which generation the SoCs use: 7 7 generation 1: mt2701 and mt7623. 8 - generation 2: mt2712, mt6779, mt8173 and mt8183. 8 + generation 2: mt2712, mt6779, mt8167, mt8173 and mt8183. 9 9 10 10 There's slight differences between the two SMI, for generation 2, the 11 11 register which control the iommu port is at each larb's register base. But ··· 20 20 "mediatek,mt2712-smi-common" 21 21 "mediatek,mt6779-smi-common" 22 22 "mediatek,mt7623-smi-common", "mediatek,mt2701-smi-common" 23 + "mediatek,mt8167-smi-common" 23 24 "mediatek,mt8173-smi-common" 24 25 "mediatek,mt8183-smi-common" 25 26 - reg : the register and size of the SMI block.
+2 -1
Documentation/devicetree/bindings/memory-controllers/mediatek,smi-larb.txt
··· 8 8 "mediatek,mt2712-smi-larb" 9 9 "mediatek,mt6779-smi-larb" 10 10 "mediatek,mt7623-smi-larb", "mediatek,mt2701-smi-larb" 11 + "mediatek,mt8167-smi-larb" 11 12 "mediatek,mt8173-smi-larb" 12 13 "mediatek,mt8183-smi-larb" 13 14 - reg : the register and size of this local arbiter. ··· 23 22 - "gals": the clock for GALS(Global Async Local Sync). 24 23 Here is the list which has this GALS: mt8183. 25 24 26 - Required property for mt2701, mt2712, mt6779 and mt7623: 25 + Required property for mt2701, mt2712, mt6779, mt7623 and mt8167: 27 26 - mediatek,larb-id :the hardware id of this larb. 28 27 29 28 Example:
+21 -2
Documentation/devicetree/bindings/power/amlogic,meson-ee-pwrc.yaml
··· 27 27 - amlogic,meson8b-pwrc 28 28 - amlogic,meson8m2-pwrc 29 29 - amlogic,meson-gxbb-pwrc 30 + - amlogic,meson-axg-pwrc 30 31 - amlogic,meson-g12a-pwrc 31 32 - amlogic,meson-sm1-pwrc 32 33 ··· 43 42 - const: vapb 44 43 45 44 resets: 46 - minItems: 11 45 + minItems: 5 47 46 maxItems: 12 48 47 49 48 reset-names: 50 - minItems: 11 49 + minItems: 5 51 50 maxItems: 12 52 51 53 52 "#power-domain-cells": ··· 102 101 - const: vencp 103 102 - const: vdac 104 103 - const: vdi6 104 + - const: vencl 105 + - const: vid_lock 106 + required: 107 + - resets 108 + - reset-names 109 + 110 + - if: 111 + properties: 112 + compatible: 113 + enum: 114 + - amlogic,meson-axg-pwrc 115 + then: 116 + properties: 117 + reset-names: 118 + items: 119 + - const: viu 120 + - const: venc 121 + - const: vcbus 105 122 - const: vencl 106 123 - const: vid_lock 107 124 required:
+44
Documentation/devicetree/bindings/power/brcm,bcm63xx-power.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: "http://devicetree.org/schemas/power/brcm,bcm63xx-power.yaml#" 5 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 6 + 7 + title: BCM63xx power domain driver 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + 12 + description: | 13 + BCM6318, BCM6328, BCM6362 and BCM63268 SoCs have a power domain controller 14 + to enable/disable certain components in order to save power. 15 + 16 + properties: 17 + compatible: 18 + items: 19 + - enum: 20 + - brcm,bcm6318-power-controller 21 + - brcm,bcm6328-power-controller 22 + - brcm,bcm6362-power-controller 23 + - brcm,bcm63268-power-controller 24 + 25 + reg: 26 + maxItems: 1 27 + 28 + "#power-domain-cells": 29 + const: 1 30 + 31 + required: 32 + - compatible 33 + - reg 34 + - "#power-domain-cells" 35 + 36 + additionalProperties: false 37 + 38 + examples: 39 + - | 40 + periph_pwr: power-controller@10001848 { 41 + compatible = "brcm,bcm6328-power-controller"; 42 + reg = <0x10001848 0x4>; 43 + #power-domain-cells = <1>; 44 + };
+7 -4
Documentation/devicetree/bindings/reset/xlnx,zynqmp-reset.txt
··· 1 1 -------------------------------------------------------------------------- 2 - = Zynq UltraScale+ MPSoC reset driver binding = 2 + = Zynq UltraScale+ MPSoC and Versal reset driver binding = 3 3 -------------------------------------------------------------------------- 4 - The Zynq UltraScale+ MPSoC has several different resets. 4 + The Zynq UltraScale+ MPSoC and Versal has several different resets. 5 5 6 6 See Chapter 36 of the Zynq UltraScale+ MPSoC TRM (UG) for more information 7 7 about zynqmp resets. ··· 10 10 controller binding usage. 11 11 12 12 Required Properties: 13 - - compatible: "xlnx,zynqmp-reset" 13 + - compatible: "xlnx,zynqmp-reset" for Zynq UltraScale+ MPSoC platform 14 + "xlnx,versal-reset" for Versal platform 14 15 - #reset-cells: Specifies the number of cells needed to encode reset 15 16 line, should be 1 16 17 ··· 38 37 specify them as a reset phandle in their corresponding node as 39 38 specified in reset.txt. 40 39 41 - For list of all valid reset indicies see 40 + For list of all valid reset indices for Zynq UltraScale+ MPSoC see 42 41 <dt-bindings/reset/xlnx-zynqmp-resets.h> 42 + For list of all valid reset indices for Versal see 43 + <dt-bindings/reset/xlnx-versal-resets.h> 43 44 44 45 Example: 45 46
-6
Documentation/devicetree/bindings/soc/ti/k3-ringacc.yaml
··· 62 62 $ref: /schemas/types.yaml#/definitions/uint32 63 63 description: TI-SCI device id of the ring accelerator 64 64 65 - ti,dma-ring-reset-quirk: 66 - $ref: /schemas/types.yaml#definitions/flag 67 - description: | 68 - enable ringacc/udma ring state interoperability issue software w/a 69 - 70 65 required: 71 66 - compatible 72 67 - reg ··· 89 94 reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target"; 90 95 ti,num-rings = <818>; 91 96 ti,sci-rm-range-gp-rings = <0x2>; /* GP ring range */ 92 - ti,dma-ring-reset-quirk; 93 97 ti,sci = <&dmsc>; 94 98 ti,sci-dev-id = <187>; 95 99 msi-parent = <&inta_main_udmass>;
+439
Documentation/devicetree/bindings/soc/ti/ti,pruss.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/soc/ti/ti,pruss.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: |+ 8 + TI Programmable Real-Time Unit and Industrial Communication Subsystem 9 + 10 + maintainers: 11 + - Suman Anna <s-anna@ti.com> 12 + 13 + description: |+ 14 + 15 + The Programmable Real-Time Unit and Industrial Communication Subsystem 16 + (PRU-ICSS a.k.a. PRUSS) is present on various TI SoCs such as AM335x, AM437x, 17 + Keystone 66AK2G, OMAP-L138/DA850 etc. A PRUSS consists of dual 32-bit RISC 18 + cores (Programmable Real-Time Units, or PRUs), shared RAM, data and 19 + instruction RAMs, some internal peripheral modules to facilitate industrial 20 + communication, and an interrupt controller. 21 + 22 + The programmable nature of the PRUs provide flexibility to implement custom 23 + peripheral interfaces, fast real-time responses, or specialized data handling. 24 + The common peripheral modules include the following, 25 + - an Ethernet MII_RT module with two MII ports 26 + - an MDIO port to control external Ethernet PHYs 27 + - an Industrial Ethernet Peripheral (IEP) to manage/generate Industrial 28 + Ethernet functions 29 + - an Enhanced Capture Module (eCAP) 30 + - an Industrial Ethernet Timer with 7/9 capture and 16 compare events 31 + - a 16550-compatible UART to support PROFIBUS 32 + - Enhanced GPIO with async capture and serial support 33 + 34 + A PRU-ICSS subsystem can have up to three shared data memories. A PRU core 35 + acts on a primary Data RAM (there are usually 2 Data RAMs) at its address 36 + 0x0, but also has access to a secondary Data RAM (primary to the other PRU 37 + core) at its address 0x2000. A shared Data RAM, if present, can be accessed 38 + by both the PRU cores. The Interrupt Controller (INTC) and a CFG module are 39 + common to both the PRU cores. Each PRU core also has a private instruction 40 + RAM, and specific register spaces for Control and Debug functionalities. 41 + 42 + Various sub-modules within a PRU-ICSS subsystem are represented as individual 43 + nodes and are defined using a parent-child hierarchy depending on their 44 + integration within the IP and the SoC. These nodes are described in the 45 + following sections. 46 + 47 + 48 + PRU-ICSS Node 49 + ============== 50 + Each PRU-ICSS instance is represented as its own node with the individual PRU 51 + processor cores, the memories node, an INTC node and an MDIO node represented 52 + as child nodes within this PRUSS node. This node shall be a child of the 53 + corresponding interconnect bus nodes or target-module nodes. 54 + 55 + See ../../mfd/syscon.yaml for generic SysCon binding details. 56 + 57 + 58 + properties: 59 + $nodename: 60 + pattern: "^(pruss|icssg)@[0-9a-f]+$" 61 + 62 + compatible: 63 + enum: 64 + - ti,am3356-pruss # for AM335x SoC family 65 + - ti,am4376-pruss0 # for AM437x SoC family and PRUSS unit 0 66 + - ti,am4376-pruss1 # for AM437x SoC family and PRUSS unit 1 67 + - ti,am5728-pruss # for AM57xx SoC family 68 + - ti,k2g-pruss # for 66AK2G SoC family 69 + - ti,am654-icssg # for K3 AM65x SoC family 70 + - ti,j721e-icssg # for K3 J721E SoC family 71 + 72 + reg: 73 + maxItems: 1 74 + 75 + "#address-cells": 76 + const: 1 77 + 78 + "#size-cells": 79 + const: 1 80 + 81 + ranges: 82 + maxItems: 1 83 + 84 + power-domains: 85 + description: | 86 + This property is as per sci-pm-domain.txt. 87 + 88 + patternProperties: 89 + 90 + memories@[a-f0-9]+$: 91 + description: | 92 + The various Data RAMs within a single PRU-ICSS unit are represented as a 93 + single node with the name 'memories'. 94 + 95 + type: object 96 + 97 + properties: 98 + reg: 99 + minItems: 2 # On AM437x one of two PRUSS units don't contain Shared RAM. 100 + maxItems: 3 101 + items: 102 + - description: Address and size of the Data RAM0. 103 + - description: Address and size of the Data RAM1. 104 + - description: | 105 + Address and size of the Shared Data RAM. Note that on AM437x one 106 + of two PRUSS units don't contain Shared RAM, while the second one 107 + has it. 108 + 109 + reg-names: 110 + minItems: 2 111 + maxItems: 3 112 + items: 113 + - const: dram0 114 + - const: dram1 115 + - const: shrdram2 116 + 117 + required: 118 + - reg 119 + - reg-names 120 + 121 + additionalProperties: false 122 + 123 + cfg@[a-f0-9]+$: 124 + description: | 125 + PRU-ICSS configuration space. CFG sub-module represented as a SysCon. 126 + 127 + type: object 128 + 129 + properties: 130 + compatible: 131 + items: 132 + - const: ti,pruss-cfg 133 + - const: syscon 134 + 135 + "#address-cells": 136 + const: 1 137 + 138 + "#size-cells": 139 + const: 1 140 + 141 + reg: 142 + maxItems: 1 143 + 144 + ranges: 145 + maxItems: 1 146 + 147 + clocks: 148 + type: object 149 + 150 + properties: 151 + "#address-cells": 152 + const: 1 153 + 154 + "#size-cells": 155 + const: 0 156 + 157 + patternProperties: 158 + coreclk-mux@[a-f0-9]+$: 159 + description: | 160 + This is applicable only for ICSSG (K3 SoCs). The ICSSG modules 161 + core clock can be set to one of the 2 sources: ICSSG_CORE_CLK or 162 + ICSSG_ICLK. This node models this clock mux and should have the 163 + name "coreclk-mux". 164 + 165 + type: object 166 + 167 + properties: 168 + '#clock-cells': 169 + const: 0 170 + 171 + clocks: 172 + items: 173 + - description: ICSSG_CORE Clock 174 + - description: ICSSG_ICLK Clock 175 + 176 + assigned-clocks: 177 + maxItems: 1 178 + 179 + assigned-clock-parents: 180 + maxItems: 1 181 + description: | 182 + Standard assigned-clocks-parents definition used for selecting 183 + mux parent (one of the mux input). 184 + 185 + reg: 186 + maxItems: 1 187 + 188 + required: 189 + - clocks 190 + 191 + additionalProperties: false 192 + 193 + iepclk-mux@[a-f0-9]+$: 194 + description: | 195 + The IEP module can get its clock from 2 sources: ICSSG_IEP_CLK or 196 + CORE_CLK (OCP_CLK in older SoCs). This node models this clock 197 + mux and should have the name "iepclk-mux". 198 + 199 + type: object 200 + 201 + properties: 202 + '#clock-cells': 203 + const: 0 204 + 205 + clocks: 206 + items: 207 + - description: ICSSG_IEP Clock 208 + - description: Core Clock (OCP Clock in older SoCs) 209 + 210 + assigned-clocks: 211 + maxItems: 1 212 + 213 + assigned-clock-parents: 214 + maxItems: 1 215 + description: | 216 + Standard assigned-clocks-parents definition used for selecting 217 + mux parent (one of the mux input). 218 + 219 + reg: 220 + maxItems: 1 221 + 222 + required: 223 + - clocks 224 + 225 + additionalProperties: false 226 + 227 + additionalProperties: false 228 + 229 + iep@[a-f0-9]+$: 230 + description: | 231 + Industrial Ethernet Peripheral to manage/generate Industrial Ethernet 232 + functions such as time stamping. Each PRUSS has either 1 IEP (on AM335x, 233 + AM437x, AM57xx & 66AK2G SoCs) or 2 IEPs (on K3 AM65x & J721E SoCs ). IEP 234 + is used for creating PTP clocks and generating PPS signals. 235 + 236 + type: object 237 + 238 + mii-rt@[a-f0-9]+$: 239 + description: | 240 + Real-Time Ethernet to support multiple industrial communication protocols. 241 + MII-RT sub-module represented as a SysCon. 242 + 243 + type: object 244 + 245 + properties: 246 + compatible: 247 + items: 248 + - const: ti,pruss-mii 249 + - const: syscon 250 + 251 + reg: 252 + maxItems: 1 253 + 254 + additionalProperties: false 255 + 256 + mii-g-rt@[a-f0-9]+$: 257 + description: | 258 + The Real-time Media Independent Interface to support multiple industrial 259 + communication protocols (G stands for Gigabit). MII-G-RT sub-module 260 + represented as a SysCon. 261 + 262 + type: object 263 + 264 + properties: 265 + compatible: 266 + items: 267 + - const: ti,pruss-mii-g 268 + - const: syscon 269 + 270 + reg: 271 + maxItems: 1 272 + 273 + additionalProperties: false 274 + 275 + interrupt-controller@[a-f0-9]+$: 276 + description: | 277 + PRUSS INTC Node. Each PRUSS has a single interrupt controller instance 278 + that is common to all the PRU cores. This should be represented as an 279 + interrupt-controller node. 280 + 281 + type: object 282 + 283 + mdio@[a-f0-9]+$: 284 + description: | 285 + MDIO Node. Each PRUSS has an MDIO module that can be used to control 286 + external PHYs. The MDIO module used within the PRU-ICSS is an instance of 287 + the MDIO Controller used in TI Davinci SoCs. 288 + 289 + allOf: 290 + - $ref: /schemas/net/ti,davinci-mdio.yaml# 291 + 292 + type: object 293 + 294 + "^(pru|rtu|txpru)@[0-9a-f]+$": 295 + description: | 296 + PRU Node. Each PRUSS has dual PRU cores, each represented as a RemoteProc 297 + device through a PRU child node each. Each node can optionally be rendered 298 + inactive by using the standard DT string property, "status". The ICSSG IP 299 + present on K3 SoCs have additional auxiliary PRU cores with slightly 300 + different IP integration. 301 + 302 + type: object 303 + 304 + required: 305 + - compatible 306 + - reg 307 + - ranges 308 + 309 + additionalProperties: false 310 + 311 + # Due to inability of correctly verifying sub-nodes with an @address through 312 + # the "required" list, the required sub-nodes below are commented out for now. 313 + 314 + #required: 315 + # - memories 316 + # - interrupt-controller 317 + # - pru 318 + 319 + if: 320 + properties: 321 + compatible: 322 + contains: 323 + enum: 324 + - ti,k2g-pruss 325 + - ti,am654-icssg 326 + - ti,j721e-icssg 327 + then: 328 + required: 329 + - power-domains 330 + 331 + examples: 332 + - | 333 + 334 + /* Example 1 AM33xx PRU-ICSS */ 335 + pruss: pruss@0 { 336 + compatible = "ti,am3356-pruss"; 337 + reg = <0x0 0x80000>; 338 + #address-cells = <1>; 339 + #size-cells = <1>; 340 + ranges; 341 + 342 + pruss_mem: memories@0 { 343 + reg = <0x0 0x2000>, 344 + <0x2000 0x2000>, 345 + <0x10000 0x3000>; 346 + reg-names = "dram0", "dram1", "shrdram2"; 347 + }; 348 + 349 + pruss_cfg: cfg@26000 { 350 + compatible = "ti,pruss-cfg", "syscon"; 351 + #address-cells = <1>; 352 + #size-cells = <1>; 353 + reg = <0x26000 0x2000>; 354 + ranges = <0x00 0x26000 0x2000>; 355 + 356 + clocks { 357 + #address-cells = <1>; 358 + #size-cells = <0>; 359 + 360 + pruss_iepclk_mux: iepclk-mux@30 { 361 + reg = <0x30>; 362 + #clock-cells = <0>; 363 + clocks = <&l3_gclk>, /* icss_iep */ 364 + <&pruss_ocp_gclk>; /* icss_ocp */ 365 + }; 366 + }; 367 + }; 368 + 369 + pruss_mii_rt: mii-rt@32000 { 370 + compatible = "ti,pruss-mii", "syscon"; 371 + reg = <0x32000 0x58>; 372 + }; 373 + 374 + pruss_mdio: mdio@32400 { 375 + compatible = "ti,davinci_mdio"; 376 + reg = <0x32400 0x90>; 377 + clocks = <&dpll_core_m4_ck>; 378 + clock-names = "fck"; 379 + bus_freq = <1000000>; 380 + #address-cells = <1>; 381 + #size-cells = <0>; 382 + }; 383 + }; 384 + 385 + - | 386 + 387 + /* Example 2 AM43xx PRU-ICSS with PRUSS1 node */ 388 + #include <dt-bindings/interrupt-controller/arm-gic.h> 389 + pruss1: pruss@0 { 390 + compatible = "ti,am4376-pruss1"; 391 + reg = <0x0 0x40000>; 392 + #address-cells = <1>; 393 + #size-cells = <1>; 394 + ranges; 395 + 396 + pruss1_mem: memories@0 { 397 + reg = <0x0 0x2000>, 398 + <0x2000 0x2000>, 399 + <0x10000 0x8000>; 400 + reg-names = "dram0", "dram1", "shrdram2"; 401 + }; 402 + 403 + pruss1_cfg: cfg@26000 { 404 + compatible = "ti,pruss-cfg", "syscon"; 405 + #address-cells = <1>; 406 + #size-cells = <1>; 407 + reg = <0x26000 0x2000>; 408 + ranges = <0x00 0x26000 0x2000>; 409 + 410 + clocks { 411 + #address-cells = <1>; 412 + #size-cells = <0>; 413 + 414 + pruss1_iepclk_mux: iepclk-mux@30 { 415 + reg = <0x30>; 416 + #clock-cells = <0>; 417 + clocks = <&sysclk_div>, /* icss_iep */ 418 + <&pruss_ocp_gclk>; /* icss_ocp */ 419 + }; 420 + }; 421 + }; 422 + 423 + pruss1_mii_rt: mii-rt@32000 { 424 + compatible = "ti,pruss-mii", "syscon"; 425 + reg = <0x32000 0x58>; 426 + }; 427 + 428 + pruss1_mdio: mdio@32400 { 429 + compatible = "ti,davinci_mdio"; 430 + reg = <0x32400 0x90>; 431 + clocks = <&dpll_core_m4_ck>; 432 + clock-names = "fck"; 433 + bus_freq = <1000000>; 434 + #address-cells = <1>; 435 + #size-cells = <0>; 436 + }; 437 + }; 438 + 439 + ...
+1
MAINTAINERS
··· 3482 3482 F: arch/mips/boot/dts/brcm/bcm*.dts* 3483 3483 F: arch/mips/include/asm/mach-bmips/* 3484 3484 F: arch/mips/kernel/*bmips* 3485 + F: drivers/soc/bcm/bcm63xx 3485 3486 F: drivers/irqchip/irq-bcm63* 3486 3487 F: drivers/irqchip/irq-bcm7* 3487 3488 F: drivers/irqchip/irq-brcmstb*
+6
arch/mips/boot/dts/brcm/bcm63268.dtsi
··· 117 117 status = "disabled"; 118 118 }; 119 119 120 + periph_pwr: power-controller@1000184c { 121 + compatible = "brcm,bcm6328-power-controller"; 122 + reg = <0x1000184c 0x4>; 123 + #power-domain-cells = <1>; 124 + }; 125 + 120 126 ehci: usb@10002500 { 121 127 compatible = "brcm,bcm63268-ehci", "generic-ehci"; 122 128 reg = <0x10002500 0x100>;
+6
arch/mips/boot/dts/brcm/bcm6328.dtsi
··· 110 110 status = "disabled"; 111 111 }; 112 112 113 + periph_pwr: power-controller@10001848 { 114 + compatible = "brcm,bcm6328-power-controller"; 115 + reg = <0x10001848 0x4>; 116 + #power-domain-cells = <1>; 117 + }; 118 + 113 119 ehci: usb@10002500 { 114 120 compatible = "brcm,bcm6328-ehci", "generic-ehci"; 115 121 reg = <0x10002500 0x100>;
+6
arch/mips/boot/dts/brcm/bcm6362.dtsi
··· 108 108 status = "disabled"; 109 109 }; 110 110 111 + periph_pwr: power-controller@10001848 { 112 + compatible = "brcm,bcm6362-power-controller"; 113 + reg = <0x10001848 0x4>; 114 + #power-domain-cells = <1>; 115 + }; 116 + 111 117 leds0: led-controller@10001900 { 112 118 #address-cells = <1>; 113 119 #size-cells = <0>;
+97 -3
drivers/bus/brcmstb_gisb.c
··· 30 30 #define ARB_ERR_CAP_STATUS_WRITE (1 << 1) 31 31 #define ARB_ERR_CAP_STATUS_VALID (1 << 0) 32 32 33 + #define ARB_BP_CAP_CLEAR (1 << 0) 34 + #define ARB_BP_CAP_STATUS_PROT_SHIFT 14 35 + #define ARB_BP_CAP_STATUS_TYPE (1 << 13) 36 + #define ARB_BP_CAP_STATUS_RSP_SHIFT 10 37 + #define ARB_BP_CAP_STATUS_MASK GENMASK(1, 0) 38 + #define ARB_BP_CAP_STATUS_BS_SHIFT 2 39 + #define ARB_BP_CAP_STATUS_WRITE (1 << 1) 40 + #define ARB_BP_CAP_STATUS_VALID (1 << 0) 41 + 33 42 enum { 34 43 ARB_TIMER, 44 + ARB_BP_CAP_CLR, 45 + ARB_BP_CAP_HI_ADDR, 46 + ARB_BP_CAP_ADDR, 47 + ARB_BP_CAP_STATUS, 48 + ARB_BP_CAP_MASTER, 35 49 ARB_ERR_CAP_CLR, 36 50 ARB_ERR_CAP_HI_ADDR, 37 51 ARB_ERR_CAP_ADDR, ··· 55 41 56 42 static const int gisb_offsets_bcm7038[] = { 57 43 [ARB_TIMER] = 0x00c, 44 + [ARB_BP_CAP_CLR] = 0x014, 45 + [ARB_BP_CAP_HI_ADDR] = -1, 46 + [ARB_BP_CAP_ADDR] = 0x0b8, 47 + [ARB_BP_CAP_STATUS] = 0x0c0, 48 + [ARB_BP_CAP_MASTER] = -1, 58 49 [ARB_ERR_CAP_CLR] = 0x0c4, 59 50 [ARB_ERR_CAP_HI_ADDR] = -1, 60 51 [ARB_ERR_CAP_ADDR] = 0x0c8, ··· 69 50 70 51 static const int gisb_offsets_bcm7278[] = { 71 52 [ARB_TIMER] = 0x008, 53 + [ARB_BP_CAP_CLR] = 0x01c, 54 + [ARB_BP_CAP_HI_ADDR] = -1, 55 + [ARB_BP_CAP_ADDR] = 0x220, 56 + [ARB_BP_CAP_STATUS] = 0x230, 57 + [ARB_BP_CAP_MASTER] = 0x234, 72 58 [ARB_ERR_CAP_CLR] = 0x7f8, 73 59 [ARB_ERR_CAP_HI_ADDR] = -1, 74 60 [ARB_ERR_CAP_ADDR] = 0x7e0, ··· 83 59 84 60 static const int gisb_offsets_bcm7400[] = { 85 61 [ARB_TIMER] = 0x00c, 62 + [ARB_BP_CAP_CLR] = 0x014, 63 + [ARB_BP_CAP_HI_ADDR] = -1, 64 + [ARB_BP_CAP_ADDR] = 0x0b8, 65 + [ARB_BP_CAP_STATUS] = 0x0c0, 66 + [ARB_BP_CAP_MASTER] = 0x0c4, 86 67 [ARB_ERR_CAP_CLR] = 0x0c8, 87 68 [ARB_ERR_CAP_HI_ADDR] = -1, 88 69 [ARB_ERR_CAP_ADDR] = 0x0cc, ··· 97 68 98 69 static const int gisb_offsets_bcm7435[] = { 99 70 [ARB_TIMER] = 0x00c, 71 + [ARB_BP_CAP_CLR] = 0x014, 72 + [ARB_BP_CAP_HI_ADDR] = -1, 73 + [ARB_BP_CAP_ADDR] = 0x158, 74 + [ARB_BP_CAP_STATUS] = 0x160, 75 + [ARB_BP_CAP_MASTER] = 0x164, 100 76 [ARB_ERR_CAP_CLR] = 0x168, 101 77 [ARB_ERR_CAP_HI_ADDR] = -1, 102 78 [ARB_ERR_CAP_ADDR] = 0x16c, ··· 111 77 112 78 static const int gisb_offsets_bcm7445[] = { 113 79 [ARB_TIMER] = 0x008, 80 + [ARB_BP_CAP_CLR] = 0x010, 81 + [ARB_BP_CAP_HI_ADDR] = -1, 82 + [ARB_BP_CAP_ADDR] = 0x1d8, 83 + [ARB_BP_CAP_STATUS] = 0x1e0, 84 + [ARB_BP_CAP_MASTER] = 0x1e4, 114 85 [ARB_ERR_CAP_CLR] = 0x7e4, 115 86 [ARB_ERR_CAP_HI_ADDR] = 0x7e8, 116 87 [ARB_ERR_CAP_ADDR] = 0x7ec, ··· 160 121 161 122 value = gisb_read(gdev, ARB_ERR_CAP_ADDR); 162 123 value |= (u64)gisb_read(gdev, ARB_ERR_CAP_HI_ADDR) << 32; 124 + 125 + return value; 126 + } 127 + 128 + static u64 gisb_read_bp_address(struct brcmstb_gisb_arb_device *gdev) 129 + { 130 + u64 value; 131 + 132 + value = gisb_read(gdev, ARB_BP_CAP_ADDR); 133 + value |= (u64)gisb_read(gdev, ARB_BP_CAP_HI_ADDR) << 32; 163 134 164 135 return value; 165 136 } ··· 259 210 m_name = m_fmt; 260 211 } 261 212 262 - pr_crit("%s: %s at 0x%llx [%c %s], core: %s\n", 263 - __func__, reason, arb_addr, 213 + pr_crit("GISB: %s at 0x%llx [%c %s], core: %s\n", 214 + reason, arb_addr, 264 215 cap_status & ARB_ERR_CAP_STATUS_WRITE ? 'W' : 'R', 265 216 cap_status & ARB_ERR_CAP_STATUS_TIMEOUT ? "timeout" : "", 266 217 m_name); ··· 304 255 static irqreturn_t brcmstb_gisb_tea_handler(int irq, void *dev_id) 305 256 { 306 257 brcmstb_gisb_arb_decode_addr(dev_id, "target abort"); 258 + 259 + return IRQ_HANDLED; 260 + } 261 + 262 + static irqreturn_t brcmstb_gisb_bp_handler(int irq, void *dev_id) 263 + { 264 + struct brcmstb_gisb_arb_device *gdev = dev_id; 265 + const char *m_name; 266 + u32 bp_status; 267 + u64 arb_addr; 268 + u32 master; 269 + char m_fmt[11]; 270 + 271 + bp_status = gisb_read(gdev, ARB_BP_CAP_STATUS); 272 + 273 + /* Invalid captured address, bail out */ 274 + if (!(bp_status & ARB_BP_CAP_STATUS_VALID)) 275 + return IRQ_HANDLED; 276 + 277 + /* Read the address and master */ 278 + arb_addr = gisb_read_bp_address(gdev); 279 + master = gisb_read(gdev, ARB_BP_CAP_MASTER); 280 + 281 + m_name = brcmstb_gisb_master_to_str(gdev, master); 282 + if (!m_name) { 283 + snprintf(m_fmt, sizeof(m_fmt), "0x%08x", master); 284 + m_name = m_fmt; 285 + } 286 + 287 + pr_crit("GISB: breakpoint at 0x%llx [%c], core: %s\n", 288 + arb_addr, bp_status & ARB_BP_CAP_STATUS_WRITE ? 'W' : 'R', 289 + m_name); 290 + 291 + /* clear the GISB error */ 292 + gisb_write(gdev, ARB_ERR_CAP_CLEAR, ARB_ERR_CAP_CLR); 307 293 308 294 return IRQ_HANDLED; 309 295 } ··· 401 317 struct brcmstb_gisb_arb_device *gdev; 402 318 const struct of_device_id *of_id; 403 319 struct resource *r; 404 - int err, timeout_irq, tea_irq; 320 + int err, timeout_irq, tea_irq, bp_irq; 405 321 unsigned int num_masters, j = 0; 406 322 int i, first, last; 407 323 408 324 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 409 325 timeout_irq = platform_get_irq(pdev, 0); 410 326 tea_irq = platform_get_irq(pdev, 1); 327 + bp_irq = platform_get_irq(pdev, 2); 411 328 412 329 gdev = devm_kzalloc(&pdev->dev, sizeof(*gdev), GFP_KERNEL); 413 330 if (!gdev) ··· 440 355 gdev); 441 356 if (err < 0) 442 357 return err; 358 + 359 + /* Interrupt is optional */ 360 + if (bp_irq > 0) { 361 + err = devm_request_irq(&pdev->dev, bp_irq, 362 + brcmstb_gisb_bp_handler, 0, pdev->name, 363 + gdev); 364 + if (err < 0) 365 + return err; 366 + } 443 367 444 368 /* If we do not have a valid mask, assume all masters are enabled */ 445 369 if (of_property_read_u32(dn, "brcm,gisb-arb-master-mask",
+3 -3
drivers/cpufreq/scmi-cpufreq.c
··· 29 29 static unsigned int scmi_cpufreq_get_rate(unsigned int cpu) 30 30 { 31 31 struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu); 32 - struct scmi_perf_ops *perf_ops = handle->perf_ops; 32 + const struct scmi_perf_ops *perf_ops = handle->perf_ops; 33 33 struct scmi_data *priv = policy->driver_data; 34 34 unsigned long rate; 35 35 int ret; ··· 49 49 scmi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) 50 50 { 51 51 struct scmi_data *priv = policy->driver_data; 52 - struct scmi_perf_ops *perf_ops = handle->perf_ops; 52 + const struct scmi_perf_ops *perf_ops = handle->perf_ops; 53 53 u64 freq = policy->freq_table[index].frequency; 54 54 55 55 return perf_ops->freq_set(handle, priv->domain_id, freq * 1000, false); ··· 59 59 unsigned int target_freq) 60 60 { 61 61 struct scmi_data *priv = policy->driver_data; 62 - struct scmi_perf_ops *perf_ops = handle->perf_ops; 62 + const struct scmi_perf_ops *perf_ops = handle->perf_ops; 63 63 64 64 if (!perf_ops->freq_set(handle, priv->domain_id, 65 65 target_freq * 1000, true))
+1 -1
drivers/dma/ti/k3-udma-glue.c
··· 573 573 574 574 /* request and cfg rings */ 575 575 ret = k3_ringacc_request_rings_pair(rx_chn->common.ringacc, 576 - flow_cfg->ring_rxq_id, 577 576 flow_cfg->ring_rxfdq0_id, 577 + flow_cfg->ring_rxq_id, 578 578 &flow->ringrxfdq, 579 579 &flow->ringrx); 580 580 if (ret) {
+1 -1
drivers/firmware/Kconfig
··· 7 7 menu "Firmware Drivers" 8 8 9 9 config ARM_SCMI_PROTOCOL 10 - bool "ARM System Control and Management Interface (SCMI) Message Protocol" 10 + tristate "ARM System Control and Management Interface (SCMI) Message Protocol" 11 11 depends on ARM || ARM64 || COMPILE_TEST 12 12 depends on MAILBOX 13 13 help
+1 -1
drivers/firmware/Makefile
··· 22 22 obj-$(CONFIG_TRUSTED_FOUNDATIONS) += trusted_foundations.o 23 23 obj-$(CONFIG_TURRIS_MOX_RWTM) += turris-mox-rwtm.o 24 24 25 - obj-$(CONFIG_ARM_SCMI_PROTOCOL) += arm_scmi/ 25 + obj-y += arm_scmi/ 26 26 obj-y += broadcom/ 27 27 obj-y += meson/ 28 28 obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
+4 -2
drivers/firmware/arm_scmi/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - obj-y = scmi-bus.o scmi-driver.o scmi-protocols.o scmi-transport.o 3 2 scmi-bus-y = bus.o 4 3 scmi-driver-y = driver.o notify.o 5 4 scmi-transport-y = shmem.o 6 5 scmi-transport-$(CONFIG_MAILBOX) += mailbox.o 7 6 scmi-transport-$(CONFIG_HAVE_ARM_SMCCC_DISCOVERY) += smc.o 8 - scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o 7 + scmi-protocols-y = base.o clock.o perf.o power.o reset.o sensors.o system.o 8 + scmi-module-objs := $(scmi-bus-y) $(scmi-driver-y) $(scmi-protocols-y) \ 9 + $(scmi-transport-y) 10 + obj-$(CONFIG_ARM_SCMI_PROTOCOL) += scmi-module.o 9 11 obj-$(CONFIG_ARM_SCMI_POWER_DOMAIN) += scmi_pm_domain.o
+2 -4
drivers/firmware/arm_scmi/bus.c
··· 230 230 bus_for_each_dev(&scmi_bus_type, NULL, NULL, __scmi_devices_unregister); 231 231 } 232 232 233 - static int __init scmi_bus_init(void) 233 + int __init scmi_bus_init(void) 234 234 { 235 235 int retval; 236 236 ··· 240 240 241 241 return retval; 242 242 } 243 - subsys_initcall(scmi_bus_init); 244 243 245 - static void __exit scmi_bus_exit(void) 244 + void __exit scmi_bus_exit(void) 246 245 { 247 246 scmi_devices_unregister(); 248 247 bus_unregister(&scmi_bus_type); 249 248 ida_destroy(&scmi_bus_id); 250 249 } 251 - module_exit(scmi_bus_exit);
+2 -7
drivers/firmware/arm_scmi/clock.c
··· 318 318 return clk; 319 319 } 320 320 321 - static struct scmi_clk_ops clk_ops = { 321 + static const struct scmi_clk_ops clk_ops = { 322 322 .count_get = scmi_clock_count_get, 323 323 .info_get = scmi_clock_info_get, 324 324 .rate_get = scmi_clock_rate_get, ··· 364 364 return 0; 365 365 } 366 366 367 - static int __init scmi_clock_init(void) 368 - { 369 - return scmi_protocol_register(SCMI_PROTOCOL_CLOCK, 370 - &scmi_clock_protocol_init); 371 - } 372 - subsys_initcall(scmi_clock_init); 367 + DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_CLOCK, clock)
+25 -1
drivers/firmware/arm_scmi/common.h
··· 156 156 157 157 int scmi_base_protocol_init(struct scmi_handle *h); 158 158 159 + int __init scmi_bus_init(void); 160 + void __exit scmi_bus_exit(void); 161 + 162 + #define DECLARE_SCMI_REGISTER_UNREGISTER(func) \ 163 + int __init scmi_##func##_register(void); \ 164 + void __exit scmi_##func##_unregister(void) 165 + DECLARE_SCMI_REGISTER_UNREGISTER(clock); 166 + DECLARE_SCMI_REGISTER_UNREGISTER(perf); 167 + DECLARE_SCMI_REGISTER_UNREGISTER(power); 168 + DECLARE_SCMI_REGISTER_UNREGISTER(reset); 169 + DECLARE_SCMI_REGISTER_UNREGISTER(sensors); 170 + DECLARE_SCMI_REGISTER_UNREGISTER(system); 171 + 172 + #define DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(id, name) \ 173 + int __init scmi_##name##_register(void) \ 174 + { \ 175 + return scmi_protocol_register((id), &scmi_##name##_protocol_init); \ 176 + } \ 177 + \ 178 + void __exit scmi_##name##_unregister(void) \ 179 + { \ 180 + scmi_protocol_unregister((id)); \ 181 + } 182 + 159 183 /* SCMI Transport */ 160 184 /** 161 185 * struct scmi_chan_info - Structure representing a SCMI channel information ··· 234 210 * @max_msg_size: Maximum size of data per message that can be handled. 235 211 */ 236 212 struct scmi_desc { 237 - struct scmi_transport_ops *ops; 213 + const struct scmi_transport_ops *ops; 238 214 int max_rx_timeout_ms; 239 215 int max_msg; 240 216 int max_msg_size;
+30 -1
drivers/firmware/arm_scmi/driver.c
··· 730 730 731 731 static struct scmi_prot_devnames devnames[] = { 732 732 { SCMI_PROTOCOL_POWER, { "genpd" },}, 733 + { SCMI_PROTOCOL_SYSTEM, { "syspower" },}, 733 734 { SCMI_PROTOCOL_PERF, { "cpufreq" },}, 734 735 { SCMI_PROTOCOL_CLOCK, { "clocks" },}, 735 736 { SCMI_PROTOCOL_SENSOR, { "hwmon" },}, ··· 929 928 .remove = scmi_remove, 930 929 }; 931 930 932 - module_platform_driver(scmi_driver); 931 + static int __init scmi_driver_init(void) 932 + { 933 + scmi_bus_init(); 934 + 935 + scmi_clock_register(); 936 + scmi_perf_register(); 937 + scmi_power_register(); 938 + scmi_reset_register(); 939 + scmi_sensors_register(); 940 + scmi_system_register(); 941 + 942 + return platform_driver_register(&scmi_driver); 943 + } 944 + subsys_initcall(scmi_driver_init); 945 + 946 + static void __exit scmi_driver_exit(void) 947 + { 948 + scmi_bus_exit(); 949 + 950 + scmi_clock_unregister(); 951 + scmi_perf_unregister(); 952 + scmi_power_unregister(); 953 + scmi_reset_unregister(); 954 + scmi_sensors_unregister(); 955 + scmi_system_unregister(); 956 + 957 + platform_driver_unregister(&scmi_driver); 958 + } 959 + module_exit(scmi_driver_exit); 933 960 934 961 MODULE_ALIAS("platform: arm-scmi"); 935 962 MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>");
+2 -2
drivers/firmware/arm_scmi/mailbox.c
··· 110 110 struct scmi_chan_info *cinfo = p; 111 111 struct scmi_mailbox *smbox = cinfo->transport_info; 112 112 113 - if (!IS_ERR(smbox->chan)) { 113 + if (smbox && !IS_ERR(smbox->chan)) { 114 114 mbox_free_channel(smbox->chan); 115 115 cinfo->transport_info = NULL; 116 116 smbox->chan = NULL; ··· 181 181 return shmem_poll_done(smbox->shmem, xfer); 182 182 } 183 183 184 - static struct scmi_transport_ops scmi_mailbox_ops = { 184 + static const struct scmi_transport_ops scmi_mailbox_ops = { 185 185 .chan_available = mailbox_chan_available, 186 186 .chan_setup = mailbox_chan_setup, 187 187 .chan_free = mailbox_chan_free,
+1 -1
drivers/firmware/arm_scmi/notify.c
··· 1421 1421 * notify_ops are attached to the handle so that can be accessed 1422 1422 * directly from an scmi_driver to register its own notifiers. 1423 1423 */ 1424 - static struct scmi_notify_ops notify_ops = { 1424 + static const struct scmi_notify_ops notify_ops = { 1425 1425 .register_event_notifier = scmi_register_notifier, 1426 1426 .unregister_event_notifier = scmi_unregister_notifier, 1427 1427 };
+2 -7
drivers/firmware/arm_scmi/perf.c
··· 748 748 return dom->fc_info && dom->fc_info->level_set_addr; 749 749 } 750 750 751 - static struct scmi_perf_ops perf_ops = { 751 + static const struct scmi_perf_ops perf_ops = { 752 752 .limits_set = scmi_perf_limits_set, 753 753 .limits_get = scmi_perf_limits_get, 754 754 .level_set = scmi_perf_level_set, ··· 890 890 return 0; 891 891 } 892 892 893 - static int __init scmi_perf_init(void) 894 - { 895 - return scmi_protocol_register(SCMI_PROTOCOL_PERF, 896 - &scmi_perf_protocol_init); 897 - } 898 - subsys_initcall(scmi_perf_init); 893 + DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_PERF, perf)
+2 -7
drivers/firmware/arm_scmi/power.c
··· 184 184 return dom->name; 185 185 } 186 186 187 - static struct scmi_power_ops power_ops = { 187 + static const struct scmi_power_ops power_ops = { 188 188 .num_domains_get = scmi_power_num_domains_get, 189 189 .name_get = scmi_power_name_get, 190 190 .state_set = scmi_power_state_set, ··· 301 301 return 0; 302 302 } 303 303 304 - static int __init scmi_power_init(void) 305 - { 306 - return scmi_protocol_register(SCMI_PROTOCOL_POWER, 307 - &scmi_power_protocol_init); 308 - } 309 - subsys_initcall(scmi_power_init); 304 + DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_POWER, power)
+2 -7
drivers/firmware/arm_scmi/reset.c
··· 194 194 return scmi_domain_reset(handle, domain, 0, ARCH_COLD_RESET); 195 195 } 196 196 197 - static struct scmi_reset_ops reset_ops = { 197 + static const struct scmi_reset_ops reset_ops = { 198 198 .num_domains_get = scmi_reset_num_domains_get, 199 199 .name_get = scmi_reset_name_get, 200 200 .latency_get = scmi_reset_latency_get, ··· 313 313 return 0; 314 314 } 315 315 316 - static int __init scmi_reset_init(void) 317 - { 318 - return scmi_protocol_register(SCMI_PROTOCOL_RESET, 319 - &scmi_reset_protocol_init); 320 - } 321 - subsys_initcall(scmi_reset_init); 316 + DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_RESET, reset)
+2 -7
drivers/firmware/arm_scmi/sensors.c
··· 275 275 return si->num_sensors; 276 276 } 277 277 278 - static struct scmi_sensor_ops sensor_ops = { 278 + static const struct scmi_sensor_ops sensor_ops = { 279 279 .count_get = scmi_sensor_count_get, 280 280 .info_get = scmi_sensor_info_get, 281 281 .trip_point_config = scmi_sensor_trip_point_config, ··· 365 365 return 0; 366 366 } 367 367 368 - static int __init scmi_sensors_init(void) 369 - { 370 - return scmi_protocol_register(SCMI_PROTOCOL_SENSOR, 371 - &scmi_sensors_protocol_init); 372 - } 373 - subsys_initcall(scmi_sensors_init); 368 + DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_SENSOR, sensors)
+1 -1
drivers/firmware/arm_scmi/smc.c
··· 137 137 return shmem_poll_done(scmi_info->shmem, xfer); 138 138 } 139 139 140 - static struct scmi_transport_ops scmi_smc_ops = { 140 + static const struct scmi_transport_ops scmi_smc_ops = { 141 141 .chan_available = smc_chan_available, 142 142 .chan_setup = smc_chan_setup, 143 143 .chan_free = smc_chan_free,
+131
drivers/firmware/arm_scmi/system.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * System Control and Management Interface (SCMI) System Power Protocol 4 + * 5 + * Copyright (C) 2020 ARM Ltd. 6 + */ 7 + 8 + #define pr_fmt(fmt) "SCMI Notifications SYSTEM - " fmt 9 + 10 + #include <linux/scmi_protocol.h> 11 + 12 + #include "common.h" 13 + #include "notify.h" 14 + 15 + #define SCMI_SYSTEM_NUM_SOURCES 1 16 + 17 + enum scmi_system_protocol_cmd { 18 + SYSTEM_POWER_STATE_NOTIFY = 0x5, 19 + }; 20 + 21 + struct scmi_system_power_state_notify { 22 + __le32 notify_enable; 23 + }; 24 + 25 + struct scmi_system_power_state_notifier_payld { 26 + __le32 agent_id; 27 + __le32 flags; 28 + __le32 system_state; 29 + }; 30 + 31 + struct scmi_system_info { 32 + u32 version; 33 + }; 34 + 35 + static int scmi_system_request_notify(const struct scmi_handle *handle, 36 + bool enable) 37 + { 38 + int ret; 39 + struct scmi_xfer *t; 40 + struct scmi_system_power_state_notify *notify; 41 + 42 + ret = scmi_xfer_get_init(handle, SYSTEM_POWER_STATE_NOTIFY, 43 + SCMI_PROTOCOL_SYSTEM, sizeof(*notify), 0, &t); 44 + if (ret) 45 + return ret; 46 + 47 + notify = t->tx.buf; 48 + notify->notify_enable = enable ? cpu_to_le32(BIT(0)) : 0; 49 + 50 + ret = scmi_do_xfer(handle, t); 51 + 52 + scmi_xfer_put(handle, t); 53 + return ret; 54 + } 55 + 56 + static int scmi_system_set_notify_enabled(const struct scmi_handle *handle, 57 + u8 evt_id, u32 src_id, bool enable) 58 + { 59 + int ret; 60 + 61 + ret = scmi_system_request_notify(handle, enable); 62 + if (ret) 63 + pr_debug("FAIL_ENABLE - evt[%X] - ret:%d\n", evt_id, ret); 64 + 65 + return ret; 66 + } 67 + 68 + static void *scmi_system_fill_custom_report(const struct scmi_handle *handle, 69 + u8 evt_id, ktime_t timestamp, 70 + const void *payld, size_t payld_sz, 71 + void *report, u32 *src_id) 72 + { 73 + const struct scmi_system_power_state_notifier_payld *p = payld; 74 + struct scmi_system_power_state_notifier_report *r = report; 75 + 76 + if (evt_id != SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER || 77 + sizeof(*p) != payld_sz) 78 + return NULL; 79 + 80 + r->timestamp = timestamp; 81 + r->agent_id = le32_to_cpu(p->agent_id); 82 + r->flags = le32_to_cpu(p->flags); 83 + r->system_state = le32_to_cpu(p->system_state); 84 + *src_id = 0; 85 + 86 + return r; 87 + } 88 + 89 + static const struct scmi_event system_events[] = { 90 + { 91 + .id = SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER, 92 + .max_payld_sz = 93 + sizeof(struct scmi_system_power_state_notifier_payld), 94 + .max_report_sz = 95 + sizeof(struct scmi_system_power_state_notifier_report), 96 + }, 97 + }; 98 + 99 + static const struct scmi_event_ops system_event_ops = { 100 + .set_notify_enabled = scmi_system_set_notify_enabled, 101 + .fill_custom_report = scmi_system_fill_custom_report, 102 + }; 103 + 104 + static int scmi_system_protocol_init(struct scmi_handle *handle) 105 + { 106 + u32 version; 107 + struct scmi_system_info *pinfo; 108 + 109 + scmi_version_get(handle, SCMI_PROTOCOL_SYSTEM, &version); 110 + 111 + dev_dbg(handle->dev, "System Power Version %d.%d\n", 112 + PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version)); 113 + 114 + pinfo = devm_kzalloc(handle->dev, sizeof(*pinfo), GFP_KERNEL); 115 + if (!pinfo) 116 + return -ENOMEM; 117 + 118 + scmi_register_protocol_events(handle, 119 + SCMI_PROTOCOL_SYSTEM, SCMI_PROTO_QUEUE_SZ, 120 + &system_event_ops, 121 + system_events, 122 + ARRAY_SIZE(system_events), 123 + SCMI_SYSTEM_NUM_SOURCES); 124 + 125 + pinfo->version = version; 126 + handle->system_priv = pinfo; 127 + 128 + return 0; 129 + } 130 + 131 + DEFINE_SCMI_PROTOCOL_REGISTER_UNREGISTER(SCMI_PROTOCOL_SYSTEM, system)
+4
drivers/firmware/imx/scu-pd.c
··· 46 46 47 47 #include <dt-bindings/firmware/imx/rsrc.h> 48 48 #include <linux/firmware/imx/sci.h> 49 + #include <linux/firmware/imx/svc/rm.h> 49 50 #include <linux/io.h> 50 51 #include <linux/module.h> 51 52 #include <linux/of.h> ··· 256 255 { 257 256 struct imx_sc_pm_domain *sc_pd; 258 257 int ret; 258 + 259 + if (!imx_sc_rm_is_resource_owned(pm_ipc_handle, pd_ranges->rsrc + idx)) 260 + return NULL; 259 261 260 262 sc_pd = devm_kzalloc(dev, sizeof(*sc_pd), GFP_KERNEL); 261 263 if (!sc_pd)
+2
drivers/firmware/smccc/smccc.c
··· 24 24 25 25 return smccc_conduit; 26 26 } 27 + EXPORT_SYMBOL_GPL(arm_smccc_1_1_get_conduit); 27 28 28 29 u32 arm_smccc_get_version(void) 29 30 { 30 31 return smccc_version; 31 32 } 33 + EXPORT_SYMBOL_GPL(arm_smccc_get_version);
+2 -1
drivers/firmware/tegra/bpmp.c
··· 856 856 857 857 static const struct of_device_id tegra_bpmp_match[] = { 858 858 #if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) || \ 859 - IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) 859 + IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \ 860 + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) 860 861 { .compatible = "nvidia,tegra186-bpmp", .data = &tegra186_soc }, 861 862 #endif 862 863 #if IS_ENABLED(CONFIG_ARCH_TEGRA_210_SOC)
+4 -2
drivers/firmware/ti_sci.c
··· 1106 1106 static int ti_sci_cmd_idle_clock(const struct ti_sci_handle *handle, 1107 1107 u32 dev_id, u32 clk_id) 1108 1108 { 1109 - return ti_sci_set_clock_state(handle, dev_id, clk_id, 0, 1109 + return ti_sci_set_clock_state(handle, dev_id, clk_id, 1110 + MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE, 1110 1111 MSG_CLOCK_SW_STATE_UNREQ); 1111 1112 } 1112 1113 ··· 1126 1125 static int ti_sci_cmd_put_clock(const struct ti_sci_handle *handle, 1127 1126 u32 dev_id, u32 clk_id) 1128 1127 { 1129 - return ti_sci_set_clock_state(handle, dev_id, clk_id, 0, 1128 + return ti_sci_set_clock_state(handle, dev_id, clk_id, 1129 + MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE, 1130 1130 MSG_CLOCK_SW_STATE_AUTO); 1131 1131 } 1132 1132
+1 -1
drivers/gpu/drm/mediatek/mtk_drm_crtc.c
··· 481 481 mbox_flush(mtk_crtc->cmdq_client->chan, 2000); 482 482 cmdq_handle = cmdq_pkt_create(mtk_crtc->cmdq_client, PAGE_SIZE); 483 483 cmdq_pkt_clear_event(cmdq_handle, mtk_crtc->cmdq_event); 484 - cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event); 484 + cmdq_pkt_wfe(cmdq_handle, mtk_crtc->cmdq_event, false); 485 485 mtk_crtc_ddp_config(crtc, cmdq_handle); 486 486 cmdq_pkt_finalize(cmdq_handle); 487 487 cmdq_pkt_flush_async(cmdq_handle, ddp_cmdq_cb, cmdq_handle);
+8 -1
drivers/mailbox/tegra-hsp.c
··· 13 13 #include <linux/pm.h> 14 14 #include <linux/slab.h> 15 15 16 + #include <soc/tegra/fuse.h> 17 + 16 18 #include <dt-bindings/mailbox/tegra186-hsp.h> 17 19 18 20 #include "mailbox.h" ··· 324 322 if (!ccplex) 325 323 return -ENODEV; 326 324 327 - if (!tegra_hsp_doorbell_can_ring(db)) 325 + /* 326 + * On simulation platforms the BPMP hasn't had a chance yet to mark 327 + * the doorbell as ringable by the CCPLEX, so we want to skip extra 328 + * checks here. 329 + */ 330 + if (tegra_is_silicon() && !tegra_hsp_doorbell_can_ring(db)) 328 331 return -ENODEV; 329 332 330 333 spin_lock_irqsave(&hsp->lock, flags);
+35 -17
drivers/memory/Kconfig
··· 32 32 33 33 config ATMEL_SDRAMC 34 34 bool "Atmel (Multi-port DDR-)SDRAM Controller" 35 - default y 36 - depends on ARCH_AT91 && OF 35 + default y if ARCH_AT91 36 + depends on ARCH_AT91 || COMPILE_TEST 37 + depends on OF 37 38 help 38 39 This driver is for Atmel SDRAM Controller or Atmel Multi-port 39 40 DDR-SDRAM Controller available on Atmel AT91SAM9 and SAMA5 SoCs. ··· 43 42 44 43 config ATMEL_EBI 45 44 bool "Atmel EBI driver" 46 - default y 47 - depends on ARCH_AT91 && OF 45 + default y if ARCH_AT91 46 + depends on ARCH_AT91 || COMPILE_TEST 47 + depends on OF 48 48 select MFD_SYSCON 49 49 select MFD_ATMEL_SMC 50 50 help ··· 53 51 Used to configure the EBI (external bus interface) when the device- 54 52 tree is used. This bus supports NANDs, external ethernet controller, 55 53 SRAMs, ATA devices, etc. 54 + 55 + config BRCMSTB_DPFE 56 + bool "Broadcom STB DPFE driver" if COMPILE_TEST 57 + default y if ARCH_BRCMSTB 58 + depends on ARCH_BRCMSTB || COMPILE_TEST 59 + help 60 + This driver provides access to the DPFE interface of Broadcom 61 + STB SoCs. The firmware running on the DCPU inside the DDR PHY can 62 + provide current information about the system's RAM, for instance 63 + the DRAM refresh rate. This can be used as an indirect indicator 64 + for the DRAM's temperature. Slower refresh rate means cooler RAM, 65 + higher refresh rate means hotter RAM. 56 66 57 67 config BT1_L2_CTL 58 68 bool "Baikal-T1 CM2 L2-RAM Cache Control Block" ··· 79 65 80 66 config TI_AEMIF 81 67 tristate "Texas Instruments AEMIF driver" 82 - depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF 68 + depends on ARCH_DAVINCI || ARCH_KEYSTONE || COMPILE_TEST 69 + depends on OF 83 70 help 84 71 This driver is for the AEMIF module available in Texas Instruments 85 72 SoCs. AEMIF stands for Asynchronous External Memory Interface and ··· 91 76 92 77 config TI_EMIF 93 78 tristate "Texas Instruments EMIF driver" 94 - depends on ARCH_OMAP2PLUS 79 + depends on ARCH_OMAP2PLUS || COMPILE_TEST 95 80 select DDR 96 81 help 97 82 This driver is for the EMIF module available in Texas Instruments ··· 103 88 temperature changes 104 89 105 90 config OMAP_GPMC 106 - bool 91 + bool "Texas Instruments OMAP SoC GPMC driver" if COMPILE_TEST 92 + depends on OF_ADDRESS 107 93 select GPIOLIB 108 94 help 109 95 This driver is for the General Purpose Memory Controller (GPMC) ··· 128 112 129 113 config TI_EMIF_SRAM 130 114 tristate "Texas Instruments EMIF SRAM driver" 131 - depends on (SOC_AM33XX || SOC_AM43XX) && SRAM 115 + depends on SOC_AM33XX || SOC_AM43XX || (ARM && COMPILE_TEST) 116 + depends on SRAM 132 117 help 133 118 This driver is for the EMIF module available on Texas Instruments 134 119 AM33XX and AM43XX SoCs and is required for PM. Certain parts of ··· 139 122 140 123 config MVEBU_DEVBUS 141 124 bool "Marvell EBU Device Bus Controller" 142 - default y 143 - depends on PLAT_ORION && OF 125 + default y if PLAT_ORION 126 + depends on PLAT_ORION || COMPILE_TEST 127 + depends on OF 144 128 help 145 129 This driver is for the Device Bus controller available in some 146 130 Marvell EBU SoCs such as Discovery (mv78xx0), Orion (88f5xxx) and ··· 150 132 151 133 config FSL_CORENET_CF 152 134 tristate "Freescale CoreNet Error Reporting" 153 - depends on FSL_SOC_BOOKE 135 + depends on FSL_SOC_BOOKE || COMPILE_TEST 154 136 help 155 137 Say Y for reporting of errors from the Freescale CoreNet 156 138 Coherency Fabric. Errors reported include accesses to ··· 159 141 represents a coherency violation. 160 142 161 143 config FSL_IFC 162 - bool 144 + bool "Freescale IFC driver" if COMPILE_TEST 163 145 depends on FSL_SOC || ARCH_LAYERSCAPE || SOC_LS1021A || COMPILE_TEST 164 146 depends on HAS_IOMEM 165 147 ··· 173 155 memory devices such as NAND and SRAM. 174 156 175 157 config MTK_SMI 176 - bool 158 + bool "Mediatek SoC Memory Controller driver" if COMPILE_TEST 177 159 depends on ARCH_MEDIATEK || COMPILE_TEST 178 160 help 179 161 This driver is for the Memory Controller module in MediaTek SoCs, ··· 182 164 183 165 config DA8XX_DDRCTL 184 166 bool "Texas Instruments da8xx DDR2/mDDR driver" 185 - depends on ARCH_DAVINCI_DA8XX 167 + depends on ARCH_DAVINCI_DA8XX || COMPILE_TEST 186 168 help 187 169 This driver is for the DDR2/mDDR Memory Controller present on 188 170 Texas Instruments da8xx SoCs. It's used to tweak various memory ··· 190 172 191 173 config PL353_SMC 192 174 tristate "ARM PL35X Static Memory Controller(SMC) driver" 193 - default y 175 + default y if ARM 194 176 depends on ARM 195 - depends on ARM_AMBA 177 + depends on ARM_AMBA || COMPILE_TEST 196 178 help 197 179 This driver is for the ARM PL351/PL353 Static Memory 198 180 Controller(SMC) module. 199 181 200 182 config RENESAS_RPCIF 201 183 tristate "Renesas RPC-IF driver" 202 - depends on ARCH_RENESAS 184 + depends on ARCH_RENESAS || COMPILE_TEST 203 185 select REGMAP_MMIO 204 186 help 205 187 This supports Renesas R-Car Gen3 RPC-IF which provides either SPI
+1 -1
drivers/memory/Makefile
··· 10 10 obj-$(CONFIG_ARM_PL172_MPMC) += pl172.o 11 11 obj-$(CONFIG_ATMEL_SDRAMC) += atmel-sdramc.o 12 12 obj-$(CONFIG_ATMEL_EBI) += atmel-ebi.o 13 - obj-$(CONFIG_ARCH_BRCMSTB) += brcmstb_dpfe.o 13 + obj-$(CONFIG_BRCMSTB_DPFE) += brcmstb_dpfe.o 14 14 obj-$(CONFIG_BT1_L2_CTL) += bt1-l2-ctl.o 15 15 obj-$(CONFIG_TI_AEMIF) += ti-aemif.o 16 16 obj-$(CONFIG_TI_EMIF) += emif.o
+28 -18
drivers/memory/brcmstb_dpfe.c
··· 188 188 struct mutex lock; 189 189 }; 190 190 191 - static const char * const error_text[] = { 192 - "Success", "Header code incorrect", "Unknown command or argument", 193 - "Incorrect checksum", "Malformed command", "Timed out", 194 - }; 195 - 196 191 /* 197 192 * Forward declaration of our sysfs attribute functions, so we can declare the 198 193 * attribute data structures early. ··· 301 306 /* There's no GET_VENDOR command in API v3. */ 302 307 }, 303 308 }; 309 + 310 + static const char *get_error_text(unsigned int i) 311 + { 312 + static const char * const error_text[] = { 313 + "Success", "Header code incorrect", 314 + "Unknown command or argument", "Incorrect checksum", 315 + "Malformed command", "Timed out", "Unknown error", 316 + }; 317 + 318 + if (unlikely(i >= ARRAY_SIZE(error_text))) 319 + i = ARRAY_SIZE(error_text) - 1; 320 + 321 + return error_text[i]; 322 + } 304 323 305 324 static bool is_dcpu_enabled(struct brcmstb_dpfe_priv *priv) 306 325 { ··· 454 445 } 455 446 if (resp != 0) { 456 447 mutex_unlock(&priv->lock); 457 - return -ETIMEDOUT; 448 + return -ffs(DCPU_RET_ERR_TIMEDOUT); 458 449 } 459 450 460 451 /* Compute checksum over the message */ ··· 656 647 return (ret == -ENOENT) ? -EPROBE_DEFER : ret; 657 648 658 649 ret = __verify_firmware(&init, fw); 659 - if (ret) 660 - return -EFAULT; 650 + if (ret) { 651 + ret = -EFAULT; 652 + goto release_fw; 653 + } 661 654 662 655 __disable_dcpu(priv); 663 656 ··· 678 667 679 668 ret = __write_firmware(priv->dmem, dmem, dmem_size, is_big_endian); 680 669 if (ret) 681 - return ret; 670 + goto release_fw; 682 671 ret = __write_firmware(priv->imem, imem, imem_size, is_big_endian); 683 672 if (ret) 684 - return ret; 673 + goto release_fw; 685 674 686 675 ret = __verify_fw_checksum(&init, priv, header, init.chksum); 687 676 if (ret) 688 - return ret; 677 + goto release_fw; 689 678 690 679 __enable_dcpu(priv); 691 680 692 - return 0; 681 + release_fw: 682 + release_firmware(fw); 683 + return ret; 693 684 } 694 685 695 686 static ssize_t generic_show(unsigned int command, u32 response[], ··· 704 691 705 692 ret = __send_command(priv, command, response); 706 693 if (ret < 0) 707 - return sprintf(buf, "ERROR: %s\n", error_text[-ret]); 694 + return sprintf(buf, "ERROR: %s\n", get_error_text(-ret)); 708 695 709 696 return 0; 710 697 } ··· 901 888 } 902 889 903 890 ret = brcmstb_dpfe_download_firmware(priv); 904 - if (ret) { 905 - if (ret != -EPROBE_DEFER) 906 - dev_err(dev, "Couldn't download firmware -- %d\n", ret); 907 - return ret; 908 - } 891 + if (ret) 892 + return dev_err_probe(dev, ret, "Couldn't download firmware\n"); 909 893 910 894 ret = sysfs_create_groups(&pdev->dev.kobj, priv->dpfe_api->sysfs_attrs); 911 895 if (!ret)
+7 -48
drivers/memory/emif.c
··· 131 131 return 0; 132 132 } 133 133 134 - static int emif_regdump_open(struct inode *inode, struct file *file) 135 - { 136 - return single_open(file, emif_regdump_show, inode->i_private); 137 - } 138 - 139 - static const struct file_operations emif_regdump_fops = { 140 - .open = emif_regdump_open, 141 - .read = seq_read, 142 - .release = single_release, 143 - }; 134 + DEFINE_SHOW_ATTRIBUTE(emif_regdump); 144 135 145 136 static int emif_mr4_show(struct seq_file *s, void *unused) 146 137 { ··· 141 150 return 0; 142 151 } 143 152 144 - static int emif_mr4_open(struct inode *inode, struct file *file) 145 - { 146 - return single_open(file, emif_mr4_show, inode->i_private); 147 - } 148 - 149 - static const struct file_operations emif_mr4_fops = { 150 - .open = emif_mr4_open, 151 - .read = seq_read, 152 - .release = single_release, 153 - }; 153 + DEFINE_SHOW_ATTRIBUTE(emif_mr4); 154 154 155 155 static int __init_or_module emif_debugfs_init(struct emif_data *emif) 156 156 { 157 - struct dentry *dentry; 158 - int ret; 159 - 160 - dentry = debugfs_create_dir(dev_name(emif->dev), NULL); 161 - if (!dentry) { 162 - ret = -ENOMEM; 163 - goto err0; 164 - } 165 - emif->debugfs_root = dentry; 166 - 167 - dentry = debugfs_create_file("regcache_dump", S_IRUGO, 168 - emif->debugfs_root, emif, &emif_regdump_fops); 169 - if (!dentry) { 170 - ret = -ENOMEM; 171 - goto err1; 172 - } 173 - 174 - dentry = debugfs_create_file("mr4", S_IRUGO, 175 - emif->debugfs_root, emif, &emif_mr4_fops); 176 - if (!dentry) { 177 - ret = -ENOMEM; 178 - goto err1; 179 - } 180 - 157 + emif->debugfs_root = debugfs_create_dir(dev_name(emif->dev), NULL); 158 + debugfs_create_file("regcache_dump", S_IRUGO, emif->debugfs_root, emif, 159 + &emif_regdump_fops); 160 + debugfs_create_file("mr4", S_IRUGO, emif->debugfs_root, emif, 161 + &emif_mr4_fops); 181 162 return 0; 182 - err1: 183 - debugfs_remove_recursive(emif->debugfs_root); 184 - err0: 185 - return ret; 186 163 } 187 164 188 165 static void __exit emif_debugfs_exit(struct emif_data *emif)
+2 -4
drivers/memory/fsl-corenet-cf.c
··· 211 211 dev_set_drvdata(&pdev->dev, ccf); 212 212 213 213 irq = platform_get_irq(pdev, 0); 214 - if (!irq) { 215 - dev_err(&pdev->dev, "%s: no irq\n", __func__); 216 - return -ENXIO; 217 - } 214 + if (irq < 0) 215 + return irq; 218 216 219 217 ret = devm_request_irq(&pdev->dev, irq, ccf_irq, 0, pdev->name, ccf); 220 218 if (ret) {
+23
drivers/memory/mtk-smi.c
··· 19 19 /* mt8173 */ 20 20 #define SMI_LARB_MMU_EN 0xf00 21 21 22 + /* mt8167 */ 23 + #define MT8167_SMI_LARB_MMU_EN 0xfc0 24 + 22 25 /* mt2701 */ 23 26 #define REG_SMI_SECUR_CON_BASE 0x5c0 24 27 ··· 182 179 writel(*larb->mmu, larb->base + SMI_LARB_MMU_EN); 183 180 } 184 181 182 + static void mtk_smi_larb_config_port_mt8167(struct device *dev) 183 + { 184 + struct mtk_smi_larb *larb = dev_get_drvdata(dev); 185 + 186 + writel(*larb->mmu, larb->base + MT8167_SMI_LARB_MMU_EN); 187 + } 188 + 185 189 static void mtk_smi_larb_config_port_gen1(struct device *dev) 186 190 { 187 191 struct mtk_smi_larb *larb = dev_get_drvdata(dev); ··· 236 226 .config_port = mtk_smi_larb_config_port_mt8173, 237 227 }; 238 228 229 + static const struct mtk_smi_larb_gen mtk_smi_larb_mt8167 = { 230 + /* mt8167 do not need the port in larb */ 231 + .config_port = mtk_smi_larb_config_port_mt8167, 232 + }; 233 + 239 234 static const struct mtk_smi_larb_gen mtk_smi_larb_mt2701 = { 240 235 .port_in_larb = { 241 236 LARB0_PORT_OFFSET, LARB1_PORT_OFFSET, ··· 269 254 }; 270 255 271 256 static const struct of_device_id mtk_smi_larb_of_ids[] = { 257 + { 258 + .compatible = "mediatek,mt8167-smi-larb", 259 + .data = &mtk_smi_larb_mt8167 260 + }, 272 261 { 273 262 .compatible = "mediatek,mt8173-smi-larb", 274 263 .data = &mtk_smi_larb_mt8173 ··· 435 416 static const struct of_device_id mtk_smi_common_of_ids[] = { 436 417 { 437 418 .compatible = "mediatek,mt8173-smi-common", 419 + .data = &mtk_smi_common_gen2, 420 + }, 421 + { 422 + .compatible = "mediatek,mt8167-smi-common", 438 423 .data = &mtk_smi_common_gen2, 439 424 }, 440 425 {
+156 -110
drivers/memory/omap-gpmc.c
··· 33 33 34 34 #include <linux/platform_data/mtd-nand-omap2.h> 35 35 36 - #include <asm/mach-types.h> 37 - 38 36 #define DEVICE_NAME "omap-gpmc" 39 37 40 38 /* GPMC register offsets */ ··· 243 245 /* Define chip-selects as reserved by default until probe completes */ 244 246 static unsigned int gpmc_cs_num = GPMC_CS_NUM; 245 247 static unsigned int gpmc_nr_waitpins; 246 - static resource_size_t phys_base, mem_size; 247 248 static unsigned int gpmc_capability; 248 249 static void __iomem *gpmc_base; 249 250 ··· 631 634 return 0; 632 635 } 633 636 634 - #define GPMC_SET_ONE_CD_MAX(reg, st, end, max, field, cd) \ 635 - if (set_gpmc_timing_reg(cs, (reg), (st), (end), (max), \ 636 - t->field, (cd), #field) < 0) \ 637 - return -1 638 - 639 - #define GPMC_SET_ONE(reg, st, end, field) \ 640 - GPMC_SET_ONE_CD_MAX(reg, st, end, 0, field, GPMC_CD_FCLK) 641 - 642 637 /** 643 638 * gpmc_calc_waitmonitoring_divider - calculate proper GPMCFCLKDIVIDER based on WAITMONITORINGTIME 644 639 * WAITMONITORINGTIME will be _at least_ as long as desired, i.e. ··· 689 700 int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t, 690 701 const struct gpmc_settings *s) 691 702 { 692 - int div; 703 + int div, ret; 693 704 u32 l; 694 705 695 706 div = gpmc_calc_divider(t->sync_clk); 696 707 if (div < 0) 697 - return div; 708 + return -EINVAL; 698 709 699 710 /* 700 711 * See if we need to change the divider for waitmonitoringtime. ··· 718 729 __func__, 719 730 t->wait_monitoring 720 731 ); 721 - return -1; 732 + return -ENXIO; 722 733 } 723 734 } 724 735 725 - GPMC_SET_ONE(GPMC_CS_CONFIG2, 0, 3, cs_on); 726 - GPMC_SET_ONE(GPMC_CS_CONFIG2, 8, 12, cs_rd_off); 727 - GPMC_SET_ONE(GPMC_CS_CONFIG2, 16, 20, cs_wr_off); 736 + ret = 0; 737 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG2, 0, 3, 0, t->cs_on, 738 + GPMC_CD_FCLK, "cs_on"); 739 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG2, 8, 12, 0, t->cs_rd_off, 740 + GPMC_CD_FCLK, "cs_rd_off"); 741 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG2, 16, 20, 0, t->cs_wr_off, 742 + GPMC_CD_FCLK, "cs_wr_off"); 743 + if (ret) 744 + return -ENXIO; 728 745 729 - GPMC_SET_ONE(GPMC_CS_CONFIG3, 0, 3, adv_on); 730 - GPMC_SET_ONE(GPMC_CS_CONFIG3, 8, 12, adv_rd_off); 731 - GPMC_SET_ONE(GPMC_CS_CONFIG3, 16, 20, adv_wr_off); 746 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 0, 3, 0, t->adv_on, 747 + GPMC_CD_FCLK, "adv_on"); 748 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 8, 12, 0, t->adv_rd_off, 749 + GPMC_CD_FCLK, "adv_rd_off"); 750 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 16, 20, 0, t->adv_wr_off, 751 + GPMC_CD_FCLK, "adv_wr_off"); 752 + if (ret) 753 + return -ENXIO; 754 + 732 755 if (gpmc_capability & GPMC_HAS_MUX_AAD) { 733 - GPMC_SET_ONE(GPMC_CS_CONFIG3, 4, 6, adv_aad_mux_on); 734 - GPMC_SET_ONE(GPMC_CS_CONFIG3, 24, 26, adv_aad_mux_rd_off); 735 - GPMC_SET_ONE(GPMC_CS_CONFIG3, 28, 30, adv_aad_mux_wr_off); 756 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 4, 6, 0, 757 + t->adv_aad_mux_on, GPMC_CD_FCLK, 758 + "adv_aad_mux_on"); 759 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 24, 26, 0, 760 + t->adv_aad_mux_rd_off, GPMC_CD_FCLK, 761 + "adv_aad_mux_rd_off"); 762 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG3, 28, 30, 0, 763 + t->adv_aad_mux_wr_off, GPMC_CD_FCLK, 764 + "adv_aad_mux_wr_off"); 765 + if (ret) 766 + return -ENXIO; 736 767 } 737 768 738 - GPMC_SET_ONE(GPMC_CS_CONFIG4, 0, 3, oe_on); 739 - GPMC_SET_ONE(GPMC_CS_CONFIG4, 8, 12, oe_off); 769 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 0, 3, 0, t->oe_on, 770 + GPMC_CD_FCLK, "oe_on"); 771 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 8, 12, 0, t->oe_off, 772 + GPMC_CD_FCLK, "oe_off"); 740 773 if (gpmc_capability & GPMC_HAS_MUX_AAD) { 741 - GPMC_SET_ONE(GPMC_CS_CONFIG4, 4, 6, oe_aad_mux_on); 742 - GPMC_SET_ONE(GPMC_CS_CONFIG4, 13, 15, oe_aad_mux_off); 774 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 4, 6, 0, 775 + t->oe_aad_mux_on, GPMC_CD_FCLK, 776 + "oe_aad_mux_on"); 777 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 13, 15, 0, 778 + t->oe_aad_mux_off, GPMC_CD_FCLK, 779 + "oe_aad_mux_off"); 743 780 } 744 - GPMC_SET_ONE(GPMC_CS_CONFIG4, 16, 19, we_on); 745 - GPMC_SET_ONE(GPMC_CS_CONFIG4, 24, 28, we_off); 781 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 16, 19, 0, t->we_on, 782 + GPMC_CD_FCLK, "we_on"); 783 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG4, 24, 28, 0, t->we_off, 784 + GPMC_CD_FCLK, "we_off"); 785 + if (ret) 786 + return -ENXIO; 746 787 747 - GPMC_SET_ONE(GPMC_CS_CONFIG5, 0, 4, rd_cycle); 748 - GPMC_SET_ONE(GPMC_CS_CONFIG5, 8, 12, wr_cycle); 749 - GPMC_SET_ONE(GPMC_CS_CONFIG5, 16, 20, access); 788 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG5, 0, 4, 0, t->rd_cycle, 789 + GPMC_CD_FCLK, "rd_cycle"); 790 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG5, 8, 12, 0, t->wr_cycle, 791 + GPMC_CD_FCLK, "wr_cycle"); 792 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG5, 16, 20, 0, t->access, 793 + GPMC_CD_FCLK, "access"); 794 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG5, 24, 27, 0, 795 + t->page_burst_access, GPMC_CD_FCLK, 796 + "page_burst_access"); 797 + if (ret) 798 + return -ENXIO; 750 799 751 - GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access); 800 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG6, 0, 3, 0, 801 + t->bus_turnaround, GPMC_CD_FCLK, 802 + "bus_turnaround"); 803 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG6, 8, 11, 0, 804 + t->cycle2cycle_delay, GPMC_CD_FCLK, 805 + "cycle2cycle_delay"); 806 + if (ret) 807 + return -ENXIO; 752 808 753 - GPMC_SET_ONE(GPMC_CS_CONFIG6, 0, 3, bus_turnaround); 754 - GPMC_SET_ONE(GPMC_CS_CONFIG6, 8, 11, cycle2cycle_delay); 755 - 756 - if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS) 757 - GPMC_SET_ONE(GPMC_CS_CONFIG6, 16, 19, wr_data_mux_bus); 758 - if (gpmc_capability & GPMC_HAS_WR_ACCESS) 759 - GPMC_SET_ONE(GPMC_CS_CONFIG6, 24, 28, wr_access); 809 + if (gpmc_capability & GPMC_HAS_WR_DATA_MUX_BUS) { 810 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG6, 16, 19, 0, 811 + t->wr_data_mux_bus, GPMC_CD_FCLK, 812 + "wr_data_mux_bus"); 813 + if (ret) 814 + return -ENXIO; 815 + } 816 + if (gpmc_capability & GPMC_HAS_WR_ACCESS) { 817 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG6, 24, 28, 0, 818 + t->wr_access, GPMC_CD_FCLK, 819 + "wr_access"); 820 + if (ret) 821 + return -ENXIO; 822 + } 760 823 761 824 l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 762 825 l &= ~0x03; 763 826 l |= (div - 1); 764 827 gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l); 765 828 766 - GPMC_SET_ONE_CD_MAX(GPMC_CS_CONFIG1, 18, 19, 767 - GPMC_CONFIG1_WAITMONITORINGTIME_MAX, 768 - wait_monitoring, GPMC_CD_CLK); 769 - GPMC_SET_ONE_CD_MAX(GPMC_CS_CONFIG1, 25, 26, 770 - GPMC_CONFIG1_CLKACTIVATIONTIME_MAX, 771 - clk_activation, GPMC_CD_FCLK); 829 + ret = 0; 830 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG1, 18, 19, 831 + GPMC_CONFIG1_WAITMONITORINGTIME_MAX, 832 + t->wait_monitoring, GPMC_CD_CLK, 833 + "wait_monitoring"); 834 + ret |= set_gpmc_timing_reg(cs, GPMC_CS_CONFIG1, 25, 26, 835 + GPMC_CONFIG1_CLKACTIVATIONTIME_MAX, 836 + t->clk_activation, GPMC_CD_FCLK, 837 + "clk_activation"); 838 + if (ret) 839 + return -ENXIO; 772 840 773 841 #ifdef CONFIG_OMAP_GPMC_DEBUG 774 842 pr_info("GPMC CS%d CLK period is %lu ns (div %d)\n", ··· 916 870 return gpmc->flags & GPMC_CS_RESERVED; 917 871 } 918 872 919 - static void gpmc_cs_set_name(int cs, const char *name) 920 - { 921 - struct gpmc_cs_data *gpmc = &gpmc_cs[cs]; 922 - 923 - gpmc->name = name; 924 - } 925 - 926 - static const char *gpmc_cs_get_name(int cs) 927 - { 928 - struct gpmc_cs_data *gpmc = &gpmc_cs[cs]; 929 - 930 - return gpmc->name; 931 - } 932 - 933 873 static unsigned long gpmc_mem_align(unsigned long size) 934 874 { 935 875 int order; ··· 961 929 return r; 962 930 } 963 931 964 - /** 965 - * gpmc_cs_remap - remaps a chip-select physical base address 966 - * @cs: chip-select to remap 967 - * @base: physical base address to re-map chip-select to 968 - * 969 - * Re-maps a chip-select to a new physical base address specified by 970 - * "base". Returns 0 on success and appropriate negative error code 971 - * on failure. 972 - */ 973 - static int gpmc_cs_remap(int cs, u32 base) 974 - { 975 - int ret; 976 - u32 old_base, size; 977 - 978 - if (cs > gpmc_cs_num) { 979 - pr_err("%s: requested chip-select is disabled\n", __func__); 980 - return -ENODEV; 981 - } 982 - 983 - /* 984 - * Make sure we ignore any device offsets from the GPMC partition 985 - * allocated for the chip select and that the new base confirms 986 - * to the GPMC 16MB minimum granularity. 987 - */ 988 - base &= ~(SZ_16M - 1); 989 - 990 - gpmc_cs_get_memconf(cs, &old_base, &size); 991 - if (base == old_base) 992 - return 0; 993 - 994 - ret = gpmc_cs_delete_mem(cs); 995 - if (ret < 0) 996 - return ret; 997 - 998 - ret = gpmc_cs_insert_mem(cs, base, size); 999 - if (ret < 0) 1000 - return ret; 1001 - 1002 - ret = gpmc_cs_set_memconf(cs, base, size); 1003 - 1004 - return ret; 1005 - } 1006 - 1007 932 int gpmc_cs_request(int cs, unsigned long size, unsigned long *base) 1008 933 { 1009 934 struct gpmc_cs_data *gpmc = &gpmc_cs[cs]; 1010 935 struct resource *res = &gpmc->mem; 1011 936 int r = -1; 1012 937 1013 - if (cs > gpmc_cs_num) { 938 + if (cs >= gpmc_cs_num) { 1014 939 pr_err("%s: requested chip-select is disabled\n", __func__); 1015 940 return -ENODEV; 1016 941 } ··· 1014 1025 1015 1026 spin_lock(&gpmc_mem_lock); 1016 1027 if (cs >= gpmc_cs_num || cs < 0 || !gpmc_cs_reserved(cs)) { 1017 - printk(KERN_ERR "Trying to free non-reserved GPMC CS%d\n", cs); 1018 - BUG(); 1028 + WARN(1, "Trying to free non-reserved GPMC CS%d\n", cs); 1019 1029 spin_unlock(&gpmc_mem_lock); 1020 1030 return; 1021 1031 } ··· 1884 1896 { } 1885 1897 }; 1886 1898 1899 + static void gpmc_cs_set_name(int cs, const char *name) 1900 + { 1901 + struct gpmc_cs_data *gpmc = &gpmc_cs[cs]; 1902 + 1903 + gpmc->name = name; 1904 + } 1905 + 1906 + static const char *gpmc_cs_get_name(int cs) 1907 + { 1908 + struct gpmc_cs_data *gpmc = &gpmc_cs[cs]; 1909 + 1910 + return gpmc->name; 1911 + } 1912 + 1913 + /** 1914 + * gpmc_cs_remap - remaps a chip-select physical base address 1915 + * @cs: chip-select to remap 1916 + * @base: physical base address to re-map chip-select to 1917 + * 1918 + * Re-maps a chip-select to a new physical base address specified by 1919 + * "base". Returns 0 on success and appropriate negative error code 1920 + * on failure. 1921 + */ 1922 + static int gpmc_cs_remap(int cs, u32 base) 1923 + { 1924 + int ret; 1925 + u32 old_base, size; 1926 + 1927 + if (cs >= gpmc_cs_num) { 1928 + pr_err("%s: requested chip-select is disabled\n", __func__); 1929 + return -ENODEV; 1930 + } 1931 + 1932 + /* 1933 + * Make sure we ignore any device offsets from the GPMC partition 1934 + * allocated for the chip select and that the new base confirms 1935 + * to the GPMC 16MB minimum granularity. 1936 + */ 1937 + base &= ~(SZ_16M - 1); 1938 + 1939 + gpmc_cs_get_memconf(cs, &old_base, &size); 1940 + if (base == old_base) 1941 + return 0; 1942 + 1943 + ret = gpmc_cs_delete_mem(cs); 1944 + if (ret < 0) 1945 + return ret; 1946 + 1947 + ret = gpmc_cs_insert_mem(cs, base, size); 1948 + if (ret < 0) 1949 + return ret; 1950 + 1951 + ret = gpmc_cs_set_memconf(cs, base, size); 1952 + 1953 + return ret; 1954 + } 1955 + 1887 1956 /** 1888 1957 * gpmc_read_settings_dt - read gpmc settings from device-tree 1889 1958 * @np: pointer to device-tree node for a gpmc child device ··· 2310 2265 } 2311 2266 } 2312 2267 #else 2268 + void gpmc_read_settings_dt(struct device_node *np, struct gpmc_settings *p) 2269 + { 2270 + memset(p, 0, sizeof(*p)); 2271 + } 2313 2272 static int gpmc_probe_dt(struct platform_device *pdev) 2314 2273 { 2315 2274 return 0; ··· 2396 2347 platform_set_drvdata(pdev, gpmc); 2397 2348 2398 2349 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2399 - if (res == NULL) 2350 + if (!res) 2400 2351 return -ENOENT; 2401 - 2402 - phys_base = res->start; 2403 - mem_size = resource_size(res); 2404 2352 2405 2353 gpmc_base = devm_ioremap_resource(&pdev->dev, res); 2406 2354 if (IS_ERR(gpmc_base))
+1 -3
drivers/memory/renesas-rpc-if.c
··· 199 199 rpc->dirmap = NULL; 200 200 201 201 rpc->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); 202 - if (IS_ERR(rpc->rstc)) 203 - return PTR_ERR(rpc->rstc); 204 202 205 - return 0; 203 + return PTR_ERR_OR_ZERO(rpc->rstc); 206 204 } 207 205 EXPORT_SYMBOL(rpcif_sw_init); 208 206
+71 -37
drivers/memory/samsung/exynos5422-dmc.c
··· 98 98 99 99 /** 100 100 * struct dmc_opp_table - Operating level desciption 101 + * @freq_hz: target frequency in Hz 102 + * @volt_uv: target voltage in uV 101 103 * 102 104 * Covers frequency and voltage settings of the DMC operating mode. 103 105 */ ··· 110 108 111 109 /** 112 110 * struct exynos5_dmc - main structure describing DMC device 111 + * @dev: DMC device 112 + * @df: devfreq device structure returned by devfreq framework 113 + * @gov_data: configuration of devfreq governor 114 + * @base_drexi0: DREX0 registers mapping 115 + * @base_drexi1: DREX1 registers mapping 116 + * @clk_regmap: regmap for clock controller registers 117 + * @lock: protects curr_rate and frequency/voltage setting section 118 + * @curr_rate: current frequency 119 + * @curr_volt: current voltage 120 + * @opp: OPP table 121 + * @opp_count: number of 'opp' elements 122 + * @timings_arr_size: number of 'timings' elements 123 + * @timing_row: values for timing row register, for each OPP 124 + * @timing_data: values for timing data register, for each OPP 125 + * @timing_power: balues for timing power register, for each OPP 126 + * @timings: DDR memory timings, from device tree 127 + * @min_tck: DDR memory minimum timing values, from device tree 128 + * @bypass_timing_row: value for timing row register for bypass timings 129 + * @bypass_timing_data: value for timing data register for bypass timings 130 + * @bypass_timing_power: value for timing power register for bypass 131 + * timings 132 + * @vdd_mif: Memory interface regulator 133 + * @fout_spll: clock: SPLL 134 + * @fout_bpll: clock: BPLL 135 + * @mout_spll: clock: mux SPLL 136 + * @mout_bpll: clock: mux BPLL 137 + * @mout_mclk_cdrex: clock: mux mclk_cdrex 138 + * @mout_mx_mspll_ccore: clock: mux mx_mspll_ccore 139 + * @counter: devfreq events 140 + * @num_counters: number of 'counter' elements 141 + * @last_overflow_ts: time (in ns) of last overflow of each DREX 142 + * @load: utilization in percents 143 + * @total: total time between devfreq events 144 + * @in_irq_mode: whether running in interrupt mode (true) 145 + * or polling (false) 113 146 * 114 147 * The main structure for the Dynamic Memory Controller which covers clocks, 115 148 * memory regions, HW information, parameters and current operating mode. ··· 156 119 void __iomem *base_drexi0; 157 120 void __iomem *base_drexi1; 158 121 struct regmap *clk_regmap; 122 + /* Protects curr_rate and frequency/voltage setting section */ 159 123 struct mutex lock; 160 124 unsigned long curr_rate; 161 125 unsigned long curr_volt; 162 - unsigned long bypass_rate; 163 126 struct dmc_opp_table *opp; 164 - struct dmc_opp_table opp_bypass; 165 127 int opp_count; 166 128 u32 timings_arr_size; 167 129 u32 *timing_row; ··· 178 142 struct clk *mout_bpll; 179 143 struct clk *mout_mclk_cdrex; 180 144 struct clk *mout_mx_mspll_ccore; 181 - struct clk *mx_mspll_ccore_phy; 182 - struct clk *mout_mx_mspll_ccore_phy; 183 145 struct devfreq_event_dev **counter; 184 146 int num_counters; 185 147 u64 last_overflow_ts[2]; ··· 203 169 unsigned int val; 204 170 }; 205 171 206 - static const struct timing_reg timing_row[] = { 172 + static const struct timing_reg timing_row_reg_fields[] = { 207 173 TIMING_FIELD("tRFC", 24, 31), 208 174 TIMING_FIELD("tRRD", 20, 23), 209 175 TIMING_FIELD("tRP", 16, 19), ··· 212 178 TIMING_FIELD("tRAS", 0, 5), 213 179 }; 214 180 215 - static const struct timing_reg timing_data[] = { 181 + static const struct timing_reg timing_data_reg_fields[] = { 216 182 TIMING_FIELD("tWTR", 28, 31), 217 183 TIMING_FIELD("tWR", 24, 27), 218 184 TIMING_FIELD("tRTP", 20, 23), ··· 223 189 TIMING_FIELD("RL", 0, 3), 224 190 }; 225 191 226 - static const struct timing_reg timing_power[] = { 192 + static const struct timing_reg timing_power_reg_fields[] = { 227 193 TIMING_FIELD("tFAW", 26, 31), 228 194 TIMING_FIELD("tXSR", 16, 25), 229 195 TIMING_FIELD("tXP", 8, 15), ··· 231 197 TIMING_FIELD("tMRD", 0, 3), 232 198 }; 233 199 234 - #define TIMING_COUNT (ARRAY_SIZE(timing_row) + ARRAY_SIZE(timing_data) + \ 235 - ARRAY_SIZE(timing_power)) 200 + #define TIMING_COUNT (ARRAY_SIZE(timing_row_reg_fields) + \ 201 + ARRAY_SIZE(timing_data_reg_fields) + \ 202 + ARRAY_SIZE(timing_power_reg_fields)) 236 203 237 204 static int exynos5_counters_set_event(struct exynos5_dmc *dmc) 238 205 { ··· 381 346 /** 382 347 * exynos5_set_bypass_dram_timings() - Low-level changes of the DRAM timings 383 348 * @dmc: device for which the new settings is going to be applied 384 - * @param: DRAM parameters which passes timing data 385 349 * 386 350 * Low-level function for changing timings for DRAM memory clocking from 387 351 * 'bypass' clock source (fixed frequency @400MHz). ··· 487 453 unsigned long target_volt) 488 454 { 489 455 int ret = 0; 490 - unsigned long bypass_volt = dmc->opp_bypass.volt_uv; 491 - 492 - target_volt = max(bypass_volt, target_volt); 493 456 494 457 if (dmc->curr_volt >= target_volt) 495 458 return 0; ··· 648 617 * requested 649 618 * @target_volt: returned voltage which corresponds to the returned 650 619 * frequency 620 + * @flags: devfreq flags provided for this frequency change request 651 621 * 652 622 * Function gets requested frequency and checks OPP framework for needed 653 623 * frequency and voltage. It populates the values 'target_rate' and ··· 940 908 int ret; 941 909 942 910 if (dmc->in_irq_mode) { 911 + mutex_lock(&dmc->lock); 943 912 stat->current_frequency = dmc->curr_rate; 913 + mutex_unlock(&dmc->lock); 914 + 944 915 stat->busy_time = dmc->load; 945 916 stat->total_time = dmc->total; 946 917 } else { ··· 985 950 return 0; 986 951 } 987 952 988 - /** 953 + /* 989 954 * exynos5_dmc_df_profile - Devfreq governor's profile structure 990 955 * 991 956 * It provides to the devfreq framework needed functions and polling period. ··· 1028 993 /** 1029 994 * create_timings_aligned() - Create register values and align with standard 1030 995 * @dmc: device for which the frequency is going to be set 1031 - * @idx: speed bin in the OPP table 996 + * @reg_timing_row: array to fill with values for timing row register 997 + * @reg_timing_data: array to fill with values for timing data register 998 + * @reg_timing_power: array to fill with values for timing power register 1032 999 * @clk_period_ps: the period of the clock, known as tCK 1033 1000 * 1034 1001 * The function calculates timings and creates a register value ready for ··· 1055 1018 val = dmc->timings->tRFC / clk_period_ps; 1056 1019 val += dmc->timings->tRFC % clk_period_ps ? 1 : 0; 1057 1020 val = max(val, dmc->min_tck->tRFC); 1058 - reg = &timing_row[0]; 1021 + reg = &timing_row_reg_fields[0]; 1059 1022 *reg_timing_row |= TIMING_VAL2REG(reg, val); 1060 1023 1061 1024 val = dmc->timings->tRRD / clk_period_ps; 1062 1025 val += dmc->timings->tRRD % clk_period_ps ? 1 : 0; 1063 1026 val = max(val, dmc->min_tck->tRRD); 1064 - reg = &timing_row[1]; 1027 + reg = &timing_row_reg_fields[1]; 1065 1028 *reg_timing_row |= TIMING_VAL2REG(reg, val); 1066 1029 1067 1030 val = dmc->timings->tRPab / clk_period_ps; 1068 1031 val += dmc->timings->tRPab % clk_period_ps ? 1 : 0; 1069 1032 val = max(val, dmc->min_tck->tRPab); 1070 - reg = &timing_row[2]; 1033 + reg = &timing_row_reg_fields[2]; 1071 1034 *reg_timing_row |= TIMING_VAL2REG(reg, val); 1072 1035 1073 1036 val = dmc->timings->tRCD / clk_period_ps; 1074 1037 val += dmc->timings->tRCD % clk_period_ps ? 1 : 0; 1075 1038 val = max(val, dmc->min_tck->tRCD); 1076 - reg = &timing_row[3]; 1039 + reg = &timing_row_reg_fields[3]; 1077 1040 *reg_timing_row |= TIMING_VAL2REG(reg, val); 1078 1041 1079 1042 val = dmc->timings->tRC / clk_period_ps; 1080 1043 val += dmc->timings->tRC % clk_period_ps ? 1 : 0; 1081 1044 val = max(val, dmc->min_tck->tRC); 1082 - reg = &timing_row[4]; 1045 + reg = &timing_row_reg_fields[4]; 1083 1046 *reg_timing_row |= TIMING_VAL2REG(reg, val); 1084 1047 1085 1048 val = dmc->timings->tRAS / clk_period_ps; 1086 1049 val += dmc->timings->tRAS % clk_period_ps ? 1 : 0; 1087 1050 val = max(val, dmc->min_tck->tRAS); 1088 - reg = &timing_row[5]; 1051 + reg = &timing_row_reg_fields[5]; 1089 1052 *reg_timing_row |= TIMING_VAL2REG(reg, val); 1090 1053 1091 1054 /* data related timings */ 1092 1055 val = dmc->timings->tWTR / clk_period_ps; 1093 1056 val += dmc->timings->tWTR % clk_period_ps ? 1 : 0; 1094 1057 val = max(val, dmc->min_tck->tWTR); 1095 - reg = &timing_data[0]; 1058 + reg = &timing_data_reg_fields[0]; 1096 1059 *reg_timing_data |= TIMING_VAL2REG(reg, val); 1097 1060 1098 1061 val = dmc->timings->tWR / clk_period_ps; 1099 1062 val += dmc->timings->tWR % clk_period_ps ? 1 : 0; 1100 1063 val = max(val, dmc->min_tck->tWR); 1101 - reg = &timing_data[1]; 1064 + reg = &timing_data_reg_fields[1]; 1102 1065 *reg_timing_data |= TIMING_VAL2REG(reg, val); 1103 1066 1104 1067 val = dmc->timings->tRTP / clk_period_ps; 1105 1068 val += dmc->timings->tRTP % clk_period_ps ? 1 : 0; 1106 1069 val = max(val, dmc->min_tck->tRTP); 1107 - reg = &timing_data[2]; 1070 + reg = &timing_data_reg_fields[2]; 1108 1071 *reg_timing_data |= TIMING_VAL2REG(reg, val); 1109 1072 1110 1073 val = dmc->timings->tW2W_C2C / clk_period_ps; 1111 1074 val += dmc->timings->tW2W_C2C % clk_period_ps ? 1 : 0; 1112 1075 val = max(val, dmc->min_tck->tW2W_C2C); 1113 - reg = &timing_data[3]; 1076 + reg = &timing_data_reg_fields[3]; 1114 1077 *reg_timing_data |= TIMING_VAL2REG(reg, val); 1115 1078 1116 1079 val = dmc->timings->tR2R_C2C / clk_period_ps; 1117 1080 val += dmc->timings->tR2R_C2C % clk_period_ps ? 1 : 0; 1118 1081 val = max(val, dmc->min_tck->tR2R_C2C); 1119 - reg = &timing_data[4]; 1082 + reg = &timing_data_reg_fields[4]; 1120 1083 *reg_timing_data |= TIMING_VAL2REG(reg, val); 1121 1084 1122 1085 val = dmc->timings->tWL / clk_period_ps; 1123 1086 val += dmc->timings->tWL % clk_period_ps ? 1 : 0; 1124 1087 val = max(val, dmc->min_tck->tWL); 1125 - reg = &timing_data[5]; 1088 + reg = &timing_data_reg_fields[5]; 1126 1089 *reg_timing_data |= TIMING_VAL2REG(reg, val); 1127 1090 1128 1091 val = dmc->timings->tDQSCK / clk_period_ps; 1129 1092 val += dmc->timings->tDQSCK % clk_period_ps ? 1 : 0; 1130 1093 val = max(val, dmc->min_tck->tDQSCK); 1131 - reg = &timing_data[6]; 1094 + reg = &timing_data_reg_fields[6]; 1132 1095 *reg_timing_data |= TIMING_VAL2REG(reg, val); 1133 1096 1134 1097 val = dmc->timings->tRL / clk_period_ps; 1135 1098 val += dmc->timings->tRL % clk_period_ps ? 1 : 0; 1136 1099 val = max(val, dmc->min_tck->tRL); 1137 - reg = &timing_data[7]; 1100 + reg = &timing_data_reg_fields[7]; 1138 1101 *reg_timing_data |= TIMING_VAL2REG(reg, val); 1139 1102 1140 1103 /* power related timings */ 1141 1104 val = dmc->timings->tFAW / clk_period_ps; 1142 1105 val += dmc->timings->tFAW % clk_period_ps ? 1 : 0; 1143 1106 val = max(val, dmc->min_tck->tFAW); 1144 - reg = &timing_power[0]; 1107 + reg = &timing_power_reg_fields[0]; 1145 1108 *reg_timing_power |= TIMING_VAL2REG(reg, val); 1146 1109 1147 1110 val = dmc->timings->tXSR / clk_period_ps; 1148 1111 val += dmc->timings->tXSR % clk_period_ps ? 1 : 0; 1149 1112 val = max(val, dmc->min_tck->tXSR); 1150 - reg = &timing_power[1]; 1113 + reg = &timing_power_reg_fields[1]; 1151 1114 *reg_timing_power |= TIMING_VAL2REG(reg, val); 1152 1115 1153 1116 val = dmc->timings->tXP / clk_period_ps; 1154 1117 val += dmc->timings->tXP % clk_period_ps ? 1 : 0; 1155 1118 val = max(val, dmc->min_tck->tXP); 1156 - reg = &timing_power[2]; 1119 + reg = &timing_power_reg_fields[2]; 1157 1120 *reg_timing_power |= TIMING_VAL2REG(reg, val); 1158 1121 1159 1122 val = dmc->timings->tCKE / clk_period_ps; 1160 1123 val += dmc->timings->tCKE % clk_period_ps ? 1 : 0; 1161 1124 val = max(val, dmc->min_tck->tCKE); 1162 - reg = &timing_power[3]; 1125 + reg = &timing_power_reg_fields[3]; 1163 1126 *reg_timing_power |= TIMING_VAL2REG(reg, val); 1164 1127 1165 1128 val = dmc->timings->tMRD / clk_period_ps; 1166 1129 val += dmc->timings->tMRD % clk_period_ps ? 1 : 0; 1167 1130 val = max(val, dmc->min_tck->tMRD); 1168 - reg = &timing_power[4]; 1131 + reg = &timing_power_reg_fields[4]; 1169 1132 *reg_timing_power |= TIMING_VAL2REG(reg, val); 1170 1133 1171 1134 return 0; ··· 1300 1263 1301 1264 clk_set_parent(dmc->mout_mx_mspll_ccore, dmc->mout_spll); 1302 1265 1303 - dmc->bypass_rate = clk_get_rate(dmc->mout_mx_mspll_ccore); 1304 - 1305 1266 clk_prepare_enable(dmc->fout_bpll); 1306 1267 clk_prepare_enable(dmc->mout_bpll); 1307 1268 ··· 1367 1332 /** 1368 1333 * exynos5_dmc_set_pause_on_switching() - Controls a pause feature in DMC 1369 1334 * @dmc: device which is used for changing this feature 1370 - * @set: a boolean state passing enable/disable request 1371 1335 * 1372 1336 * There is a need of pausing DREX DMC when divider or MUX in clock tree 1373 1337 * changes its configuration. In such situation access to the memory is blocked
+1 -13
drivers/memory/tegra/tegra124-emc.c
··· 1060 1060 return 0; 1061 1061 } 1062 1062 1063 - static int tegra_emc_debug_available_rates_open(struct inode *inode, 1064 - struct file *file) 1065 - { 1066 - return single_open(file, tegra_emc_debug_available_rates_show, 1067 - inode->i_private); 1068 - } 1069 - 1070 - static const struct file_operations tegra_emc_debug_available_rates_fops = { 1071 - .open = tegra_emc_debug_available_rates_open, 1072 - .read = seq_read, 1073 - .llseek = seq_lseek, 1074 - .release = single_release, 1075 - }; 1063 + DEFINE_SHOW_ATTRIBUTE(tegra_emc_debug_available_rates); 1076 1064 1077 1065 static int tegra_emc_debug_min_rate_get(void *data, u64 *rate) 1078 1066 {
-1
drivers/memory/tegra/tegra124.c
··· 957 957 static const unsigned int tegra124_group_drm[] = { 958 958 TEGRA_SWGROUP_DC, 959 959 TEGRA_SWGROUP_DCB, 960 - TEGRA_SWGROUP_GPU, 961 960 TEGRA_SWGROUP_VIC, 962 961 }; 963 962
+2 -8
drivers/memory/tegra/tegra186-emc.c
··· 172 172 return -ENOMEM; 173 173 174 174 emc->bpmp = tegra_bpmp_get(&pdev->dev); 175 - if (IS_ERR(emc->bpmp)) { 176 - err = PTR_ERR(emc->bpmp); 177 - 178 - if (err != -EPROBE_DEFER) 179 - dev_err(&pdev->dev, "failed to get BPMP: %d\n", err); 180 - 181 - return err; 182 - } 175 + if (IS_ERR(emc->bpmp)) 176 + return dev_err_probe(&pdev->dev, PTR_ERR(emc->bpmp), "failed to get BPMP\n"); 183 177 184 178 emc->clk = devm_clk_get(&pdev->dev, "emc"); 185 179 if (IS_ERR(emc->clk)) {
+1 -2
drivers/memory/tegra/tegra210-emc-cc-r21021.c
··· 501 501 emc_cfg_o = emc_readl(emc, EMC_CFG); 502 502 emc_cfg = emc_cfg_o & ~(EMC_CFG_DYN_SELF_REF | 503 503 EMC_CFG_DRAM_ACPD | 504 - EMC_CFG_DRAM_CLKSTOP_PD | 505 504 EMC_CFG_DRAM_CLKSTOP_PD); 506 505 507 506 ··· 1043 1044 !opt_cc_short_zcal && opt_short_zcal) { 1044 1045 value = (value & ~(EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_MASK << 1045 1046 EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_SHIFT)) | 1046 - ((zq_wait_long & EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_MASK) << 1047 + ((zq_wait_long & EMC_ZCAL_WAIT_CNT_ZCAL_WAIT_CNT_MASK) << 1047 1048 EMC_MRS_WAIT_CNT_SHORT_WAIT_SHIFT); 1048 1049 } else if (offset == EMC_ZCAL_INTERVAL && opt_zcal_en_cc) { 1049 1050 value = 0; /* EMC_ZCAL_INTERVAL reset value. */
+1 -1
drivers/memory/tegra/tegra210.c
··· 842 842 }, 843 843 .la = { 844 844 .reg = 0x3dc, 845 - .shift = 0, 845 + .shift = 16, 846 846 .mask = 0xff, 847 847 .def = 0x80, 848 848 },
+3 -2
drivers/reset/Kconfig
··· 65 65 This enables the reset controller driver for HSDK board. 66 66 67 67 config RESET_IMX7 68 - bool "i.MX7/8 Reset Driver" if COMPILE_TEST 68 + tristate "i.MX7/8 Reset Driver" 69 69 depends on HAS_IOMEM 70 - default SOC_IMX7D || (ARM64 && ARCH_MXC) 70 + depends on SOC_IMX7D || (ARM64 && ARCH_MXC) || COMPILE_TEST 71 + default y if SOC_IMX7D 71 72 select MFD_SYSCON 72 73 help 73 74 This enables the reset controller driver for i.MX7 SoCs.
+2 -1
drivers/reset/core.c
··· 32 32 * @refcnt: Number of gets of this reset_control 33 33 * @acquired: Only one reset_control may be acquired for a given rcdev and id. 34 34 * @shared: Is this a shared (1), or an exclusive (0) reset_control? 35 - * @deassert_cnt: Number of times this reset line has been deasserted 35 + * @array: Is this an array of reset controls (1)? 36 + * @deassert_count: Number of times this reset line has been deasserted 36 37 * @triggered_count: Number of times this reset line has been reset. Currently 37 38 * only used for shared resets, which means that the value 38 39 * will be either 0 or 1.
+11 -2
drivers/reset/reset-imx7.c
··· 8 8 */ 9 9 10 10 #include <linux/mfd/syscon.h> 11 - #include <linux/mod_devicetable.h> 11 + #include <linux/module.h> 12 12 #include <linux/of_device.h> 13 13 #include <linux/platform_device.h> 14 14 #include <linux/reset-controller.h> ··· 178 178 [IMX8MQ_RESET_A53_SOC_DBG_RESET] = { SRC_A53RCR0, BIT(20) }, 179 179 [IMX8MQ_RESET_A53_L2RESET] = { SRC_A53RCR0, BIT(21) }, 180 180 [IMX8MQ_RESET_SW_NON_SCLR_M4C_RST] = { SRC_M4RCR, BIT(0) }, 181 + [IMX8MQ_RESET_SW_M4C_RST] = { SRC_M4RCR, BIT(1) }, 182 + [IMX8MQ_RESET_SW_M4P_RST] = { SRC_M4RCR, BIT(2) }, 183 + [IMX8MQ_RESET_M4_ENABLE] = { SRC_M4RCR, BIT(3) }, 181 184 [IMX8MQ_RESET_OTG1_PHY_RESET] = { SRC_USBOPHY1_RCR, BIT(0) }, 182 185 [IMX8MQ_RESET_OTG2_PHY_RESET] = { SRC_USBOPHY2_RCR, BIT(0) }, 183 186 [IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N] = { SRC_MIPIPHY_RCR, BIT(1) }, ··· 241 238 case IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N: 242 239 case IMX8MQ_RESET_MIPI_DSI_RESET_N: 243 240 case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N: 241 + case IMX8MQ_RESET_M4_ENABLE: 244 242 value = assert ? 0 : bit; 245 243 break; 246 244 } ··· 390 386 { .compatible = "fsl,imx8mp-src", .data = &variant_imx8mp }, 391 387 { /* sentinel */ }, 392 388 }; 389 + MODULE_DEVICE_TABLE(of, imx7_reset_dt_ids); 393 390 394 391 static struct platform_driver imx7_reset_driver = { 395 392 .probe = imx7_reset_probe, ··· 399 394 .of_match_table = imx7_reset_dt_ids, 400 395 }, 401 396 }; 402 - builtin_platform_driver(imx7_reset_driver); 397 + module_platform_driver(imx7_reset_driver); 398 + 399 + MODULE_AUTHOR("Andrey Smirnov <andrew.smirnov@gmail.com>"); 400 + MODULE_DESCRIPTION("NXP i.MX7 reset driver"); 401 + MODULE_LICENSE("GPL v2");
+44 -6
drivers/reset/reset-zynqmp.c
··· 9 9 #include <linux/platform_device.h> 10 10 #include <linux/reset-controller.h> 11 11 #include <linux/firmware/xlnx-zynqmp.h> 12 + #include <linux/of_device.h> 12 13 13 14 #define ZYNQMP_NR_RESETS (ZYNQMP_PM_RESET_END - ZYNQMP_PM_RESET_START) 14 15 #define ZYNQMP_RESET_ID ZYNQMP_PM_RESET_START 16 + #define VERSAL_NR_RESETS 95 17 + 18 + struct zynqmp_reset_soc_data { 19 + u32 reset_id; 20 + u32 num_resets; 21 + }; 15 22 16 23 struct zynqmp_reset_data { 17 24 struct reset_controller_dev rcdev; 25 + const struct zynqmp_reset_soc_data *data; 18 26 }; 19 27 20 28 static inline struct zynqmp_reset_data * ··· 34 26 static int zynqmp_reset_assert(struct reset_controller_dev *rcdev, 35 27 unsigned long id) 36 28 { 37 - return zynqmp_pm_reset_assert(ZYNQMP_RESET_ID + id, 29 + struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev); 30 + 31 + return zynqmp_pm_reset_assert(priv->data->reset_id + id, 38 32 PM_RESET_ACTION_ASSERT); 39 33 } 40 34 41 35 static int zynqmp_reset_deassert(struct reset_controller_dev *rcdev, 42 36 unsigned long id) 43 37 { 44 - return zynqmp_pm_reset_assert(ZYNQMP_RESET_ID + id, 38 + struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev); 39 + 40 + return zynqmp_pm_reset_assert(priv->data->reset_id + id, 45 41 PM_RESET_ACTION_RELEASE); 46 42 } 47 43 48 44 static int zynqmp_reset_status(struct reset_controller_dev *rcdev, 49 45 unsigned long id) 50 46 { 47 + struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev); 51 48 int val, err; 52 49 53 - err = zynqmp_pm_reset_get_status(ZYNQMP_RESET_ID + id, &val); 50 + err = zynqmp_pm_reset_get_status(priv->data->reset_id + id, &val); 54 51 if (err) 55 52 return err; 56 53 ··· 65 52 static int zynqmp_reset_reset(struct reset_controller_dev *rcdev, 66 53 unsigned long id) 67 54 { 68 - return zynqmp_pm_reset_assert(ZYNQMP_RESET_ID + id, 55 + struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev); 56 + 57 + return zynqmp_pm_reset_assert(priv->data->reset_id + id, 69 58 PM_RESET_ACTION_PULSE); 70 59 } 60 + 61 + static int zynqmp_reset_of_xlate(struct reset_controller_dev *rcdev, 62 + const struct of_phandle_args *reset_spec) 63 + { 64 + return reset_spec->args[0]; 65 + } 66 + 67 + static const struct zynqmp_reset_soc_data zynqmp_reset_data = { 68 + .reset_id = ZYNQMP_RESET_ID, 69 + .num_resets = ZYNQMP_NR_RESETS, 70 + }; 71 + 72 + static const struct zynqmp_reset_soc_data versal_reset_data = { 73 + .reset_id = 0, 74 + .num_resets = VERSAL_NR_RESETS, 75 + }; 71 76 72 77 static const struct reset_control_ops zynqmp_reset_ops = { 73 78 .reset = zynqmp_reset_reset, ··· 102 71 if (!priv) 103 72 return -ENOMEM; 104 73 74 + priv->data = of_device_get_match_data(&pdev->dev); 75 + if (!priv->data) 76 + return -EINVAL; 77 + 105 78 platform_set_drvdata(pdev, priv); 106 79 107 80 priv->rcdev.ops = &zynqmp_reset_ops; 108 81 priv->rcdev.owner = THIS_MODULE; 109 82 priv->rcdev.of_node = pdev->dev.of_node; 110 - priv->rcdev.nr_resets = ZYNQMP_NR_RESETS; 83 + priv->rcdev.nr_resets = priv->data->num_resets; 84 + priv->rcdev.of_reset_n_cells = 1; 85 + priv->rcdev.of_xlate = zynqmp_reset_of_xlate; 111 86 112 87 return devm_reset_controller_register(&pdev->dev, &priv->rcdev); 113 88 } 114 89 115 90 static const struct of_device_id zynqmp_reset_dt_ids[] = { 116 - { .compatible = "xlnx,zynqmp-reset", }, 91 + { .compatible = "xlnx,zynqmp-reset", .data = &zynqmp_reset_data, }, 92 + { .compatible = "xlnx,versal-reset", .data = &versal_reset_data, }, 117 93 { /* sentinel */ }, 118 94 }; 119 95
+4 -3
drivers/reset/sti/reset-syscfg.c
··· 17 17 #include "reset-syscfg.h" 18 18 19 19 /** 20 - * Reset channel regmap configuration 20 + * struct syscfg_reset_channel - Reset channel regmap configuration 21 21 * 22 22 * @reset: regmap field for the channel's reset bit. 23 23 * @ack: regmap field for the channel's ack bit (optional). ··· 28 28 }; 29 29 30 30 /** 31 - * A reset controller which groups together a set of related reset bits, which 32 - * may be located in different system configuration registers. 31 + * struct syscfg_reset_controller - A reset controller which groups together 32 + * a set of related reset bits, which may be located in different system 33 + * configuration registers. 33 34 * 34 35 * @rst: base reset controller structure. 35 36 * @active_low: are the resets in this controller active low, i.e. clearing
+28 -2
drivers/soc/amlogic/meson-ee-pwrc.c
··· 15 15 #include <linux/reset.h> 16 16 #include <linux/clk.h> 17 17 #include <dt-bindings/power/meson8-power.h> 18 + #include <dt-bindings/power/meson-axg-power.h> 18 19 #include <dt-bindings/power/meson-g12a-power.h> 19 20 #include <dt-bindings/power/meson-gxbb-power.h> 20 21 #include <dt-bindings/power/meson-sm1-power.h> ··· 135 134 { __reg, BIT(14) }, \ 136 135 { __reg, BIT(15) } 137 136 137 + static struct meson_ee_pwrc_mem_domain axg_pwrc_mem_vpu[] = { 138 + VPU_MEMPD(HHI_VPU_MEM_PD_REG0), 139 + VPU_HHI_MEMPD(HHI_MEM_PD_REG0), 140 + }; 141 + 138 142 static struct meson_ee_pwrc_mem_domain g12a_pwrc_mem_vpu[] = { 139 143 VPU_MEMPD(HHI_VPU_MEM_PD_REG0), 140 144 VPU_MEMPD(HHI_VPU_MEM_PD_REG1), ··· 196 190 { HHI_MEM_PD_REG0, GENMASK(25, 18) }, 197 191 }; 198 192 193 + static struct meson_ee_pwrc_mem_domain axg_pwrc_mem_audio[] = { 194 + { HHI_MEM_PD_REG0, GENMASK(5, 4) }, 195 + }; 196 + 199 197 static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_audio[] = { 200 198 { HHI_MEM_PD_REG0, GENMASK(5, 4) }, 201 199 { HHI_AUDIO_MEM_PD_REG0, GENMASK(1, 0) }, ··· 240 230 TOP_PD(__name, NULL, __mem, NULL) 241 231 242 232 static bool pwrc_ee_get_power(struct meson_ee_pwrc_domain *pwrc_domain); 233 + 234 + static struct meson_ee_pwrc_domain_desc axg_pwrc_domains[] = { 235 + [PWRC_AXG_VPU_ID] = VPU_PD("VPU", &gx_pwrc_vpu, axg_pwrc_mem_vpu, 236 + pwrc_ee_get_power, 5, 2), 237 + [PWRC_AXG_ETHERNET_MEM_ID] = MEM_PD("ETH", meson_pwrc_mem_eth), 238 + [PWRC_AXG_AUDIO_ID] = MEM_PD("AUDIO", axg_pwrc_mem_audio), 239 + }; 243 240 244 241 static struct meson_ee_pwrc_domain_desc g12a_pwrc_domains[] = { 245 242 [PWRC_G12A_VPU_ID] = VPU_PD("VPU", &gx_pwrc_vpu, g12a_pwrc_mem_vpu, ··· 450 433 if (ret) 451 434 return ret; 452 435 453 - ret = pm_genpd_init(&dom->base, &pm_domain_always_on_gov, 454 - false); 436 + dom->base.flags = GENPD_FLAG_ALWAYS_ON; 437 + ret = pm_genpd_init(&dom->base, NULL, false); 455 438 if (ret) 456 439 return ret; 457 440 } else { ··· 546 529 .domains = g12a_pwrc_domains, 547 530 }; 548 531 532 + static struct meson_ee_pwrc_domain_data meson_ee_axg_pwrc_data = { 533 + .count = ARRAY_SIZE(axg_pwrc_domains), 534 + .domains = axg_pwrc_domains, 535 + }; 536 + 549 537 static struct meson_ee_pwrc_domain_data meson_ee_gxbb_pwrc_data = { 550 538 .count = ARRAY_SIZE(gxbb_pwrc_domains), 551 539 .domains = gxbb_pwrc_domains, ··· 583 561 { 584 562 .compatible = "amlogic,meson8m2-pwrc", 585 563 .data = &meson_ee_m8b_pwrc_data, 564 + }, 565 + { 566 + .compatible = "amlogic,meson-axg-pwrc", 567 + .data = &meson_ee_axg_pwrc_data, 586 568 }, 587 569 { 588 570 .compatible = "amlogic,meson-gxbb-pwrc",
+2 -2
drivers/soc/amlogic/meson-gx-pwrc-vpu.c
··· 339 339 return ret; 340 340 } 341 341 342 - pm_genpd_init(&vpu_pd->genpd, &pm_domain_always_on_gov, 343 - powered_off); 342 + vpu_pd->genpd.flags = GENPD_FLAG_ALWAYS_ON; 343 + pm_genpd_init(&vpu_pd->genpd, NULL, powered_off); 344 344 345 345 return of_genpd_add_provider_simple(pdev->dev.of_node, 346 346 &vpu_pd->genpd);
+10
drivers/soc/bcm/Kconfig
··· 22 22 This enables support for the RPi power domains which can be enabled 23 23 or disabled via the RPi firmware. 24 24 25 + config SOC_BCM63XX 26 + bool "Broadcom 63xx SoC drivers" 27 + depends on BMIPS_GENERIC || COMPILE_TEST 28 + help 29 + Enables drivers for the Broadcom 63xx series of chips. 30 + Drivers can be enabled individually within this menu. 31 + 32 + If unsure, say N. 33 + 25 34 config SOC_BRCMSTB 26 35 bool "Broadcom STB SoC drivers" 27 36 depends on ARM || ARM64 || BMIPS_GENERIC || COMPILE_TEST ··· 42 33 43 34 If unsure, say N. 44 35 36 + source "drivers/soc/bcm/bcm63xx/Kconfig" 45 37 source "drivers/soc/bcm/brcmstb/Kconfig" 46 38 47 39 endmenu
+1
drivers/soc/bcm/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 obj-$(CONFIG_BCM2835_POWER) += bcm2835-power.o 3 3 obj-$(CONFIG_RASPBERRYPI_POWER) += raspberrypi-power.o 4 + obj-$(CONFIG_SOC_BCM63XX) += bcm63xx/ 4 5 obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/
+12
drivers/soc/bcm/bcm63xx/Kconfig
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + if SOC_BCM63XX 3 + 4 + config BCM63XX_POWER 5 + bool "BCM63xx power domain driver" 6 + depends on BMIPS_GENERIC || (COMPILE_TEST && OF) 7 + select PM_GENERIC_DOMAINS if PM 8 + help 9 + This enables support for the BCM63xx power domains controller on 10 + BCM6318, BCM6328, BCM6362 and BCM63268 SoCs. 11 + 12 + endif # SOC_BCM63XX
+2
drivers/soc/bcm/bcm63xx/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + obj-$(CONFIG_BCM63XX_POWER) += bcm63xx-power.o
+378
drivers/soc/bcm/bcm63xx/bcm63xx-power.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * BCM63xx Power Domain Controller Driver 4 + * 5 + * Copyright (C) 2020 Álvaro Fernández Rojas <noltari@gmail.com> 6 + */ 7 + 8 + #include <dt-bindings/soc/bcm6318-pm.h> 9 + #include <dt-bindings/soc/bcm6328-pm.h> 10 + #include <dt-bindings/soc/bcm6362-pm.h> 11 + #include <dt-bindings/soc/bcm63268-pm.h> 12 + #include <linux/io.h> 13 + #include <linux/module.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/pm_domain.h> 16 + #include <linux/of.h> 17 + #include <linux/of_device.h> 18 + 19 + struct bcm63xx_power_dev { 20 + struct generic_pm_domain genpd; 21 + struct bcm63xx_power *power; 22 + uint32_t mask; 23 + }; 24 + 25 + struct bcm63xx_power { 26 + void __iomem *base; 27 + spinlock_t lock; 28 + struct bcm63xx_power_dev *dev; 29 + struct genpd_onecell_data genpd_data; 30 + struct generic_pm_domain **genpd; 31 + }; 32 + 33 + struct bcm63xx_power_data { 34 + const char * const name; 35 + uint8_t bit; 36 + unsigned int flags; 37 + }; 38 + 39 + static int bcm63xx_power_get_state(struct bcm63xx_power_dev *pmd, bool *is_on) 40 + { 41 + struct bcm63xx_power *power = pmd->power; 42 + 43 + if (!pmd->mask) { 44 + *is_on = false; 45 + return -EINVAL; 46 + } 47 + 48 + *is_on = !(__raw_readl(power->base) & pmd->mask); 49 + 50 + return 0; 51 + } 52 + 53 + static int bcm63xx_power_set_state(struct bcm63xx_power_dev *pmd, bool on) 54 + { 55 + struct bcm63xx_power *power = pmd->power; 56 + unsigned long flags; 57 + uint32_t val; 58 + 59 + if (!pmd->mask) 60 + return -EINVAL; 61 + 62 + spin_lock_irqsave(&power->lock, flags); 63 + val = __raw_readl(power->base); 64 + if (on) 65 + val &= ~pmd->mask; 66 + else 67 + val |= pmd->mask; 68 + __raw_writel(val, power->base); 69 + spin_unlock_irqrestore(&power->lock, flags); 70 + 71 + return 0; 72 + } 73 + 74 + static int bcm63xx_power_on(struct generic_pm_domain *genpd) 75 + { 76 + struct bcm63xx_power_dev *pmd = container_of(genpd, 77 + struct bcm63xx_power_dev, genpd); 78 + 79 + return bcm63xx_power_set_state(pmd, true); 80 + } 81 + 82 + static int bcm63xx_power_off(struct generic_pm_domain *genpd) 83 + { 84 + struct bcm63xx_power_dev *pmd = container_of(genpd, 85 + struct bcm63xx_power_dev, genpd); 86 + 87 + return bcm63xx_power_set_state(pmd, false); 88 + } 89 + 90 + static int bcm63xx_power_probe(struct platform_device *pdev) 91 + { 92 + struct device *dev = &pdev->dev; 93 + struct device_node *np = dev->of_node; 94 + struct resource *res; 95 + const struct bcm63xx_power_data *entry, *table; 96 + struct bcm63xx_power *power; 97 + unsigned int ndom; 98 + uint8_t max_bit = 0; 99 + int ret; 100 + 101 + power = devm_kzalloc(dev, sizeof(*power), GFP_KERNEL); 102 + if (!power) 103 + return -ENOMEM; 104 + 105 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 106 + power->base = devm_ioremap_resource(&pdev->dev, res); 107 + if (IS_ERR(power->base)) 108 + return PTR_ERR(power->base); 109 + 110 + table = of_device_get_match_data(dev); 111 + if (!table) 112 + return -EINVAL; 113 + 114 + power->genpd_data.num_domains = 0; 115 + ndom = 0; 116 + for (entry = table; entry->name; entry++) { 117 + max_bit = max(max_bit, entry->bit); 118 + ndom++; 119 + } 120 + 121 + if (!ndom) 122 + return -ENODEV; 123 + 124 + power->genpd_data.num_domains = max_bit + 1; 125 + 126 + power->dev = devm_kcalloc(dev, power->genpd_data.num_domains, 127 + sizeof(struct bcm63xx_power_dev), 128 + GFP_KERNEL); 129 + if (!power->dev) 130 + return -ENOMEM; 131 + 132 + power->genpd = devm_kcalloc(dev, power->genpd_data.num_domains, 133 + sizeof(struct generic_pm_domain *), 134 + GFP_KERNEL); 135 + if (!power->genpd) 136 + return -ENOMEM; 137 + 138 + power->genpd_data.domains = power->genpd; 139 + 140 + ndom = 0; 141 + for (entry = table; entry->name; entry++) { 142 + struct bcm63xx_power_dev *pmd = &power->dev[ndom]; 143 + bool is_on; 144 + 145 + pmd->power = power; 146 + pmd->mask = BIT(entry->bit); 147 + pmd->genpd.name = entry->name; 148 + pmd->genpd.flags = entry->flags; 149 + 150 + ret = bcm63xx_power_get_state(pmd, &is_on); 151 + if (ret) 152 + dev_warn(dev, "unable to get current state for %s\n", 153 + pmd->genpd.name); 154 + 155 + pmd->genpd.power_on = bcm63xx_power_on; 156 + pmd->genpd.power_off = bcm63xx_power_off; 157 + 158 + pm_genpd_init(&pmd->genpd, NULL, !is_on); 159 + power->genpd[entry->bit] = &pmd->genpd; 160 + 161 + ndom++; 162 + } 163 + 164 + spin_lock_init(&power->lock); 165 + 166 + ret = of_genpd_add_provider_onecell(np, &power->genpd_data); 167 + if (ret) { 168 + dev_err(dev, "failed to register genpd driver: %d\n", ret); 169 + return ret; 170 + } 171 + 172 + dev_info(dev, "registered %u power domains\n", ndom); 173 + 174 + return 0; 175 + } 176 + 177 + static const struct bcm63xx_power_data bcm6318_power_domains[] = { 178 + { 179 + .name = "pcie", 180 + .bit = BCM6318_POWER_DOMAIN_PCIE, 181 + }, { 182 + .name = "usb", 183 + .bit = BCM6318_POWER_DOMAIN_USB, 184 + }, { 185 + .name = "ephy0", 186 + .bit = BCM6318_POWER_DOMAIN_EPHY0, 187 + }, { 188 + .name = "ephy1", 189 + .bit = BCM6318_POWER_DOMAIN_EPHY1, 190 + }, { 191 + .name = "ephy2", 192 + .bit = BCM6318_POWER_DOMAIN_EPHY2, 193 + }, { 194 + .name = "ephy3", 195 + .bit = BCM6318_POWER_DOMAIN_EPHY3, 196 + }, { 197 + .name = "ldo2p5", 198 + .bit = BCM6318_POWER_DOMAIN_LDO2P5, 199 + .flags = GENPD_FLAG_ALWAYS_ON, 200 + }, { 201 + .name = "ldo2p9", 202 + .bit = BCM6318_POWER_DOMAIN_LDO2P9, 203 + .flags = GENPD_FLAG_ALWAYS_ON, 204 + }, { 205 + .name = "sw1p0", 206 + .bit = BCM6318_POWER_DOMAIN_SW1P0, 207 + .flags = GENPD_FLAG_ALWAYS_ON, 208 + }, { 209 + .name = "pad", 210 + .bit = BCM6318_POWER_DOMAIN_PAD, 211 + .flags = GENPD_FLAG_ALWAYS_ON, 212 + }, { 213 + /* sentinel */ 214 + }, 215 + }; 216 + 217 + static const struct bcm63xx_power_data bcm6328_power_domains[] = { 218 + { 219 + .name = "adsl2-mips", 220 + .bit = BCM6328_POWER_DOMAIN_ADSL2_MIPS, 221 + }, { 222 + .name = "adsl2-phy", 223 + .bit = BCM6328_POWER_DOMAIN_ADSL2_PHY, 224 + }, { 225 + .name = "adsl2-afe", 226 + .bit = BCM6328_POWER_DOMAIN_ADSL2_AFE, 227 + }, { 228 + .name = "sar", 229 + .bit = BCM6328_POWER_DOMAIN_SAR, 230 + }, { 231 + .name = "pcm", 232 + .bit = BCM6328_POWER_DOMAIN_PCM, 233 + }, { 234 + .name = "usbd", 235 + .bit = BCM6328_POWER_DOMAIN_USBD, 236 + }, { 237 + .name = "usbh", 238 + .bit = BCM6328_POWER_DOMAIN_USBH, 239 + }, { 240 + .name = "pcie", 241 + .bit = BCM6328_POWER_DOMAIN_PCIE, 242 + }, { 243 + .name = "robosw", 244 + .bit = BCM6328_POWER_DOMAIN_ROBOSW, 245 + }, { 246 + .name = "ephy", 247 + .bit = BCM6328_POWER_DOMAIN_EPHY, 248 + }, { 249 + /* sentinel */ 250 + }, 251 + }; 252 + 253 + static const struct bcm63xx_power_data bcm6362_power_domains[] = { 254 + { 255 + .name = "sar", 256 + .bit = BCM6362_POWER_DOMAIN_SAR, 257 + }, { 258 + .name = "ipsec", 259 + .bit = BCM6362_POWER_DOMAIN_IPSEC, 260 + }, { 261 + .name = "mips", 262 + .bit = BCM6362_POWER_DOMAIN_MIPS, 263 + .flags = GENPD_FLAG_ALWAYS_ON, 264 + }, { 265 + .name = "dect", 266 + .bit = BCM6362_POWER_DOMAIN_DECT, 267 + }, { 268 + .name = "usbh", 269 + .bit = BCM6362_POWER_DOMAIN_USBH, 270 + }, { 271 + .name = "usbd", 272 + .bit = BCM6362_POWER_DOMAIN_USBD, 273 + }, { 274 + .name = "robosw", 275 + .bit = BCM6362_POWER_DOMAIN_ROBOSW, 276 + }, { 277 + .name = "pcm", 278 + .bit = BCM6362_POWER_DOMAIN_PCM, 279 + }, { 280 + .name = "periph", 281 + .bit = BCM6362_POWER_DOMAIN_PERIPH, 282 + .flags = GENPD_FLAG_ALWAYS_ON, 283 + }, { 284 + .name = "adsl-phy", 285 + .bit = BCM6362_POWER_DOMAIN_ADSL_PHY, 286 + }, { 287 + .name = "gmii-pads", 288 + .bit = BCM6362_POWER_DOMAIN_GMII_PADS, 289 + }, { 290 + .name = "fap", 291 + .bit = BCM6362_POWER_DOMAIN_FAP, 292 + }, { 293 + .name = "pcie", 294 + .bit = BCM6362_POWER_DOMAIN_PCIE, 295 + }, { 296 + .name = "wlan-pads", 297 + .bit = BCM6362_POWER_DOMAIN_WLAN_PADS, 298 + }, { 299 + /* sentinel */ 300 + }, 301 + }; 302 + 303 + static const struct bcm63xx_power_data bcm63268_power_domains[] = { 304 + { 305 + .name = "sar", 306 + .bit = BCM63268_POWER_DOMAIN_SAR, 307 + }, { 308 + .name = "ipsec", 309 + .bit = BCM63268_POWER_DOMAIN_IPSEC, 310 + }, { 311 + .name = "mips", 312 + .bit = BCM63268_POWER_DOMAIN_MIPS, 313 + .flags = GENPD_FLAG_ALWAYS_ON, 314 + }, { 315 + .name = "dect", 316 + .bit = BCM63268_POWER_DOMAIN_DECT, 317 + }, { 318 + .name = "usbh", 319 + .bit = BCM63268_POWER_DOMAIN_USBH, 320 + }, { 321 + .name = "usbd", 322 + .bit = BCM63268_POWER_DOMAIN_USBD, 323 + }, { 324 + .name = "robosw", 325 + .bit = BCM63268_POWER_DOMAIN_ROBOSW, 326 + }, { 327 + .name = "pcm", 328 + .bit = BCM63268_POWER_DOMAIN_PCM, 329 + }, { 330 + .name = "periph", 331 + .bit = BCM63268_POWER_DOMAIN_PERIPH, 332 + .flags = GENPD_FLAG_ALWAYS_ON, 333 + }, { 334 + .name = "vdsl-phy", 335 + .bit = BCM63268_POWER_DOMAIN_VDSL_PHY, 336 + }, { 337 + .name = "vdsl-mips", 338 + .bit = BCM63268_POWER_DOMAIN_VDSL_MIPS, 339 + }, { 340 + .name = "fap", 341 + .bit = BCM63268_POWER_DOMAIN_FAP, 342 + }, { 343 + .name = "pcie", 344 + .bit = BCM63268_POWER_DOMAIN_PCIE, 345 + }, { 346 + .name = "wlan-pads", 347 + .bit = BCM63268_POWER_DOMAIN_WLAN_PADS, 348 + }, { 349 + /* sentinel */ 350 + }, 351 + }; 352 + 353 + static const struct of_device_id bcm63xx_power_of_match[] = { 354 + { 355 + .compatible = "brcm,bcm6318-power-controller", 356 + .data = &bcm6318_power_domains, 357 + }, { 358 + .compatible = "brcm,bcm6328-power-controller", 359 + .data = &bcm6328_power_domains, 360 + }, { 361 + .compatible = "brcm,bcm6362-power-controller", 362 + .data = &bcm6362_power_domains, 363 + }, { 364 + .compatible = "brcm,bcm63268-power-controller", 365 + .data = &bcm63268_power_domains, 366 + }, { 367 + /* sentinel */ 368 + } 369 + }; 370 + 371 + static struct platform_driver bcm63xx_power_driver = { 372 + .driver = { 373 + .name = "bcm63xx-power-controller", 374 + .of_match_table = bcm63xx_power_of_match, 375 + }, 376 + .probe = bcm63xx_power_probe, 377 + }; 378 + builtin_platform_driver(bcm63xx_power_driver);
+95 -10
drivers/soc/bcm/brcmstb/biuctrl.c
··· 13 13 #include <linux/syscore_ops.h> 14 14 #include <linux/soc/brcmstb/brcmstb.h> 15 15 16 + #define RACENPREF_MASK 0x3 17 + #define RACPREFINST_SHIFT 0 18 + #define RACENINST_SHIFT 2 19 + #define RACPREFDATA_SHIFT 4 20 + #define RACENDATA_SHIFT 6 21 + #define RAC_CPU_SHIFT 8 22 + #define RACCFG_MASK 0xff 23 + #define DPREF_LINE_2_SHIFT 24 24 + #define DPREF_LINE_2_MASK 0xff 25 + 26 + /* Bitmask to enable instruction and data prefetching with a 256-bytes stride */ 27 + #define RAC_DATA_INST_EN_MASK (1 << RACPREFINST_SHIFT | \ 28 + RACENPREF_MASK << RACENINST_SHIFT | \ 29 + 1 << RACPREFDATA_SHIFT | \ 30 + RACENPREF_MASK << RACENDATA_SHIFT) 31 + 16 32 #define CPU_CREDIT_REG_MCPx_WR_PAIRING_EN_MASK 0x70000000 17 33 #define CPU_CREDIT_REG_MCPx_READ_CRED_MASK 0xf 18 34 #define CPU_CREDIT_REG_MCPx_WRITE_CRED_MASK 0xf ··· 47 31 static bool mcp_wr_pairing_en; 48 32 static const int *cpubiuctrl_regs; 49 33 34 + enum cpubiuctrl_regs { 35 + CPU_CREDIT_REG = 0, 36 + CPU_MCP_FLOW_REG, 37 + CPU_WRITEBACK_CTRL_REG, 38 + RAC_CONFIG0_REG, 39 + RAC_CONFIG1_REG, 40 + NUM_CPU_BIUCTRL_REGS, 41 + }; 42 + 50 43 static inline u32 cbc_readl(int reg) 51 44 { 52 45 int offset = cpubiuctrl_regs[reg]; 53 46 54 - if (offset == -1) 47 + if (offset == -1 || 48 + (IS_ENABLED(CONFIG_CACHE_B15_RAC) && reg >= RAC_CONFIG0_REG)) 55 49 return (u32)-1; 56 50 57 51 return readl_relaxed(cpubiuctrl_base + offset); ··· 71 45 { 72 46 int offset = cpubiuctrl_regs[reg]; 73 47 74 - if (offset == -1) 48 + if (offset == -1 || 49 + (IS_ENABLED(CONFIG_CACHE_B15_RAC) && reg >= RAC_CONFIG0_REG)) 75 50 return; 76 51 77 52 writel(val, cpubiuctrl_base + offset); 78 53 } 79 54 80 - enum cpubiuctrl_regs { 81 - CPU_CREDIT_REG = 0, 82 - CPU_MCP_FLOW_REG, 83 - CPU_WRITEBACK_CTRL_REG 84 - }; 85 - 86 55 static const int b15_cpubiuctrl_regs[] = { 87 56 [CPU_CREDIT_REG] = 0x184, 88 57 [CPU_MCP_FLOW_REG] = -1, 89 58 [CPU_WRITEBACK_CTRL_REG] = -1, 59 + [RAC_CONFIG0_REG] = -1, 60 + [RAC_CONFIG1_REG] = -1, 90 61 }; 91 62 92 63 /* Odd cases, e.g: 7260A0 */ ··· 91 68 [CPU_CREDIT_REG] = 0x0b0, 92 69 [CPU_MCP_FLOW_REG] = 0x0b4, 93 70 [CPU_WRITEBACK_CTRL_REG] = -1, 71 + [RAC_CONFIG0_REG] = 0x78, 72 + [RAC_CONFIG1_REG] = 0x7c, 94 73 }; 95 74 96 75 static const int b53_cpubiuctrl_regs[] = { 97 76 [CPU_CREDIT_REG] = 0x0b0, 98 77 [CPU_MCP_FLOW_REG] = 0x0b4, 99 78 [CPU_WRITEBACK_CTRL_REG] = 0x22c, 79 + [RAC_CONFIG0_REG] = 0x78, 80 + [RAC_CONFIG1_REG] = 0x7c, 100 81 }; 101 82 102 83 static const int a72_cpubiuctrl_regs[] = { 103 84 [CPU_CREDIT_REG] = 0x18, 104 85 [CPU_MCP_FLOW_REG] = 0x1c, 105 86 [CPU_WRITEBACK_CTRL_REG] = 0x20, 87 + [RAC_CONFIG0_REG] = 0x08, 88 + [RAC_CONFIG1_REG] = 0x0c, 106 89 }; 107 - 108 - #define NUM_CPU_BIUCTRL_REGS 3 109 90 110 91 static int __init mcp_write_pairing_set(void) 111 92 { ··· 137 110 static const u32 a72_b53_mach_compat[] = { 138 111 0x7211, 139 112 0x7216, 113 + 0x72164, 114 + 0x72165, 140 115 0x7255, 141 116 0x7260, 142 117 0x7268, 143 118 0x7271, 144 119 0x7278, 145 120 }; 121 + 122 + /* The read-ahead cache present in the Brahma-B53 CPU is a special piece of 123 + * hardware after the integrated L2 cache of the B53 CPU complex whose purpose 124 + * is to prefetch instruction and/or data with a line size of either 64 bytes 125 + * or 256 bytes. The rationale is that the data-bus of the CPU interface is 126 + * optimized for 256-byte transactions, and enabling the read-ahead cache 127 + * provides a significant performance boost (typically twice the performance 128 + * for a memcpy benchmark application). 129 + * 130 + * The read-ahead cache is transparent for Virtual Address cache maintenance 131 + * operations: IC IVAU, DC IVAC, DC CVAC, DC CVAU and DC CIVAC. So no special 132 + * handling is needed for the DMA API above and beyond what is included in the 133 + * arm64 implementation. 134 + * 135 + * In addition, since the Point of Unification is typically between L1 and L2 136 + * for the Brahma-B53 processor no special read-ahead cache handling is needed 137 + * for the IC IALLU and IC IALLUIS cache maintenance operations. 138 + * 139 + * However, it is not possible to specify the cache level (L3) for the cache 140 + * maintenance instructions operating by set/way to operate on the read-ahead 141 + * cache. The read-ahead cache will maintain coherency when inner cache lines 142 + * are cleaned by set/way, but if it is necessary to invalidate inner cache 143 + * lines by set/way to maintain coherency with system masters operating on 144 + * shared memory that does not have hardware support for coherency, then it 145 + * will also be necessary to explicitly invalidate the read-ahead cache. 146 + */ 147 + static void __init a72_b53_rac_enable_all(struct device_node *np) 148 + { 149 + unsigned int cpu; 150 + u32 enable = 0, pref_dist, shift; 151 + 152 + if (IS_ENABLED(CONFIG_CACHE_B15_RAC)) 153 + return; 154 + 155 + if (WARN(num_possible_cpus() > 4, "RAC only supports 4 CPUs\n")) 156 + return; 157 + 158 + pref_dist = cbc_readl(RAC_CONFIG1_REG); 159 + for_each_possible_cpu(cpu) { 160 + shift = cpu * RAC_CPU_SHIFT + RACPREFDATA_SHIFT; 161 + enable |= RAC_DATA_INST_EN_MASK << (cpu * RAC_CPU_SHIFT); 162 + if (cpubiuctrl_regs == a72_cpubiuctrl_regs) { 163 + enable &= ~(RACENPREF_MASK << shift); 164 + enable |= 3 << shift; 165 + pref_dist |= 1 << (cpu + DPREF_LINE_2_SHIFT); 166 + } 167 + } 168 + 169 + cbc_writel(enable, RAC_CONFIG0_REG); 170 + cbc_writel(pref_dist, RAC_CONFIG1_REG); 171 + 172 + pr_info("%pOF: Broadcom %s read-ahead cache\n", 173 + np, cpubiuctrl_regs == a72_cpubiuctrl_regs ? 174 + "Cortex-A72" : "Brahma-B53"); 175 + } 146 176 147 177 static void __init mcp_a72_b53_set(void) 148 178 { ··· 346 262 return ret; 347 263 } 348 264 265 + a72_b53_rac_enable_all(np); 349 266 mcp_a72_b53_set(); 350 267 #ifdef CONFIG_PM_SLEEP 351 268 register_syscore_ops(&brcmstb_cpu_credit_syscore_ops);
-2
drivers/soc/fsl/dpio/qbman-portal.c
··· 647 647 const uint32_t *cl = (uint32_t *)d; 648 648 uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask; 649 649 int i, num_enqueued = 0; 650 - uint64_t addr_cena; 651 650 652 651 spin_lock(&s->access_spinlock); 653 652 half_mask = (s->eqcr.pi_ci_mask>>1); ··· 700 701 701 702 /* Flush all the cacheline without load/store in between */ 702 703 eqcr_pi = s->eqcr.pi; 703 - addr_cena = (size_t)s->addr_cena; 704 704 for (i = 0; i < num_enqueued; i++) 705 705 eqcr_pi++; 706 706 s->eqcr.pi = eqcr_pi & full_mask;
+1 -1
drivers/soc/fsl/qbman/bman.c
··· 660 660 } 661 661 done: 662 662 put_affine_portal(); 663 - return 0; 663 + return err; 664 664 } 665 665 666 666 struct gen_pool *bm_bpalloc;
+1 -1
drivers/soc/fsl/qbman/qman_test_api.c
··· 86 86 len--; 87 87 qm_fd_set_param(fd, fmt, off, len); 88 88 89 - fd->cmd = cpu_to_be32(be32_to_cpu(fd->cmd) + 1); 89 + be32_add_cpu(&fd->cmd, 1); 90 90 } 91 91 92 92 /* The only part of the 'fd' we can't memcmp() is the ppid */
+1 -1
drivers/soc/fsl/qe/ucc.c
··· 523 523 524 524 qe_mux_reg = &qe_immr->qmx; 525 525 526 - if (tdm_num > 7 || tdm_num < 0) 526 + if (tdm_num > 7) 527 527 return -EINVAL; 528 528 529 529 /* The communications direction must be RX or TX */
+5 -10
drivers/soc/imx/gpcv2.c
··· 487 487 488 488 domain->regulator = devm_regulator_get_optional(domain->dev, "power"); 489 489 if (IS_ERR(domain->regulator)) { 490 - if (PTR_ERR(domain->regulator) != -ENODEV) { 491 - if (PTR_ERR(domain->regulator) != -EPROBE_DEFER) 492 - dev_err(domain->dev, "Failed to get domain's regulator\n"); 493 - return PTR_ERR(domain->regulator); 494 - } 490 + if (PTR_ERR(domain->regulator) != -ENODEV) 491 + return dev_err_probe(domain->dev, PTR_ERR(domain->regulator), 492 + "Failed to get domain's regulator\n"); 495 493 } else if (domain->voltage) { 496 494 regulator_set_voltage(domain->regulator, 497 495 domain->voltage, domain->voltage); 498 496 } 499 497 500 498 ret = imx_pgc_get_clocks(domain); 501 - if (ret) { 502 - if (ret != -EPROBE_DEFER) 503 - dev_err(domain->dev, "Failed to get domain's clocks\n"); 504 - return ret; 505 - } 499 + if (ret) 500 + return dev_err_probe(domain->dev, ret, "Failed to get domain's clocks\n"); 506 501 507 502 ret = pm_genpd_init(&domain->genpd, NULL, true); 508 503 if (ret) {
+110 -3
drivers/soc/mediatek/mtk-cmdq-helper.c
··· 13 13 #define CMDQ_POLL_ENABLE_MASK BIT(0) 14 14 #define CMDQ_EOC_IRQ_EN BIT(0) 15 15 #define CMDQ_REG_TYPE 1 16 + #define CMDQ_JUMP_RELATIVE 1 16 17 17 18 struct cmdq_instruction { 18 19 union { 19 20 u32 value; 20 21 u32 mask; 22 + struct { 23 + u16 arg_c; 24 + u16 src_reg; 25 + }; 21 26 }; 22 27 union { 23 28 u16 offset; ··· 228 223 } 229 224 EXPORT_SYMBOL(cmdq_pkt_write_mask); 230 225 231 - int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event) 226 + int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, u16 addr_low, 227 + u16 reg_idx) 228 + { 229 + struct cmdq_instruction inst = {}; 230 + 231 + inst.op = CMDQ_CODE_READ_S; 232 + inst.dst_t = CMDQ_REG_TYPE; 233 + inst.sop = high_addr_reg_idx; 234 + inst.reg_dst = reg_idx; 235 + inst.src_reg = addr_low; 236 + 237 + return cmdq_pkt_append_command(pkt, inst); 238 + } 239 + EXPORT_SYMBOL(cmdq_pkt_read_s); 240 + 241 + int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, 242 + u16 addr_low, u16 src_reg_idx) 243 + { 244 + struct cmdq_instruction inst = {}; 245 + 246 + inst.op = CMDQ_CODE_WRITE_S; 247 + inst.src_t = CMDQ_REG_TYPE; 248 + inst.sop = high_addr_reg_idx; 249 + inst.offset = addr_low; 250 + inst.src_reg = src_reg_idx; 251 + 252 + return cmdq_pkt_append_command(pkt, inst); 253 + } 254 + EXPORT_SYMBOL(cmdq_pkt_write_s); 255 + 256 + int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, 257 + u16 addr_low, u16 src_reg_idx, u32 mask) 258 + { 259 + struct cmdq_instruction inst = {}; 260 + int err; 261 + 262 + inst.op = CMDQ_CODE_MASK; 263 + inst.mask = ~mask; 264 + err = cmdq_pkt_append_command(pkt, inst); 265 + if (err < 0) 266 + return err; 267 + 268 + inst.mask = 0; 269 + inst.op = CMDQ_CODE_WRITE_S_MASK; 270 + inst.src_t = CMDQ_REG_TYPE; 271 + inst.sop = high_addr_reg_idx; 272 + inst.offset = addr_low; 273 + inst.src_reg = src_reg_idx; 274 + 275 + return cmdq_pkt_append_command(pkt, inst); 276 + } 277 + EXPORT_SYMBOL(cmdq_pkt_write_s_mask); 278 + 279 + int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, 280 + u16 addr_low, u32 value) 281 + { 282 + struct cmdq_instruction inst = {}; 283 + 284 + inst.op = CMDQ_CODE_WRITE_S; 285 + inst.sop = high_addr_reg_idx; 286 + inst.offset = addr_low; 287 + inst.value = value; 288 + 289 + return cmdq_pkt_append_command(pkt, inst); 290 + } 291 + EXPORT_SYMBOL(cmdq_pkt_write_s_value); 292 + 293 + int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, 294 + u16 addr_low, u32 value, u32 mask) 295 + { 296 + struct cmdq_instruction inst = {}; 297 + int err; 298 + 299 + inst.op = CMDQ_CODE_MASK; 300 + inst.mask = ~mask; 301 + err = cmdq_pkt_append_command(pkt, inst); 302 + if (err < 0) 303 + return err; 304 + 305 + inst.op = CMDQ_CODE_WRITE_S_MASK; 306 + inst.sop = high_addr_reg_idx; 307 + inst.offset = addr_low; 308 + inst.value = value; 309 + 310 + return cmdq_pkt_append_command(pkt, inst); 311 + } 312 + EXPORT_SYMBOL(cmdq_pkt_write_s_mask_value); 313 + 314 + int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear) 232 315 { 233 316 struct cmdq_instruction inst = { {0} }; 317 + u32 clear_option = clear ? CMDQ_WFE_UPDATE : 0; 234 318 235 319 if (event >= CMDQ_MAX_EVENT) 236 320 return -EINVAL; 237 321 238 322 inst.op = CMDQ_CODE_WFE; 239 - inst.value = CMDQ_WFE_OPTION; 323 + inst.value = CMDQ_WFE_OPTION | clear_option; 240 324 inst.event = event; 241 325 242 326 return cmdq_pkt_append_command(pkt, inst); ··· 409 315 } 410 316 EXPORT_SYMBOL(cmdq_pkt_assign); 411 317 318 + int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) 319 + { 320 + struct cmdq_instruction inst = {}; 321 + 322 + inst.op = CMDQ_CODE_JUMP; 323 + inst.offset = CMDQ_JUMP_RELATIVE; 324 + inst.value = addr >> 325 + cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); 326 + return cmdq_pkt_append_command(pkt, inst); 327 + } 328 + EXPORT_SYMBOL(cmdq_pkt_jump); 329 + 412 330 int cmdq_pkt_finalize(struct cmdq_pkt *pkt) 413 331 { 414 332 struct cmdq_instruction inst = { {0} }; ··· 435 329 436 330 /* JUMP to end */ 437 331 inst.op = CMDQ_CODE_JUMP; 438 - inst.value = CMDQ_JUMP_PASS; 332 + inst.value = CMDQ_JUMP_PASS >> 333 + cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); 439 334 err = cmdq_pkt_append_command(pkt, inst); 440 335 441 336 return err;
+2 -2
drivers/soc/mediatek/mtk-infracfg.c
··· 19 19 20 20 /** 21 21 * mtk_infracfg_set_bus_protection - enable bus protection 22 - * @regmap: The infracfg regmap 22 + * @infracfg: The infracfg regmap 23 23 * @mask: The mask containing the protection bits to be enabled. 24 24 * @reg_update: The boolean flag determines to set the protection bits 25 25 * by regmap_update_bits with enable register(PROTECTEN) or ··· 50 50 51 51 /** 52 52 * mtk_infracfg_clear_bus_protection - disable bus protection 53 - * @regmap: The infracfg regmap 53 + * @infracfg: The infracfg regmap 54 54 * @mask: The mask containing the protection bits to be disabled. 55 55 * @reg_update: The boolean flag determines to clear the protection bits 56 56 * by regmap_update_bits with enable register(PROTECTEN) or
+1 -1
drivers/soc/qcom/apr.c
··· 328 328 329 329 pds = pdr_add_lookup(apr->pdr, service_name, service_path); 330 330 if (IS_ERR(pds) && PTR_ERR(pds) != -EALREADY) { 331 - dev_err(dev, "pdr add lookup failed: %d\n", ret); 331 + dev_err(dev, "pdr add lookup failed: %ld\n", PTR_ERR(pds)); 332 332 return PTR_ERR(pds); 333 333 } 334 334 }
+1 -6
drivers/soc/qcom/llcc-qcom.c
··· 387 387 static struct regmap *qcom_llcc_init_mmio(struct platform_device *pdev, 388 388 const char *name) 389 389 { 390 - struct resource *res; 391 390 void __iomem *base; 392 391 struct regmap_config llcc_regmap_config = { 393 392 .reg_bits = 32, ··· 395 396 .fast_io = true, 396 397 }; 397 398 398 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); 399 - if (!res) 400 - return ERR_PTR(-ENODEV); 401 - 402 - base = devm_ioremap_resource(&pdev->dev, res); 399 + base = devm_platform_ioremap_resource_byname(pdev, name); 403 400 if (IS_ERR(base)) 404 401 return ERR_CAST(base); 405 402
+4
drivers/soc/qcom/rpmh-internal.h
··· 8 8 #define __RPM_INTERNAL_H__ 9 9 10 10 #include <linux/bitmap.h> 11 + #include <linux/wait.h> 11 12 #include <soc/qcom/tcs.h> 12 13 13 14 #define TCS_TYPE_NR 4 ··· 107 106 * @lock: Synchronize state of the controller. If RPMH's cache 108 107 * lock will also be held, the order is: drv->lock then 109 108 * cache_lock. 109 + * @tcs_wait: Wait queue used to wait for @tcs_in_use to free up a 110 + * slot 110 111 * @client: Handle to the DRV's client. 111 112 */ 112 113 struct rsc_drv { ··· 121 118 struct tcs_group tcs[TCS_TYPE_NR]; 122 119 DECLARE_BITMAP(tcs_in_use, MAX_TCS_NR); 123 120 spinlock_t lock; 121 + wait_queue_head_t tcs_wait; 124 122 struct rpmh_ctrlr client; 125 123 }; 126 124
+55 -62
drivers/soc/qcom/rpmh-rsc.c
··· 19 19 #include <linux/platform_device.h> 20 20 #include <linux/slab.h> 21 21 #include <linux/spinlock.h> 22 + #include <linux/wait.h> 22 23 23 24 #include <soc/qcom/cmd-db.h> 24 25 #include <soc/qcom/tcs.h> ··· 454 453 if (!drv->tcs[ACTIVE_TCS].num_tcs) 455 454 enable_tcs_irq(drv, i, false); 456 455 spin_unlock(&drv->lock); 456 + wake_up(&drv->tcs_wait); 457 457 if (req) 458 458 rpmh_tx_done(req, err); 459 459 } ··· 573 571 } 574 572 575 573 /** 576 - * tcs_write() - Store messages into a TCS right now, or return -EBUSY. 574 + * claim_tcs_for_req() - Claim a tcs in the given tcs_group; only for active. 577 575 * @drv: The controller. 576 + * @tcs: The tcs_group used for ACTIVE_ONLY transfers. 578 577 * @msg: The data to be sent. 579 578 * 580 - * Grabs a TCS for ACTIVE_ONLY transfers and writes the messages to it. 579 + * Claims a tcs in the given tcs_group while making sure that no existing cmd 580 + * is in flight that would conflict with the one in @msg. 581 581 * 582 - * If there are no free TCSes for ACTIVE_ONLY transfers or if a command for 583 - * the same address is already transferring returns -EBUSY which means the 584 - * client should retry shortly. 582 + * Context: Must be called with the drv->lock held since that protects 583 + * tcs_in_use. 585 584 * 586 - * Return: 0 on success, -EBUSY if client should retry, or an error. 587 - * Client should have interrupts enabled for a bit before retrying. 585 + * Return: The id of the claimed tcs or -EBUSY if a matching msg is in flight 586 + * or the tcs_group is full. 588 587 */ 589 - static int tcs_write(struct rsc_drv *drv, const struct tcs_request *msg) 588 + static int claim_tcs_for_req(struct rsc_drv *drv, struct tcs_group *tcs, 589 + const struct tcs_request *msg) 590 590 { 591 - struct tcs_group *tcs; 592 - int tcs_id; 593 - unsigned long flags; 594 591 int ret; 595 592 596 - tcs = get_tcs_for_msg(drv, msg); 597 - if (IS_ERR(tcs)) 598 - return PTR_ERR(tcs); 599 - 600 - spin_lock_irqsave(&drv->lock, flags); 601 593 /* 602 594 * The h/w does not like if we send a request to the same address, 603 595 * when one is already in-flight or being processed. 604 596 */ 605 597 ret = check_for_req_inflight(drv, tcs, msg); 606 598 if (ret) 607 - goto unlock; 599 + return ret; 608 600 609 - ret = find_free_tcs(tcs); 610 - if (ret < 0) 611 - goto unlock; 612 - tcs_id = ret; 601 + return find_free_tcs(tcs); 602 + } 603 + 604 + /** 605 + * rpmh_rsc_send_data() - Write / trigger active-only message. 606 + * @drv: The controller. 607 + * @msg: The data to be sent. 608 + * 609 + * NOTES: 610 + * - This is only used for "ACTIVE_ONLY" since the limitations of this 611 + * function don't make sense for sleep/wake cases. 612 + * - To do the transfer, we will grab a whole TCS for ourselves--we don't 613 + * try to share. If there are none available we'll wait indefinitely 614 + * for a free one. 615 + * - This function will not wait for the commands to be finished, only for 616 + * data to be programmed into the RPMh. See rpmh_tx_done() which will 617 + * be called when the transfer is fully complete. 618 + * - This function must be called with interrupts enabled. If the hardware 619 + * is busy doing someone else's transfer we need that transfer to fully 620 + * finish so that we can have the hardware, and to fully finish it needs 621 + * the interrupt handler to run. If the interrupts is set to run on the 622 + * active CPU this can never happen if interrupts are disabled. 623 + * 624 + * Return: 0 on success, -EINVAL on error. 625 + */ 626 + int rpmh_rsc_send_data(struct rsc_drv *drv, const struct tcs_request *msg) 627 + { 628 + struct tcs_group *tcs; 629 + int tcs_id; 630 + unsigned long flags; 631 + 632 + tcs = get_tcs_for_msg(drv, msg); 633 + if (IS_ERR(tcs)) 634 + return PTR_ERR(tcs); 635 + 636 + spin_lock_irqsave(&drv->lock, flags); 637 + 638 + /* Wait forever for a free tcs. It better be there eventually! */ 639 + wait_event_lock_irq(drv->tcs_wait, 640 + (tcs_id = claim_tcs_for_req(drv, tcs, msg)) >= 0, 641 + drv->lock); 613 642 614 643 tcs->req[tcs_id - tcs->offset] = msg; 615 644 set_bit(tcs_id, drv->tcs_in_use); ··· 668 635 __tcs_set_trigger(drv, tcs_id, true); 669 636 670 637 return 0; 671 - unlock: 672 - spin_unlock_irqrestore(&drv->lock, flags); 673 - return ret; 674 - } 675 - 676 - /** 677 - * rpmh_rsc_send_data() - Write / trigger active-only message. 678 - * @drv: The controller. 679 - * @msg: The data to be sent. 680 - * 681 - * NOTES: 682 - * - This is only used for "ACTIVE_ONLY" since the limitations of this 683 - * function don't make sense for sleep/wake cases. 684 - * - To do the transfer, we will grab a whole TCS for ourselves--we don't 685 - * try to share. If there are none available we'll wait indefinitely 686 - * for a free one. 687 - * - This function will not wait for the commands to be finished, only for 688 - * data to be programmed into the RPMh. See rpmh_tx_done() which will 689 - * be called when the transfer is fully complete. 690 - * - This function must be called with interrupts enabled. If the hardware 691 - * is busy doing someone else's transfer we need that transfer to fully 692 - * finish so that we can have the hardware, and to fully finish it needs 693 - * the interrupt handler to run. If the interrupts is set to run on the 694 - * active CPU this can never happen if interrupts are disabled. 695 - * 696 - * Return: 0 on success, -EINVAL on error. 697 - */ 698 - int rpmh_rsc_send_data(struct rsc_drv *drv, const struct tcs_request *msg) 699 - { 700 - int ret; 701 - 702 - do { 703 - ret = tcs_write(drv, msg); 704 - if (ret == -EBUSY) { 705 - pr_info_ratelimited("TCS Busy, retrying RPMH message send: addr=%#x\n", 706 - msg->cmds[0].addr); 707 - udelay(10); 708 - } 709 - } while (ret == -EBUSY); 710 - 711 - return ret; 712 638 } 713 639 714 640 /** ··· 975 983 return ret; 976 984 977 985 spin_lock_init(&drv->lock); 986 + init_waitqueue_head(&drv->tcs_wait); 978 987 bitmap_zero(drv->tcs_in_use, MAX_TCS_NR); 979 988 980 989 irq = platform_get_irq(pdev, drv->id);
+5
drivers/soc/qcom/socinfo.c
··· 194 194 { 186, "MSM8674" }, 195 195 { 194, "MSM8974PRO" }, 196 196 { 206, "MSM8916" }, 197 + { 207, "MSM8994" }, 197 198 { 208, "APQ8074-AA" }, 198 199 { 209, "APQ8074-AB" }, 199 200 { 210, "APQ8074PRO" }, ··· 215 214 { 248, "MSM8216" }, 216 215 { 249, "MSM8116" }, 217 216 { 250, "MSM8616" }, 217 + { 251, "MSM8992" }, 218 + { 253, "APQ8094" }, 218 219 { 291, "APQ8096" }, 219 220 { 305, "MSM8996SG" }, 220 221 { 310, "MSM8996AU" }, ··· 226 223 { 321, "SDM845" }, 227 224 { 341, "SDA845" }, 228 225 { 356, "SM8250" }, 226 + { 402, "IPQ6018" }, 227 + { 425, "SC7180" }, 229 228 }; 230 229 231 230 static const char *socinfo_machine(struct device *dev, unsigned int id)
+216 -208
drivers/soc/renesas/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - config SOC_RENESAS 2 + menuconfig SOC_RENESAS 3 3 bool "Renesas SoC driver support" if COMPILE_TEST && !ARCH_RENESAS 4 4 default y if ARCH_RENESAS 5 5 select SOC_BUS ··· 49 49 #comment "Renesas ARM SoCs System Type" 50 50 51 51 config ARCH_EMEV2 52 - bool "Emma Mobile EV2" 52 + bool "ARM32 Platform support for Emma Mobile EV2" 53 53 select HAVE_ARM_SCU if SMP 54 54 select SYS_SUPPORTS_EM_STI 55 55 56 - config ARCH_R7S72100 57 - bool "RZ/A1H (R7S72100)" 58 - select ARM_ERRATA_754322 59 - select PM 60 - select PM_GENERIC_DOMAINS 61 - select RENESAS_OSTM 62 - select RENESAS_RZA1_IRQC 63 - select SYS_SUPPORTS_SH_MTU2 64 - 65 - config ARCH_R7S9210 66 - bool "RZ/A2 (R7S9210)" 67 - select PM 68 - select PM_GENERIC_DOMAINS 69 - select RENESAS_OSTM 70 - select RENESAS_RZA1_IRQC 71 - 72 - config ARCH_R8A73A4 73 - bool "R-Mobile APE6 (R8A73A40)" 74 - select ARCH_RMOBILE 75 - select ARM_ERRATA_798181 if SMP 76 - select ARM_ERRATA_814220 77 - select HAVE_ARM_ARCH_TIMER 78 - select RENESAS_IRQC 79 - 80 - config ARCH_R8A7740 81 - bool "R-Mobile A1 (R8A77400)" 82 - select ARCH_RMOBILE 83 - select ARM_ERRATA_754322 84 - select RENESAS_INTC_IRQPIN 85 - 86 - config ARCH_R8A7742 87 - bool "RZ/G1H (R8A77420)" 88 - select ARCH_RCAR_GEN2 89 - select ARM_ERRATA_798181 if SMP 90 - select ARM_ERRATA_814220 91 - select SYSC_R8A7742 92 - 93 - config ARCH_R8A7743 94 - bool "RZ/G1M (R8A77430)" 95 - select ARCH_RCAR_GEN2 96 - select ARM_ERRATA_798181 if SMP 97 - select SYSC_R8A7743 98 - 99 - config ARCH_R8A7744 100 - bool "RZ/G1N (R8A77440)" 101 - select ARCH_RCAR_GEN2 102 - select ARM_ERRATA_798181 if SMP 103 - select SYSC_R8A7743 104 - 105 - config ARCH_R8A7745 106 - bool "RZ/G1E (R8A77450)" 56 + config ARCH_R8A7794 57 + bool "ARM32 Platform support for R-Car E2" 107 58 select ARCH_RCAR_GEN2 108 59 select ARM_ERRATA_814220 109 - select SYSC_R8A7745 110 - 111 - config ARCH_R8A77470 112 - bool "RZ/G1C (R8A77470)" 113 - select ARCH_RCAR_GEN2 114 - select ARM_ERRATA_814220 115 - select SYSC_R8A77470 116 - 117 - config ARCH_R8A7778 118 - bool "R-Car M1A (R8A77781)" 119 - select ARCH_RCAR_GEN1 120 - select ARM_ERRATA_754322 60 + select SYSC_R8A7794 121 61 122 62 config ARCH_R8A7779 123 - bool "R-Car H1 (R8A77790)" 63 + bool "ARM32 Platform support for R-Car H1" 124 64 select ARCH_RCAR_GEN1 125 65 select ARM_ERRATA_754322 126 66 select ARM_GLOBAL_TIMER ··· 69 129 select SYSC_R8A7779 70 130 71 131 config ARCH_R8A7790 72 - bool "R-Car H2 (R8A77900)" 132 + bool "ARM32 Platform support for R-Car H2" 73 133 select ARCH_RCAR_GEN2 74 134 select ARM_ERRATA_798181 if SMP 75 135 select ARM_ERRATA_814220 76 136 select I2C 77 137 select SYSC_R8A7790 78 138 139 + config ARCH_R8A7778 140 + bool "ARM32 Platform support for R-Car M1A" 141 + select ARCH_RCAR_GEN1 142 + select ARM_ERRATA_754322 143 + 144 + config ARCH_R8A7793 145 + bool "ARM32 Platform support for R-Car M2-N" 146 + select ARCH_RCAR_GEN2 147 + select ARM_ERRATA_798181 if SMP 148 + select I2C 149 + select SYSC_R8A7791 150 + 79 151 config ARCH_R8A7791 80 - bool "R-Car M2-W (R8A77910)" 152 + bool "ARM32 Platform support for R-Car M2-W" 81 153 select ARCH_RCAR_GEN2 82 154 select ARM_ERRATA_798181 if SMP 83 155 select I2C 84 156 select SYSC_R8A7791 85 157 86 158 config ARCH_R8A7792 87 - bool "R-Car V2H (R8A77920)" 159 + bool "ARM32 Platform support for R-Car V2H" 88 160 select ARCH_RCAR_GEN2 89 161 select ARM_ERRATA_798181 if SMP 90 162 select SYSC_R8A7792 91 163 92 - config ARCH_R8A7793 93 - bool "R-Car M2-N (R8A7793)" 94 - select ARCH_RCAR_GEN2 95 - select ARM_ERRATA_798181 if SMP 96 - select I2C 97 - select SYSC_R8A7791 164 + config ARCH_R8A7740 165 + bool "ARM32 Platform support for R-Mobile A1" 166 + select ARCH_RMOBILE 167 + select ARM_ERRATA_754322 168 + select RENESAS_INTC_IRQPIN 98 169 99 - config ARCH_R8A7794 100 - bool "R-Car E2 (R8A77940)" 170 + config ARCH_R8A73A4 171 + bool "ARM32 Platform support for R-Mobile APE6" 172 + select ARCH_RMOBILE 173 + select ARM_ERRATA_798181 if SMP 174 + select ARM_ERRATA_814220 175 + select HAVE_ARM_ARCH_TIMER 176 + select RENESAS_IRQC 177 + 178 + config ARCH_R7S72100 179 + bool "ARM32 Platform support for RZ/A1H" 180 + select ARM_ERRATA_754322 181 + select PM 182 + select PM_GENERIC_DOMAINS 183 + select RENESAS_OSTM 184 + select RENESAS_RZA1_IRQC 185 + select SYS_SUPPORTS_SH_MTU2 186 + 187 + config ARCH_R7S9210 188 + bool "ARM32 Platform support for RZ/A2" 189 + select PM 190 + select PM_GENERIC_DOMAINS 191 + select RENESAS_OSTM 192 + select RENESAS_RZA1_IRQC 193 + 194 + config ARCH_R8A77470 195 + bool "ARM32 Platform support for RZ/G1C" 101 196 select ARCH_RCAR_GEN2 102 197 select ARM_ERRATA_814220 103 - select SYSC_R8A7794 198 + select SYSC_R8A77470 199 + 200 + config ARCH_R8A7745 201 + bool "ARM32 Platform support for RZ/G1E" 202 + select ARCH_RCAR_GEN2 203 + select ARM_ERRATA_814220 204 + select SYSC_R8A7745 205 + 206 + config ARCH_R8A7742 207 + bool "ARM32 Platform support for RZ/G1H" 208 + select ARCH_RCAR_GEN2 209 + select ARM_ERRATA_798181 if SMP 210 + select ARM_ERRATA_814220 211 + select SYSC_R8A7742 212 + 213 + config ARCH_R8A7743 214 + bool "ARM32 Platform support for RZ/G1M" 215 + select ARCH_RCAR_GEN2 216 + select ARM_ERRATA_798181 if SMP 217 + select SYSC_R8A7743 218 + 219 + config ARCH_R8A7744 220 + bool "ARM32 Platform support for RZ/G1N" 221 + select ARCH_RCAR_GEN2 222 + select ARM_ERRATA_798181 if SMP 223 + select SYSC_R8A7743 104 224 105 225 config ARCH_R9A06G032 106 - bool "RZ/N1D (R9A06G032)" 226 + bool "ARM32 Platform support for RZ/N1D" 107 227 select ARCH_RZN1 108 228 select ARM_ERRATA_814220 109 229 110 230 config ARCH_SH73A0 111 - bool "SH-Mobile AG5 (R8A73A00)" 231 + bool "ARM32 Platform support for SH-Mobile AG5" 112 232 select ARCH_RMOBILE 113 233 select ARM_ERRATA_754322 114 234 select ARM_GLOBAL_TIMER ··· 180 180 181 181 if ARM64 182 182 183 - config ARCH_R8A774A1 184 - bool "Renesas RZ/G2M SoC Platform" 183 + config ARCH_R8A77995 184 + bool "ARM64 Platform support for R-Car D3" 185 185 select ARCH_RCAR_GEN3 186 - select SYSC_R8A774A1 186 + select SYSC_R8A77995 187 187 help 188 - This enables support for the Renesas RZ/G2M SoC. 188 + This enables support for the Renesas R-Car D3 SoC. 189 189 190 - config ARCH_R8A774B1 191 - bool "Renesas RZ/G2N SoC Platform" 190 + config ARCH_R8A77990 191 + bool "ARM64 Platform support for R-Car E3" 192 192 select ARCH_RCAR_GEN3 193 - select SYSC_R8A774B1 193 + select SYSC_R8A77990 194 194 help 195 - This enables support for the Renesas RZ/G2N SoC. 196 - 197 - config ARCH_R8A774C0 198 - bool "Renesas RZ/G2E SoC Platform" 199 - select ARCH_RCAR_GEN3 200 - select SYSC_R8A774C0 201 - help 202 - This enables support for the Renesas RZ/G2E SoC. 203 - 204 - config ARCH_R8A774E1 205 - bool "Renesas RZ/G2H SoC Platform" 206 - select ARCH_RCAR_GEN3 207 - select SYSC_R8A774E1 208 - help 209 - This enables support for the Renesas RZ/G2H SoC. 195 + This enables support for the Renesas R-Car E3 SoC. 210 196 211 197 config ARCH_R8A77950 212 - bool "Renesas R-Car H3 ES1.x SoC Platform" 198 + bool "ARM64 Platform support for R-Car H3 ES1.x" 213 199 select ARCH_RCAR_GEN3 214 200 select SYSC_R8A7795 215 201 help 216 202 This enables support for the Renesas R-Car H3 SoC (revision 1.x). 217 203 218 204 config ARCH_R8A77951 219 - bool "Renesas R-Car H3 ES2.0+ SoC Platform" 205 + bool "ARM64 Platform support for R-Car H3 ES2.0+" 220 206 select ARCH_RCAR_GEN3 221 207 select SYSC_R8A7795 222 208 help 223 209 This enables support for the Renesas R-Car H3 SoC (revisions 2.0 and 224 210 later). 225 211 212 + config ARCH_R8A77965 213 + bool "ARM64 Platform support for R-Car M3-N" 214 + select ARCH_RCAR_GEN3 215 + select SYSC_R8A77965 216 + help 217 + This enables support for the Renesas R-Car M3-N SoC. 218 + 226 219 config ARCH_R8A77960 227 - bool "Renesas R-Car M3-W SoC Platform" 220 + bool "ARM64 Platform support for R-Car M3-W" 228 221 select ARCH_RCAR_GEN3 229 222 select SYSC_R8A77960 230 223 help 231 224 This enables support for the Renesas R-Car M3-W SoC. 232 225 233 226 config ARCH_R8A77961 234 - bool "Renesas R-Car M3-W+ SoC Platform" 227 + bool "ARM64 Platform support for R-Car M3-W+" 235 228 select ARCH_RCAR_GEN3 236 229 select SYSC_R8A77961 237 230 help 238 231 This enables support for the Renesas R-Car M3-W+ SoC. 239 232 240 - config ARCH_R8A77965 241 - bool "Renesas R-Car M3-N SoC Platform" 242 - select ARCH_RCAR_GEN3 243 - select SYSC_R8A77965 244 - help 245 - This enables support for the Renesas R-Car M3-N SoC. 246 - 247 - config ARCH_R8A77970 248 - bool "Renesas R-Car V3M SoC Platform" 249 - select ARCH_RCAR_GEN3 250 - select SYSC_R8A77970 251 - help 252 - This enables support for the Renesas R-Car V3M SoC. 253 - 254 233 config ARCH_R8A77980 255 - bool "Renesas R-Car V3H SoC Platform" 234 + bool "ARM64 Platform support for R-Car V3H" 256 235 select ARCH_RCAR_GEN3 257 236 select SYSC_R8A77980 258 237 help 259 238 This enables support for the Renesas R-Car V3H SoC. 260 239 261 - config ARCH_R8A77990 262 - bool "Renesas R-Car E3 SoC Platform" 240 + config ARCH_R8A77970 241 + bool "ARM64 Platform support for R-Car V3M" 263 242 select ARCH_RCAR_GEN3 264 - select SYSC_R8A77990 243 + select SYSC_R8A77970 265 244 help 266 - This enables support for the Renesas R-Car E3 SoC. 245 + This enables support for the Renesas R-Car V3M SoC. 267 246 268 - config ARCH_R8A77995 269 - bool "Renesas R-Car D3 SoC Platform" 247 + config ARCH_R8A779A0 248 + bool "ARM64 Platform support for R-Car V3U" 270 249 select ARCH_RCAR_GEN3 271 - select SYSC_R8A77995 250 + select SYSC_R8A779A0 272 251 help 273 - This enables support for the Renesas R-Car D3 SoC. 252 + This enables support for the Renesas R-Car V3U SoC. 253 + 254 + config ARCH_R8A774C0 255 + bool "ARM64 Platform support for RZ/G2E" 256 + select ARCH_RCAR_GEN3 257 + select SYSC_R8A774C0 258 + help 259 + This enables support for the Renesas RZ/G2E SoC. 260 + 261 + config ARCH_R8A774E1 262 + bool "ARM64 Platform support for RZ/G2H" 263 + select ARCH_RCAR_GEN3 264 + select SYSC_R8A774E1 265 + help 266 + This enables support for the Renesas RZ/G2H SoC. 267 + 268 + config ARCH_R8A774A1 269 + bool "ARM64 Platform support for RZ/G2M" 270 + select ARCH_RCAR_GEN3 271 + select SYSC_R8A774A1 272 + help 273 + This enables support for the Renesas RZ/G2M SoC. 274 + 275 + config ARCH_R8A774B1 276 + bool "ARM64 Platform support for RZ/G2N" 277 + select ARCH_RCAR_GEN3 278 + select SYSC_R8A774B1 279 + help 280 + This enables support for the Renesas RZ/G2N SoC. 274 281 275 282 endif # ARM64 276 283 277 - # SoC 278 - config SYSC_R8A7742 279 - bool "RZ/G1H System Controller support" if COMPILE_TEST 280 - select SYSC_RCAR 284 + config RST_RCAR 285 + bool "Reset Controller support for R-Car" if COMPILE_TEST 281 286 282 - config SYSC_R8A7743 283 - bool "RZ/G1M System Controller support" if COMPILE_TEST 284 - select SYSC_RCAR 287 + config SYSC_RCAR 288 + bool "System Controller support for R-Car" if COMPILE_TEST 285 289 286 - config SYSC_R8A7745 287 - bool "RZ/G1E System Controller support" if COMPILE_TEST 288 - select SYSC_RCAR 289 - 290 - config SYSC_R8A77470 291 - bool "RZ/G1C System Controller support" if COMPILE_TEST 292 - select SYSC_RCAR 293 - 294 - config SYSC_R8A774A1 295 - bool "RZ/G2M System Controller support" if COMPILE_TEST 296 - select SYSC_RCAR 297 - 298 - config SYSC_R8A774B1 299 - bool "RZ/G2N System Controller support" if COMPILE_TEST 300 - select SYSC_RCAR 301 - 302 - config SYSC_R8A774C0 303 - bool "RZ/G2E System Controller support" if COMPILE_TEST 304 - select SYSC_RCAR 305 - 306 - config SYSC_R8A774E1 307 - bool "RZ/G2H System Controller support" if COMPILE_TEST 308 - select SYSC_RCAR 309 - 310 - config SYSC_R8A7779 311 - bool "R-Car H1 System Controller support" if COMPILE_TEST 312 - select SYSC_RCAR 313 - 314 - config SYSC_R8A7790 315 - bool "R-Car H2 System Controller support" if COMPILE_TEST 316 - select SYSC_RCAR 317 - 318 - config SYSC_R8A7791 319 - bool "R-Car M2-W/N System Controller support" if COMPILE_TEST 320 - select SYSC_RCAR 321 - 322 - config SYSC_R8A7792 323 - bool "R-Car V2H System Controller support" if COMPILE_TEST 290 + config SYSC_R8A77995 291 + bool "System Controller support for R-Car D3" if COMPILE_TEST 324 292 select SYSC_RCAR 325 293 326 294 config SYSC_R8A7794 327 - bool "R-Car E2 System Controller support" if COMPILE_TEST 328 - select SYSC_RCAR 329 - 330 - config SYSC_R8A7795 331 - bool "R-Car H3 System Controller support" if COMPILE_TEST 332 - select SYSC_RCAR 333 - 334 - config SYSC_R8A77960 335 - bool "R-Car M3-W System Controller support" if COMPILE_TEST 336 - select SYSC_RCAR 337 - 338 - config SYSC_R8A77961 339 - bool "R-Car M3-W+ System Controller support" if COMPILE_TEST 340 - select SYSC_RCAR 341 - 342 - config SYSC_R8A77965 343 - bool "R-Car M3-N System Controller support" if COMPILE_TEST 344 - select SYSC_RCAR 345 - 346 - config SYSC_R8A77970 347 - bool "R-Car V3M System Controller support" if COMPILE_TEST 348 - select SYSC_RCAR 349 - 350 - config SYSC_R8A77980 351 - bool "R-Car V3H System Controller support" if COMPILE_TEST 295 + bool "System Controller support for R-Car E2" if COMPILE_TEST 352 296 select SYSC_RCAR 353 297 354 298 config SYSC_R8A77990 355 - bool "R-Car E3 System Controller support" if COMPILE_TEST 299 + bool "System Controller support for R-Car E3" if COMPILE_TEST 356 300 select SYSC_RCAR 357 301 358 - config SYSC_R8A77995 359 - bool "R-Car D3 System Controller support" if COMPILE_TEST 302 + config SYSC_R8A7779 303 + bool "System Controller support for R-Car H1" if COMPILE_TEST 360 304 select SYSC_RCAR 361 305 362 - # Family 363 - config RST_RCAR 364 - bool "R-Car Reset Controller support" if COMPILE_TEST 306 + config SYSC_R8A7790 307 + bool "System Controller support for R-Car H2" if COMPILE_TEST 308 + select SYSC_RCAR 365 309 366 - config SYSC_RCAR 367 - bool "R-Car System Controller support" if COMPILE_TEST 310 + config SYSC_R8A7795 311 + bool "System Controller support for R-Car H3" if COMPILE_TEST 312 + select SYSC_RCAR 313 + 314 + config SYSC_R8A7791 315 + bool "System Controller support for R-Car M2-W/N" if COMPILE_TEST 316 + select SYSC_RCAR 317 + 318 + config SYSC_R8A77965 319 + bool "System Controller support for R-Car M3-N" if COMPILE_TEST 320 + select SYSC_RCAR 321 + 322 + config SYSC_R8A77960 323 + bool "System Controller support for R-Car M3-W" if COMPILE_TEST 324 + select SYSC_RCAR 325 + 326 + config SYSC_R8A77961 327 + bool "System Controller support for R-Car M3-W+" if COMPILE_TEST 328 + select SYSC_RCAR 329 + 330 + config SYSC_R8A7792 331 + bool "System Controller support for R-Car V2H" if COMPILE_TEST 332 + select SYSC_RCAR 333 + 334 + config SYSC_R8A77980 335 + bool "System Controller support for R-Car V3H" if COMPILE_TEST 336 + select SYSC_RCAR 337 + 338 + config SYSC_R8A77970 339 + bool "System Controller support for R-Car V3M" if COMPILE_TEST 340 + select SYSC_RCAR 341 + 342 + config SYSC_R8A779A0 343 + bool "System Controller support for R-Car V3U" if COMPILE_TEST 368 344 369 345 config SYSC_RMOBILE 370 - bool "R-Mobile System Controller support" if COMPILE_TEST 346 + bool "System Controller support for R-Mobile" if COMPILE_TEST 347 + 348 + config SYSC_R8A77470 349 + bool "System Controller support for RZ/G1C" if COMPILE_TEST 350 + select SYSC_RCAR 351 + 352 + config SYSC_R8A7745 353 + bool "System Controller support for RZ/G1E" if COMPILE_TEST 354 + select SYSC_RCAR 355 + 356 + config SYSC_R8A7742 357 + bool "System Controller support for RZ/G1H" if COMPILE_TEST 358 + select SYSC_RCAR 359 + 360 + config SYSC_R8A7743 361 + bool "System Controller support for RZ/G1M" if COMPILE_TEST 362 + select SYSC_RCAR 363 + 364 + config SYSC_R8A774C0 365 + bool "System Controller support for RZ/G2E" if COMPILE_TEST 366 + select SYSC_RCAR 367 + 368 + config SYSC_R8A774E1 369 + bool "System Controller support for RZ/G2H" if COMPILE_TEST 370 + select SYSC_RCAR 371 + 372 + config SYSC_R8A774A1 373 + bool "System Controller support for RZ/G2M" if COMPILE_TEST 374 + select SYSC_RCAR 375 + 376 + config SYSC_R8A774B1 377 + bool "System Controller support for RZ/G2N" if COMPILE_TEST 378 + select SYSC_RCAR 371 379 372 380 endif # SOC_RENESAS
+1
drivers/soc/renesas/Makefile
··· 24 24 obj-$(CONFIG_SYSC_R8A77980) += r8a77980-sysc.o 25 25 obj-$(CONFIG_SYSC_R8A77990) += r8a77990-sysc.o 26 26 obj-$(CONFIG_SYSC_R8A77995) += r8a77995-sysc.o 27 + obj-$(CONFIG_SYSC_R8A779A0) += r8a779a0-sysc.o 27 28 ifdef CONFIG_SMP 28 29 obj-$(CONFIG_ARCH_R9A06G032) += r9a06g032-smp.o 29 30 endif
+448
drivers/soc/renesas/r8a779a0-sysc.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Renesas R-Car V3U System Controller 4 + * 5 + * Copyright (C) 2020 Renesas Electronics Corp. 6 + */ 7 + 8 + #include <linux/bits.h> 9 + #include <linux/clk/renesas.h> 10 + #include <linux/delay.h> 11 + #include <linux/err.h> 12 + #include <linux/io.h> 13 + #include <linux/iopoll.h> 14 + #include <linux/kernel.h> 15 + #include <linux/mm.h> 16 + #include <linux/of_address.h> 17 + #include <linux/pm_domain.h> 18 + #include <linux/slab.h> 19 + #include <linux/spinlock.h> 20 + #include <linux/types.h> 21 + 22 + #include <dt-bindings/power/r8a779a0-sysc.h> 23 + 24 + /* 25 + * Power Domain flags 26 + */ 27 + #define PD_CPU BIT(0) /* Area contains main CPU core */ 28 + #define PD_SCU BIT(1) /* Area contains SCU and L2 cache */ 29 + #define PD_NO_CR BIT(2) /* Area lacks PWR{ON,OFF}CR registers */ 30 + 31 + #define PD_CPU_NOCR PD_CPU | PD_NO_CR /* CPU area lacks CR */ 32 + #define PD_ALWAYS_ON PD_NO_CR /* Always-on area */ 33 + 34 + /* 35 + * Description of a Power Area 36 + */ 37 + struct r8a779a0_sysc_area { 38 + const char *name; 39 + u8 pdr; /* PDRn */ 40 + int parent; /* -1 if none */ 41 + unsigned int flags; /* See PD_* */ 42 + }; 43 + 44 + /* 45 + * SoC-specific Power Area Description 46 + */ 47 + struct r8a779a0_sysc_info { 48 + const struct r8a779a0_sysc_area *areas; 49 + unsigned int num_areas; 50 + }; 51 + 52 + static struct r8a779a0_sysc_area r8a779a0_areas[] __initdata = { 53 + { "always-on", R8A779A0_PD_ALWAYS_ON, -1, PD_ALWAYS_ON }, 54 + { "a3e0", R8A779A0_PD_A3E0, R8A779A0_PD_ALWAYS_ON, PD_SCU }, 55 + { "a3e1", R8A779A0_PD_A3E1, R8A779A0_PD_ALWAYS_ON, PD_SCU }, 56 + { "a2e0d0", R8A779A0_PD_A2E0D0, R8A779A0_PD_A3E0, PD_SCU }, 57 + { "a2e0d1", R8A779A0_PD_A2E0D1, R8A779A0_PD_A3E0, PD_SCU }, 58 + { "a2e1d0", R8A779A0_PD_A2E1D0, R8A779A0_PD_A3E1, PD_SCU }, 59 + { "a2e1d1", R8A779A0_PD_A2E1D1, R8A779A0_PD_A3E1, PD_SCU }, 60 + { "a1e0d0c0", R8A779A0_PD_A1E0D0C0, R8A779A0_PD_A2E0D0, PD_CPU_NOCR }, 61 + { "a1e0d0c1", R8A779A0_PD_A1E0D0C1, R8A779A0_PD_A2E0D0, PD_CPU_NOCR }, 62 + { "a1e0d1c0", R8A779A0_PD_A1E0D1C0, R8A779A0_PD_A2E0D1, PD_CPU_NOCR }, 63 + { "a1e0d1c1", R8A779A0_PD_A1E0D1C1, R8A779A0_PD_A2E0D1, PD_CPU_NOCR }, 64 + { "a1e1d0c0", R8A779A0_PD_A1E1D0C0, R8A779A0_PD_A2E1D0, PD_CPU_NOCR }, 65 + { "a1e1d0c1", R8A779A0_PD_A1E1D0C1, R8A779A0_PD_A2E1D0, PD_CPU_NOCR }, 66 + { "a1e1d1c0", R8A779A0_PD_A1E1D1C0, R8A779A0_PD_A2E1D1, PD_CPU_NOCR }, 67 + { "a1e1d1c1", R8A779A0_PD_A1E1D1C1, R8A779A0_PD_A2E1D1, PD_CPU_NOCR }, 68 + { "3dg-a", R8A779A0_PD_3DG_A, R8A779A0_PD_ALWAYS_ON }, 69 + { "3dg-b", R8A779A0_PD_3DG_B, R8A779A0_PD_3DG_A }, 70 + { "a3vip0", R8A779A0_PD_A3VIP0, R8A779A0_PD_ALWAYS_ON }, 71 + { "a3vip1", R8A779A0_PD_A3VIP1, R8A779A0_PD_ALWAYS_ON }, 72 + { "a3vip3", R8A779A0_PD_A3VIP3, R8A779A0_PD_ALWAYS_ON }, 73 + { "a3vip2", R8A779A0_PD_A3VIP2, R8A779A0_PD_ALWAYS_ON }, 74 + { "a3isp01", R8A779A0_PD_A3ISP01, R8A779A0_PD_ALWAYS_ON }, 75 + { "a3isp23", R8A779A0_PD_A3ISP23, R8A779A0_PD_ALWAYS_ON }, 76 + { "a3ir", R8A779A0_PD_A3IR, R8A779A0_PD_ALWAYS_ON }, 77 + { "a2cn0", R8A779A0_PD_A2CN0, R8A779A0_PD_A3IR }, 78 + { "a2imp01", R8A779A0_PD_A2IMP01, R8A779A0_PD_A3IR }, 79 + { "a2dp0", R8A779A0_PD_A2DP0, R8A779A0_PD_A3IR }, 80 + { "a2cv0", R8A779A0_PD_A2CV0, R8A779A0_PD_A3IR }, 81 + { "a2cv1", R8A779A0_PD_A2CV1, R8A779A0_PD_A3IR }, 82 + { "a2cv4", R8A779A0_PD_A2CV4, R8A779A0_PD_A3IR }, 83 + { "a2cv6", R8A779A0_PD_A2CV6, R8A779A0_PD_A3IR }, 84 + { "a2cn2", R8A779A0_PD_A2CN2, R8A779A0_PD_A3IR }, 85 + { "a2imp23", R8A779A0_PD_A2IMP23, R8A779A0_PD_A3IR }, 86 + { "a2dp1", R8A779A0_PD_A2DP0, R8A779A0_PD_A3IR }, 87 + { "a2cv2", R8A779A0_PD_A2CV0, R8A779A0_PD_A3IR }, 88 + { "a2cv3", R8A779A0_PD_A2CV1, R8A779A0_PD_A3IR }, 89 + { "a2cv5", R8A779A0_PD_A2CV4, R8A779A0_PD_A3IR }, 90 + { "a2cv7", R8A779A0_PD_A2CV6, R8A779A0_PD_A3IR }, 91 + { "a2cn1", R8A779A0_PD_A2CN1, R8A779A0_PD_A3IR }, 92 + { "a1cnn0", R8A779A0_PD_A1CNN0, R8A779A0_PD_A2CN0 }, 93 + { "a1cnn2", R8A779A0_PD_A1CNN2, R8A779A0_PD_A2CN2 }, 94 + { "a1dsp0", R8A779A0_PD_A1DSP0, R8A779A0_PD_A2CN2 }, 95 + { "a1cnn1", R8A779A0_PD_A1CNN1, R8A779A0_PD_A2CN1 }, 96 + { "a1dsp1", R8A779A0_PD_A1DSP1, R8A779A0_PD_A2CN1 }, 97 + }; 98 + 99 + static const struct r8a779a0_sysc_info r8a779a0_sysc_info __initconst = { 100 + .areas = r8a779a0_areas, 101 + .num_areas = ARRAY_SIZE(r8a779a0_areas), 102 + }; 103 + 104 + /* SYSC Common */ 105 + #define SYSCSR 0x000 /* SYSC Status Register */ 106 + #define SYSCPONSR(x) (0x800 + ((x) * 0x4)) /* Power-ON Status Register 0 */ 107 + #define SYSCPOFFSR(x) (0x808 + ((x) * 0x4)) /* Power-OFF Status Register */ 108 + #define SYSCISCR(x) (0x810 + ((x) * 0x4)) /* Interrupt Status/Clear Register */ 109 + #define SYSCIER(x) (0x820 + ((x) * 0x4)) /* Interrupt Enable Register */ 110 + #define SYSCIMR(x) (0x830 + ((x) * 0x4)) /* Interrupt Mask Register */ 111 + 112 + /* Power Domain Registers */ 113 + #define PDRSR(n) (0x1000 + ((n) * 0x40)) 114 + #define PDRONCR(n) (0x1004 + ((n) * 0x40)) 115 + #define PDROFFCR(n) (0x1008 + ((n) * 0x40)) 116 + #define PDRESR(n) (0x100C + ((n) * 0x40)) 117 + 118 + /* PWRON/PWROFF */ 119 + #define PWRON_PWROFF BIT(0) /* Power-ON/OFF request */ 120 + 121 + /* PDRESR */ 122 + #define PDRESR_ERR BIT(0) 123 + 124 + /* PDRSR */ 125 + #define PDRSR_OFF BIT(0) /* Power-OFF state */ 126 + #define PDRSR_ON BIT(4) /* Power-ON state */ 127 + #define PDRSR_OFF_STATE BIT(8) /* Processing Power-OFF sequence */ 128 + #define PDRSR_ON_STATE BIT(12) /* Processing Power-ON sequence */ 129 + 130 + #define SYSCSR_BUSY GENMASK(1, 0) /* All bit sets is not busy */ 131 + 132 + #define SYSCSR_TIMEOUT 10000 133 + #define SYSCSR_DELAY_US 10 134 + 135 + #define PDRESR_RETRIES 1000 136 + #define PDRESR_DELAY_US 10 137 + 138 + #define SYSCISR_TIMEOUT 10000 139 + #define SYSCISR_DELAY_US 10 140 + 141 + #define NUM_DOMAINS_EACH_REG BITS_PER_TYPE(u32) 142 + 143 + static void __iomem *r8a779a0_sysc_base; 144 + static DEFINE_SPINLOCK(r8a779a0_sysc_lock); /* SMP CPUs + I/O devices */ 145 + 146 + static int r8a779a0_sysc_pwr_on_off(u8 pdr, bool on) 147 + { 148 + unsigned int reg_offs; 149 + u32 val; 150 + int ret; 151 + 152 + if (on) 153 + reg_offs = PDRONCR(pdr); 154 + else 155 + reg_offs = PDROFFCR(pdr); 156 + 157 + /* Wait until SYSC is ready to accept a power request */ 158 + ret = readl_poll_timeout_atomic(r8a779a0_sysc_base + SYSCSR, val, 159 + (val & SYSCSR_BUSY) == SYSCSR_BUSY, 160 + SYSCSR_DELAY_US, SYSCSR_TIMEOUT); 161 + if (ret < 0) 162 + return -EAGAIN; 163 + 164 + /* Submit power shutoff or power resume request */ 165 + iowrite32(PWRON_PWROFF, r8a779a0_sysc_base + reg_offs); 166 + 167 + return 0; 168 + } 169 + 170 + static int clear_irq_flags(unsigned int reg_idx, unsigned int isr_mask) 171 + { 172 + u32 val; 173 + int ret; 174 + 175 + iowrite32(isr_mask, r8a779a0_sysc_base + SYSCISCR(reg_idx)); 176 + 177 + ret = readl_poll_timeout_atomic(r8a779a0_sysc_base + SYSCISCR(reg_idx), 178 + val, !(val & isr_mask), 179 + SYSCISR_DELAY_US, SYSCISR_TIMEOUT); 180 + if (ret < 0) { 181 + pr_err("\n %s : Can not clear IRQ flags in SYSCISCR", __func__); 182 + return -EIO; 183 + } 184 + 185 + return 0; 186 + } 187 + 188 + static int r8a779a0_sysc_power(u8 pdr, bool on) 189 + { 190 + unsigned int isr_mask; 191 + unsigned int reg_idx, bit_idx; 192 + unsigned int status; 193 + unsigned long flags; 194 + int ret = 0; 195 + u32 val; 196 + int k; 197 + 198 + spin_lock_irqsave(&r8a779a0_sysc_lock, flags); 199 + 200 + reg_idx = pdr / NUM_DOMAINS_EACH_REG; 201 + bit_idx = pdr % NUM_DOMAINS_EACH_REG; 202 + 203 + isr_mask = BIT(bit_idx); 204 + 205 + /* 206 + * The interrupt source needs to be enabled, but masked, to prevent the 207 + * CPU from receiving it. 208 + */ 209 + iowrite32(ioread32(r8a779a0_sysc_base + SYSCIER(reg_idx)) | isr_mask, 210 + r8a779a0_sysc_base + SYSCIER(reg_idx)); 211 + iowrite32(ioread32(r8a779a0_sysc_base + SYSCIMR(reg_idx)) | isr_mask, 212 + r8a779a0_sysc_base + SYSCIMR(reg_idx)); 213 + 214 + ret = clear_irq_flags(reg_idx, isr_mask); 215 + if (ret) 216 + goto out; 217 + 218 + /* Submit power shutoff or resume request until it was accepted */ 219 + for (k = 0; k < PDRESR_RETRIES; k++) { 220 + ret = r8a779a0_sysc_pwr_on_off(pdr, on); 221 + if (ret) 222 + goto out; 223 + 224 + status = ioread32(r8a779a0_sysc_base + PDRESR(pdr)); 225 + if (!(status & PDRESR_ERR)) 226 + break; 227 + 228 + udelay(PDRESR_DELAY_US); 229 + } 230 + 231 + if (k == PDRESR_RETRIES) { 232 + ret = -EIO; 233 + goto out; 234 + } 235 + 236 + /* Wait until the power shutoff or resume request has completed * */ 237 + ret = readl_poll_timeout_atomic(r8a779a0_sysc_base + SYSCISCR(reg_idx), 238 + val, (val & isr_mask), 239 + SYSCISR_DELAY_US, SYSCISR_TIMEOUT); 240 + if (ret < 0) { 241 + ret = -EIO; 242 + goto out; 243 + } 244 + 245 + /* Clear interrupt flags */ 246 + ret = clear_irq_flags(reg_idx, isr_mask); 247 + if (ret) 248 + goto out; 249 + 250 + out: 251 + spin_unlock_irqrestore(&r8a779a0_sysc_lock, flags); 252 + 253 + pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off", 254 + pdr, ioread32(r8a779a0_sysc_base + SYSCISCR(reg_idx)), ret); 255 + return ret; 256 + } 257 + 258 + static bool r8a779a0_sysc_power_is_off(u8 pdr) 259 + { 260 + unsigned int st; 261 + 262 + st = ioread32(r8a779a0_sysc_base + PDRSR(pdr)); 263 + 264 + if (st & PDRSR_OFF) 265 + return true; 266 + 267 + return false; 268 + } 269 + 270 + struct r8a779a0_sysc_pd { 271 + struct generic_pm_domain genpd; 272 + u8 pdr; 273 + unsigned int flags; 274 + char name[]; 275 + }; 276 + 277 + static inline struct r8a779a0_sysc_pd *to_r8a779a0_pd(struct generic_pm_domain *d) 278 + { 279 + return container_of(d, struct r8a779a0_sysc_pd, genpd); 280 + } 281 + 282 + static int r8a779a0_sysc_pd_power_off(struct generic_pm_domain *genpd) 283 + { 284 + struct r8a779a0_sysc_pd *pd = to_r8a779a0_pd(genpd); 285 + 286 + pr_debug("%s: %s\n", __func__, genpd->name); 287 + return r8a779a0_sysc_power(pd->pdr, false); 288 + } 289 + 290 + static int r8a779a0_sysc_pd_power_on(struct generic_pm_domain *genpd) 291 + { 292 + struct r8a779a0_sysc_pd *pd = to_r8a779a0_pd(genpd); 293 + 294 + pr_debug("%s: %s\n", __func__, genpd->name); 295 + return r8a779a0_sysc_power(pd->pdr, true); 296 + } 297 + 298 + static int __init r8a779a0_sysc_pd_setup(struct r8a779a0_sysc_pd *pd) 299 + { 300 + struct generic_pm_domain *genpd = &pd->genpd; 301 + const char *name = pd->genpd.name; 302 + int error; 303 + 304 + if (pd->flags & PD_CPU) { 305 + /* 306 + * This domain contains a CPU core and therefore it should 307 + * only be turned off if the CPU is not in use. 308 + */ 309 + pr_debug("PM domain %s contains %s\n", name, "CPU"); 310 + genpd->flags |= GENPD_FLAG_ALWAYS_ON; 311 + } else if (pd->flags & PD_SCU) { 312 + /* 313 + * This domain contains an SCU and cache-controller, and 314 + * therefore it should only be turned off if the CPU cores are 315 + * not in use. 316 + */ 317 + pr_debug("PM domain %s contains %s\n", name, "SCU"); 318 + genpd->flags |= GENPD_FLAG_ALWAYS_ON; 319 + } else if (pd->flags & PD_NO_CR) { 320 + /* 321 + * This domain cannot be turned off. 322 + */ 323 + genpd->flags |= GENPD_FLAG_ALWAYS_ON; 324 + } 325 + 326 + if (!(pd->flags & (PD_CPU | PD_SCU))) { 327 + /* Enable Clock Domain for I/O devices */ 328 + genpd->flags |= GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP; 329 + genpd->attach_dev = cpg_mssr_attach_dev; 330 + genpd->detach_dev = cpg_mssr_detach_dev; 331 + } 332 + 333 + genpd->power_off = r8a779a0_sysc_pd_power_off; 334 + genpd->power_on = r8a779a0_sysc_pd_power_on; 335 + 336 + if (pd->flags & (PD_CPU | PD_NO_CR)) { 337 + /* Skip CPUs (handled by SMP code) and areas without control */ 338 + pr_debug("%s: Not touching %s\n", __func__, genpd->name); 339 + goto finalize; 340 + } 341 + 342 + if (!r8a779a0_sysc_power_is_off(pd->pdr)) { 343 + pr_debug("%s: %s is already powered\n", __func__, genpd->name); 344 + goto finalize; 345 + } 346 + 347 + r8a779a0_sysc_power(pd->pdr, true); 348 + 349 + finalize: 350 + error = pm_genpd_init(genpd, &simple_qos_governor, false); 351 + if (error) 352 + pr_err("Failed to init PM domain %s: %d\n", name, error); 353 + 354 + return error; 355 + } 356 + 357 + static const struct of_device_id r8a779a0_sysc_matches[] __initconst = { 358 + { .compatible = "renesas,r8a779a0-sysc", .data = &r8a779a0_sysc_info }, 359 + { /* sentinel */ } 360 + }; 361 + 362 + struct r8a779a0_pm_domains { 363 + struct genpd_onecell_data onecell_data; 364 + struct generic_pm_domain *domains[R8A779A0_PD_ALWAYS_ON + 1]; 365 + }; 366 + 367 + static struct genpd_onecell_data *r8a779a0_sysc_onecell_data; 368 + 369 + static int __init r8a779a0_sysc_pd_init(void) 370 + { 371 + const struct r8a779a0_sysc_info *info; 372 + const struct of_device_id *match; 373 + struct r8a779a0_pm_domains *domains; 374 + struct device_node *np; 375 + void __iomem *base; 376 + unsigned int i; 377 + int error; 378 + 379 + np = of_find_matching_node_and_match(NULL, r8a779a0_sysc_matches, &match); 380 + if (!np) 381 + return -ENODEV; 382 + 383 + info = match->data; 384 + 385 + base = of_iomap(np, 0); 386 + if (!base) { 387 + pr_warn("%pOF: Cannot map regs\n", np); 388 + error = -ENOMEM; 389 + goto out_put; 390 + } 391 + 392 + r8a779a0_sysc_base = base; 393 + 394 + domains = kzalloc(sizeof(*domains), GFP_KERNEL); 395 + if (!domains) { 396 + error = -ENOMEM; 397 + goto out_put; 398 + } 399 + 400 + domains->onecell_data.domains = domains->domains; 401 + domains->onecell_data.num_domains = ARRAY_SIZE(domains->domains); 402 + r8a779a0_sysc_onecell_data = &domains->onecell_data; 403 + 404 + for (i = 0; i < info->num_areas; i++) { 405 + const struct r8a779a0_sysc_area *area = &info->areas[i]; 406 + struct r8a779a0_sysc_pd *pd; 407 + 408 + if (!area->name) { 409 + /* Skip NULLified area */ 410 + continue; 411 + } 412 + 413 + pd = kzalloc(sizeof(*pd) + strlen(area->name) + 1, GFP_KERNEL); 414 + if (!pd) { 415 + error = -ENOMEM; 416 + goto out_put; 417 + } 418 + 419 + strcpy(pd->name, area->name); 420 + pd->genpd.name = pd->name; 421 + pd->pdr = area->pdr; 422 + pd->flags = area->flags; 423 + 424 + error = r8a779a0_sysc_pd_setup(pd); 425 + if (error) 426 + goto out_put; 427 + 428 + domains->domains[area->pdr] = &pd->genpd; 429 + 430 + if (area->parent < 0) 431 + continue; 432 + 433 + error = pm_genpd_add_subdomain(domains->domains[area->parent], 434 + &pd->genpd); 435 + if (error) { 436 + pr_warn("Failed to add PM subdomain %s to parent %u\n", 437 + area->name, area->parent); 438 + goto out_put; 439 + } 440 + } 441 + 442 + error = of_genpd_add_provider_onecell(np, &domains->onecell_data); 443 + 444 + out_put: 445 + of_node_put(np); 446 + return error; 447 + } 448 + early_initcall(r8a779a0_sysc_pd_init);
+6
drivers/soc/renesas/rcar-rst.c
··· 37 37 .modemr = 0x60, 38 38 }; 39 39 40 + static const struct rst_config rcar_rst_r8a779a0 __initconst = { 41 + .modemr = 0x00, /* MODEMR0 and it has CPG related bits */ 42 + }; 43 + 40 44 static const struct of_device_id rcar_rst_matches[] __initconst = { 41 45 /* RZ/G1 is handled like R-Car Gen2 */ 42 46 { .compatible = "renesas,r8a7742-rst", .data = &rcar_rst_gen2 }, ··· 71 67 { .compatible = "renesas,r8a77980-rst", .data = &rcar_rst_gen3 }, 72 68 { .compatible = "renesas,r8a77990-rst", .data = &rcar_rst_gen3 }, 73 69 { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen3 }, 70 + /* R-Car V3U */ 71 + { .compatible = "renesas,r8a779a0-rst", .data = &rcar_rst_r8a779a0 }, 74 72 { /* sentinel */ } 75 73 }; 76 74
+8
drivers/soc/renesas/renesas-soc.c
··· 200 200 .id = 0x58, 201 201 }; 202 202 203 + static const struct renesas_soc soc_rcar_v3u __initconst __maybe_unused = { 204 + .family = &fam_rcar_gen3, 205 + .id = 0x59, 206 + }; 207 + 203 208 static const struct renesas_soc soc_shmobile_ag5 __initconst __maybe_unused = { 204 209 .family = &fam_shmobile, 205 210 .id = 0x37, ··· 295 290 #endif 296 291 #ifdef CONFIG_ARCH_R8A77995 297 292 { .compatible = "renesas,r8a77995", .data = &soc_rcar_d3 }, 293 + #endif 294 + #ifdef CONFIG_ARCH_R8A779A0 295 + { .compatible = "renesas,r8a779a0", .data = &soc_rcar_v3u }, 298 296 #endif 299 297 #ifdef CONFIG_ARCH_SH73A0 300 298 { .compatible = "renesas,sh73a0", .data = &soc_shmobile_ag5 },
+1 -1
drivers/soc/sunxi/sunxi_sram.c
··· 194 194 if (!data) { 195 195 ret = -EINVAL; 196 196 goto err; 197 - }; 197 + } 198 198 199 199 for (func = data->func; func->func; func++) { 200 200 if (val == func->val) {
+6 -2
drivers/soc/tegra/fuse/fuse-tegra.c
··· 49 49 }; 50 50 51 51 static const struct of_device_id tegra_fuse_match[] = { 52 + #ifdef CONFIG_ARCH_TEGRA_234_SOC 53 + { .compatible = "nvidia,tegra234-efuse", .data = &tegra234_fuse_soc }, 54 + #endif 52 55 #ifdef CONFIG_ARCH_TEGRA_194_SOC 53 56 { .compatible = "nvidia,tegra194-efuse", .data = &tegra194_fuse_soc }, 54 57 #endif ··· 329 326 .attrs = tegra_soc_attr, 330 327 }; 331 328 332 - #ifdef CONFIG_ARCH_TEGRA_194_SOC 329 + #if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \ 330 + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) 333 331 static ssize_t platform_show(struct device *dev, struct device_attribute *attr, 334 332 char *buf) 335 333 { ··· 340 336 * platform type is silicon and all other non-zero values indicate 341 337 * the type of simulation platform is being used. 342 338 */ 343 - return sprintf(buf, "%d\n", (tegra_read_chipid() >> 20) & 0xf); 339 + return sprintf(buf, "%d\n", tegra_get_platform()); 344 340 } 345 341 346 342 static DEVICE_ATTR_RO(platform);
+30
drivers/soc/tegra/fuse/fuse-tegra30.c
··· 356 356 .soc_attr_group = &tegra194_soc_attr_group, 357 357 }; 358 358 #endif 359 + 360 + #if defined(CONFIG_ARCH_TEGRA_234_SOC) 361 + static const struct nvmem_cell_lookup tegra234_fuse_lookups[] = { 362 + { 363 + .nvmem_name = "fuse", 364 + .cell_name = "xusb-pad-calibration", 365 + .dev_id = "3520000.padctl", 366 + .con_id = "calibration", 367 + }, { 368 + .nvmem_name = "fuse", 369 + .cell_name = "xusb-pad-calibration-ext", 370 + .dev_id = "3520000.padctl", 371 + .con_id = "calibration-ext", 372 + }, 373 + }; 374 + 375 + static const struct tegra_fuse_info tegra234_fuse_info = { 376 + .read = tegra30_fuse_read, 377 + .size = 0x300, 378 + .spare = 0x280, 379 + }; 380 + 381 + const struct tegra_fuse_soc tegra234_fuse_soc = { 382 + .init = tegra30_fuse_init, 383 + .info = &tegra234_fuse_info, 384 + .lookups = tegra234_fuse_lookups, 385 + .num_lookups = ARRAY_SIZE(tegra234_fuse_lookups), 386 + .soc_attr_group = &tegra194_soc_attr_group, 387 + }; 388 + #endif
+9 -1
drivers/soc/tegra/fuse/fuse.h
··· 115 115 extern const struct tegra_fuse_soc tegra186_fuse_soc; 116 116 #endif 117 117 118 + #if IS_ENABLED(CONFIG_ARCH_TEGRA_194_SOC) || \ 119 + IS_ENABLED(CONFIG_ARCH_TEGRA_234_SOC) 120 + extern const struct attribute_group tegra194_soc_attr_group; 121 + #endif 122 + 118 123 #ifdef CONFIG_ARCH_TEGRA_194_SOC 119 124 extern const struct tegra_fuse_soc tegra194_fuse_soc; 120 - extern const struct attribute_group tegra194_soc_attr_group; 125 + #endif 126 + 127 + #ifdef CONFIG_ARCH_TEGRA_234_SOC 128 + extern const struct tegra_fuse_soc tegra234_fuse_soc; 121 129 #endif 122 130 123 131 #endif
+26
drivers/soc/tegra/fuse/tegra-apbmisc.c
··· 47 47 return (tegra_read_chipid() >> 16) & 0xf; 48 48 } 49 49 50 + u8 tegra_get_platform(void) 51 + { 52 + return (tegra_read_chipid() >> 20) & 0xf; 53 + } 54 + 55 + bool tegra_is_silicon(void) 56 + { 57 + switch (tegra_get_chip_id()) { 58 + case TEGRA194: 59 + case TEGRA234: 60 + if (tegra_get_platform() == 0) 61 + return true; 62 + 63 + return false; 64 + } 65 + 66 + /* 67 + * Chips prior to Tegra194 have a different way of determining whether 68 + * they are silicon or not. Since we never supported simulation on the 69 + * older Tegra chips, don't bother extracting the information and just 70 + * report that we're running on silicon. 71 + */ 72 + return true; 73 + } 74 + 50 75 u32 tegra_read_straps(void) 51 76 { 52 77 WARN(!chipid, "Tegra ABP MISC not yet available\n"); ··· 95 70 { .compatible = "nvidia,tegra20-apbmisc", }, 96 71 { .compatible = "nvidia,tegra186-misc", }, 97 72 { .compatible = "nvidia,tegra194-misc", }, 73 + { .compatible = "nvidia,tegra234-misc", }, 98 74 {}, 99 75 }; 100 76
+107 -39
drivers/soc/tegra/pmc.c
··· 336 336 bool has_blink_output; 337 337 }; 338 338 339 - static const char * const tegra186_reset_sources[] = { 340 - "SYS_RESET", 341 - "AOWDT", 342 - "MCCPLEXWDT", 343 - "BPMPWDT", 344 - "SCEWDT", 345 - "SPEWDT", 346 - "APEWDT", 347 - "BCCPLEXWDT", 348 - "SENSOR", 349 - "AOTAG", 350 - "VFSENSOR", 351 - "SWREST", 352 - "SC7", 353 - "HSM", 354 - "CORESIGHT" 355 - }; 356 - 357 - static const char * const tegra186_reset_levels[] = { 358 - "L0", "L1", "L2", "WARM" 359 - }; 360 - 361 - static const char * const tegra30_reset_sources[] = { 362 - "POWER_ON_RESET", 363 - "WATCHDOG", 364 - "SENSOR", 365 - "SW_MAIN", 366 - "LP0" 367 - }; 368 - 369 - static const char * const tegra210_reset_sources[] = { 370 - "POWER_ON_RESET", 371 - "WATCHDOG", 372 - "SENSOR", 373 - "SW_MAIN", 374 - "LP0", 375 - "AOTAG" 376 - }; 377 - 378 339 /** 379 340 * struct tegra_pmc - NVIDIA Tegra PMC 380 341 * @dev: pointer to PMC device structure ··· 2732 2771 TEGRA_POWERGATE_CPU3, 2733 2772 }; 2734 2773 2774 + static const char * const tegra30_reset_sources[] = { 2775 + "POWER_ON_RESET", 2776 + "WATCHDOG", 2777 + "SENSOR", 2778 + "SW_MAIN", 2779 + "LP0" 2780 + }; 2781 + 2735 2782 static const struct tegra_pmc_soc tegra30_pmc_soc = { 2736 2783 .num_powergates = ARRAY_SIZE(tegra30_powergates), 2737 2784 .powergates = tegra30_powergates, ··· 3017 3048 TEGRA210_IO_PAD_TABLE(TEGRA_IO_PIN_DESC) 3018 3049 }; 3019 3050 3051 + static const char * const tegra210_reset_sources[] = { 3052 + "POWER_ON_RESET", 3053 + "WATCHDOG", 3054 + "SENSOR", 3055 + "SW_MAIN", 3056 + "LP0", 3057 + "AOTAG" 3058 + }; 3059 + 3020 3060 static const struct tegra_wake_event tegra210_wake_events[] = { 3021 3061 TEGRA_WAKE_IRQ("rtc", 16, 2), 3022 3062 TEGRA_WAKE_IRQ("pmu", 51, 86), ··· 3157 3179 3158 3180 iounmap(wake); 3159 3181 } 3182 + 3183 + static const char * const tegra186_reset_sources[] = { 3184 + "SYS_RESET", 3185 + "AOWDT", 3186 + "MCCPLEXWDT", 3187 + "BPMPWDT", 3188 + "SCEWDT", 3189 + "SPEWDT", 3190 + "APEWDT", 3191 + "BCCPLEXWDT", 3192 + "SENSOR", 3193 + "AOTAG", 3194 + "VFSENSOR", 3195 + "SWREST", 3196 + "SC7", 3197 + "HSM", 3198 + "CORESIGHT" 3199 + }; 3200 + 3201 + static const char * const tegra186_reset_levels[] = { 3202 + "L0", "L1", "L2", "WARM" 3203 + }; 3160 3204 3161 3205 static const struct tegra_wake_event tegra186_wake_events[] = { 3162 3206 TEGRA_WAKE_IRQ("pmu", 24, 209), ··· 3349 3349 .has_blink_output = false, 3350 3350 }; 3351 3351 3352 + static const struct tegra_pmc_regs tegra234_pmc_regs = { 3353 + .scratch0 = 0x2000, 3354 + .dpd_req = 0, 3355 + .dpd_status = 0, 3356 + .dpd2_req = 0, 3357 + .dpd2_status = 0, 3358 + .rst_status = 0x70, 3359 + .rst_source_shift = 0x2, 3360 + .rst_source_mask = 0xfc, 3361 + .rst_level_shift = 0x0, 3362 + .rst_level_mask = 0x3, 3363 + }; 3364 + 3365 + static const char * const tegra234_reset_sources[] = { 3366 + "SYS_RESET_N", 3367 + "AOWDT", 3368 + "BCCPLEXWDT", 3369 + "BPMPWDT", 3370 + "SCEWDT", 3371 + "SPEWDT", 3372 + "APEWDT", 3373 + "LCCPLEXWDT", 3374 + "SENSOR", 3375 + "AOTAG", 3376 + "VFSENSOR", 3377 + "MAINSWRST", 3378 + "SC7", 3379 + "HSM", 3380 + "CSITE", 3381 + "RCEWDT", 3382 + "PVA0WDT", 3383 + "PVA1WDT", 3384 + "L1A_ASYNC", 3385 + "BPMPBOOT", 3386 + "FUSECRC", 3387 + }; 3388 + 3389 + static const struct tegra_pmc_soc tegra234_pmc_soc = { 3390 + .num_powergates = 0, 3391 + .powergates = NULL, 3392 + .num_cpu_powergates = 0, 3393 + .cpu_powergates = NULL, 3394 + .has_tsense_reset = false, 3395 + .has_gpu_clamps = false, 3396 + .needs_mbist_war = false, 3397 + .has_impl_33v_pwr = true, 3398 + .maybe_tz_only = false, 3399 + .num_io_pads = 0, 3400 + .io_pads = NULL, 3401 + .num_pin_descs = 0, 3402 + .pin_descs = NULL, 3403 + .regs = &tegra234_pmc_regs, 3404 + .init = NULL, 3405 + .setup_irq_polarity = tegra186_pmc_setup_irq_polarity, 3406 + .irq_set_wake = tegra186_pmc_irq_set_wake, 3407 + .irq_set_type = tegra186_pmc_irq_set_type, 3408 + .reset_sources = tegra234_reset_sources, 3409 + .num_reset_sources = ARRAY_SIZE(tegra234_reset_sources), 3410 + .reset_levels = tegra186_reset_levels, 3411 + .num_reset_levels = ARRAY_SIZE(tegra186_reset_levels), 3412 + .num_wake_events = 0, 3413 + .wake_events = NULL, 3414 + .pmc_clks_data = NULL, 3415 + .num_pmc_clks = 0, 3416 + .has_blink_output = false, 3417 + }; 3418 + 3352 3419 static const struct of_device_id tegra_pmc_match[] = { 3420 + { .compatible = "nvidia,tegra234-pmc", .data = &tegra234_pmc_soc }, 3353 3421 { .compatible = "nvidia,tegra194-pmc", .data = &tegra194_pmc_soc }, 3354 3422 { .compatible = "nvidia,tegra186-pmc", .data = &tegra186_pmc_soc }, 3355 3423 { .compatible = "nvidia,tegra210-pmc", .data = &tegra210_pmc_soc },
+11
drivers/soc/ti/Kconfig
··· 101 101 platforms to provide information about the SoC family and 102 102 variant to user space. 103 103 104 + config TI_PRUSS 105 + tristate "TI PRU-ICSS Subsystem Platform drivers" 106 + depends on SOC_AM33XX || SOC_AM43XX || SOC_DRA7XX || ARCH_KEYSTONE || ARCH_K3 107 + select MFD_SYSCON 108 + help 109 + TI PRU-ICSS Subsystem platform specific support. 110 + 111 + Say Y or M here to support the Programmable Realtime Unit (PRU) 112 + processors on various TI SoCs. It's safe to say N here if you're 113 + not interested in the PRU or if you are unsure. 114 + 104 115 endif # SOC_TI 105 116 106 117 config TI_SCI_INTA_MSI_DOMAIN
+1
drivers/soc/ti/Makefile
··· 12 12 obj-$(CONFIG_TI_SCI_INTA_MSI_DOMAIN) += ti_sci_inta_msi.o 13 13 obj-$(CONFIG_TI_K3_RINGACC) += k3-ringacc.o 14 14 obj-$(CONFIG_TI_K3_SOCINFO) += k3-socinfo.o 15 + obj-$(CONFIG_TI_PRUSS) += pruss.o 15 16 obj-$(CONFIG_POWER_AVS_OMAP) += smartreflex.o
+30 -3
drivers/soc/ti/k3-ringacc.c
··· 10 10 #include <linux/init.h> 11 11 #include <linux/of.h> 12 12 #include <linux/platform_device.h> 13 + #include <linux/sys_soc.h> 13 14 #include <linux/soc/ti/k3-ringacc.h> 14 15 #include <linux/soc/ti/ti_sci_protocol.h> 15 16 #include <linux/soc/ti/ti_sci_inta_msi.h> ··· 207 206 u32 tisci_dev_id; 208 207 209 208 const struct k3_ringacc_ops *ops; 209 + }; 210 + 211 + /** 212 + * struct k3_ringacc - Rings accelerator SoC data 213 + * 214 + * @dma_ring_reset_quirk: DMA reset w/a enable 215 + */ 216 + struct k3_ringacc_soc_data { 217 + unsigned dma_ring_reset_quirk:1; 210 218 }; 211 219 212 220 static long k3_ringacc_ring_get_fifo_pos(struct k3_ring *ring) ··· 1061 1051 return ret; 1062 1052 } 1063 1053 1064 - ringacc->dma_ring_reset_quirk = 1065 - of_property_read_bool(node, "ti,dma-ring-reset-quirk"); 1066 - 1067 1054 ringacc->tisci = ti_sci_get_by_phandle(node, "ti,sci"); 1068 1055 if (IS_ERR(ringacc->tisci)) { 1069 1056 ret = PTR_ERR(ringacc->tisci); ··· 1091 1084 ringacc->rm_gp_range); 1092 1085 } 1093 1086 1087 + static const struct k3_ringacc_soc_data k3_ringacc_soc_data_sr1 = { 1088 + .dma_ring_reset_quirk = 1, 1089 + }; 1090 + 1091 + static const struct soc_device_attribute k3_ringacc_socinfo[] = { 1092 + { .family = "AM65X", 1093 + .revision = "SR1.0", 1094 + .data = &k3_ringacc_soc_data_sr1 1095 + }, 1096 + {/* sentinel */} 1097 + }; 1098 + 1094 1099 static int k3_ringacc_init(struct platform_device *pdev, 1095 1100 struct k3_ringacc *ringacc) 1096 1101 { 1102 + const struct soc_device_attribute *soc; 1097 1103 void __iomem *base_fifo, *base_rt; 1098 1104 struct device *dev = &pdev->dev; 1099 1105 struct resource *res; ··· 1122 1102 ret = k3_ringacc_probe_dt(ringacc); 1123 1103 if (ret) 1124 1104 return ret; 1105 + 1106 + soc = soc_device_match(k3_ringacc_socinfo); 1107 + if (soc && soc->data) { 1108 + const struct k3_ringacc_soc_data *soc_data = soc->data; 1109 + 1110 + ringacc->dma_ring_reset_quirk = soc_data->dma_ring_reset_quirk; 1111 + } 1125 1112 1126 1113 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rt"); 1127 1114 base_rt = devm_ioremap_resource(dev, res);
+1
drivers/soc/ti/k3-socinfo.c
··· 39 39 } k3_soc_ids[] = { 40 40 { 0xBB5A, "AM65X" }, 41 41 { 0xBB64, "J721E" }, 42 + { 0xBB6D, "J7200" }, 42 43 }; 43 44 44 45 static int
+3 -13
drivers/soc/ti/knav_dma.c
··· 355 355 } 356 356 } 357 357 358 - static int dma_debug_show(struct seq_file *s, void *v) 358 + static int knav_dma_debug_show(struct seq_file *s, void *v) 359 359 { 360 360 struct knav_dma_device *dma; 361 361 ··· 370 370 return 0; 371 371 } 372 372 373 - static int knav_dma_debug_open(struct inode *inode, struct file *file) 374 - { 375 - return single_open(file, dma_debug_show, NULL); 376 - } 377 - 378 - static const struct file_operations knav_dma_debug_ops = { 379 - .open = knav_dma_debug_open, 380 - .read = seq_read, 381 - .llseek = seq_lseek, 382 - .release = single_release, 383 - }; 373 + DEFINE_SHOW_ATTRIBUTE(knav_dma_debug); 384 374 385 375 static int of_channel_match_helper(struct device_node *np, const char *name, 386 376 const char **dma_instance) ··· 768 778 } 769 779 770 780 debugfs_create_file("knav_dma", S_IFREG | S_IRUGO, NULL, NULL, 771 - &knav_dma_debug_ops); 781 + &knav_dma_debug_fops); 772 782 773 783 device_ready = true; 774 784 return ret;
+2 -12
drivers/soc/ti/knav_qmss_queue.c
··· 478 478 return 0; 479 479 } 480 480 481 - static int knav_queue_debug_open(struct inode *inode, struct file *file) 482 - { 483 - return single_open(file, knav_queue_debug_show, NULL); 484 - } 485 - 486 - static const struct file_operations knav_queue_debug_ops = { 487 - .open = knav_queue_debug_open, 488 - .read = seq_read, 489 - .llseek = seq_lseek, 490 - .release = single_release, 491 - }; 481 + DEFINE_SHOW_ATTRIBUTE(knav_queue_debug); 492 482 493 483 static inline int knav_queue_pdsp_wait(u32 * __iomem addr, unsigned timeout, 494 484 u32 flags) ··· 1868 1878 } 1869 1879 1870 1880 debugfs_create_file("qmss", S_IFREG | S_IRUGO, NULL, NULL, 1871 - &knav_queue_debug_ops); 1881 + &knav_queue_debug_fops); 1872 1882 device_ready = true; 1873 1883 return 0; 1874 1884
+354
drivers/soc/ti/pruss.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * PRU-ICSS platform driver for various TI SoCs 4 + * 5 + * Copyright (C) 2014-2020 Texas Instruments Incorporated - http://www.ti.com/ 6 + * Author(s): 7 + * Suman Anna <s-anna@ti.com> 8 + * Andrew F. Davis <afd@ti.com> 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/dma-mapping.h> 13 + #include <linux/io.h> 14 + #include <linux/mfd/syscon.h> 15 + #include <linux/module.h> 16 + #include <linux/of_address.h> 17 + #include <linux/of_device.h> 18 + #include <linux/pm_runtime.h> 19 + #include <linux/pruss_driver.h> 20 + #include <linux/regmap.h> 21 + #include <linux/slab.h> 22 + 23 + /** 24 + * struct pruss_private_data - PRUSS driver private data 25 + * @has_no_sharedram: flag to indicate the absence of PRUSS Shared Data RAM 26 + * @has_core_mux_clock: flag to indicate the presence of PRUSS core clock 27 + */ 28 + struct pruss_private_data { 29 + bool has_no_sharedram; 30 + bool has_core_mux_clock; 31 + }; 32 + 33 + static void pruss_of_free_clk_provider(void *data) 34 + { 35 + struct device_node *clk_mux_np = data; 36 + 37 + of_clk_del_provider(clk_mux_np); 38 + of_node_put(clk_mux_np); 39 + } 40 + 41 + static int pruss_clk_mux_setup(struct pruss *pruss, struct clk *clk_mux, 42 + char *mux_name, struct device_node *clks_np) 43 + { 44 + struct device_node *clk_mux_np; 45 + struct device *dev = pruss->dev; 46 + char *clk_mux_name; 47 + unsigned int num_parents; 48 + const char **parent_names; 49 + void __iomem *reg; 50 + u32 reg_offset; 51 + int ret; 52 + 53 + clk_mux_np = of_get_child_by_name(clks_np, mux_name); 54 + if (!clk_mux_np) { 55 + dev_err(dev, "%pOF is missing its '%s' node\n", clks_np, 56 + mux_name); 57 + return -ENODEV; 58 + } 59 + 60 + num_parents = of_clk_get_parent_count(clk_mux_np); 61 + if (num_parents < 1) { 62 + dev_err(dev, "mux-clock %pOF must have parents\n", clk_mux_np); 63 + ret = -EINVAL; 64 + goto put_clk_mux_np; 65 + } 66 + 67 + parent_names = devm_kcalloc(dev, sizeof(*parent_names), num_parents, 68 + GFP_KERNEL); 69 + if (!parent_names) { 70 + ret = -ENOMEM; 71 + goto put_clk_mux_np; 72 + } 73 + 74 + of_clk_parent_fill(clk_mux_np, parent_names, num_parents); 75 + 76 + clk_mux_name = devm_kasprintf(dev, GFP_KERNEL, "%s.%pOFn", 77 + dev_name(dev), clk_mux_np); 78 + if (!clk_mux_name) { 79 + ret = -ENOMEM; 80 + goto put_clk_mux_np; 81 + } 82 + 83 + ret = of_property_read_u32(clk_mux_np, "reg", &reg_offset); 84 + if (ret) 85 + goto put_clk_mux_np; 86 + 87 + reg = pruss->cfg_base + reg_offset; 88 + 89 + clk_mux = clk_register_mux(NULL, clk_mux_name, parent_names, 90 + num_parents, 0, reg, 0, 1, 0, NULL); 91 + if (IS_ERR(clk_mux)) { 92 + ret = PTR_ERR(clk_mux); 93 + goto put_clk_mux_np; 94 + } 95 + 96 + ret = devm_add_action_or_reset(dev, (void(*)(void *))clk_unregister_mux, 97 + clk_mux); 98 + if (ret) { 99 + dev_err(dev, "failed to add clkmux unregister action %d", ret); 100 + goto put_clk_mux_np; 101 + } 102 + 103 + ret = of_clk_add_provider(clk_mux_np, of_clk_src_simple_get, clk_mux); 104 + if (ret) 105 + goto put_clk_mux_np; 106 + 107 + ret = devm_add_action_or_reset(dev, pruss_of_free_clk_provider, 108 + clk_mux_np); 109 + if (ret) { 110 + dev_err(dev, "failed to add clkmux free action %d", ret); 111 + goto put_clk_mux_np; 112 + } 113 + 114 + return 0; 115 + 116 + put_clk_mux_np: 117 + of_node_put(clk_mux_np); 118 + return ret; 119 + } 120 + 121 + static int pruss_clk_init(struct pruss *pruss, struct device_node *cfg_node) 122 + { 123 + const struct pruss_private_data *data; 124 + struct device_node *clks_np; 125 + struct device *dev = pruss->dev; 126 + int ret = 0; 127 + 128 + data = of_device_get_match_data(dev); 129 + if (IS_ERR(data)) 130 + return -ENODEV; 131 + 132 + clks_np = of_get_child_by_name(cfg_node, "clocks"); 133 + if (!clks_np) { 134 + dev_err(dev, "%pOF is missing its 'clocks' node\n", clks_np); 135 + return -ENODEV; 136 + } 137 + 138 + if (data && data->has_core_mux_clock) { 139 + ret = pruss_clk_mux_setup(pruss, pruss->core_clk_mux, 140 + "coreclk-mux", clks_np); 141 + if (ret) { 142 + dev_err(dev, "failed to setup coreclk-mux\n"); 143 + goto put_clks_node; 144 + } 145 + } 146 + 147 + ret = pruss_clk_mux_setup(pruss, pruss->iep_clk_mux, "iepclk-mux", 148 + clks_np); 149 + if (ret) { 150 + dev_err(dev, "failed to setup iepclk-mux\n"); 151 + goto put_clks_node; 152 + } 153 + 154 + put_clks_node: 155 + of_node_put(clks_np); 156 + 157 + return ret; 158 + } 159 + 160 + static struct regmap_config regmap_conf = { 161 + .reg_bits = 32, 162 + .val_bits = 32, 163 + .reg_stride = 4, 164 + }; 165 + 166 + static int pruss_probe(struct platform_device *pdev) 167 + { 168 + struct device *dev = &pdev->dev; 169 + struct device_node *np = dev_of_node(dev); 170 + struct device_node *child; 171 + struct pruss *pruss; 172 + struct resource res; 173 + int ret, i, index; 174 + const struct pruss_private_data *data; 175 + const char *mem_names[PRUSS_MEM_MAX] = { "dram0", "dram1", "shrdram2" }; 176 + 177 + data = of_device_get_match_data(&pdev->dev); 178 + if (IS_ERR(data)) { 179 + dev_err(dev, "missing private data\n"); 180 + return -ENODEV; 181 + } 182 + 183 + ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); 184 + if (ret) { 185 + dev_err(dev, "failed to set the DMA coherent mask"); 186 + return ret; 187 + } 188 + 189 + pruss = devm_kzalloc(dev, sizeof(*pruss), GFP_KERNEL); 190 + if (!pruss) 191 + return -ENOMEM; 192 + 193 + pruss->dev = dev; 194 + 195 + child = of_get_child_by_name(np, "memories"); 196 + if (!child) { 197 + dev_err(dev, "%pOF is missing its 'memories' node\n", child); 198 + return -ENODEV; 199 + } 200 + 201 + for (i = 0; i < PRUSS_MEM_MAX; i++) { 202 + /* 203 + * On AM437x one of two PRUSS units don't contain Shared RAM, 204 + * skip it 205 + */ 206 + if (data && data->has_no_sharedram && i == PRUSS_MEM_SHRD_RAM2) 207 + continue; 208 + 209 + index = of_property_match_string(child, "reg-names", 210 + mem_names[i]); 211 + if (index < 0) { 212 + of_node_put(child); 213 + return index; 214 + } 215 + 216 + if (of_address_to_resource(child, index, &res)) { 217 + of_node_put(child); 218 + return -EINVAL; 219 + } 220 + 221 + pruss->mem_regions[i].va = devm_ioremap(dev, res.start, 222 + resource_size(&res)); 223 + if (!pruss->mem_regions[i].va) { 224 + dev_err(dev, "failed to parse and map memory resource %d %s\n", 225 + i, mem_names[i]); 226 + of_node_put(child); 227 + return -ENOMEM; 228 + } 229 + pruss->mem_regions[i].pa = res.start; 230 + pruss->mem_regions[i].size = resource_size(&res); 231 + 232 + dev_dbg(dev, "memory %8s: pa %pa size 0x%zx va %pK\n", 233 + mem_names[i], &pruss->mem_regions[i].pa, 234 + pruss->mem_regions[i].size, pruss->mem_regions[i].va); 235 + } 236 + of_node_put(child); 237 + 238 + platform_set_drvdata(pdev, pruss); 239 + 240 + pm_runtime_enable(dev); 241 + ret = pm_runtime_get_sync(dev); 242 + if (ret < 0) { 243 + dev_err(dev, "couldn't enable module\n"); 244 + pm_runtime_put_noidle(dev); 245 + goto rpm_disable; 246 + } 247 + 248 + child = of_get_child_by_name(np, "cfg"); 249 + if (!child) { 250 + dev_err(dev, "%pOF is missing its 'cfg' node\n", child); 251 + ret = -ENODEV; 252 + goto rpm_put; 253 + } 254 + 255 + if (of_address_to_resource(child, 0, &res)) { 256 + ret = -ENOMEM; 257 + goto node_put; 258 + } 259 + 260 + pruss->cfg_base = devm_ioremap(dev, res.start, resource_size(&res)); 261 + if (!pruss->cfg_base) { 262 + ret = -ENOMEM; 263 + goto node_put; 264 + } 265 + 266 + regmap_conf.name = kasprintf(GFP_KERNEL, "%pOFn@%llx", child, 267 + (u64)res.start); 268 + regmap_conf.max_register = resource_size(&res) - 4; 269 + 270 + pruss->cfg_regmap = devm_regmap_init_mmio(dev, pruss->cfg_base, 271 + &regmap_conf); 272 + kfree(regmap_conf.name); 273 + if (IS_ERR(pruss->cfg_regmap)) { 274 + dev_err(dev, "regmap_init_mmio failed for cfg, ret = %ld\n", 275 + PTR_ERR(pruss->cfg_regmap)); 276 + ret = PTR_ERR(pruss->cfg_regmap); 277 + goto node_put; 278 + } 279 + 280 + ret = pruss_clk_init(pruss, child); 281 + if (ret) { 282 + dev_err(dev, "failed to setup coreclk-mux\n"); 283 + goto node_put; 284 + } 285 + 286 + ret = devm_of_platform_populate(dev); 287 + if (ret) { 288 + dev_err(dev, "failed to register child devices\n"); 289 + goto node_put; 290 + } 291 + 292 + of_node_put(child); 293 + 294 + return 0; 295 + 296 + node_put: 297 + of_node_put(child); 298 + rpm_put: 299 + pm_runtime_put_sync(dev); 300 + rpm_disable: 301 + pm_runtime_disable(dev); 302 + return ret; 303 + } 304 + 305 + static int pruss_remove(struct platform_device *pdev) 306 + { 307 + struct device *dev = &pdev->dev; 308 + 309 + devm_of_platform_depopulate(dev); 310 + 311 + pm_runtime_put_sync(dev); 312 + pm_runtime_disable(dev); 313 + 314 + return 0; 315 + } 316 + 317 + /* instance-specific driver private data */ 318 + static const struct pruss_private_data am437x_pruss1_data = { 319 + .has_no_sharedram = false, 320 + }; 321 + 322 + static const struct pruss_private_data am437x_pruss0_data = { 323 + .has_no_sharedram = true, 324 + }; 325 + 326 + static const struct pruss_private_data am65x_j721e_pruss_data = { 327 + .has_core_mux_clock = true, 328 + }; 329 + 330 + static const struct of_device_id pruss_of_match[] = { 331 + { .compatible = "ti,am3356-pruss" }, 332 + { .compatible = "ti,am4376-pruss0", .data = &am437x_pruss0_data, }, 333 + { .compatible = "ti,am4376-pruss1", .data = &am437x_pruss1_data, }, 334 + { .compatible = "ti,am5728-pruss" }, 335 + { .compatible = "ti,k2g-pruss" }, 336 + { .compatible = "ti,am654-icssg", .data = &am65x_j721e_pruss_data, }, 337 + { .compatible = "ti,j721e-icssg", .data = &am65x_j721e_pruss_data, }, 338 + {}, 339 + }; 340 + MODULE_DEVICE_TABLE(of, pruss_of_match); 341 + 342 + static struct platform_driver pruss_driver = { 343 + .driver = { 344 + .name = "pruss", 345 + .of_match_table = pruss_of_match, 346 + }, 347 + .probe = pruss_probe, 348 + .remove = pruss_remove, 349 + }; 350 + module_platform_driver(pruss_driver); 351 + 352 + MODULE_AUTHOR("Suman Anna <s-anna@ti.com>"); 353 + MODULE_DESCRIPTION("PRU-ICSS Subsystem Driver"); 354 + MODULE_LICENSE("GPL v2");
+121 -130
drivers/soc/ti/ti_sci_pm_domains.c
··· 9 9 10 10 #include <linux/err.h> 11 11 #include <linux/module.h> 12 - #include <linux/mutex.h> 13 12 #include <linux/of.h> 14 13 #include <linux/platform_device.h> 15 14 #include <linux/pm_domain.h> ··· 17 18 #include <dt-bindings/soc/ti,sci_pm_domain.h> 18 19 19 20 /** 20 - * struct ti_sci_genpd_dev_data: holds data needed for every device attached 21 - * to this genpd 22 - * @idx: index of the device that identifies it with the system 23 - * control processor. 24 - * @exclusive: Permissions for exclusive request or shared request of the 25 - * device. 21 + * struct ti_sci_genpd_provider: holds common TI SCI genpd provider data 22 + * @ti_sci: handle to TI SCI protocol driver that provides ops to 23 + * communicate with system control processor. 24 + * @dev: pointer to dev for the driver for devm allocs 25 + * @pd_list: list of all the power domains on the device 26 + * @data: onecell data for genpd core 26 27 */ 27 - struct ti_sci_genpd_dev_data { 28 - int idx; 29 - u8 exclusive; 28 + struct ti_sci_genpd_provider { 29 + const struct ti_sci_handle *ti_sci; 30 + struct device *dev; 31 + struct list_head pd_list; 32 + struct genpd_onecell_data data; 30 33 }; 31 34 32 35 /** 33 36 * struct ti_sci_pm_domain: TI specific data needed for power domain 34 - * @ti_sci: handle to TI SCI protocol driver that provides ops to 35 - * communicate with system control processor. 36 - * @dev: pointer to dev for the driver for devm allocs 37 + * @idx: index of the device that identifies it with the system 38 + * control processor. 39 + * @exclusive: Permissions for exclusive request or shared request of the 40 + * device. 37 41 * @pd: generic_pm_domain for use with the genpd framework 42 + * @node: link for the genpd list 43 + * @parent: link to the parent TI SCI genpd provider 38 44 */ 39 45 struct ti_sci_pm_domain { 40 - const struct ti_sci_handle *ti_sci; 41 - struct device *dev; 46 + int idx; 47 + u8 exclusive; 42 48 struct generic_pm_domain pd; 49 + struct list_head node; 50 + struct ti_sci_genpd_provider *parent; 43 51 }; 44 52 45 53 #define genpd_to_ti_sci_pd(gpd) container_of(gpd, struct ti_sci_pm_domain, pd) 46 54 47 - /** 48 - * ti_sci_dev_id(): get prepopulated ti_sci id from struct dev 49 - * @dev: pointer to device associated with this genpd 50 - * 51 - * Returns device_id stored from ti,sci_id property 55 + /* 56 + * ti_sci_pd_power_off(): genpd power down hook 57 + * @domain: pointer to the powerdomain to power off 52 58 */ 53 - static int ti_sci_dev_id(struct device *dev) 59 + static int ti_sci_pd_power_off(struct generic_pm_domain *domain) 54 60 { 55 - struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev); 56 - struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data; 61 + struct ti_sci_pm_domain *pd = genpd_to_ti_sci_pd(domain); 62 + const struct ti_sci_handle *ti_sci = pd->parent->ti_sci; 57 63 58 - return sci_dev_data->idx; 64 + return ti_sci->ops.dev_ops.put_device(ti_sci, pd->idx); 59 65 } 60 66 61 - static u8 is_ti_sci_dev_exclusive(struct device *dev) 62 - { 63 - struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev); 64 - struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data; 65 - 66 - return sci_dev_data->exclusive; 67 - } 68 - 69 - /** 70 - * ti_sci_dev_to_sci_handle(): get pointer to ti_sci_handle 71 - * @dev: pointer to device associated with this genpd 72 - * 73 - * Returns ti_sci_handle to be used to communicate with system 74 - * control processor. 67 + /* 68 + * ti_sci_pd_power_on(): genpd power up hook 69 + * @domain: pointer to the powerdomain to power on 75 70 */ 76 - static const struct ti_sci_handle *ti_sci_dev_to_sci_handle(struct device *dev) 71 + static int ti_sci_pd_power_on(struct generic_pm_domain *domain) 77 72 { 78 - struct generic_pm_domain *pd = pd_to_genpd(dev->pm_domain); 79 - struct ti_sci_pm_domain *ti_sci_genpd = genpd_to_ti_sci_pd(pd); 73 + struct ti_sci_pm_domain *pd = genpd_to_ti_sci_pd(domain); 74 + const struct ti_sci_handle *ti_sci = pd->parent->ti_sci; 80 75 81 - return ti_sci_genpd->ti_sci; 82 - } 83 - 84 - /** 85 - * ti_sci_dev_start(): genpd device start hook called to turn device on 86 - * @dev: pointer to device associated with this genpd to be powered on 87 - */ 88 - static int ti_sci_dev_start(struct device *dev) 89 - { 90 - const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev); 91 - int idx = ti_sci_dev_id(dev); 92 - 93 - if (is_ti_sci_dev_exclusive(dev)) 94 - return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci, idx); 76 + if (pd->exclusive) 77 + return ti_sci->ops.dev_ops.get_device_exclusive(ti_sci, 78 + pd->idx); 95 79 else 96 - return ti_sci->ops.dev_ops.get_device(ti_sci, idx); 80 + return ti_sci->ops.dev_ops.get_device(ti_sci, pd->idx); 97 81 } 98 82 99 - /** 100 - * ti_sci_dev_stop(): genpd device stop hook called to turn device off 101 - * @dev: pointer to device associated with this genpd to be powered off 83 + /* 84 + * ti_sci_pd_xlate(): translation service for TI SCI genpds 85 + * @genpdspec: DT identification data for the genpd 86 + * @data: genpd core data for all the powerdomains on the device 102 87 */ 103 - static int ti_sci_dev_stop(struct device *dev) 88 + static struct generic_pm_domain *ti_sci_pd_xlate( 89 + struct of_phandle_args *genpdspec, 90 + void *data) 104 91 { 105 - const struct ti_sci_handle *ti_sci = ti_sci_dev_to_sci_handle(dev); 106 - int idx = ti_sci_dev_id(dev); 92 + struct genpd_onecell_data *genpd_data = data; 93 + unsigned int idx = genpdspec->args[0]; 107 94 108 - return ti_sci->ops.dev_ops.put_device(ti_sci, idx); 109 - } 95 + if (genpdspec->args_count < 2) 96 + return ERR_PTR(-EINVAL); 110 97 111 - static int ti_sci_pd_attach_dev(struct generic_pm_domain *domain, 112 - struct device *dev) 113 - { 114 - struct device_node *np = dev->of_node; 115 - struct of_phandle_args pd_args; 116 - struct ti_sci_pm_domain *ti_sci_genpd = genpd_to_ti_sci_pd(domain); 117 - const struct ti_sci_handle *ti_sci = ti_sci_genpd->ti_sci; 118 - struct ti_sci_genpd_dev_data *sci_dev_data; 119 - struct generic_pm_domain_data *genpd_data; 120 - int idx, ret = 0; 98 + if (idx >= genpd_data->num_domains) { 99 + pr_err("%s: invalid domain index %u\n", __func__, idx); 100 + return ERR_PTR(-EINVAL); 101 + } 121 102 122 - ret = of_parse_phandle_with_args(np, "power-domains", 123 - "#power-domain-cells", 0, &pd_args); 124 - if (ret < 0) 125 - return ret; 103 + if (!genpd_data->domains[idx]) 104 + return ERR_PTR(-ENOENT); 126 105 127 - if (pd_args.args_count != 1 && pd_args.args_count != 2) 128 - return -EINVAL; 106 + genpd_to_ti_sci_pd(genpd_data->domains[idx])->exclusive = 107 + genpdspec->args[1]; 129 108 130 - idx = pd_args.args[0]; 131 - 132 - /* 133 - * Check the validity of the requested idx, if the index is not valid 134 - * the PMMC will return a NAK here and we will not allocate it. 135 - */ 136 - ret = ti_sci->ops.dev_ops.is_valid(ti_sci, idx); 137 - if (ret) 138 - return -EINVAL; 139 - 140 - sci_dev_data = kzalloc(sizeof(*sci_dev_data), GFP_KERNEL); 141 - if (!sci_dev_data) 142 - return -ENOMEM; 143 - 144 - sci_dev_data->idx = idx; 145 - /* Enable the exclusive permissions by default */ 146 - sci_dev_data->exclusive = TI_SCI_PD_EXCLUSIVE; 147 - if (pd_args.args_count == 2) 148 - sci_dev_data->exclusive = pd_args.args[1] & 0x1; 149 - 150 - genpd_data = dev_gpd_data(dev); 151 - genpd_data->data = sci_dev_data; 152 - 153 - return 0; 154 - } 155 - 156 - static void ti_sci_pd_detach_dev(struct generic_pm_domain *domain, 157 - struct device *dev) 158 - { 159 - struct generic_pm_domain_data *genpd_data = dev_gpd_data(dev); 160 - struct ti_sci_genpd_dev_data *sci_dev_data = genpd_data->data; 161 - 162 - kfree(sci_dev_data); 163 - genpd_data->data = NULL; 109 + return genpd_data->domains[idx]; 164 110 } 165 111 166 112 static const struct of_device_id ti_sci_pm_domain_matches[] = { ··· 117 173 static int ti_sci_pm_domain_probe(struct platform_device *pdev) 118 174 { 119 175 struct device *dev = &pdev->dev; 120 - struct device_node *np = dev->of_node; 121 - struct ti_sci_pm_domain *ti_sci_pd; 176 + struct ti_sci_genpd_provider *pd_provider; 177 + struct ti_sci_pm_domain *pd; 178 + struct device_node *np = NULL; 179 + struct of_phandle_args args; 122 180 int ret; 181 + u32 max_id = 0; 182 + int index; 123 183 124 - ti_sci_pd = devm_kzalloc(dev, sizeof(*ti_sci_pd), GFP_KERNEL); 125 - if (!ti_sci_pd) 184 + pd_provider = devm_kzalloc(dev, sizeof(*pd_provider), GFP_KERNEL); 185 + if (!pd_provider) 126 186 return -ENOMEM; 127 187 128 - ti_sci_pd->ti_sci = devm_ti_sci_get_handle(dev); 129 - if (IS_ERR(ti_sci_pd->ti_sci)) 130 - return PTR_ERR(ti_sci_pd->ti_sci); 188 + pd_provider->ti_sci = devm_ti_sci_get_handle(dev); 189 + if (IS_ERR(pd_provider->ti_sci)) 190 + return PTR_ERR(pd_provider->ti_sci); 131 191 132 - ti_sci_pd->dev = dev; 192 + pd_provider->dev = dev; 133 193 134 - ti_sci_pd->pd.name = "ti_sci_pd"; 194 + INIT_LIST_HEAD(&pd_provider->pd_list); 135 195 136 - ti_sci_pd->pd.attach_dev = ti_sci_pd_attach_dev; 137 - ti_sci_pd->pd.detach_dev = ti_sci_pd_detach_dev; 196 + /* Find highest device ID used for power domains */ 197 + while (1) { 198 + np = of_find_node_with_property(np, "power-domains"); 199 + if (!np) 200 + break; 138 201 139 - ti_sci_pd->pd.dev_ops.start = ti_sci_dev_start; 140 - ti_sci_pd->pd.dev_ops.stop = ti_sci_dev_stop; 202 + index = 0; 141 203 142 - pm_genpd_init(&ti_sci_pd->pd, NULL, true); 204 + while (1) { 205 + ret = of_parse_phandle_with_args(np, "power-domains", 206 + "#power-domain-cells", 207 + index, &args); 208 + if (ret) 209 + break; 143 210 144 - ret = of_genpd_add_provider_simple(np, &ti_sci_pd->pd); 211 + if (args.args_count >= 1 && args.np == dev->of_node) { 212 + if (args.args[0] > max_id) 213 + max_id = args.args[0]; 145 214 146 - return ret; 215 + pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); 216 + if (!pd) 217 + return -ENOMEM; 218 + 219 + pd->pd.name = devm_kasprintf(dev, GFP_KERNEL, 220 + "pd:%d", 221 + args.args[0]); 222 + if (!pd->pd.name) 223 + return -ENOMEM; 224 + 225 + pd->pd.power_off = ti_sci_pd_power_off; 226 + pd->pd.power_on = ti_sci_pd_power_on; 227 + pd->idx = args.args[0]; 228 + pd->parent = pd_provider; 229 + 230 + pm_genpd_init(&pd->pd, NULL, true); 231 + 232 + list_add(&pd->node, &pd_provider->pd_list); 233 + } 234 + index++; 235 + } 236 + } 237 + 238 + pd_provider->data.domains = 239 + devm_kcalloc(dev, max_id + 1, 240 + sizeof(*pd_provider->data.domains), 241 + GFP_KERNEL); 242 + 243 + pd_provider->data.num_domains = max_id + 1; 244 + pd_provider->data.xlate = ti_sci_pd_xlate; 245 + 246 + list_for_each_entry(pd, &pd_provider->pd_list, node) 247 + pd_provider->data.domains[pd->idx] = &pd->pd; 248 + 249 + return of_genpd_add_provider_onecell(dev->of_node, &pd_provider->data); 147 250 } 148 251 149 252 static struct platform_driver ti_sci_pm_domains_driver = {
+7
drivers/tee/optee/core.c
··· 216 216 217 217 if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM) 218 218 v.gen_caps |= TEE_GEN_CAP_REG_MEM; 219 + if (optee->sec_caps & OPTEE_SMC_SEC_CAP_MEMREF_NULL) 220 + v.gen_caps |= TEE_GEN_CAP_MEMREF_NULL; 219 221 *vers = v; 220 222 } 221 223 ··· 263 261 } 264 262 mutex_init(&ctxdata->mutex); 265 263 INIT_LIST_HEAD(&ctxdata->sess_list); 264 + 265 + if (optee->sec_caps & OPTEE_SMC_SEC_CAP_MEMREF_NULL) 266 + ctx->cap_memref_null = true; 267 + else 268 + ctx->cap_memref_null = false; 266 269 267 270 ctx->data = ctxdata; 268 271 return 0;
+21
drivers/tee/optee/optee_msg.h
··· 419 419 */ 420 420 #define OPTEE_MSG_RPC_CMD_SHM_FREE 7 421 421 422 + /* 423 + * Access a device on an i2c bus 424 + * 425 + * [in] param[0].u.value.a mode: RD(0), WR(1) 426 + * [in] param[0].u.value.b i2c adapter 427 + * [in] param[0].u.value.c i2c chip 428 + * 429 + * [in] param[1].u.value.a i2c control flags 430 + * 431 + * [in/out] memref[2] buffer to exchange the transfer data 432 + * with the secure world 433 + * 434 + * [out] param[3].u.value.a bytes transferred by the driver 435 + */ 436 + #define OPTEE_MSG_RPC_CMD_I2C_TRANSFER 21 437 + /* I2C master transfer modes */ 438 + #define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD 0 439 + #define OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR 1 440 + /* I2C master control flags */ 441 + #define OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT BIT(0) 442 + 422 443 #endif /* _OPTEE_MSG_H */
+1
drivers/tee/optee/optee_private.h
··· 17 17 /* Some Global Platform error codes used in this driver */ 18 18 #define TEEC_SUCCESS 0x00000000 19 19 #define TEEC_ERROR_BAD_PARAMETERS 0xFFFF0006 20 + #define TEEC_ERROR_NOT_SUPPORTED 0xFFFF000A 20 21 #define TEEC_ERROR_COMMUNICATION 0xFFFF000E 21 22 #define TEEC_ERROR_OUT_OF_MEMORY 0xFFFF000C 22 23 #define TEEC_ERROR_SHORT_BUFFER 0xFFFF0010
+3
drivers/tee/optee/optee_smc.h
··· 215 215 */ 216 216 #define OPTEE_SMC_SEC_CAP_DYNAMIC_SHM BIT(2) 217 217 218 + /* Secure world supports Shared Memory with a NULL buffer reference */ 219 + #define OPTEE_SMC_SEC_CAP_MEMREF_NULL BIT(4) 220 + 218 221 #define OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES 9 219 222 #define OPTEE_SMC_EXCHANGE_CAPABILITIES \ 220 223 OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_EXCHANGE_CAPABILITIES)
+95
drivers/tee/optee/rpc.c
··· 7 7 8 8 #include <linux/delay.h> 9 9 #include <linux/device.h> 10 + #include <linux/i2c.h> 10 11 #include <linux/slab.h> 11 12 #include <linux/tee_drv.h> 12 13 #include "optee_private.h" ··· 49 48 bad: 50 49 arg->ret = TEEC_ERROR_BAD_PARAMETERS; 51 50 } 51 + 52 + #if IS_REACHABLE(CONFIG_I2C) 53 + static void handle_rpc_func_cmd_i2c_transfer(struct tee_context *ctx, 54 + struct optee_msg_arg *arg) 55 + { 56 + struct i2c_client client = { 0 }; 57 + struct tee_param *params; 58 + size_t i; 59 + int ret = -EOPNOTSUPP; 60 + u8 attr[] = { 61 + TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT, 62 + TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_INPUT, 63 + TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT, 64 + TEE_IOCTL_PARAM_ATTR_TYPE_VALUE_OUTPUT, 65 + }; 66 + 67 + if (arg->num_params != ARRAY_SIZE(attr)) { 68 + arg->ret = TEEC_ERROR_BAD_PARAMETERS; 69 + return; 70 + } 71 + 72 + params = kmalloc_array(arg->num_params, sizeof(struct tee_param), 73 + GFP_KERNEL); 74 + if (!params) { 75 + arg->ret = TEEC_ERROR_OUT_OF_MEMORY; 76 + return; 77 + } 78 + 79 + if (optee_from_msg_param(params, arg->num_params, arg->params)) 80 + goto bad; 81 + 82 + for (i = 0; i < arg->num_params; i++) { 83 + if (params[i].attr != attr[i]) 84 + goto bad; 85 + } 86 + 87 + client.adapter = i2c_get_adapter(params[0].u.value.b); 88 + if (!client.adapter) 89 + goto bad; 90 + 91 + if (params[1].u.value.a & OPTEE_MSG_RPC_CMD_I2C_FLAGS_TEN_BIT) { 92 + if (!i2c_check_functionality(client.adapter, 93 + I2C_FUNC_10BIT_ADDR)) { 94 + i2c_put_adapter(client.adapter); 95 + goto bad; 96 + } 97 + 98 + client.flags = I2C_CLIENT_TEN; 99 + } 100 + 101 + client.addr = params[0].u.value.c; 102 + snprintf(client.name, I2C_NAME_SIZE, "i2c%d", client.adapter->nr); 103 + 104 + switch (params[0].u.value.a) { 105 + case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_RD: 106 + ret = i2c_master_recv(&client, params[2].u.memref.shm->kaddr, 107 + params[2].u.memref.size); 108 + break; 109 + case OPTEE_MSG_RPC_CMD_I2C_TRANSFER_WR: 110 + ret = i2c_master_send(&client, params[2].u.memref.shm->kaddr, 111 + params[2].u.memref.size); 112 + break; 113 + default: 114 + i2c_put_adapter(client.adapter); 115 + goto bad; 116 + } 117 + 118 + if (ret < 0) { 119 + arg->ret = TEEC_ERROR_COMMUNICATION; 120 + } else { 121 + params[3].u.value.a = ret; 122 + if (optee_to_msg_param(arg->params, arg->num_params, params)) 123 + arg->ret = TEEC_ERROR_BAD_PARAMETERS; 124 + else 125 + arg->ret = TEEC_SUCCESS; 126 + } 127 + 128 + i2c_put_adapter(client.adapter); 129 + kfree(params); 130 + return; 131 + bad: 132 + kfree(params); 133 + arg->ret = TEEC_ERROR_BAD_PARAMETERS; 134 + } 135 + #else 136 + static void handle_rpc_func_cmd_i2c_transfer(struct tee_context *ctx, 137 + struct optee_msg_arg *arg) 138 + { 139 + arg->ret = TEEC_ERROR_NOT_SUPPORTED; 140 + } 141 + #endif 52 142 53 143 static struct wq_entry *wq_entry_get(struct optee_wait_queue *wq, u32 key) 54 144 { ··· 473 381 break; 474 382 case OPTEE_MSG_RPC_CMD_SHM_FREE: 475 383 handle_rpc_func_cmd_shm_free(ctx, arg); 384 + break; 385 + case OPTEE_MSG_RPC_CMD_I2C_TRANSFER: 386 + handle_rpc_func_cmd_i2c_transfer(ctx, arg); 476 387 break; 477 388 default: 478 389 handle_rpc_supp_cmd(ctx, arg);
+37 -50
drivers/tee/tee_core.c
··· 383 383 case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_OUTPUT: 384 384 case TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT: 385 385 /* 386 - * If we fail to get a pointer to a shared memory 387 - * object (and increase the ref count) from an 388 - * identifier we return an error. All pointers that 389 - * has been added in params have an increased ref 390 - * count. It's the callers responibility to do 391 - * tee_shm_put() on all resolved pointers. 386 + * If a NULL pointer is passed to a TA in the TEE, 387 + * the ip.c IOCTL parameters is set to TEE_MEMREF_NULL 388 + * indicating a NULL memory reference. 392 389 */ 393 - shm = tee_shm_get_from_id(ctx, ip.c); 394 - if (IS_ERR(shm)) 395 - return PTR_ERR(shm); 390 + if (ip.c != TEE_MEMREF_NULL) { 391 + /* 392 + * If we fail to get a pointer to a shared 393 + * memory object (and increase the ref count) 394 + * from an identifier we return an error. All 395 + * pointers that has been added in params have 396 + * an increased ref count. It's the callers 397 + * responibility to do tee_shm_put() on all 398 + * resolved pointers. 399 + */ 400 + shm = tee_shm_get_from_id(ctx, ip.c); 401 + if (IS_ERR(shm)) 402 + return PTR_ERR(shm); 396 403 397 - /* 398 - * Ensure offset + size does not overflow offset 399 - * and does not overflow the size of the referred 400 - * shared memory object. 401 - */ 402 - if ((ip.a + ip.b) < ip.a || 403 - (ip.a + ip.b) > shm->size) { 404 - tee_shm_put(shm); 404 + /* 405 + * Ensure offset + size does not overflow 406 + * offset and does not overflow the size of 407 + * the referred shared memory object. 408 + */ 409 + if ((ip.a + ip.b) < ip.a || 410 + (ip.a + ip.b) > shm->size) { 411 + tee_shm_put(shm); 412 + return -EINVAL; 413 + } 414 + } else if (ctx->cap_memref_null) { 415 + /* Pass NULL pointer to OP-TEE */ 416 + shm = NULL; 417 + } else { 405 418 return -EINVAL; 406 419 } 407 420 ··· 930 917 931 918 cdev_init(&teedev->cdev, &tee_fops); 932 919 teedev->cdev.owner = teedesc->owner; 933 - teedev->cdev.kobj.parent = &teedev->dev.kobj; 934 920 935 921 dev_set_drvdata(&teedev->dev, driver_data); 936 922 device_initialize(&teedev->dev); ··· 975 963 NULL 976 964 }; 977 965 978 - static const struct attribute_group tee_dev_group = { 979 - .attrs = tee_dev_attrs, 980 - }; 966 + ATTRIBUTE_GROUPS(tee_dev); 981 967 982 968 /** 983 969 * tee_device_register() - Registers a TEE device ··· 995 985 return -EINVAL; 996 986 } 997 987 998 - rc = cdev_add(&teedev->cdev, teedev->dev.devt, 1); 988 + teedev->dev.groups = tee_dev_groups; 989 + 990 + rc = cdev_device_add(&teedev->cdev, &teedev->dev); 999 991 if (rc) { 1000 992 dev_err(&teedev->dev, 1001 - "unable to cdev_add() %s, major %d, minor %d, err=%d\n", 993 + "unable to cdev_device_add() %s, major %d, minor %d, err=%d\n", 1002 994 teedev->name, MAJOR(teedev->dev.devt), 1003 995 MINOR(teedev->dev.devt), rc); 1004 996 return rc; 1005 997 } 1006 998 1007 - rc = device_add(&teedev->dev); 1008 - if (rc) { 1009 - dev_err(&teedev->dev, 1010 - "unable to device_add() %s, major %d, minor %d, err=%d\n", 1011 - teedev->name, MAJOR(teedev->dev.devt), 1012 - MINOR(teedev->dev.devt), rc); 1013 - goto err_device_add; 1014 - } 1015 - 1016 - rc = sysfs_create_group(&teedev->dev.kobj, &tee_dev_group); 1017 - if (rc) { 1018 - dev_err(&teedev->dev, 1019 - "failed to create sysfs attributes, err=%d\n", rc); 1020 - goto err_sysfs_create_group; 1021 - } 1022 - 1023 999 teedev->flags |= TEE_DEVICE_FLAG_REGISTERED; 1024 1000 return 0; 1025 - 1026 - err_sysfs_create_group: 1027 - device_del(&teedev->dev); 1028 - err_device_add: 1029 - cdev_del(&teedev->cdev); 1030 - return rc; 1031 1001 } 1032 1002 EXPORT_SYMBOL_GPL(tee_device_register); 1033 1003 ··· 1050 1060 if (!teedev) 1051 1061 return; 1052 1062 1053 - if (teedev->flags & TEE_DEVICE_FLAG_REGISTERED) { 1054 - sysfs_remove_group(&teedev->dev.kobj, &tee_dev_group); 1055 - cdev_del(&teedev->cdev); 1056 - device_del(&teedev->dev); 1057 - } 1063 + if (teedev->flags & TEE_DEVICE_FLAG_REGISTERED) 1064 + cdev_device_del(&teedev->cdev, &teedev->dev); 1058 1065 1059 1066 tee_device_put(teedev); 1060 1067 wait_for_completion(&teedev->c_no_users);
+19 -13
drivers/tee/tee_shm.c
··· 12 12 #include <linux/uio.h> 13 13 #include "tee_private.h" 14 14 15 + static void release_registered_pages(struct tee_shm *shm) 16 + { 17 + if (shm->pages) { 18 + if (shm->flags & TEE_SHM_USER_MAPPED) { 19 + unpin_user_pages(shm->pages, shm->num_pages); 20 + } else { 21 + size_t n; 22 + 23 + for (n = 0; n < shm->num_pages; n++) 24 + put_page(shm->pages[n]); 25 + } 26 + 27 + kfree(shm->pages); 28 + } 29 + } 30 + 15 31 static void tee_shm_release(struct tee_shm *shm) 16 32 { 17 33 struct tee_device *teedev = shm->ctx->teedev; ··· 48 32 49 33 poolm->ops->free(poolm, shm); 50 34 } else if (shm->flags & TEE_SHM_REGISTER) { 51 - size_t n; 52 35 int rc = teedev->desc->ops->shm_unregister(shm->ctx, shm); 53 36 54 37 if (rc) 55 38 dev_err(teedev->dev.parent, 56 39 "unregister shm %p failed: %d", shm, rc); 57 40 58 - for (n = 0; n < shm->num_pages; n++) 59 - put_page(shm->pages[n]); 60 - 61 - kfree(shm->pages); 41 + release_registered_pages(shm); 62 42 } 63 43 64 44 teedev_ctx_put(shm->ctx); ··· 240 228 } 241 229 242 230 if (flags & TEE_SHM_USER_MAPPED) { 243 - rc = get_user_pages_fast(start, num_pages, FOLL_WRITE, 231 + rc = pin_user_pages_fast(start, num_pages, FOLL_WRITE, 244 232 shm->pages); 245 233 } else { 246 234 struct kvec *kiov; ··· 304 292 return shm; 305 293 err: 306 294 if (shm) { 307 - size_t n; 308 - 309 295 if (shm->id >= 0) { 310 296 mutex_lock(&teedev->mutex); 311 297 idr_remove(&teedev->idr, shm->id); 312 298 mutex_unlock(&teedev->mutex); 313 299 } 314 - if (shm->pages) { 315 - for (n = 0; n < shm->num_pages; n++) 316 - put_page(shm->pages[n]); 317 - kfree(shm->pages); 318 - } 300 + release_registered_pages(shm); 319 301 } 320 302 kfree(shm); 321 303 teedev_ctx_put(ctx);
+14
include/dt-bindings/power/meson-axg-power.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0+ or MIT) */ 2 + /* 3 + * Copyright (c) 2020 BayLibre, SAS 4 + * Author: Neil Armstrong <narmstrong@baylibre.com> 5 + */ 6 + 7 + #ifndef _DT_BINDINGS_MESON_AXG_POWER_H 8 + #define _DT_BINDINGS_MESON_AXG_POWER_H 9 + 10 + #define PWRC_AXG_VPU_ID 0 11 + #define PWRC_AXG_ETHERNET_MEM_ID 1 12 + #define PWRC_AXG_AUDIO_ID 2 13 + 14 + #endif
+4 -1
include/dt-bindings/reset/imx8mq-reset.h
··· 58 58 #define IMX8MQ_RESET_DDRC2_PRST 47 /* i.MX8MM/i.MX8MN does NOT support */ 59 59 #define IMX8MQ_RESET_DDRC2_CORE_RESET 48 /* i.MX8MM/i.MX8MN does NOT support */ 60 60 #define IMX8MQ_RESET_DDRC2_PHY_RESET 49 /* i.MX8MM/i.MX8MN does NOT support */ 61 + #define IMX8MQ_RESET_SW_M4C_RST 50 62 + #define IMX8MQ_RESET_SW_M4P_RST 51 63 + #define IMX8MQ_RESET_M4_ENABLE 52 61 64 62 - #define IMX8MQ_RESET_NUM 50 65 + #define IMX8MQ_RESET_NUM 53 63 66 64 67 #endif
+105
include/dt-bindings/reset/xlnx-versal-resets.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (C) 2020 Xilinx, Inc. 4 + */ 5 + 6 + #ifndef _DT_BINDINGS_VERSAL_RESETS_H 7 + #define _DT_BINDINGS_VERSAL_RESETS_H 8 + 9 + #define VERSAL_RST_PMC_POR (0xc30c001U) 10 + #define VERSAL_RST_PMC (0xc410002U) 11 + #define VERSAL_RST_PS_POR (0xc30c003U) 12 + #define VERSAL_RST_PL_POR (0xc30c004U) 13 + #define VERSAL_RST_NOC_POR (0xc30c005U) 14 + #define VERSAL_RST_FPD_POR (0xc30c006U) 15 + #define VERSAL_RST_ACPU_0_POR (0xc30c007U) 16 + #define VERSAL_RST_ACPU_1_POR (0xc30c008U) 17 + #define VERSAL_RST_OCM2_POR (0xc30c009U) 18 + #define VERSAL_RST_PS_SRST (0xc41000aU) 19 + #define VERSAL_RST_PL_SRST (0xc41000bU) 20 + #define VERSAL_RST_NOC (0xc41000cU) 21 + #define VERSAL_RST_NPI (0xc41000dU) 22 + #define VERSAL_RST_SYS_RST_1 (0xc41000eU) 23 + #define VERSAL_RST_SYS_RST_2 (0xc41000fU) 24 + #define VERSAL_RST_SYS_RST_3 (0xc410010U) 25 + #define VERSAL_RST_FPD (0xc410011U) 26 + #define VERSAL_RST_PL0 (0xc410012U) 27 + #define VERSAL_RST_PL1 (0xc410013U) 28 + #define VERSAL_RST_PL2 (0xc410014U) 29 + #define VERSAL_RST_PL3 (0xc410015U) 30 + #define VERSAL_RST_APU (0xc410016U) 31 + #define VERSAL_RST_ACPU_0 (0xc410017U) 32 + #define VERSAL_RST_ACPU_1 (0xc410018U) 33 + #define VERSAL_RST_ACPU_L2 (0xc410019U) 34 + #define VERSAL_RST_ACPU_GIC (0xc41001aU) 35 + #define VERSAL_RST_RPU_ISLAND (0xc41001bU) 36 + #define VERSAL_RST_RPU_AMBA (0xc41001cU) 37 + #define VERSAL_RST_R5_0 (0xc41001dU) 38 + #define VERSAL_RST_R5_1 (0xc41001eU) 39 + #define VERSAL_RST_SYSMON_PMC_SEQ_RST (0xc41001fU) 40 + #define VERSAL_RST_SYSMON_PMC_CFG_RST (0xc410020U) 41 + #define VERSAL_RST_SYSMON_FPD_CFG_RST (0xc410021U) 42 + #define VERSAL_RST_SYSMON_FPD_SEQ_RST (0xc410022U) 43 + #define VERSAL_RST_SYSMON_LPD (0xc410023U) 44 + #define VERSAL_RST_PDMA_RST1 (0xc410024U) 45 + #define VERSAL_RST_PDMA_RST0 (0xc410025U) 46 + #define VERSAL_RST_ADMA (0xc410026U) 47 + #define VERSAL_RST_TIMESTAMP (0xc410027U) 48 + #define VERSAL_RST_OCM (0xc410028U) 49 + #define VERSAL_RST_OCM2_RST (0xc410029U) 50 + #define VERSAL_RST_IPI (0xc41002aU) 51 + #define VERSAL_RST_SBI (0xc41002bU) 52 + #define VERSAL_RST_LPD (0xc41002cU) 53 + #define VERSAL_RST_QSPI (0xc10402dU) 54 + #define VERSAL_RST_OSPI (0xc10402eU) 55 + #define VERSAL_RST_SDIO_0 (0xc10402fU) 56 + #define VERSAL_RST_SDIO_1 (0xc104030U) 57 + #define VERSAL_RST_I2C_PMC (0xc104031U) 58 + #define VERSAL_RST_GPIO_PMC (0xc104032U) 59 + #define VERSAL_RST_GEM_0 (0xc104033U) 60 + #define VERSAL_RST_GEM_1 (0xc104034U) 61 + #define VERSAL_RST_SPARE (0xc104035U) 62 + #define VERSAL_RST_USB_0 (0xc104036U) 63 + #define VERSAL_RST_UART_0 (0xc104037U) 64 + #define VERSAL_RST_UART_1 (0xc104038U) 65 + #define VERSAL_RST_SPI_0 (0xc104039U) 66 + #define VERSAL_RST_SPI_1 (0xc10403aU) 67 + #define VERSAL_RST_CAN_FD_0 (0xc10403bU) 68 + #define VERSAL_RST_CAN_FD_1 (0xc10403cU) 69 + #define VERSAL_RST_I2C_0 (0xc10403dU) 70 + #define VERSAL_RST_I2C_1 (0xc10403eU) 71 + #define VERSAL_RST_GPIO_LPD (0xc10403fU) 72 + #define VERSAL_RST_TTC_0 (0xc104040U) 73 + #define VERSAL_RST_TTC_1 (0xc104041U) 74 + #define VERSAL_RST_TTC_2 (0xc104042U) 75 + #define VERSAL_RST_TTC_3 (0xc104043U) 76 + #define VERSAL_RST_SWDT_FPD (0xc104044U) 77 + #define VERSAL_RST_SWDT_LPD (0xc104045U) 78 + #define VERSAL_RST_USB (0xc104046U) 79 + #define VERSAL_RST_DPC (0xc208047U) 80 + #define VERSAL_RST_PMCDBG (0xc208048U) 81 + #define VERSAL_RST_DBG_TRACE (0xc208049U) 82 + #define VERSAL_RST_DBG_FPD (0xc20804aU) 83 + #define VERSAL_RST_DBG_TSTMP (0xc20804bU) 84 + #define VERSAL_RST_RPU0_DBG (0xc20804cU) 85 + #define VERSAL_RST_RPU1_DBG (0xc20804dU) 86 + #define VERSAL_RST_HSDP (0xc20804eU) 87 + #define VERSAL_RST_DBG_LPD (0xc20804fU) 88 + #define VERSAL_RST_CPM_POR (0xc30c050U) 89 + #define VERSAL_RST_CPM (0xc410051U) 90 + #define VERSAL_RST_CPMDBG (0xc208052U) 91 + #define VERSAL_RST_PCIE_CFG (0xc410053U) 92 + #define VERSAL_RST_PCIE_CORE0 (0xc410054U) 93 + #define VERSAL_RST_PCIE_CORE1 (0xc410055U) 94 + #define VERSAL_RST_PCIE_DMA (0xc410056U) 95 + #define VERSAL_RST_CMN (0xc410057U) 96 + #define VERSAL_RST_L2_0 (0xc410058U) 97 + #define VERSAL_RST_L2_1 (0xc410059U) 98 + #define VERSAL_RST_ADDR_REMAP (0xc41005aU) 99 + #define VERSAL_RST_CPI0 (0xc41005bU) 100 + #define VERSAL_RST_CPI1 (0xc41005cU) 101 + #define VERSAL_RST_XRAM (0xc30c05dU) 102 + #define VERSAL_RST_AIE_ARRAY (0xc10405eU) 103 + #define VERSAL_RST_AIE_SHIM (0xc10405fU) 104 + 105 + #endif
+17
include/dt-bindings/soc/bcm6318-pm.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + 3 + #ifndef __DT_BINDINGS_BMIPS_BCM6318_PM_H 4 + #define __DT_BINDINGS_BMIPS_BCM6318_PM_H 5 + 6 + #define BCM6318_POWER_DOMAIN_PCIE 0 7 + #define BCM6318_POWER_DOMAIN_USB 1 8 + #define BCM6318_POWER_DOMAIN_EPHY0 2 9 + #define BCM6318_POWER_DOMAIN_EPHY1 3 10 + #define BCM6318_POWER_DOMAIN_EPHY2 4 11 + #define BCM6318_POWER_DOMAIN_EPHY3 5 12 + #define BCM6318_POWER_DOMAIN_LDO2P5 6 13 + #define BCM6318_POWER_DOMAIN_LDO2P9 7 14 + #define BCM6318_POWER_DOMAIN_SW1P0 8 15 + #define BCM6318_POWER_DOMAIN_PAD 9 16 + 17 + #endif /* __DT_BINDINGS_BMIPS_BCM6318_PM_H */
+21
include/dt-bindings/soc/bcm63268-pm.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + 3 + #ifndef __DT_BINDINGS_BMIPS_BCM63268_PM_H 4 + #define __DT_BINDINGS_BMIPS_BCM63268_PM_H 5 + 6 + #define BCM63268_POWER_DOMAIN_SAR 0 7 + #define BCM63268_POWER_DOMAIN_IPSEC 1 8 + #define BCM63268_POWER_DOMAIN_MIPS 2 9 + #define BCM63268_POWER_DOMAIN_DECT 3 10 + #define BCM63268_POWER_DOMAIN_USBH 4 11 + #define BCM63268_POWER_DOMAIN_USBD 5 12 + #define BCM63268_POWER_DOMAIN_ROBOSW 6 13 + #define BCM63268_POWER_DOMAIN_PCM 7 14 + #define BCM63268_POWER_DOMAIN_PERIPH 8 15 + #define BCM63268_POWER_DOMAIN_VDSL_PHY 9 16 + #define BCM63268_POWER_DOMAIN_VDSL_MIPS 10 17 + #define BCM63268_POWER_DOMAIN_FAP 11 18 + #define BCM63268_POWER_DOMAIN_PCIE 12 19 + #define BCM63268_POWER_DOMAIN_WLAN_PADS 13 20 + 21 + #endif /* __DT_BINDINGS_BMIPS_BCM63268_PM_H */
+17
include/dt-bindings/soc/bcm6328-pm.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + 3 + #ifndef __DT_BINDINGS_BMIPS_BCM6328_PM_H 4 + #define __DT_BINDINGS_BMIPS_BCM6328_PM_H 5 + 6 + #define BCM6328_POWER_DOMAIN_ADSL2_MIPS 0 7 + #define BCM6328_POWER_DOMAIN_ADSL2_PHY 1 8 + #define BCM6328_POWER_DOMAIN_ADSL2_AFE 2 9 + #define BCM6328_POWER_DOMAIN_SAR 3 10 + #define BCM6328_POWER_DOMAIN_PCM 4 11 + #define BCM6328_POWER_DOMAIN_USBD 5 12 + #define BCM6328_POWER_DOMAIN_USBH 6 13 + #define BCM6328_POWER_DOMAIN_PCIE 7 14 + #define BCM6328_POWER_DOMAIN_ROBOSW 8 15 + #define BCM6328_POWER_DOMAIN_EPHY 9 16 + 17 + #endif /* __DT_BINDINGS_BMIPS_BCM6328_PM_H */
+21
include/dt-bindings/soc/bcm6362-pm.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + 3 + #ifndef __DT_BINDINGS_BMIPS_BCM6362_PM_H 4 + #define __DT_BINDINGS_BMIPS_BCM6362_PM_H 5 + 6 + #define BCM6362_POWER_DOMAIN_SAR 0 7 + #define BCM6362_POWER_DOMAIN_IPSEC 1 8 + #define BCM6362_POWER_DOMAIN_MIPS 2 9 + #define BCM6362_POWER_DOMAIN_DECT 3 10 + #define BCM6362_POWER_DOMAIN_USBH 4 11 + #define BCM6362_POWER_DOMAIN_USBD 5 12 + #define BCM6362_POWER_DOMAIN_ROBOSW 6 13 + #define BCM6362_POWER_DOMAIN_PCM 7 14 + #define BCM6362_POWER_DOMAIN_PERIPH 8 15 + #define BCM6362_POWER_DOMAIN_ADSL_PHY 9 16 + #define BCM6362_POWER_DOMAIN_GMII_PADS 10 17 + #define BCM6362_POWER_DOMAIN_FAP 11 18 + #define BCM6362_POWER_DOMAIN_PCIE 12 19 + #define BCM6362_POWER_DOMAIN_WLAN_PADS 13 20 + 21 + #endif /* __DT_BINDINGS_BMIPS_BCM6362_PM_H */
+4 -2
include/linux/mailbox/mtk-cmdq-mailbox.h
··· 28 28 * bit 16-27: update value 29 29 * bit 31: 1 - update, 0 - no update 30 30 */ 31 - #define CMDQ_WFE_OPTION (CMDQ_WFE_UPDATE | CMDQ_WFE_WAIT | \ 32 - CMDQ_WFE_WAIT_VALUE) 31 + #define CMDQ_WFE_OPTION (CMDQ_WFE_WAIT | CMDQ_WFE_WAIT_VALUE) 33 32 34 33 /** cmdq event maximum */ 35 34 #define CMDQ_MAX_EVENT 0x3ff ··· 59 60 CMDQ_CODE_JUMP = 0x10, 60 61 CMDQ_CODE_WFE = 0x20, 61 62 CMDQ_CODE_EOC = 0x40, 63 + CMDQ_CODE_READ_S = 0x80, 64 + CMDQ_CODE_WRITE_S = 0x90, 65 + CMDQ_CODE_WRITE_S_MASK = 0x91, 62 66 CMDQ_CODE_LOGIC = 0xa0, 63 67 }; 64 68
+54
include/linux/pruss_driver.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * PRU-ICSS sub-system specific definitions 4 + * 5 + * Copyright (C) 2014-2020 Texas Instruments Incorporated - http://www.ti.com/ 6 + * Suman Anna <s-anna@ti.com> 7 + */ 8 + 9 + #ifndef _PRUSS_DRIVER_H_ 10 + #define _PRUSS_DRIVER_H_ 11 + 12 + #include <linux/types.h> 13 + 14 + /* 15 + * enum pruss_mem - PRUSS memory range identifiers 16 + */ 17 + enum pruss_mem { 18 + PRUSS_MEM_DRAM0 = 0, 19 + PRUSS_MEM_DRAM1, 20 + PRUSS_MEM_SHRD_RAM2, 21 + PRUSS_MEM_MAX, 22 + }; 23 + 24 + /** 25 + * struct pruss_mem_region - PRUSS memory region structure 26 + * @va: kernel virtual address of the PRUSS memory region 27 + * @pa: physical (bus) address of the PRUSS memory region 28 + * @size: size of the PRUSS memory region 29 + */ 30 + struct pruss_mem_region { 31 + void __iomem *va; 32 + phys_addr_t pa; 33 + size_t size; 34 + }; 35 + 36 + /** 37 + * struct pruss - PRUSS parent structure 38 + * @dev: pruss device pointer 39 + * @cfg_base: base iomap for CFG region 40 + * @cfg_regmap: regmap for config region 41 + * @mem_regions: data for each of the PRUSS memory regions 42 + * @core_clk_mux: clk handle for PRUSS CORE_CLK_MUX 43 + * @iep_clk_mux: clk handle for PRUSS IEP_CLK_MUX 44 + */ 45 + struct pruss { 46 + struct device *dev; 47 + void __iomem *cfg_base; 48 + struct regmap *cfg_regmap; 49 + struct pruss_mem_region mem_regions[PRUSS_MEM_MAX]; 50 + struct clk *core_clk_mux; 51 + struct clk *iep_clk_mux; 52 + }; 53 + 54 + #endif /* _PRUSS_DRIVER_H_ */
+2 -2
include/linux/qcom-geni-se.h
··· 299 299 u32 m_cmd; 300 300 301 301 m_cmd = (cmd << M_OPCODE_SHFT) | (params & M_PARAMS_MSK); 302 - writel_relaxed(m_cmd, se->base + SE_GENI_M_CMD0); 302 + writel(m_cmd, se->base + SE_GENI_M_CMD0); 303 303 } 304 304 305 305 /** ··· 319 319 s_cmd &= ~(S_OPCODE_MSK | S_PARAMS_MSK); 320 320 s_cmd |= (cmd << S_OPCODE_SHFT); 321 321 s_cmd |= (params & S_PARAMS_MSK); 322 - writel_relaxed(s_cmd, se->base + SE_GENI_S_CMD0); 322 + writel(s_cmd, se->base + SE_GENI_S_CMD0); 323 323 } 324 324 325 325 /**
+25 -7
include/linux/scmi_protocol.h
··· 279 279 struct scmi_handle { 280 280 struct device *dev; 281 281 struct scmi_revision_info *version; 282 - struct scmi_perf_ops *perf_ops; 283 - struct scmi_clk_ops *clk_ops; 284 - struct scmi_power_ops *power_ops; 285 - struct scmi_sensor_ops *sensor_ops; 286 - struct scmi_reset_ops *reset_ops; 287 - struct scmi_notify_ops *notify_ops; 282 + const struct scmi_perf_ops *perf_ops; 283 + const struct scmi_clk_ops *clk_ops; 284 + const struct scmi_power_ops *power_ops; 285 + const struct scmi_sensor_ops *sensor_ops; 286 + const struct scmi_reset_ops *reset_ops; 287 + const struct scmi_notify_ops *notify_ops; 288 288 /* for protocol internal use */ 289 289 void *perf_priv; 290 290 void *clk_priv; ··· 292 292 void *sensor_priv; 293 293 void *reset_priv; 294 294 void *notify_priv; 295 + void *system_priv; 295 296 }; 296 297 297 298 enum scmi_std_protocol { ··· 303 302 SCMI_PROTOCOL_CLOCK = 0x14, 304 303 SCMI_PROTOCOL_SENSOR = 0x15, 305 304 SCMI_PROTOCOL_RESET = 0x16, 305 + }; 306 + 307 + enum scmi_system_events { 308 + SCMI_SYSTEM_SHUTDOWN, 309 + SCMI_SYSTEM_COLDRESET, 310 + SCMI_SYSTEM_WARMRESET, 311 + SCMI_SYSTEM_POWERUP, 312 + SCMI_SYSTEM_SUSPEND, 313 + SCMI_SYSTEM_MAX 306 314 }; 307 315 308 316 struct scmi_device { ··· 345 335 346 336 #define to_scmi_driver(d) container_of(d, struct scmi_driver, driver) 347 337 348 - #ifdef CONFIG_ARM_SCMI_PROTOCOL 338 + #if IS_REACHABLE(CONFIG_ARM_SCMI_PROTOCOL) 349 339 int scmi_driver_register(struct scmi_driver *driver, 350 340 struct module *owner, const char *mod_name); 351 341 void scmi_driver_unregister(struct scmi_driver *driver); ··· 388 378 SCMI_EVENT_SENSOR_TRIP_POINT_EVENT = 0x0, 389 379 SCMI_EVENT_RESET_ISSUED = 0x0, 390 380 SCMI_EVENT_BASE_ERROR_EVENT = 0x0, 381 + SCMI_EVENT_SYSTEM_POWER_STATE_NOTIFIER = 0x0, 391 382 }; 392 383 393 384 struct scmi_power_state_changed_report { ··· 396 385 unsigned int agent_id; 397 386 unsigned int domain_id; 398 387 unsigned int power_state; 388 + }; 389 + 390 + struct scmi_system_power_state_notifier_report { 391 + ktime_t timestamp; 392 + unsigned int agent_id; 393 + unsigned int flags; 394 + unsigned int system_state; 399 395 }; 400 396 401 397 struct scmi_perf_limits_report {
+93 -4
include/linux/soc/mediatek/mtk-cmdq.h
··· 12 12 #include <linux/timer.h> 13 13 14 14 #define CMDQ_NO_TIMEOUT 0xffffffffu 15 + #define CMDQ_ADDR_HIGH(addr) ((u32)(((addr) >> 16) & GENMASK(31, 0))) 16 + #define CMDQ_ADDR_LOW(addr) ((u16)(addr) | BIT(1)) 15 17 16 18 struct cmdq_pkt; 17 19 ··· 104 102 int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys, 105 103 u16 offset, u32 value, u32 mask); 106 104 107 - /** 108 - * cmdq_pkt_wfe() - append wait for event command to the CMDQ packet 105 + /* 106 + * cmdq_pkt_read_s() - append read_s command to the CMDQ packet 109 107 * @pkt: the CMDQ packet 110 - * @event: the desired event type to "wait and CLEAR" 108 + * @high_addr_reg_idx: internal register ID which contains high address of pa 109 + * @addr_low: low address of pa 110 + * @reg_idx: the CMDQ internal register ID to cache read data 111 111 * 112 112 * Return: 0 for success; else the error code is returned 113 113 */ 114 - int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event); 114 + int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, u16 addr_low, 115 + u16 reg_idx); 116 + 117 + /** 118 + * cmdq_pkt_write_s() - append write_s command to the CMDQ packet 119 + * @pkt: the CMDQ packet 120 + * @high_addr_reg_idx: internal register ID which contains high address of pa 121 + * @addr_low: low address of pa 122 + * @src_reg_idx: the CMDQ internal register ID which cache source value 123 + * 124 + * Return: 0 for success; else the error code is returned 125 + * 126 + * Support write value to physical address without subsys. Use CMDQ_ADDR_HIGH() 127 + * to get high address and call cmdq_pkt_assign() to assign value into internal 128 + * reg. Also use CMDQ_ADDR_LOW() to get low address for addr_low parameter when 129 + * call to this function. 130 + */ 131 + int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, 132 + u16 addr_low, u16 src_reg_idx); 133 + 134 + /** 135 + * cmdq_pkt_write_s_mask() - append write_s with mask command to the CMDQ packet 136 + * @pkt: the CMDQ packet 137 + * @high_addr_reg_idx: internal register ID which contains high address of pa 138 + * @addr_low: low address of pa 139 + * @src_reg_idx: the CMDQ internal register ID which cache source value 140 + * @mask: the specified target address mask, use U32_MAX if no need 141 + * 142 + * Return: 0 for success; else the error code is returned 143 + * 144 + * Support write value to physical address without subsys. Use CMDQ_ADDR_HIGH() 145 + * to get high address and call cmdq_pkt_assign() to assign value into internal 146 + * reg. Also use CMDQ_ADDR_LOW() to get low address for addr_low parameter when 147 + * call to this function. 148 + */ 149 + int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx, 150 + u16 addr_low, u16 src_reg_idx, u32 mask); 151 + 152 + /** 153 + * cmdq_pkt_write_s_value() - append write_s command to the CMDQ packet which 154 + * write value to a physical address 155 + * @pkt: the CMDQ packet 156 + * @high_addr_reg_idx: internal register ID which contains high address of pa 157 + * @addr_low: low address of pa 158 + * @value: the specified target value 159 + * 160 + * Return: 0 for success; else the error code is returned 161 + */ 162 + int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, 163 + u16 addr_low, u32 value); 164 + 165 + /** 166 + * cmdq_pkt_write_s_mask_value() - append write_s command with mask to the CMDQ 167 + * packet which write value to a physical 168 + * address 169 + * @pkt: the CMDQ packet 170 + * @high_addr_reg_idx: internal register ID which contains high address of pa 171 + * @addr_low: low address of pa 172 + * @value: the specified target value 173 + * @mask: the specified target mask 174 + * 175 + * Return: 0 for success; else the error code is returned 176 + */ 177 + int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx, 178 + u16 addr_low, u32 value, u32 mask); 179 + 180 + /** 181 + * cmdq_pkt_wfe() - append wait for event command to the CMDQ packet 182 + * @pkt: the CMDQ packet 183 + * @event: the desired event type to wait 184 + * @clear: clear event or not after event arrive 185 + * 186 + * Return: 0 for success; else the error code is returned 187 + */ 188 + int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear); 115 189 116 190 /** 117 191 * cmdq_pkt_clear_event() - append clear event command to the CMDQ packet ··· 252 174 * Return: 0 for success; else the error code is returned 253 175 */ 254 176 int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value); 177 + 178 + /** 179 + * cmdq_pkt_jump() - Append jump command to the CMDQ packet, ask GCE 180 + * to execute an instruction that change current thread PC to 181 + * a physical address which should contains more instruction. 182 + * @pkt: the CMDQ packet 183 + * @addr: physical address of target instruction buffer 184 + * 185 + * Return: 0 for success; else the error code is returned 186 + */ 187 + int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr); 255 188 256 189 /** 257 190 * cmdq_pkt_finalize() - Append EOC and jump command to pkt.
+3
include/linux/tee_drv.h
··· 47 47 * and just return with an error code. It is needed for requests 48 48 * that arises from TEE based kernel drivers that should be 49 49 * non-blocking in nature. 50 + * @cap_memref_null: flag indicating if the TEE Client support shared 51 + * memory buffer with a NULL pointer. 50 52 */ 51 53 struct tee_context { 52 54 struct tee_device *teedev; ··· 56 54 struct kref refcount; 57 55 bool releasing; 58 56 bool supp_nowait; 57 + bool cap_memref_null; 59 58 }; 60 59 61 60 struct tee_param_memref {
+2 -2
include/soc/fsl/qman.h
··· 256 256 __be32 context_b; 257 257 struct qm_fd fd; 258 258 u8 __reserved4[32]; 259 - } __packed; 259 + } __packed __aligned(64); 260 260 #define QM_DQRR_VERB_VBIT 0x80 261 261 #define QM_DQRR_VERB_MASK 0x7f /* where the verb contains; */ 262 262 #define QM_DQRR_VERB_FRAME_DEQUEUE 0x60 /* "this format" */ ··· 289 289 __be32 tag; 290 290 struct qm_fd fd; 291 291 u8 __reserved1[32]; 292 - } __packed ern; 292 + } __packed __aligned(64) ern; 293 293 struct { 294 294 u8 verb; 295 295 u8 fqs; /* Frame Queue Status */
+3
include/soc/tegra/fuse.h
··· 14 14 #define TEGRA210 0x21 15 15 #define TEGRA186 0x18 16 16 #define TEGRA194 0x19 17 + #define TEGRA234 0x23 17 18 18 19 #define TEGRA_FUSE_SKU_CALIB_0 0xf0 19 20 #define TEGRA30_FUSE_SATA_CALIB 0x124 ··· 24 23 25 24 u32 tegra_read_chipid(void); 26 25 u8 tegra_get_chip_id(void); 26 + u8 tegra_get_platform(void); 27 + bool tegra_is_silicon(void); 27 28 28 29 enum tegra_revision { 29 30 TEGRA_REVISION_UNKNOWN = 0,
+13
include/uapi/linux/tee.h
··· 51 51 #define TEE_GEN_CAP_GP (1 << 0)/* GlobalPlatform compliant TEE */ 52 52 #define TEE_GEN_CAP_PRIVILEGED (1 << 1)/* Privileged device (for supplicant) */ 53 53 #define TEE_GEN_CAP_REG_MEM (1 << 2)/* Supports registering shared memory */ 54 + #define TEE_GEN_CAP_MEMREF_NULL (1 << 3)/* NULL MemRef support */ 55 + 56 + #define TEE_MEMREF_NULL (__u64)(-1) /* NULL MemRef Buffer */ 54 57 55 58 /* 56 59 * TEE Implementation ID ··· 203 200 * a part of a shared memory by specifying an offset (@a) and size (@b) of 204 201 * the object. To supply the entire shared memory object set the offset 205 202 * (@a) to 0 and size (@b) to the previously returned size of the object. 203 + * 204 + * A client may need to present a NULL pointer in the argument 205 + * passed to a trusted application in the TEE. 206 + * This is also a requirement in GlobalPlatform Client API v1.0c 207 + * (section 3.2.5 memory references), which can be found at 208 + * http://www.globalplatform.org/specificationsdevice.asp 209 + * 210 + * If a NULL pointer is passed to a TA in the TEE, the (@c) 211 + * IOCTL parameters value must be set to TEE_MEMREF_NULL indicating a NULL 212 + * memory reference. 206 213 */ 207 214 struct tee_ioctl_param { 208 215 __u64 attr;