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/arm/arm-soc

Pull ARM SoC driver updates from Olof Johansson:
"Driver updates for ARM SoCs.

A slew of changes this release cycle. The reset driver tree, that we
merge through arm-soc for historical reasons, is also sizable this
time around.

Among the changes:

- clps711x: Treewide changes to compatible strings, merged here for simplicity.
- Qualcomm: SCM firmware driver cleanups, move to platform driver
- ux500: Major cleanups, removal of old mach-specific infrastructure.
- Atmel external bus memory driver
- Move of brcmstb platform to the rest of bcm
- PMC driver updates for tegra, various fixes and improvements
- Samsung platform driver updates to support 64-bit Exynos platforms
- Reset controller cleanups moving to devm_reset_controller_register() APIs
- Reset controller driver for Amlogic Meson
- Reset controller driver for Hisilicon hi6220
- ARM SCPI power domain support"

* tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (100 commits)
ARM: ux500: consolidate base platform files
ARM: ux500: move soc_id driver to drivers/soc
ARM: ux500: call ux500_setup_id later
ARM: ux500: consolidate soc_device code in id.c
ARM: ux500: remove cpu_is_u* helpers
ARM: ux500: use CLK_OF_DECLARE()
ARM: ux500: move l2x0 init to .init_irq
mfd: db8500 stop passing around platform data
ASoC: ab8500-codec: remove platform data based probe
ARM: ux500: move ab8500_regulator_plat_data into driver
ARM: ux500: remove unused regulator data
soc: raspberrypi-power: add CONFIG_OF dependency
firmware: scpi: add CONFIG_OF dependency
video: clps711x-fb: Changing the compatibility string to match with the smallest supported chip
input: clps711x-keypad: Changing the compatibility string to match with the smallest supported chip
pwm: clps711x: Changing the compatibility string to match with the smallest supported chip
serial: clps711x: Changing the compatibility string to match with the smallest supported chip
irqchip: clps711x: Changing the compatibility string to match with the smallest supported chip
clocksource: clps711x: Changing the compatibility string to match with the smallest supported chip
clk: clps711x: Changing the compatibility string to match with the smallest supported chip
...

+4784 -2649
+34
Documentation/devicetree/bindings/arm/arm,scpi.txt
··· 87 87 implementation for the IDs to use. For Juno 88 88 R0 and Juno R1 refer to [3]. 89 89 90 + Power domain bindings for the power domains based on SCPI Message Protocol 91 + ------------------------------------------------------------ 92 + 93 + This binding uses the generic power domain binding[4]. 94 + 95 + PM domain providers 96 + =================== 97 + 98 + Required properties: 99 + - #power-domain-cells : Should be 1. Contains the device or the power 100 + domain ID value used by SCPI commands. 101 + - num-domains: Total number of power domains provided by SCPI. This is 102 + needed as the SCPI message protocol lacks a mechanism to 103 + query this information at runtime. 104 + 105 + PM domain consumers 106 + =================== 107 + 108 + Required properties: 109 + - power-domains : A phandle and PM domain specifier as defined by bindings of 110 + the power controller specified by phandle. 111 + 90 112 [0] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922b/index.html 91 113 [1] Documentation/devicetree/bindings/clock/clock-bindings.txt 92 114 [2] Documentation/devicetree/bindings/thermal/thermal.txt 93 115 [3] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0922b/apas03s22.html 116 + [4] Documentation/devicetree/bindings/power/power_domain.txt 94 117 95 118 Example: 96 119 ··· 167 144 compatible = "arm,scpi-sensors"; 168 145 #thermal-sensor-cells = <1>; 169 146 }; 147 + 148 + scpi_devpd: scpi-power-domains { 149 + compatible = "arm,scpi-power-domains"; 150 + num-domains = <2>; 151 + #power-domain-cells = <1>; 152 + }; 170 153 }; 171 154 172 155 cpu@0 { ··· 185 156 ... 186 157 reg = <0 0x7ff60000 0 0x1000>; 187 158 clocks = <&scpi_clk 4>; 159 + power-domains = <&scpi_devpd 1>; 188 160 }; 189 161 190 162 thermal-zones { ··· 216 186 temperature sensor provided by SCP firmware to setup a thermal 217 187 zone. The ID "3" is the sensor identifier for the temperature sensor 218 188 as used by the firmware. 189 + 190 + The num-domains property in scpi-power-domains domain specifies that 191 + SCPI provides 2 power domains. The hdlcd node uses the power domain with 192 + domain ID 1.
+45
Documentation/devicetree/bindings/bus/nvidia,tegra210-aconnect.txt
··· 1 + NVIDIA Tegra ACONNECT Bus 2 + 3 + The Tegra ACONNECT bus is an AXI switch which is used to connnect various 4 + components inside the Audio Processing Engine (APE). All CPU accesses to 5 + the APE subsystem go through the ACONNECT via an APB to AXI wrapper. 6 + 7 + Required properties: 8 + - compatible: Must be "nvidia,tegra210-aconnect". 9 + - clocks: Must contain the entries for the APE clock (TEGRA210_CLK_APE), 10 + and APE interface clock (TEGRA210_CLK_APB2APE). 11 + - clock-names: Must contain the names "ape" and "apb2ape" for the corresponding 12 + 'clocks' entries. 13 + - power-domains: Must contain a phandle that points to the audio powergate 14 + (namely 'aud') for Tegra210. 15 + - #address-cells: The number of cells used to represent physical base addresses 16 + in the aconnect address space. Should be 1. 17 + - #size-cells: The number of cells used to represent the size of an address 18 + range in the aconnect address space. Should be 1. 19 + - ranges: Mapping of the aconnect address space to the CPU address space. 20 + 21 + All devices accessed via the ACONNNECT are described by child-nodes. 22 + 23 + Example: 24 + 25 + aconnect@702c0000 { 26 + compatible = "nvidia,tegra210-aconnect"; 27 + clocks = <&tegra_car TEGRA210_CLK_APE>, 28 + <&tegra_car TEGRA210_CLK_APB2APE>; 29 + clock-names = "ape", "apb2ape"; 30 + power-domains = <&pd_audio>; 31 + 32 + #address-cells = <1>; 33 + #size-cells = <1>; 34 + ranges = <0x702c0000 0x0 0x702c0000 0x00040000>; 35 + 36 + status = "disabled"; 37 + 38 + child1 { 39 + ... 40 + }; 41 + 42 + child2 { 43 + ... 44 + }; 45 + };
+2 -2
Documentation/devicetree/bindings/clock/clps711x-clock.txt
··· 1 1 * Clock bindings for the Cirrus Logic CLPS711X CPUs 2 2 3 3 Required properties: 4 - - compatible : Shall contain "cirrus,clps711x-clk". 4 + - compatible : Shall contain "cirrus,ep7209-clk". 5 5 - reg : Address of the internal register set. 6 6 - startup-frequency: Factory set CPU startup frequency in HZ. 7 7 - #clock-cells : Should be <1>. ··· 13 13 Example: 14 14 clks: clks@80000000 { 15 15 #clock-cells = <1>; 16 - compatible = "cirrus,ep7312-clk", "cirrus,clps711x-clk"; 16 + compatible = "cirrus,ep7312-clk", "cirrus,ep7209-clk"; 17 17 reg = <0x80000000 0xc000>; 18 18 startup-frequency = <73728000>; 19 19 };
+2 -2
Documentation/devicetree/bindings/display/cirrus,clps711x-fb.txt
··· 1 1 * Currus Logic CLPS711X Framebuffer 2 2 3 3 Required properties: 4 - - compatible: Shall contain "cirrus,clps711x-fb". 4 + - compatible: Shall contain "cirrus,ep7209-fb". 5 5 - reg : Physical base address and length of the controller's registers + 6 6 location and size of the framebuffer memory. 7 7 - clocks : phandle + clock specifier pair of the FB reference clock. ··· 18 18 19 19 Example: 20 20 fb: fb@800002c0 { 21 - compatible = "cirrus,ep7312-fb", "cirrus,clps711x-fb"; 21 + compatible = "cirrus,ep7312-fb", "cirrus,ep7209-fb"; 22 22 reg = <0x800002c0 0xd44>, <0x60000000 0xc000>; 23 23 clocks = <&clks 2>; 24 24 lcd-supply = <&reg5v0>;
+2 -2
Documentation/devicetree/bindings/input/clps711x-keypad.txt
··· 1 1 * Cirrus Logic CLPS711X matrix keypad device tree bindings 2 2 3 3 Required Properties: 4 - - compatible: Shall contain "cirrus,clps711x-keypad". 4 + - compatible: Shall contain "cirrus,ep7209-keypad". 5 5 - row-gpios: List of GPIOs used as row lines. 6 6 - poll-interval: Poll interval time in milliseconds. 7 7 - linux,keymap: The definition can be found at ··· 12 12 13 13 Example: 14 14 keypad { 15 - compatible = "cirrus,ep7312-keypad", "cirrus,clps711x-keypad"; 15 + compatible = "cirrus,ep7312-keypad", "cirrus,ep7209-keypad"; 16 16 autorepeat; 17 17 poll-interval = <120>; 18 18 row-gpios = <&porta 0 0>,
+2 -2
Documentation/devicetree/bindings/interrupt-controller/cirrus,clps711x-intc.txt
··· 2 2 3 3 Required properties: 4 4 5 - - compatible: Should be "cirrus,clps711x-intc". 5 + - compatible: Should be "cirrus,ep7209-intc". 6 6 - reg: Specifies base physical address of the registers set. 7 7 - interrupt-controller: Identifies the node as an interrupt controller. 8 8 - #interrupt-cells: Specifies the number of cells needed to encode an ··· 34 34 35 35 Example: 36 36 intc: interrupt-controller { 37 - compatible = "cirrus,clps711x-intc"; 37 + compatible = "cirrus,ep7312-intc", "cirrus,ep7209-intc"; 38 38 reg = <0x80000000 0x4000>; 39 39 interrupt-controller; 40 40 #interrupt-cells = <1>;
+20
Documentation/devicetree/bindings/media/nokia,n900-ir
··· 1 + Device-Tree bindings for LIRC TX driver for Nokia N900(RX51) 2 + 3 + Required properties: 4 + - compatible: should be "nokia,n900-ir". 5 + - pwms: specifies PWM used for IR signal transmission. 6 + 7 + Example node: 8 + 9 + pwm9: dmtimer-pwm@9 { 10 + compatible = "ti,omap-dmtimer-pwm"; 11 + ti,timers = <&timer9>; 12 + ti,clock-source = <0x00>; /* timer_sys_ck */ 13 + #pwm-cells = <3>; 14 + }; 15 + 16 + ir: n900-ir { 17 + compatible = "nokia,n900-ir"; 18 + 19 + pwms = <&pwm9 0 26316 0>; /* 38000 Hz */ 20 + };
+136
Documentation/devicetree/bindings/memory-controllers/atmel,ebi.txt
··· 1 + * Device tree bindings for Atmel EBI 2 + 3 + The External Bus Interface (EBI) controller is a bus where you can connect 4 + asynchronous (NAND, NOR, SRAM, ....) and synchronous memories (SDR/DDR SDRAMs). 5 + The EBI provides a glue-less interface to asynchronous memories through the SMC 6 + (Static Memory Controller). 7 + 8 + Required properties: 9 + 10 + - compatible: "atmel,at91sam9260-ebi" 11 + "atmel,at91sam9261-ebi" 12 + "atmel,at91sam9263-ebi0" 13 + "atmel,at91sam9263-ebi1" 14 + "atmel,at91sam9rl-ebi" 15 + "atmel,at91sam9g45-ebi" 16 + "atmel,at91sam9x5-ebi" 17 + "atmel,sama5d3-ebi" 18 + 19 + - reg: Contains offset/length value for EBI memory mapping. 20 + This property might contain several entries if the EBI 21 + memory range is not contiguous 22 + 23 + - #address-cells: Must be 2. 24 + The first cell encodes the CS. 25 + The second cell encode the offset into the CS memory 26 + range. 27 + 28 + - #size-cells: Must be set to 1. 29 + 30 + - ranges: Encodes CS to memory region association. 31 + 32 + - clocks: Clock feeding the EBI controller. 33 + See clock-bindings.txt 34 + 35 + Children device nodes are representing device connected to the EBI bus. 36 + 37 + Required device node properties: 38 + 39 + - reg: Contains the chip-select id, the offset and the length 40 + of the memory region requested by the device. 41 + 42 + EBI bus configuration will be defined directly in the device subnode. 43 + 44 + Optional EBI/SMC properties: 45 + 46 + - atmel,smc-bus-width: width of the asynchronous device's data bus 47 + 8, 16 or 32. 48 + Default to 8 when undefined. 49 + 50 + - atmel,smc-byte-access-type "write" or "select" (see Atmel datasheet). 51 + Default to "select" when undefined. 52 + 53 + - atmel,smc-read-mode "nrd" or "ncs". 54 + Default to "ncs" when undefined. 55 + 56 + - atmel,smc-write-mode "nwe" or "ncs". 57 + Default to "ncs" when undefined. 58 + 59 + - atmel,smc-exnw-mode "disabled", "frozen" or "ready". 60 + Default to "disabled" when undefined. 61 + 62 + - atmel,smc-page-mode enable page mode if present. The provided value 63 + defines the page size (supported values: 4, 8, 64 + 16 and 32). 65 + 66 + - atmel,smc-tdf-mode: "normal" or "optimized". When set to 67 + "optimized" the data float time is optimized 68 + depending on the next device being accessed 69 + (next device setup time is subtracted to the 70 + current device data float time). 71 + Default to "normal" when undefined. 72 + 73 + If at least one atmel,smc- property is defined the following SMC timing 74 + properties become mandatory. In the other hand, if none of the atmel,smc- 75 + properties are specified, we assume that the EBI bus configuration will be 76 + handled by the sub-device driver, and none of those properties should be 77 + defined. 78 + 79 + All the timings are expressed in nanoseconds (see Atmel datasheet for a full 80 + description). 81 + 82 + - atmel,smc-ncs-rd-setup-ns 83 + - atmel,smc-nrd-setup-ns 84 + - atmel,smc-ncs-wr-setup-ns 85 + - atmel,smc-nwe-setup-ns 86 + - atmel,smc-ncs-rd-pulse-ns 87 + - atmel,smc-nrd-pulse-ns 88 + - atmel,smc-ncs-wr-pulse-ns 89 + - atmel,smc-nwe-pulse-ns 90 + - atmel,smc-nwe-cycle-ns 91 + - atmel,smc-nrd-cycle-ns 92 + - atmel,smc-tdf-ns 93 + 94 + Example: 95 + 96 + ebi: ebi@10000000 { 97 + compatible = "atmel,sama5d3-ebi"; 98 + #address-cells = <2>; 99 + #size-cells = <1>; 100 + atmel,smc = <&hsmc>; 101 + atmel,matrix = <&matrix>; 102 + reg = <0x10000000 0x10000000 103 + 0x40000000 0x30000000>; 104 + ranges = <0x0 0x0 0x10000000 0x10000000 105 + 0x1 0x0 0x40000000 0x10000000 106 + 0x2 0x0 0x50000000 0x10000000 107 + 0x3 0x0 0x60000000 0x10000000>; 108 + clocks = <&mck>; 109 + 110 + pinctrl-names = "default"; 111 + pinctrl-0 = <&pinctrl_ebi_addr>; 112 + 113 + nor: flash@0,0 { 114 + compatible = "cfi-flash"; 115 + #address-cells = <1>; 116 + #size-cells = <1>; 117 + reg = <0x0 0x0 0x1000000>; 118 + bank-width = <2>; 119 + 120 + atmel,smc-read-mode = "nrd"; 121 + atmel,smc-write-mode = "nwe"; 122 + atmel,smc-bus-width = <16>; 123 + atmel,smc-ncs-rd-setup-ns = <0>; 124 + atmel,smc-ncs-wr-setup-ns = <0>; 125 + atmel,smc-nwe-setup-ns = <8>; 126 + atmel,smc-nrd-setup-ns = <16>; 127 + atmel,smc-ncs-rd-pulse-ns = <84>; 128 + atmel,smc-ncs-wr-pulse-ns = <84>; 129 + atmel,smc-nrd-pulse-ns = <76>; 130 + atmel,smc-nwe-pulse-ns = <76>; 131 + atmel,smc-nrd-cycle-ns = <107>; 132 + atmel,smc-nwe-cycle-ns = <84>; 133 + atmel,smc-tdf-ns = <16>; 134 + }; 135 + }; 136 +
+2 -3
Documentation/devicetree/bindings/pwm/cirrus,clps711x-pwm.txt
··· 1 1 * Cirris Logic CLPS711X PWM controller 2 2 3 3 Required properties: 4 - - compatible: Shall contain "cirrus,clps711x-pwm". 4 + - compatible: Shall contain "cirrus,ep7209-pwm". 5 5 - reg: Physical base address and length of the controller's registers. 6 6 - clocks: phandle + clock specifier pair of the PWM reference clock. 7 7 - #pwm-cells: Should be 1. The cell specifies the index of the channel. 8 8 9 9 Example: 10 10 pwm: pwm@80000400 { 11 - compatible = "cirrus,ep7312-pwm", 12 - "cirrus,clps711x-pwm"; 11 + compatible = "cirrus,ep7312-pwm", "cirrus,ep7209-pwm"; 13 12 reg = <0x80000400 0x4>; 14 13 clocks = <&clks 8>; 15 14 #pwm-cells = <1>;
+4
Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
··· 9 9 10 10 Optional properties: 11 11 - ti,prescaler: Should be a value between 0 and 7, see the timers datasheet 12 + - ti,clock-source: Set dmtimer parent clock, values between 0 and 2: 13 + - 0x00 - high-frequency system clock (timer_sys_ck) 14 + - 0x01 - 32-kHz always-on clock (timer_32k_ck) 15 + - 0x02 - external clock (timer_ext_ck, OMAP2 only) 12 16 13 17 Example: 14 18 pwm9: dmtimer-pwm@9 {
+18
Documentation/devicetree/bindings/reset/amlogic,meson-reset.txt
··· 1 + Amlogic Meson SoC Reset Controller 2 + ======================================= 3 + 4 + Please also refer to reset.txt in this directory for common reset 5 + controller binding usage. 6 + 7 + Required properties: 8 + - compatible: Should be "amlogic,meson8b-reset" or "amlogic,meson-gxbb-reset" 9 + - reg: should contain the register address base 10 + - #reset-cells: 1, see below 11 + 12 + example: 13 + 14 + reset: reset-controller { 15 + compatible = "amlogic,meson-gxbb-reset"; 16 + reg = <0x0 0x04404 0x0 0x20>; 17 + #reset-cells = <1>; 18 + };
+3 -1
Documentation/devicetree/bindings/reset/hisilicon,hi6220-reset.txt
··· 8 8 hi6220 SoC. 9 9 10 10 Required properties: 11 - - compatible: may be "hisilicon,hi6220-sysctrl" 11 + - compatible: should be one of the following: 12 + - "hisilicon,hi6220-sysctrl", "syscon" : For peripheral reset controller. 13 + - "hisilicon,hi6220-mediactrl", "syscon" : For media reset controller. 12 14 - reg: should be register base and length as documented in the 13 15 datasheet 14 16 - #reset-cells: 1, see below
+91
Documentation/devicetree/bindings/reset/ti-syscon-reset.txt
··· 1 + TI SysCon Reset Controller 2 + ======================= 3 + 4 + Almost all SoCs have hardware modules that require reset control in addition 5 + to clock and power control for their functionality. The reset control is 6 + typically provided by means of memory-mapped I/O registers. These registers are 7 + sometimes a part of a larger register space region implementing various 8 + functionalities. This register range is best represented as a syscon node to 9 + allow multiple entities to access their relevant registers in the common 10 + register space. 11 + 12 + A SysCon Reset Controller node defines a device that uses a syscon node 13 + and provides reset management functionality for various hardware modules 14 + present on the SoC. 15 + 16 + SysCon Reset Controller Node 17 + ============================ 18 + Each of the reset provider/controller nodes should be a child of a syscon 19 + node and have the following properties. 20 + 21 + Required properties: 22 + -------------------- 23 + - compatible : Should be, 24 + "ti,k2e-pscrst" 25 + "ti,k2l-pscrst" 26 + "ti,k2hk-pscrst" 27 + "ti,syscon-reset" 28 + - #reset-cells : Should be 1. Please see the reset consumer node below 29 + for usage details 30 + - ti,reset-bits : Contains the reset control register information 31 + Should contain 7 cells for each reset exposed to 32 + consumers, defined as: 33 + Cell #1 : offset of the reset assert control 34 + register from the syscon register base 35 + Cell #2 : bit position of the reset in the reset 36 + assert control register 37 + Cell #3 : offset of the reset deassert control 38 + register from the syscon register base 39 + Cell #4 : bit position of the reset in the reset 40 + deassert control register 41 + Cell #5 : offset of the reset status register 42 + from the syscon register base 43 + Cell #6 : bit position of the reset in the 44 + reset status register 45 + Cell #7 : Flags used to control reset behavior, 46 + availible flags defined in the DT include 47 + file <dt-bindings/reset/ti-syscon.h> 48 + 49 + SysCon Reset Consumer Nodes 50 + =========================== 51 + Each of the reset consumer nodes should have the following properties, 52 + in addition to their own properties. 53 + 54 + Required properties: 55 + -------------------- 56 + - resets : A phandle to the reset controller node and an index number 57 + to a reset specifier as defined above. 58 + 59 + Please also refer to Documentation/devicetree/bindings/reset/reset.txt for 60 + common reset controller usage by consumers. 61 + 62 + Example: 63 + -------- 64 + The following example demonstrates a syscon node, the reset controller node 65 + using the syscon node, and a consumer (a DSP device) on the TI Keystone 2 66 + Edison SoC. 67 + 68 + / { 69 + soc { 70 + psc: power-sleep-controller@02350000 { 71 + compatible = "syscon", "simple-mfd"; 72 + reg = <0x02350000 0x1000>; 73 + 74 + pscrst: psc-reset { 75 + compatible = "ti,k2e-pscrst", "ti,syscon-reset"; 76 + #reset-cells = <1>; 77 + 78 + ti,reset-bits = < 79 + 0xa3c 8 0xa3c 8 0x83c 8 (ASSERT_SET|DEASSERT_CLEAR|STATUS_SET) /* 0: pcrst-dsp0 */ 80 + 0xa40 5 0xa44 3 0 0 (ASSERT_SET|DEASSERT_CLEAR|STATUS_NONE) /* 1: pcrst-example */ 81 + >; 82 + }; 83 + }; 84 + 85 + dsp0: dsp0 { 86 + ... 87 + resets = <&pscrst 0>; 88 + ... 89 + }; 90 + }; 91 + };
+2 -2
Documentation/devicetree/bindings/serial/cirrus,clps711x-uart.txt
··· 1 1 * Cirrus Logic CLPS711X Universal Asynchronous Receiver/Transmitter (UART) 2 2 3 3 Required properties: 4 - - compatible: Should be "cirrus,clps711x-uart". 4 + - compatible: Should be "cirrus,ep7209-uart". 5 5 - reg: Address and length of the register set for the device. 6 6 - interrupts: Should contain UART TX and RX interrupt. 7 7 - clocks: Should contain UART core clock number. ··· 20 20 }; 21 21 22 22 uart1: uart@80000480 { 23 - compatible = "cirrus,clps711x-uart"; 23 + compatible = "cirrus,ep7312-uart","cirrus,ep7209-uart"; 24 24 reg = <0x80000480 0x80>; 25 25 interrupts = <12 13>; 26 26 clocks = <&clks 11>;
+2 -2
Documentation/devicetree/bindings/soc/qcom/qcom,smp2p.txt
··· 68 68 Value type: <u32> 69 69 Definition: must be 2 - denoting the bit in the entry and IRQ flags 70 70 71 - - #qcom,state-cells: 71 + - #qcom,smem-state-cells: 72 72 Usage: required for outgoing entries 73 73 Value type: <u32> 74 74 Definition: must be 1 - denoting the bit in the entry ··· 92 92 wcnss_smp2p_out: master-kernel { 93 93 qcom,entry-name = "master-kernel"; 94 94 95 - #qcom,state-cells = <1>; 95 + #qcom,smem-state-cells = <1>; 96 96 }; 97 97 98 98 wcnss_smp2p_in: slave-kernel {
+2 -2
Documentation/devicetree/bindings/soc/qcom/qcom,smsm.txt
··· 51 51 Definition: specifies the offset, in words, of the first bit for this 52 52 entry 53 53 54 - - #qcom,state-cells: 54 + - #qcom,smem-state-cells: 55 55 Usage: required for local entry 56 56 Value type: <u32> 57 57 Definition: must be 1 - denotes bit number ··· 91 91 apps_smsm: apps@0 { 92 92 reg = <0>; 93 93 94 - #qcom,state-cells = <1>; 94 + #qcom,smem-state-cells = <1>; 95 95 }; 96 96 97 97 wcnss_smsm: wcnss@7 {
+3 -3
Documentation/devicetree/bindings/timer/cirrus,clps711x-timer.txt
··· 1 1 * Cirrus Logic CLPS711X Timer Counter 2 2 3 3 Required properties: 4 - - compatible: Shall contain "cirrus,clps711x-timer". 4 + - compatible: Shall contain "cirrus,ep7209-timer". 5 5 - reg : Address and length of the register set. 6 6 - interrupts: The interrupt number of the timer. 7 7 - clocks : phandle of timer reference clock. ··· 15 15 }; 16 16 17 17 timer1: timer@80000300 { 18 - compatible = "cirrus,ep7312-timer", "cirrus,clps711x-timer"; 18 + compatible = "cirrus,ep7312-timer", "cirrus,ep7209-timer"; 19 19 reg = <0x80000300 0x4>; 20 20 interrupts = <8>; 21 21 clocks = <&clks 5>; 22 22 }; 23 23 24 24 timer2: timer@80000340 { 25 - compatible = "cirrus,ep7312-timer", "cirrus,clps711x-timer"; 25 + compatible = "cirrus,ep7312-timer", "cirrus,ep7209-timer"; 26 26 reg = <0x80000340 0x4>; 27 27 interrupts = <9>; 28 28 clocks = <&clks 6>;
+4
Documentation/driver-model/devres.txt
··· 352 352 devm_regulator_put() 353 353 devm_regulator_register() 354 354 355 + RESET 356 + devm_reset_control_get() 357 + devm_reset_controller_register() 358 + 355 359 SLAVE DMA ENGINE 356 360 devm_acpi_dma_controller_register() 357 361
+1 -1
MAINTAINERS
··· 1536 1536 L: linux-arm-msm@vger.kernel.org 1537 1537 L: linux-soc@vger.kernel.org 1538 1538 S: Maintained 1539 + F: Documentation/devicetree/bindings/soc/qcom/ 1539 1540 F: arch/arm/boot/dts/qcom-*.dts 1540 1541 F: arch/arm/boot/dts/qcom-*.dtsi 1541 1542 F: arch/arm/mach-qcom/ ··· 1842 1841 T: git git://git.linaro.org/people/ulfh/clk.git 1843 1842 S: Maintained 1844 1843 F: drivers/clk/ux500/ 1845 - F: include/linux/platform_data/clk-ux500.h 1846 1844 1847 1845 ARM/VERSATILE EXPRESS PLATFORM 1848 1846 M: Liviu Dudau <liviu.dudau@arm.com>
+29
arch/arm/boot/dts/exynos-mfc-reserved-memory.dtsi
··· 1 + /* 2 + * Samsung's Exynos SoC MFC (Video Codec) reserved memory common definition. 3 + * 4 + * Copyright (c) 2016 Samsung Electronics Co., Ltd 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + / { 12 + reserved-memory { 13 + #address-cells = <1>; 14 + #size-cells = <1>; 15 + ranges; 16 + 17 + mfc_left: region@51000000 { 18 + compatible = "shared-dma-pool"; 19 + no-map; 20 + reg = <0x51000000 0x800000>; 21 + }; 22 + 23 + mfc_right: region@43000000 { 24 + compatible = "shared-dma-pool"; 25 + no-map; 26 + reg = <0x43000000 0x800000>; 27 + }; 28 + }; 29 + };
+2 -2
arch/arm/boot/dts/exynos4210-origen.dts
··· 18 18 #include "exynos4210.dtsi" 19 19 #include <dt-bindings/gpio/gpio.h> 20 20 #include <dt-bindings/input/input.h> 21 + #include "exynos-mfc-reserved-memory.dtsi" 21 22 22 23 / { 23 24 model = "Insignal Origen evaluation board based on Exynos4210"; ··· 289 288 }; 290 289 291 290 &mfc { 292 - samsung,mfc-r = <0x43000000 0x800000>; 293 - samsung,mfc-l = <0x51000000 0x800000>; 291 + memory-region = <&mfc_left>, <&mfc_right>; 294 292 status = "okay"; 295 293 }; 296 294
+2 -2
arch/arm/boot/dts/exynos4210-smdkv310.dts
··· 17 17 /dts-v1/; 18 18 #include "exynos4210.dtsi" 19 19 #include <dt-bindings/gpio/gpio.h> 20 + #include "exynos-mfc-reserved-memory.dtsi" 20 21 21 22 / { 22 23 model = "Samsung smdkv310 evaluation board based on Exynos4210"; ··· 134 133 }; 135 134 136 135 &mfc { 137 - samsung,mfc-r = <0x43000000 0x800000>; 138 - samsung,mfc-l = <0x51000000 0x800000>; 136 + memory-region = <&mfc_left>, <&mfc_right>; 139 137 status = "okay"; 140 138 }; 141 139
+6
arch/arm/boot/dts/exynos4412-odroid-common.dtsi
··· 13 13 #include "exynos4412.dtsi" 14 14 #include "exynos4412-ppmu-common.dtsi" 15 15 #include <dt-bindings/gpio/gpio.h> 16 + #include "exynos-mfc-reserved-memory.dtsi" 16 17 17 18 / { 18 19 chosen { ··· 498 497 <&clock_audss EXYNOS_DOUT_AUD_BUS>, 499 498 <&clock_audss EXYNOS_SCLK_I2S>; 500 499 clock-names = "iis", "i2s_opclk0", "i2s_opclk1"; 500 + }; 501 + 502 + &mfc { 503 + memory-region = <&mfc_left>, <&mfc_right>; 504 + status = "okay"; 501 505 }; 502 506 503 507 &mixer {
+2 -2
arch/arm/boot/dts/exynos4412-origen.dts
··· 16 16 #include "exynos4412.dtsi" 17 17 #include <dt-bindings/gpio/gpio.h> 18 18 #include <dt-bindings/input/input.h> 19 + #include "exynos-mfc-reserved-memory.dtsi" 19 20 20 21 / { 21 22 model = "Insignal Origen evaluation board based on Exynos4412"; ··· 467 466 }; 468 467 469 468 &mfc { 470 - samsung,mfc-r = <0x43000000 0x800000>; 471 - samsung,mfc-l = <0x51000000 0x800000>; 469 + memory-region = <&mfc_left>, <&mfc_right>; 472 470 status = "okay"; 473 471 }; 474 472
+2 -2
arch/arm/boot/dts/exynos4412-smdk4412.dts
··· 14 14 15 15 /dts-v1/; 16 16 #include "exynos4412.dtsi" 17 + #include "exynos-mfc-reserved-memory.dtsi" 17 18 18 19 / { 19 20 model = "Samsung SMDK evaluation board based on Exynos4412"; ··· 113 112 }; 114 113 115 114 &mfc { 116 - samsung,mfc-r = <0x43000000 0x800000>; 117 - samsung,mfc-l = <0x51000000 0x800000>; 115 + memory-region = <&mfc_left>, <&mfc_right>; 118 116 status = "okay"; 119 117 }; 120 118
+2 -2
arch/arm/boot/dts/exynos5250-arndale.dts
··· 14 14 #include <dt-bindings/interrupt-controller/irq.h> 15 15 #include <dt-bindings/input/input.h> 16 16 #include "exynos5250.dtsi" 17 + #include "exynos-mfc-reserved-memory.dtsi" 17 18 18 19 / { 19 20 model = "Insignal Arndale evaluation board based on EXYNOS5250"; ··· 517 516 }; 518 517 519 518 &mfc { 520 - samsung,mfc-r = <0x43000000 0x800000>; 521 - samsung,mfc-l = <0x51000000 0x800000>; 519 + memory-region = <&mfc_left>, <&mfc_right>; 522 520 }; 523 521 524 522 &mmc_0 {
+2 -2
arch/arm/boot/dts/exynos5250-smdk5250.dts
··· 13 13 #include <dt-bindings/gpio/gpio.h> 14 14 #include <dt-bindings/interrupt-controller/irq.h> 15 15 #include "exynos5250.dtsi" 16 + #include "exynos-mfc-reserved-memory.dtsi" 16 17 17 18 / { 18 19 model = "SAMSUNG SMDK5250 board based on EXYNOS5250"; ··· 345 344 }; 346 345 347 346 &mfc { 348 - samsung,mfc-r = <0x43000000 0x800000>; 349 - samsung,mfc-l = <0x51000000 0x800000>; 347 + memory-region = <&mfc_left>, <&mfc_right>; 350 348 }; 351 349 352 350 &mmc_0 {
+2 -2
arch/arm/boot/dts/exynos5250-spring.dts
··· 14 14 #include <dt-bindings/interrupt-controller/irq.h> 15 15 #include <dt-bindings/input/input.h> 16 16 #include "exynos5250.dtsi" 17 + #include "exynos-mfc-reserved-memory.dtsi" 17 18 18 19 / { 19 20 model = "Google Spring"; ··· 426 425 }; 427 426 428 427 &mfc { 429 - samsung,mfc-r = <0x43000000 0x800000>; 430 - samsung,mfc-l = <0x51000000 0x800000>; 428 + memory-region = <&mfc_left>, <&mfc_right>; 431 429 }; 432 430 433 431 &mmc_0 {
+2 -2
arch/arm/boot/dts/exynos5420-arndale-octa.dts
··· 16 16 #include <dt-bindings/interrupt-controller/irq.h> 17 17 #include <dt-bindings/input/input.h> 18 18 #include <dt-bindings/clock/samsung,s2mps11.h> 19 + #include "exynos-mfc-reserved-memory.dtsi" 19 20 20 21 / { 21 22 model = "Insignal Arndale Octa evaluation board based on EXYNOS5420"; ··· 348 347 }; 349 348 350 349 &mfc { 351 - samsung,mfc-r = <0x43000000 0x800000>; 352 - samsung,mfc-l = <0x51000000 0x800000>; 350 + memory-region = <&mfc_left>, <&mfc_right>; 353 351 }; 354 352 355 353 &mmc_0 {
+2 -2
arch/arm/boot/dts/exynos5420-peach-pit.dts
··· 16 16 #include <dt-bindings/regulator/maxim,max77802.h> 17 17 #include "exynos5420.dtsi" 18 18 #include "exynos5420-cpus.dtsi" 19 + #include "exynos-mfc-reserved-memory.dtsi" 19 20 20 21 / { 21 22 model = "Google Peach Pit Rev 6+"; ··· 703 702 }; 704 703 705 704 &mfc { 706 - samsung,mfc-r = <0x43000000 0x800000>; 707 - samsung,mfc-l = <0x51000000 0x800000>; 705 + memory-region = <&mfc_left>, <&mfc_right>; 708 706 }; 709 707 710 708 &mmc_0 {
+2 -2
arch/arm/boot/dts/exynos5420-smdk5420.dts
··· 13 13 #include "exynos5420.dtsi" 14 14 #include "exynos5420-cpus.dtsi" 15 15 #include <dt-bindings/gpio/gpio.h> 16 + #include "exynos-mfc-reserved-memory.dtsi" 16 17 17 18 / { 18 19 model = "Samsung SMDK5420 board based on EXYNOS5420"; ··· 356 355 }; 357 356 358 357 &mfc { 359 - samsung,mfc-r = <0x43000000 0x800000>; 360 - samsung,mfc-l = <0x51000000 0x800000>; 358 + memory-region = <&mfc_left>, <&mfc_right>; 361 359 }; 362 360 363 361 &mmc_0 {
+2 -2
arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi
··· 17 17 #include "exynos5800.dtsi" 18 18 #include "exynos5422-cpus.dtsi" 19 19 #include "exynos5422-cpu-thermal.dtsi" 20 + #include "exynos-mfc-reserved-memory.dtsi" 20 21 21 22 / { 22 23 memory { ··· 407 406 }; 408 407 409 408 &mfc { 410 - samsung,mfc-r = <0x43000000 0x800000>; 411 - samsung,mfc-l = <0x51000000 0x800000>; 409 + memory-region = <&mfc_left>, <&mfc_right>; 412 410 }; 413 411 414 412 &mmc_0 {
+2 -2
arch/arm/boot/dts/exynos5800-peach-pi.dts
··· 16 16 #include <dt-bindings/regulator/maxim,max77802.h> 17 17 #include "exynos5800.dtsi" 18 18 #include "exynos5420-cpus.dtsi" 19 + #include "exynos-mfc-reserved-memory.dtsi" 19 20 20 21 / { 21 22 model = "Google Peach Pi Rev 10+"; ··· 671 670 }; 672 671 673 672 &mfc { 674 - samsung,mfc-r = <0x43000000 0x800000>; 675 - samsung,mfc-l = <0x51000000 0x800000>; 673 + memory-region = <&mfc_left>, <&mfc_right>; 676 674 }; 677 675 678 676 &mmc_0 {
+1
arch/arm/mach-exynos/Kconfig
··· 18 18 select EXYNOS_THERMAL 19 19 select EXYNOS_PMU 20 20 select EXYNOS_SROM 21 + select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS 21 22 select GPIOLIB 22 23 select HAVE_ARM_SCU if SMP 23 24 select HAVE_S3C2410_I2C if I2C
-3
arch/arm/mach-exynos/Makefile
··· 13 13 14 14 obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm.o sleep.o 15 15 obj-$(CONFIG_PM_SLEEP) += suspend.o 16 - obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o 17 16 18 17 obj-$(CONFIG_SMP) += platsmp.o headsmp.o 19 18 ··· 22 23 23 24 obj-$(CONFIG_EXYNOS5420_MCPM) += mcpm-exynos.o 24 25 CFLAGS_mcpm-exynos.o += -march=armv7-a 25 - 26 - obj-$(CONFIG_S5P_DEV_MFC) += s5p-dev-mfc.o
-19
arch/arm/mach-exynos/exynos.c
··· 27 27 #include <plat/cpu.h> 28 28 29 29 #include "common.h" 30 - #include "mfc.h" 31 30 32 31 static struct map_desc exynos4_iodesc[] __initdata = { 33 32 { ··· 234 235 NULL 235 236 }; 236 237 237 - static void __init exynos_reserve(void) 238 - { 239 - #ifdef CONFIG_S5P_DEV_MFC 240 - int i; 241 - char *mfc_mem[] = { 242 - "samsung,mfc-v5", 243 - "samsung,mfc-v6", 244 - "samsung,mfc-v7", 245 - "samsung,mfc-v8", 246 - }; 247 - 248 - for (i = 0; i < ARRAY_SIZE(mfc_mem); i++) 249 - if (of_scan_flat_dt(s5p_fdt_alloc_mfc_mem, mfc_mem[i])) 250 - break; 251 - #endif 252 - } 253 - 254 238 static void __init exynos_dt_fixup(void) 255 239 { 256 240 /* ··· 255 273 .init_machine = exynos_dt_machine_init, 256 274 .init_late = exynos_init_late, 257 275 .dt_compat = exynos_dt_compat, 258 - .reserve = exynos_reserve, 259 276 .dt_fixup = exynos_dt_fixup, 260 277 MACHINE_END
-16
arch/arm/mach-exynos/mfc.h
··· 1 - /* 2 - * Copyright (C) 2013 Samsung Electronics Co.Ltd 3 - * 4 - * This program is free software; you can redistribute it and/or modify it 5 - * under the terms of the GNU General Public License as published by the 6 - * Free Software Foundation; either version 2 of the License, or (at your 7 - * option) any later version. 8 - */ 9 - 10 - #ifndef __MACH_EXYNOS_MFC_H 11 - #define __MACH_EXYNOS_MFC_H __FILE__ 12 - 13 - int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname, 14 - int depth, void *data); 15 - 16 - #endif /* __MACH_EXYNOS_MFC_H */
+28 -6
arch/arm/mach-exynos/pm_domains.c drivers/soc/samsung/pm_domains.c
··· 23 23 #include <linux/of_platform.h> 24 24 #include <linux/sched.h> 25 25 26 - #define INT_LOCAL_PWR_EN 0x7 27 26 #define MAX_CLK_PER_DOMAIN 4 27 + 28 + struct exynos_pm_domain_config { 29 + /* Value for LOCAL_PWR_CFG and STATUS fields for each domain */ 30 + u32 local_pwr_cfg; 31 + }; 28 32 29 33 /* 30 34 * Exynos specific wrapper around the generic power domain ··· 42 38 struct clk *clk[MAX_CLK_PER_DOMAIN]; 43 39 struct clk *pclk[MAX_CLK_PER_DOMAIN]; 44 40 struct clk *asb_clk[MAX_CLK_PER_DOMAIN]; 41 + u32 local_pwr_cfg; 45 42 }; 46 43 47 44 static int exynos_pd_power(struct generic_pm_domain *domain, bool power_on) ··· 74 69 } 75 70 } 76 71 77 - pwr = power_on ? INT_LOCAL_PWR_EN : 0; 72 + pwr = power_on ? pd->local_pwr_cfg : 0; 78 73 writel_relaxed(pwr, base); 79 74 80 75 /* Wait max 1ms */ 81 76 timeout = 10; 82 77 83 - while ((readl_relaxed(base + 0x4) & INT_LOCAL_PWR_EN) != pwr) { 78 + while ((readl_relaxed(base + 0x4) & pd->local_pwr_cfg) != pwr) { 84 79 if (!timeout) { 85 80 op = (power_on) ? "enable" : "disable"; 86 81 pr_err("Power domain %s %s failed\n", domain->name, op); ··· 124 119 return exynos_pd_power(domain, false); 125 120 } 126 121 122 + static const struct exynos_pm_domain_config exynos4210_cfg __initconst = { 123 + .local_pwr_cfg = 0x7, 124 + }; 125 + 126 + static const struct of_device_id exynos_pm_domain_of_match[] __initconst = { 127 + { 128 + .compatible = "samsung,exynos4210-pd", 129 + .data = &exynos4210_cfg, 130 + }, 131 + { }, 132 + }; 133 + 127 134 static __init int exynos4_pm_init_power_domain(void) 128 135 { 129 136 struct device_node *np; 137 + const struct of_device_id *match; 130 138 131 - for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { 139 + for_each_matching_node_and_match(np, exynos_pm_domain_of_match, &match) { 140 + const struct exynos_pm_domain_config *pm_domain_cfg; 132 141 struct exynos_pm_domain *pd; 133 142 int on, i; 143 + 144 + pm_domain_cfg = match->data; 134 145 135 146 pd = kzalloc(sizeof(*pd), GFP_KERNEL); 136 147 if (!pd) { ··· 174 153 175 154 pd->pd.power_off = exynos_pd_power_off; 176 155 pd->pd.power_on = exynos_pd_power_on; 156 + pd->local_pwr_cfg = pm_domain_cfg->local_pwr_cfg; 177 157 178 158 for (i = 0; i < MAX_CLK_PER_DOMAIN; i++) { 179 159 char clk_name[8]; ··· 207 185 clk_put(pd->oscclk); 208 186 209 187 no_clk: 210 - on = readl_relaxed(pd->base + 0x4) & INT_LOCAL_PWR_EN; 188 + on = readl_relaxed(pd->base + 0x4) & pd->local_pwr_cfg; 211 189 212 190 pm_genpd_init(&pd->pd, NULL, !on); 213 191 of_genpd_add_provider_simple(np, &pd->pd); 214 192 } 215 193 216 194 /* Assign the child power domains to their parents */ 217 - for_each_compatible_node(np, NULL, "samsung,exynos4210-pd") { 195 + for_each_matching_node(np, exynos_pm_domain_of_match) { 218 196 struct generic_pm_domain *child_domain, *parent_domain; 219 197 struct of_phandle_args args; 220 198
-93
arch/arm/mach-exynos/s5p-dev-mfc.c
··· 1 - /* 2 - * Copyright (C) 2010-2011 Samsung Electronics Co.Ltd 3 - * 4 - * Base S5P MFC resource and device definitions 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - */ 10 - 11 - #include <linux/kernel.h> 12 - #include <linux/platform_device.h> 13 - #include <linux/dma-mapping.h> 14 - #include <linux/memblock.h> 15 - #include <linux/ioport.h> 16 - #include <linux/of_fdt.h> 17 - #include <linux/of.h> 18 - 19 - static struct platform_device s5p_device_mfc_l; 20 - static struct platform_device s5p_device_mfc_r; 21 - 22 - struct s5p_mfc_dt_meminfo { 23 - unsigned long loff; 24 - unsigned long lsize; 25 - unsigned long roff; 26 - unsigned long rsize; 27 - char *compatible; 28 - }; 29 - 30 - struct s5p_mfc_reserved_mem { 31 - phys_addr_t base; 32 - unsigned long size; 33 - struct device *dev; 34 - }; 35 - 36 - static struct s5p_mfc_reserved_mem s5p_mfc_mem[2] __initdata; 37 - 38 - 39 - static void __init s5p_mfc_reserve_mem(phys_addr_t rbase, unsigned int rsize, 40 - phys_addr_t lbase, unsigned int lsize) 41 - { 42 - int i; 43 - 44 - s5p_mfc_mem[0].dev = &s5p_device_mfc_r.dev; 45 - s5p_mfc_mem[0].base = rbase; 46 - s5p_mfc_mem[0].size = rsize; 47 - 48 - s5p_mfc_mem[1].dev = &s5p_device_mfc_l.dev; 49 - s5p_mfc_mem[1].base = lbase; 50 - s5p_mfc_mem[1].size = lsize; 51 - 52 - for (i = 0; i < ARRAY_SIZE(s5p_mfc_mem); i++) { 53 - struct s5p_mfc_reserved_mem *area = &s5p_mfc_mem[i]; 54 - if (memblock_remove(area->base, area->size)) { 55 - printk(KERN_ERR "Failed to reserve memory for MFC device (%ld bytes at 0x%08lx)\n", 56 - area->size, (unsigned long) area->base); 57 - area->base = 0; 58 - } 59 - } 60 - } 61 - 62 - int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname, 63 - int depth, void *data) 64 - { 65 - const __be32 *prop; 66 - int len; 67 - struct s5p_mfc_dt_meminfo mfc_mem; 68 - 69 - if (!data) 70 - return 0; 71 - 72 - if (!of_flat_dt_is_compatible(node, data)) 73 - return 0; 74 - 75 - prop = of_get_flat_dt_prop(node, "samsung,mfc-l", &len); 76 - if (!prop || (len != 2 * sizeof(unsigned long))) 77 - return 0; 78 - 79 - mfc_mem.loff = be32_to_cpu(prop[0]); 80 - mfc_mem.lsize = be32_to_cpu(prop[1]); 81 - 82 - prop = of_get_flat_dt_prop(node, "samsung,mfc-r", &len); 83 - if (!prop || (len != 2 * sizeof(unsigned long))) 84 - return 0; 85 - 86 - mfc_mem.roff = be32_to_cpu(prop[0]); 87 - mfc_mem.rsize = be32_to_cpu(prop[1]); 88 - 89 - s5p_mfc_reserve_mem(mfc_mem.roff, mfc_mem.rsize, 90 - mfc_mem.loff, mfc_mem.lsize); 91 - 92 - return 1; 93 - }
-5
arch/arm/mach-omap2/board-rx51-peripherals.c
··· 1242 1242 #if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE) 1243 1243 static struct lirc_rx51_platform_data rx51_lirc_data = { 1244 1244 .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat, 1245 - .pwm_timer = 9, /* Use GPT 9 for CIR */ 1246 - #if IS_ENABLED(CONFIG_OMAP_DM_TIMER) 1247 - .dmtimer = &pwm_dmtimer_pdata, 1248 - #endif 1249 - 1250 1245 }; 1251 1246 1252 1247 static struct platform_device rx51_lirc_device = {
+1 -9
arch/arm/mach-omap2/pdata-quirks.c
··· 274 274 }, 275 275 }; 276 276 277 - static struct platform_device rx51_lirc_device; 278 - 279 277 static void __init nokia_n900_legacy_init(void) 280 278 { 281 279 hsmmc2_internal_input_clk(); ··· 292 294 293 295 pr_info("RX-51: Registering OMAP3 HWRNG device\n"); 294 296 platform_device_register(&omap3_rom_rng_device); 295 - 296 297 } 297 - 298 - platform_device_register(&rx51_lirc_device); 299 298 } 300 299 301 300 static void __init omap3_tao3530_legacy_init(void) ··· 487 492 488 493 static struct lirc_rx51_platform_data __maybe_unused rx51_lirc_data = { 489 494 .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat, 490 - .pwm_timer = 9, /* Use GPT 9 for CIR */ 491 - #if IS_ENABLED(CONFIG_OMAP_DM_TIMER) 492 - .dmtimer = &pwm_dmtimer_pdata, 493 - #endif 494 495 }; 495 496 496 497 static struct platform_device __maybe_unused rx51_lirc_device = { ··· 534 543 &omap3_iommu_pdata), 535 544 OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x4809c000, "4809c000.mmc", &mmc_pdata[0]), 536 545 OF_DEV_AUXDATA("ti,omap3-hsmmc", 0x480b4000, "480b4000.mmc", &mmc_pdata[1]), 546 + OF_DEV_AUXDATA("nokia,n900-ir", 0, "n900-ir", &rx51_lirc_data), 537 547 /* Only on am3517 */ 538 548 OF_DEV_AUXDATA("ti,davinci_mdio", 0x5c030000, "davinci_mdio.0", NULL), 539 549 OF_DEV_AUXDATA("ti,am3517-emac", 0x5c000000, "davinci_emac.0",
+2 -4
arch/arm/mach-ux500/Makefile
··· 2 2 # Makefile for the linux kernel, U8500 machine. 3 3 # 4 4 5 - obj-y := cpu.o id.o pm.o 6 - obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 5 + obj-y := pm.o 7 6 obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o 8 - obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \ 9 - board-mop500-audio.o 7 + obj-$(CONFIG_MACH_MOP500) += board-mop500-audio.o 10 8 obj-$(CONFIG_SMP) += platsmp.o 11 9 obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o 12 10 obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
-1065
arch/arm/mach-ux500/board-mop500-regulators.c
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2010 3 - * 4 - * License Terms: GNU General Public License v2 5 - * 6 - * Authors: Sundar Iyer <sundar.iyer@stericsson.com> 7 - * Bengt Jonsson <bengt.g.jonsson@stericsson.com> 8 - * Daniel Willerud <daniel.willerud@stericsson.com> 9 - * 10 - * MOP500 board specific initialization for regulators 11 - */ 12 - #include <linux/kernel.h> 13 - #include <linux/regulator/machine.h> 14 - #include <linux/regulator/ab8500.h> 15 - #include "board-mop500-regulators.h" 16 - #include "id.h" 17 - 18 - static struct regulator_consumer_supply gpio_en_3v3_consumers[] = { 19 - REGULATOR_SUPPLY("vdd33a", "smsc911x.0"), 20 - }; 21 - 22 - struct regulator_init_data gpio_en_3v3_regulator = { 23 - .constraints = { 24 - .name = "EN-3V3", 25 - .min_uV = 3300000, 26 - .max_uV = 3300000, 27 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 28 - }, 29 - .num_consumer_supplies = ARRAY_SIZE(gpio_en_3v3_consumers), 30 - .consumer_supplies = gpio_en_3v3_consumers, 31 - }; 32 - 33 - /* 34 - * TPS61052 regulator 35 - */ 36 - static struct regulator_consumer_supply tps61052_vaudio_consumers[] = { 37 - /* 38 - * Boost converter supply to raise voltage on audio speaker, this 39 - * is actually connected to three pins, VInVhfL (left amplifier) 40 - * VInVhfR (right amplifier) and VIntDClassInt - all three must 41 - * be connected to the same voltage. 42 - */ 43 - REGULATOR_SUPPLY("vintdclassint", "ab8500-codec.0"), 44 - }; 45 - 46 - struct regulator_init_data tps61052_regulator = { 47 - .constraints = { 48 - .name = "vaudio-hf", 49 - .min_uV = 4500000, 50 - .max_uV = 4500000, 51 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 52 - }, 53 - .num_consumer_supplies = ARRAY_SIZE(tps61052_vaudio_consumers), 54 - .consumer_supplies = tps61052_vaudio_consumers, 55 - }; 56 - 57 - static struct regulator_consumer_supply ab8500_vaux1_consumers[] = { 58 - /* Main display, u8500 R3 uib */ 59 - REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"), 60 - /* Main display, u8500 uib and ST uib */ 61 - REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"), 62 - /* Secondary display, ST uib */ 63 - REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.1"), 64 - /* SFH7741 proximity sensor */ 65 - REGULATOR_SUPPLY("vcc", "gpio-keys.0"), 66 - /* BH1780GLS ambient light sensor */ 67 - REGULATOR_SUPPLY("vcc", "2-0029"), 68 - /* lsm303dlh accelerometer */ 69 - REGULATOR_SUPPLY("vdd", "2-0018"), 70 - /* lsm303dlhc accelerometer */ 71 - REGULATOR_SUPPLY("vdd", "2-0019"), 72 - /* lsm303dlh magnetometer */ 73 - REGULATOR_SUPPLY("vdd", "2-001e"), 74 - /* Rohm BU21013 Touchscreen devices */ 75 - REGULATOR_SUPPLY("avdd", "3-005c"), 76 - REGULATOR_SUPPLY("avdd", "3-005d"), 77 - /* Synaptics RMI4 Touchscreen device */ 78 - REGULATOR_SUPPLY("vdd", "3-004b"), 79 - /* L3G4200D Gyroscope device */ 80 - REGULATOR_SUPPLY("vdd", "2-0068"), 81 - /* Ambient light sensor device */ 82 - REGULATOR_SUPPLY("vdd", "3-0029"), 83 - /* Pressure sensor device */ 84 - REGULATOR_SUPPLY("vdd", "2-005c"), 85 - /* Cypress TrueTouch Touchscreen device */ 86 - REGULATOR_SUPPLY("vcpin", "spi8.0"), 87 - /* Camera device */ 88 - REGULATOR_SUPPLY("vaux12v5", "mmio_camera"), 89 - }; 90 - 91 - static struct regulator_consumer_supply ab8500_vaux2_consumers[] = { 92 - /* On-board eMMC power */ 93 - REGULATOR_SUPPLY("vmmc", "sdi4"), 94 - /* AB8500 audio codec */ 95 - REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"), 96 - /* AB8500 accessory detect 1 */ 97 - REGULATOR_SUPPLY("vcc-N2158", "ab8500-acc-det.0"), 98 - /* AB8500 Tv-out device */ 99 - REGULATOR_SUPPLY("vcc-N2158", "mcde_tv_ab8500.4"), 100 - /* AV8100 HDMI device */ 101 - REGULATOR_SUPPLY("vcc-N2158", "av8100_hdmi.3"), 102 - }; 103 - 104 - static struct regulator_consumer_supply ab8500_vaux3_consumers[] = { 105 - REGULATOR_SUPPLY("v-SD-STM", "stm"), 106 - /* External MMC slot power */ 107 - REGULATOR_SUPPLY("vmmc", "sdi0"), 108 - }; 109 - 110 - static struct regulator_consumer_supply ab8505_vaux4_consumers[] = { 111 - }; 112 - 113 - static struct regulator_consumer_supply ab8505_vaux5_consumers[] = { 114 - }; 115 - 116 - static struct regulator_consumer_supply ab8505_vaux6_consumers[] = { 117 - }; 118 - 119 - static struct regulator_consumer_supply ab8505_vaux8_consumers[] = { 120 - /* AB8500 audio codec device */ 121 - REGULATOR_SUPPLY("v-aux8", NULL), 122 - }; 123 - 124 - static struct regulator_consumer_supply ab8505_vadc_consumers[] = { 125 - /* Internal general-purpose ADC */ 126 - REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), 127 - /* ADC for charger */ 128 - REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"), 129 - }; 130 - 131 - static struct regulator_consumer_supply ab8500_vtvout_consumers[] = { 132 - /* TV-out DENC supply */ 133 - REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"), 134 - /* Internal general-purpose ADC */ 135 - REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), 136 - /* ADC for charger */ 137 - REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"), 138 - /* AB8500 Tv-out device */ 139 - REGULATOR_SUPPLY("vtvout", "mcde_tv_ab8500.4"), 140 - }; 141 - 142 - static struct regulator_consumer_supply ab8500_vaud_consumers[] = { 143 - /* AB8500 audio-codec main supply */ 144 - REGULATOR_SUPPLY("vaud", "ab8500-codec.0"), 145 - }; 146 - 147 - static struct regulator_consumer_supply ab8500_vamic1_consumers[] = { 148 - /* AB8500 audio-codec Mic1 supply */ 149 - REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"), 150 - }; 151 - 152 - static struct regulator_consumer_supply ab8500_vamic2_consumers[] = { 153 - /* AB8500 audio-codec Mic2 supply */ 154 - REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"), 155 - }; 156 - 157 - static struct regulator_consumer_supply ab8500_vdmic_consumers[] = { 158 - /* AB8500 audio-codec DMic supply */ 159 - REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"), 160 - }; 161 - 162 - static struct regulator_consumer_supply ab8500_vintcore_consumers[] = { 163 - /* SoC core supply, no device */ 164 - REGULATOR_SUPPLY("v-intcore", NULL), 165 - /* USB Transceiver */ 166 - REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"), 167 - /* Handled by abx500 clk driver */ 168 - REGULATOR_SUPPLY("v-intcore", "abx500-clk.0"), 169 - }; 170 - 171 - static struct regulator_consumer_supply ab8505_usb_consumers[] = { 172 - /* HS USB OTG physical interface */ 173 - REGULATOR_SUPPLY("v-ape", NULL), 174 - }; 175 - 176 - static struct regulator_consumer_supply ab8500_vana_consumers[] = { 177 - /* DB8500 DSI */ 178 - REGULATOR_SUPPLY("vdddsi1v2", "mcde"), 179 - REGULATOR_SUPPLY("vdddsi1v2", "b2r2_core"), 180 - REGULATOR_SUPPLY("vdddsi1v2", "b2r2_1_core"), 181 - REGULATOR_SUPPLY("vdddsi1v2", "dsilink.0"), 182 - REGULATOR_SUPPLY("vdddsi1v2", "dsilink.1"), 183 - REGULATOR_SUPPLY("vdddsi1v2", "dsilink.2"), 184 - /* DB8500 CSI */ 185 - REGULATOR_SUPPLY("vddcsi1v2", "mmio_camera"), 186 - }; 187 - 188 - /* ab8500 regulator register initialization */ 189 - static struct ab8500_regulator_reg_init ab8500_reg_init[] = { 190 - /* 191 - * VanaRequestCtrl = HP/LP depending on VxRequest 192 - * VextSupply1RequestCtrl = HP/LP depending on VxRequest 193 - */ 194 - INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xf0, 0x00), 195 - /* 196 - * VextSupply2RequestCtrl = HP/LP depending on VxRequest 197 - * VextSupply3RequestCtrl = HP/LP depending on VxRequest 198 - * Vaux1RequestCtrl = HP/LP depending on VxRequest 199 - * Vaux2RequestCtrl = HP/LP depending on VxRequest 200 - */ 201 - INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00), 202 - /* 203 - * Vaux3RequestCtrl = HP/LP depending on VxRequest 204 - * SwHPReq = Control through SWValid disabled 205 - */ 206 - INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00), 207 - /* 208 - * VanaSysClkReq1HPValid = disabled 209 - * Vaux1SysClkReq1HPValid = disabled 210 - * Vaux2SysClkReq1HPValid = disabled 211 - * Vaux3SysClkReq1HPValid = disabled 212 - */ 213 - INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00), 214 - /* 215 - * VextSupply1SysClkReq1HPValid = disabled 216 - * VextSupply2SysClkReq1HPValid = disabled 217 - * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled 218 - */ 219 - INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40), 220 - /* 221 - * VanaHwHPReq1Valid = disabled 222 - * Vaux1HwHPreq1Valid = disabled 223 - * Vaux2HwHPReq1Valid = disabled 224 - * Vaux3HwHPReqValid = disabled 225 - */ 226 - INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00), 227 - /* 228 - * VextSupply1HwHPReq1Valid = disabled 229 - * VextSupply2HwHPReq1Valid = disabled 230 - * VextSupply3HwHPReq1Valid = disabled 231 - */ 232 - INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00), 233 - /* 234 - * VanaHwHPReq2Valid = disabled 235 - * Vaux1HwHPReq2Valid = disabled 236 - * Vaux2HwHPReq2Valid = disabled 237 - * Vaux3HwHPReq2Valid = disabled 238 - */ 239 - INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00), 240 - /* 241 - * VextSupply1HwHPReq2Valid = disabled 242 - * VextSupply2HwHPReq2Valid = disabled 243 - * VextSupply3HwHPReq2Valid = HWReq2 controlled 244 - */ 245 - INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04), 246 - /* 247 - * VanaSwHPReqValid = disabled 248 - * Vaux1SwHPReqValid = disabled 249 - */ 250 - INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00), 251 - /* 252 - * Vaux2SwHPReqValid = disabled 253 - * Vaux3SwHPReqValid = disabled 254 - * VextSupply1SwHPReqValid = disabled 255 - * VextSupply2SwHPReqValid = disabled 256 - * VextSupply3SwHPReqValid = disabled 257 - */ 258 - INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00), 259 - /* 260 - * SysClkReq2Valid1 = SysClkReq2 controlled 261 - * SysClkReq3Valid1 = disabled 262 - * SysClkReq4Valid1 = SysClkReq4 controlled 263 - * SysClkReq5Valid1 = disabled 264 - * SysClkReq6Valid1 = SysClkReq6 controlled 265 - * SysClkReq7Valid1 = disabled 266 - * SysClkReq8Valid1 = disabled 267 - */ 268 - INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a), 269 - /* 270 - * SysClkReq2Valid2 = disabled 271 - * SysClkReq3Valid2 = disabled 272 - * SysClkReq4Valid2 = disabled 273 - * SysClkReq5Valid2 = disabled 274 - * SysClkReq6Valid2 = SysClkReq6 controlled 275 - * SysClkReq7Valid2 = disabled 276 - * SysClkReq8Valid2 = disabled 277 - */ 278 - INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20), 279 - /* 280 - * VTVoutEna = disabled 281 - * Vintcore12Ena = disabled 282 - * Vintcore12Sel = 1.25 V 283 - * Vintcore12LP = inactive (HP) 284 - * VTVoutLP = inactive (HP) 285 - */ 286 - INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10), 287 - /* 288 - * VaudioEna = disabled 289 - * VdmicEna = disabled 290 - * Vamic1Ena = disabled 291 - * Vamic2Ena = disabled 292 - */ 293 - INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00), 294 - /* 295 - * Vamic1_dzout = high-Z when Vamic1 is disabled 296 - * Vamic2_dzout = high-Z when Vamic2 is disabled 297 - */ 298 - INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00), 299 - /* 300 - * VPll = Hw controlled (NOTE! PRCMU bits) 301 - * VanaRegu = force off 302 - */ 303 - INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02), 304 - /* 305 - * VrefDDREna = disabled 306 - * VrefDDRSleepMode = inactive (no pulldown) 307 - */ 308 - INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00), 309 - /* 310 - * VextSupply1Regu = force LP 311 - * VextSupply2Regu = force OFF 312 - * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP) 313 - * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 314 - * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 315 - */ 316 - INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13), 317 - /* 318 - * Vaux1Regu = force HP 319 - * Vaux2Regu = force off 320 - */ 321 - INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01), 322 - /* 323 - * Vaux3Regu = force off 324 - */ 325 - INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x03, 0x00), 326 - /* 327 - * Vaux1Sel = 2.8 V 328 - */ 329 - INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x0C), 330 - /* 331 - * Vaux2Sel = 2.9 V 332 - */ 333 - INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d), 334 - /* 335 - * Vaux3Sel = 2.91 V 336 - */ 337 - INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07), 338 - /* 339 - * VextSupply12LP = disabled (no LP) 340 - */ 341 - INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00), 342 - /* 343 - * Vaux1Disch = short discharge time 344 - * Vaux2Disch = short discharge time 345 - * Vaux3Disch = short discharge time 346 - * Vintcore12Disch = short discharge time 347 - * VTVoutDisch = short discharge time 348 - * VaudioDisch = short discharge time 349 - */ 350 - INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00), 351 - /* 352 - * VanaDisch = short discharge time 353 - * VdmicPullDownEna = pulldown disabled when Vdmic is disabled 354 - * VdmicDisch = short discharge time 355 - */ 356 - INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00), 357 - }; 358 - 359 - /* AB8500 regulators */ 360 - static struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = { 361 - /* supplies to the display/camera */ 362 - [AB8500_LDO_AUX1] = { 363 - .supply_regulator = "ab8500-ext-supply3", 364 - .constraints = { 365 - .name = "V-DISPLAY", 366 - .min_uV = 2800000, 367 - .max_uV = 3300000, 368 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 369 - REGULATOR_CHANGE_STATUS, 370 - .boot_on = 1, /* display is on at boot */ 371 - }, 372 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), 373 - .consumer_supplies = ab8500_vaux1_consumers, 374 - }, 375 - /* supplies to the on-board eMMC */ 376 - [AB8500_LDO_AUX2] = { 377 - .supply_regulator = "ab8500-ext-supply3", 378 - .constraints = { 379 - .name = "V-eMMC1", 380 - .min_uV = 1100000, 381 - .max_uV = 3300000, 382 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 383 - REGULATOR_CHANGE_STATUS | 384 - REGULATOR_CHANGE_MODE, 385 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 386 - REGULATOR_MODE_IDLE, 387 - }, 388 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers), 389 - .consumer_supplies = ab8500_vaux2_consumers, 390 - }, 391 - /* supply for VAUX3, supplies to SDcard slots */ 392 - [AB8500_LDO_AUX3] = { 393 - .supply_regulator = "ab8500-ext-supply3", 394 - .constraints = { 395 - .name = "V-MMC-SD", 396 - .min_uV = 1100000, 397 - .max_uV = 3300000, 398 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 399 - REGULATOR_CHANGE_STATUS | 400 - REGULATOR_CHANGE_MODE, 401 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 402 - REGULATOR_MODE_IDLE, 403 - }, 404 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers), 405 - .consumer_supplies = ab8500_vaux3_consumers, 406 - }, 407 - /* supply for tvout, gpadc, TVOUT LDO */ 408 - [AB8500_LDO_TVOUT] = { 409 - .constraints = { 410 - .name = "V-TVOUT", 411 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 412 - }, 413 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vtvout_consumers), 414 - .consumer_supplies = ab8500_vtvout_consumers, 415 - }, 416 - /* supply for ab8500-vaudio, VAUDIO LDO */ 417 - [AB8500_LDO_AUDIO] = { 418 - .constraints = { 419 - .name = "V-AUD", 420 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 421 - }, 422 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers), 423 - .consumer_supplies = ab8500_vaud_consumers, 424 - }, 425 - /* supply for v-anamic1 VAMic1-LDO */ 426 - [AB8500_LDO_ANAMIC1] = { 427 - .constraints = { 428 - .name = "V-AMIC1", 429 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 430 - }, 431 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers), 432 - .consumer_supplies = ab8500_vamic1_consumers, 433 - }, 434 - /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */ 435 - [AB8500_LDO_ANAMIC2] = { 436 - .constraints = { 437 - .name = "V-AMIC2", 438 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 439 - }, 440 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers), 441 - .consumer_supplies = ab8500_vamic2_consumers, 442 - }, 443 - /* supply for v-dmic, VDMIC LDO */ 444 - [AB8500_LDO_DMIC] = { 445 - .constraints = { 446 - .name = "V-DMIC", 447 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 448 - }, 449 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vdmic_consumers), 450 - .consumer_supplies = ab8500_vdmic_consumers, 451 - }, 452 - /* supply for v-intcore12, VINTCORE12 LDO */ 453 - [AB8500_LDO_INTCORE] = { 454 - .constraints = { 455 - .name = "V-INTCORE", 456 - .min_uV = 1250000, 457 - .max_uV = 1350000, 458 - .input_uV = 1800000, 459 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 460 - REGULATOR_CHANGE_STATUS | 461 - REGULATOR_CHANGE_MODE | 462 - REGULATOR_CHANGE_DRMS, 463 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 464 - REGULATOR_MODE_IDLE, 465 - }, 466 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers), 467 - .consumer_supplies = ab8500_vintcore_consumers, 468 - }, 469 - /* supply for U8500 CSI-DSI, VANA LDO */ 470 - [AB8500_LDO_ANA] = { 471 - .constraints = { 472 - .name = "V-CSI-DSI", 473 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 474 - }, 475 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers), 476 - .consumer_supplies = ab8500_vana_consumers, 477 - }, 478 - }; 479 - 480 - /* supply for VextSupply3 */ 481 - static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = { 482 - /* SIM supply for 3 V SIM cards */ 483 - REGULATOR_SUPPLY("vinvsim", "sim-detect.0"), 484 - }; 485 - 486 - /* extended configuration for VextSupply2, only used for HREFP_V20 boards */ 487 - static struct ab8500_ext_regulator_cfg ab8500_ext_supply2 = { 488 - .hwreq = true, 489 - }; 490 - 491 - /* 492 - * AB8500 external regulators 493 - */ 494 - static struct regulator_init_data ab8500_ext_regulators[] = { 495 - /* fixed Vbat supplies VSMPS1_EXT_1V8 */ 496 - [AB8500_EXT_SUPPLY1] = { 497 - .constraints = { 498 - .name = "ab8500-ext-supply1", 499 - .min_uV = 1800000, 500 - .max_uV = 1800000, 501 - .initial_mode = REGULATOR_MODE_IDLE, 502 - .boot_on = 1, 503 - .always_on = 1, 504 - }, 505 - }, 506 - /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */ 507 - [AB8500_EXT_SUPPLY2] = { 508 - .constraints = { 509 - .name = "ab8500-ext-supply2", 510 - .min_uV = 1360000, 511 - .max_uV = 1360000, 512 - }, 513 - }, 514 - /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */ 515 - [AB8500_EXT_SUPPLY3] = { 516 - .constraints = { 517 - .name = "ab8500-ext-supply3", 518 - .min_uV = 3400000, 519 - .max_uV = 3400000, 520 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 521 - .boot_on = 1, 522 - }, 523 - .num_consumer_supplies = 524 - ARRAY_SIZE(ab8500_ext_supply3_consumers), 525 - .consumer_supplies = ab8500_ext_supply3_consumers, 526 - }, 527 - }; 528 - 529 - /* ab8505 regulator register initialization */ 530 - static struct ab8500_regulator_reg_init ab8505_reg_init[] = { 531 - /* 532 - * VarmRequestCtrl 533 - * VsmpsCRequestCtrl 534 - * VsmpsARequestCtrl 535 - * VsmpsBRequestCtrl 536 - */ 537 - INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL1, 0x00, 0x00), 538 - /* 539 - * VsafeRequestCtrl 540 - * VpllRequestCtrl 541 - * VanaRequestCtrl = HP/LP depending on VxRequest 542 - */ 543 - INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL2, 0x30, 0x00), 544 - /* 545 - * Vaux1RequestCtrl = HP/LP depending on VxRequest 546 - * Vaux2RequestCtrl = HP/LP depending on VxRequest 547 - */ 548 - INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL3, 0xf0, 0x00), 549 - /* 550 - * Vaux3RequestCtrl = HP/LP depending on VxRequest 551 - * SwHPReq = Control through SWValid disabled 552 - */ 553 - INIT_REGULATOR_REGISTER(AB8505_REGUREQUESTCTRL4, 0x07, 0x00), 554 - /* 555 - * VsmpsASysClkReq1HPValid 556 - * VsmpsBSysClkReq1HPValid 557 - * VsafeSysClkReq1HPValid 558 - * VanaSysClkReq1HPValid = disabled 559 - * VpllSysClkReq1HPValid 560 - * Vaux1SysClkReq1HPValid = disabled 561 - * Vaux2SysClkReq1HPValid = disabled 562 - * Vaux3SysClkReq1HPValid = disabled 563 - */ 564 - INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00), 565 - /* 566 - * VsmpsCSysClkReq1HPValid 567 - * VarmSysClkReq1HPValid 568 - * VbbSysClkReq1HPValid 569 - * VsmpsMSysClkReq1HPValid 570 - */ 571 - INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQ1HPVALID2, 0x00, 0x00), 572 - /* 573 - * VsmpsAHwHPReq1Valid 574 - * VsmpsBHwHPReq1Valid 575 - * VsafeHwHPReq1Valid 576 - * VanaHwHPReq1Valid = disabled 577 - * VpllHwHPReq1Valid 578 - * Vaux1HwHPreq1Valid = disabled 579 - * Vaux2HwHPReq1Valid = disabled 580 - * Vaux3HwHPReqValid = disabled 581 - */ 582 - INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID1, 0xe8, 0x00), 583 - /* 584 - * VsmpsMHwHPReq1Valid 585 - */ 586 - INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ1VALID2, 0x00, 0x00), 587 - /* 588 - * VsmpsAHwHPReq2Valid 589 - * VsmpsBHwHPReq2Valid 590 - * VsafeHwHPReq2Valid 591 - * VanaHwHPReq2Valid = disabled 592 - * VpllHwHPReq2Valid 593 - * Vaux1HwHPReq2Valid = disabled 594 - * Vaux2HwHPReq2Valid = disabled 595 - * Vaux3HwHPReq2Valid = disabled 596 - */ 597 - INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID1, 0xe8, 0x00), 598 - /* 599 - * VsmpsMHwHPReq2Valid 600 - */ 601 - INIT_REGULATOR_REGISTER(AB8505_REGUHWHPREQ2VALID2, 0x00, 0x00), 602 - /** 603 - * VsmpsCSwHPReqValid 604 - * VarmSwHPReqValid 605 - * VsmpsASwHPReqValid 606 - * VsmpsBSwHPReqValid 607 - * VsafeSwHPReqValid 608 - * VanaSwHPReqValid 609 - * VanaSwHPReqValid = disabled 610 - * VpllSwHPReqValid 611 - * Vaux1SwHPReqValid = disabled 612 - */ 613 - INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID1, 0xa0, 0x00), 614 - /* 615 - * Vaux2SwHPReqValid = disabled 616 - * Vaux3SwHPReqValid = disabled 617 - * VsmpsMSwHPReqValid 618 - */ 619 - INIT_REGULATOR_REGISTER(AB8505_REGUSWHPREQVALID2, 0x03, 0x00), 620 - /* 621 - * SysClkReq2Valid1 = SysClkReq2 controlled 622 - * SysClkReq3Valid1 = disabled 623 - * SysClkReq4Valid1 = SysClkReq4 controlled 624 - */ 625 - INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID1, 0x0e, 0x0a), 626 - /* 627 - * SysClkReq2Valid2 = disabled 628 - * SysClkReq3Valid2 = disabled 629 - * SysClkReq4Valid2 = disabled 630 - */ 631 - INIT_REGULATOR_REGISTER(AB8505_REGUSYSCLKREQVALID2, 0x0e, 0x00), 632 - /* 633 - * Vaux4SwHPReqValid 634 - * Vaux4HwHPReq2Valid 635 - * Vaux4HwHPReq1Valid 636 - * Vaux4SysClkReq1HPValid 637 - */ 638 - INIT_REGULATOR_REGISTER(AB8505_REGUVAUX4REQVALID, 0x00, 0x00), 639 - /* 640 - * VadcEna = disabled 641 - * VintCore12Ena = disabled 642 - * VintCore12Sel = 1.25 V 643 - * VintCore12LP = inactive (HP) 644 - * VadcLP = inactive (HP) 645 - */ 646 - INIT_REGULATOR_REGISTER(AB8505_REGUMISC1, 0xfe, 0x10), 647 - /* 648 - * VaudioEna = disabled 649 - * Vaux8Ena = disabled 650 - * Vamic1Ena = disabled 651 - * Vamic2Ena = disabled 652 - */ 653 - INIT_REGULATOR_REGISTER(AB8505_VAUDIOSUPPLY, 0x1e, 0x00), 654 - /* 655 - * Vamic1_dzout = high-Z when Vamic1 is disabled 656 - * Vamic2_dzout = high-Z when Vamic2 is disabled 657 - */ 658 - INIT_REGULATOR_REGISTER(AB8505_REGUCTRL1VAMIC, 0x03, 0x00), 659 - /* 660 - * VsmpsARegu 661 - * VsmpsASelCtrl 662 - * VsmpsAAutoMode 663 - * VsmpsAPWMMode 664 - */ 665 - INIT_REGULATOR_REGISTER(AB8505_VSMPSAREGU, 0x00, 0x00), 666 - /* 667 - * VsmpsBRegu 668 - * VsmpsBSelCtrl 669 - * VsmpsBAutoMode 670 - * VsmpsBPWMMode 671 - */ 672 - INIT_REGULATOR_REGISTER(AB8505_VSMPSBREGU, 0x00, 0x00), 673 - /* 674 - * VsafeRegu 675 - * VsafeSelCtrl 676 - * VsafeAutoMode 677 - * VsafePWMMode 678 - */ 679 - INIT_REGULATOR_REGISTER(AB8505_VSAFEREGU, 0x00, 0x00), 680 - /* 681 - * VPll = Hw controlled (NOTE! PRCMU bits) 682 - * VanaRegu = force off 683 - */ 684 - INIT_REGULATOR_REGISTER(AB8505_VPLLVANAREGU, 0x0f, 0x02), 685 - /* 686 - * VextSupply1Regu = force OFF (OTP_ExtSupply12LPnPolarity 1) 687 - * VextSupply2Regu = force OFF (OTP_ExtSupply12LPnPolarity 1) 688 - * VextSupply3Regu = force OFF (OTP_ExtSupply3LPnPolarity 0) 689 - * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 690 - * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 691 - */ 692 - INIT_REGULATOR_REGISTER(AB8505_EXTSUPPLYREGU, 0xff, 0x30), 693 - /* 694 - * Vaux1Regu = force HP 695 - * Vaux2Regu = force off 696 - */ 697 - INIT_REGULATOR_REGISTER(AB8505_VAUX12REGU, 0x0f, 0x01), 698 - /* 699 - * Vaux3Regu = force off 700 - */ 701 - INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3REGU, 0x03, 0x00), 702 - /* 703 - * VsmpsASel1 704 - */ 705 - INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL1, 0x00, 0x00), 706 - /* 707 - * VsmpsASel2 708 - */ 709 - INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL2, 0x00, 0x00), 710 - /* 711 - * VsmpsASel3 712 - */ 713 - INIT_REGULATOR_REGISTER(AB8505_VSMPSASEL3, 0x00, 0x00), 714 - /* 715 - * VsmpsBSel1 716 - */ 717 - INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL1, 0x00, 0x00), 718 - /* 719 - * VsmpsBSel2 720 - */ 721 - INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL2, 0x00, 0x00), 722 - /* 723 - * VsmpsBSel3 724 - */ 725 - INIT_REGULATOR_REGISTER(AB8505_VSMPSBSEL3, 0x00, 0x00), 726 - /* 727 - * VsafeSel1 728 - */ 729 - INIT_REGULATOR_REGISTER(AB8505_VSAFESEL1, 0x00, 0x00), 730 - /* 731 - * VsafeSel2 732 - */ 733 - INIT_REGULATOR_REGISTER(AB8505_VSAFESEL2, 0x00, 0x00), 734 - /* 735 - * VsafeSel3 736 - */ 737 - INIT_REGULATOR_REGISTER(AB8505_VSAFESEL3, 0x00, 0x00), 738 - /* 739 - * Vaux1Sel = 2.8 V 740 - */ 741 - INIT_REGULATOR_REGISTER(AB8505_VAUX1SEL, 0x0f, 0x0C), 742 - /* 743 - * Vaux2Sel = 2.9 V 744 - */ 745 - INIT_REGULATOR_REGISTER(AB8505_VAUX2SEL, 0x0f, 0x0d), 746 - /* 747 - * Vaux3Sel = 2.91 V 748 - */ 749 - INIT_REGULATOR_REGISTER(AB8505_VRF1VAUX3SEL, 0x07, 0x07), 750 - /* 751 - * Vaux4RequestCtrl 752 - */ 753 - INIT_REGULATOR_REGISTER(AB8505_VAUX4REQCTRL, 0x00, 0x00), 754 - /* 755 - * Vaux4Regu 756 - */ 757 - INIT_REGULATOR_REGISTER(AB8505_VAUX4REGU, 0x00, 0x00), 758 - /* 759 - * Vaux4Sel 760 - */ 761 - INIT_REGULATOR_REGISTER(AB8505_VAUX4SEL, 0x00, 0x00), 762 - /* 763 - * Vaux1Disch = short discharge time 764 - * Vaux2Disch = short discharge time 765 - * Vaux3Disch = short discharge time 766 - * Vintcore12Disch = short discharge time 767 - * VTVoutDisch = short discharge time 768 - * VaudioDisch = short discharge time 769 - */ 770 - INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH, 0xfc, 0x00), 771 - /* 772 - * VanaDisch = short discharge time 773 - * Vaux8PullDownEna = pulldown disabled when Vaux8 is disabled 774 - * Vaux8Disch = short discharge time 775 - */ 776 - INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH2, 0x16, 0x00), 777 - /* 778 - * Vaux4Disch = short discharge time 779 - */ 780 - INIT_REGULATOR_REGISTER(AB8505_REGUCTRLDISCH3, 0x01, 0x00), 781 - /* 782 - * Vaux5Sel 783 - * Vaux5LP 784 - * Vaux5Ena 785 - * Vaux5Disch 786 - * Vaux5DisSfst 787 - * Vaux5DisPulld 788 - */ 789 - INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX5, 0x00, 0x00), 790 - /* 791 - * Vaux6Sel 792 - * Vaux6LP 793 - * Vaux6Ena 794 - * Vaux6DisPulld 795 - */ 796 - INIT_REGULATOR_REGISTER(AB8505_CTRLVAUX6, 0x00, 0x00), 797 - }; 798 - 799 - static struct regulator_init_data ab8505_regulators[AB8505_NUM_REGULATORS] = { 800 - /* supplies to the display/camera */ 801 - [AB8505_LDO_AUX1] = { 802 - .constraints = { 803 - .name = "V-DISPLAY", 804 - .min_uV = 2800000, 805 - .max_uV = 3300000, 806 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 807 - REGULATOR_CHANGE_STATUS, 808 - .boot_on = 1, /* display is on at boot */ 809 - }, 810 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), 811 - .consumer_supplies = ab8500_vaux1_consumers, 812 - }, 813 - /* supplies to the on-board eMMC */ 814 - [AB8505_LDO_AUX2] = { 815 - .constraints = { 816 - .name = "V-eMMC1", 817 - .min_uV = 1100000, 818 - .max_uV = 3300000, 819 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 820 - REGULATOR_CHANGE_STATUS | 821 - REGULATOR_CHANGE_MODE, 822 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 823 - REGULATOR_MODE_IDLE, 824 - }, 825 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers), 826 - .consumer_supplies = ab8500_vaux2_consumers, 827 - }, 828 - /* supply for VAUX3, supplies to SDcard slots */ 829 - [AB8505_LDO_AUX3] = { 830 - .constraints = { 831 - .name = "V-MMC-SD", 832 - .min_uV = 1100000, 833 - .max_uV = 3300000, 834 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 835 - REGULATOR_CHANGE_STATUS | 836 - REGULATOR_CHANGE_MODE, 837 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 838 - REGULATOR_MODE_IDLE, 839 - }, 840 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers), 841 - .consumer_supplies = ab8500_vaux3_consumers, 842 - }, 843 - /* supply for VAUX4, supplies to NFC and standalone secure element */ 844 - [AB8505_LDO_AUX4] = { 845 - .constraints = { 846 - .name = "V-NFC-SE", 847 - .min_uV = 1100000, 848 - .max_uV = 3300000, 849 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 850 - REGULATOR_CHANGE_STATUS | 851 - REGULATOR_CHANGE_MODE, 852 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 853 - REGULATOR_MODE_IDLE, 854 - }, 855 - .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux4_consumers), 856 - .consumer_supplies = ab8505_vaux4_consumers, 857 - }, 858 - /* supply for VAUX5, supplies to TBD */ 859 - [AB8505_LDO_AUX5] = { 860 - .constraints = { 861 - .name = "V-AUX5", 862 - .min_uV = 1050000, 863 - .max_uV = 2790000, 864 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 865 - REGULATOR_CHANGE_STATUS | 866 - REGULATOR_CHANGE_MODE, 867 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 868 - REGULATOR_MODE_IDLE, 869 - }, 870 - .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux5_consumers), 871 - .consumer_supplies = ab8505_vaux5_consumers, 872 - }, 873 - /* supply for VAUX6, supplies to TBD */ 874 - [AB8505_LDO_AUX6] = { 875 - .constraints = { 876 - .name = "V-AUX6", 877 - .min_uV = 1050000, 878 - .max_uV = 2790000, 879 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 880 - REGULATOR_CHANGE_STATUS | 881 - REGULATOR_CHANGE_MODE, 882 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 883 - REGULATOR_MODE_IDLE, 884 - }, 885 - .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux6_consumers), 886 - .consumer_supplies = ab8505_vaux6_consumers, 887 - }, 888 - /* supply for gpadc, ADC LDO */ 889 - [AB8505_LDO_ADC] = { 890 - .constraints = { 891 - .name = "V-ADC", 892 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 893 - }, 894 - .num_consumer_supplies = ARRAY_SIZE(ab8505_vadc_consumers), 895 - .consumer_supplies = ab8505_vadc_consumers, 896 - }, 897 - /* supply for ab8500-vaudio, VAUDIO LDO */ 898 - [AB8505_LDO_AUDIO] = { 899 - .constraints = { 900 - .name = "V-AUD", 901 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 902 - }, 903 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers), 904 - .consumer_supplies = ab8500_vaud_consumers, 905 - }, 906 - /* supply for v-anamic1 VAMic1-LDO */ 907 - [AB8505_LDO_ANAMIC1] = { 908 - .constraints = { 909 - .name = "V-AMIC1", 910 - .valid_ops_mask = REGULATOR_CHANGE_STATUS | 911 - REGULATOR_CHANGE_MODE, 912 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 913 - REGULATOR_MODE_IDLE, 914 - }, 915 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers), 916 - .consumer_supplies = ab8500_vamic1_consumers, 917 - }, 918 - /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */ 919 - [AB8505_LDO_ANAMIC2] = { 920 - .constraints = { 921 - .name = "V-AMIC2", 922 - .valid_ops_mask = REGULATOR_CHANGE_STATUS | 923 - REGULATOR_CHANGE_MODE, 924 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 925 - REGULATOR_MODE_IDLE, 926 - }, 927 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers), 928 - .consumer_supplies = ab8500_vamic2_consumers, 929 - }, 930 - /* supply for v-aux8, VAUX8 LDO */ 931 - [AB8505_LDO_AUX8] = { 932 - .constraints = { 933 - .name = "V-AUX8", 934 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 935 - }, 936 - .num_consumer_supplies = ARRAY_SIZE(ab8505_vaux8_consumers), 937 - .consumer_supplies = ab8505_vaux8_consumers, 938 - }, 939 - /* supply for v-intcore12, VINTCORE12 LDO */ 940 - [AB8505_LDO_INTCORE] = { 941 - .constraints = { 942 - .name = "V-INTCORE", 943 - .min_uV = 1250000, 944 - .max_uV = 1350000, 945 - .input_uV = 1800000, 946 - .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 947 - REGULATOR_CHANGE_STATUS | 948 - REGULATOR_CHANGE_MODE | 949 - REGULATOR_CHANGE_DRMS, 950 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 951 - REGULATOR_MODE_IDLE, 952 - }, 953 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers), 954 - .consumer_supplies = ab8500_vintcore_consumers, 955 - }, 956 - /* supply for LDO USB */ 957 - [AB8505_LDO_USB] = { 958 - .constraints = { 959 - .name = "V-USB", 960 - .valid_ops_mask = REGULATOR_CHANGE_STATUS | 961 - REGULATOR_CHANGE_MODE, 962 - .valid_modes_mask = REGULATOR_MODE_NORMAL | 963 - REGULATOR_MODE_IDLE, 964 - }, 965 - .num_consumer_supplies = ARRAY_SIZE(ab8505_usb_consumers), 966 - .consumer_supplies = ab8505_usb_consumers, 967 - }, 968 - /* supply for U8500 CSI-DSI, VANA LDO */ 969 - [AB8505_LDO_ANA] = { 970 - .constraints = { 971 - .name = "V-CSI-DSI", 972 - .valid_ops_mask = REGULATOR_CHANGE_STATUS, 973 - }, 974 - .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers), 975 - .consumer_supplies = ab8500_vana_consumers, 976 - }, 977 - }; 978 - 979 - struct ab8500_regulator_platform_data ab8500_regulator_plat_data = { 980 - .reg_init = ab8500_reg_init, 981 - .num_reg_init = ARRAY_SIZE(ab8500_reg_init), 982 - .regulator = ab8500_regulators, 983 - .num_regulator = ARRAY_SIZE(ab8500_regulators), 984 - .ext_regulator = ab8500_ext_regulators, 985 - .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators), 986 - }; 987 - 988 - struct ab8500_regulator_platform_data ab8505_regulator_plat_data = { 989 - .reg_init = ab8505_reg_init, 990 - .num_reg_init = ARRAY_SIZE(ab8505_reg_init), 991 - .regulator = ab8505_regulators, 992 - .num_regulator = ARRAY_SIZE(ab8505_regulators), 993 - }; 994 - 995 - static void ab8500_modify_reg_init(int id, u8 mask, u8 value) 996 - { 997 - int i; 998 - 999 - if (cpu_is_u8520()) { 1000 - for (i = ARRAY_SIZE(ab8505_reg_init) - 1; i >= 0; i--) { 1001 - if (ab8505_reg_init[i].id == id) { 1002 - u8 initval = ab8505_reg_init[i].value; 1003 - initval = (initval & ~mask) | (value & mask); 1004 - ab8505_reg_init[i].value = initval; 1005 - 1006 - BUG_ON(mask & ~ab8505_reg_init[i].mask); 1007 - return; 1008 - } 1009 - } 1010 - } else { 1011 - for (i = ARRAY_SIZE(ab8500_reg_init) - 1; i >= 0; i--) { 1012 - if (ab8500_reg_init[i].id == id) { 1013 - u8 initval = ab8500_reg_init[i].value; 1014 - initval = (initval & ~mask) | (value & mask); 1015 - ab8500_reg_init[i].value = initval; 1016 - 1017 - BUG_ON(mask & ~ab8500_reg_init[i].mask); 1018 - return; 1019 - } 1020 - } 1021 - } 1022 - 1023 - BUG_ON(1); 1024 - } 1025 - 1026 - void mop500_regulator_init(void) 1027 - { 1028 - struct regulator_init_data *regulator; 1029 - 1030 - /* 1031 - * Temporarily turn on Vaux2 on 8520 machine 1032 - */ 1033 - if (cpu_is_u8520()) { 1034 - /* Vaux2 initialized to be on */ 1035 - ab8500_modify_reg_init(AB8505_VAUX12REGU, 0x0f, 0x05); 1036 - } 1037 - 1038 - /* 1039 - * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for 1040 - * all HREFP_V20 boards) 1041 - */ 1042 - if (cpu_is_u8500v20()) { 1043 - /* VextSupply2RequestCtrl = HP/OFF depending on VxRequest */ 1044 - ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01); 1045 - 1046 - /* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */ 1047 - ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2, 1048 - 0x20, 0x20); 1049 - 1050 - /* VextSupply2 = force HP at initialization */ 1051 - ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04); 1052 - 1053 - /* enable VextSupply2 during platform active */ 1054 - regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; 1055 - regulator->constraints.always_on = 1; 1056 - 1057 - /* disable VextSupply2 in suspend */ 1058 - regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2]; 1059 - regulator->constraints.state_mem.disabled = 1; 1060 - regulator->constraints.state_standby.disabled = 1; 1061 - 1062 - /* enable VextSupply2 HW control (used in suspend) */ 1063 - regulator->driver_data = (void *)&ab8500_ext_supply2; 1064 - } 1065 - }
-24
arch/arm/mach-ux500/board-mop500-regulators.h
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2010 3 - * 4 - * License Terms: GNU General Public License v2 5 - * 6 - * Author: Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson 7 - * 8 - * MOP500 board specific initialization for regulators 9 - */ 10 - 11 - #ifndef __BOARD_MOP500_REGULATORS_H 12 - #define __BOARD_MOP500_REGULATORS_H 13 - 14 - #include <linux/regulator/machine.h> 15 - #include <linux/regulator/ab8500.h> 16 - 17 - extern struct ab8500_regulator_platform_data ab8500_regulator_plat_data; 18 - extern struct ab8500_regulator_platform_data ab8505_regulator_plat_data; 19 - extern struct regulator_init_data tps61052_regulator; 20 - extern struct regulator_init_data gpio_en_3v3_regulator; 21 - 22 - void mop500_regulator_init(void); 23 - 24 - #endif
-67
arch/arm/mach-ux500/cache-l2x0.c
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2011 3 - * 4 - * License terms: GNU General Public License (GPL) version 2 5 - */ 6 - 7 - #include <linux/io.h> 8 - #include <linux/of.h> 9 - #include <linux/of_address.h> 10 - 11 - #include <asm/outercache.h> 12 - #include <asm/hardware/cache-l2x0.h> 13 - 14 - #include "db8500-regs.h" 15 - #include "id.h" 16 - 17 - static int __init ux500_l2x0_unlock(void) 18 - { 19 - int i; 20 - struct device_node *np; 21 - void __iomem *l2x0_base; 22 - 23 - np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache"); 24 - l2x0_base = of_iomap(np, 0); 25 - of_node_put(np); 26 - if (!l2x0_base) 27 - return -ENODEV; 28 - 29 - /* 30 - * Unlock Data and Instruction Lock if locked. Ux500 U-Boot versions 31 - * apparently locks both caches before jumping to the kernel. The 32 - * l2x0 core will not touch the unlock registers if the l2x0 is 33 - * already enabled, so we do it right here instead. The PL310 has 34 - * 8 sets of registers, one per possible CPU. 35 - */ 36 - for (i = 0; i < 8; i++) { 37 - writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE + 38 - i * L2X0_LOCKDOWN_STRIDE); 39 - writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_I_BASE + 40 - i * L2X0_LOCKDOWN_STRIDE); 41 - } 42 - iounmap(l2x0_base); 43 - return 0; 44 - } 45 - 46 - static void ux500_l2c310_write_sec(unsigned long val, unsigned reg) 47 - { 48 - /* 49 - * We can't write to secure registers as we are in non-secure 50 - * mode, until we have some SMI service available. 51 - */ 52 - } 53 - 54 - static int __init ux500_l2x0_init(void) 55 - { 56 - /* Multiplatform guard */ 57 - if (!((cpu_is_u8500_family() || cpu_is_ux540_family()))) 58 - return -ENODEV; 59 - 60 - /* Unlock before init */ 61 - ux500_l2x0_unlock(); 62 - outer_cache.write_sec = ux500_l2c310_write_sec; 63 - l2x0_of_init(0, ~0); 64 - 65 - return 0; 66 - } 67 - early_initcall(ux500_l2x0_init);
+90 -53
arch/arm/mach-ux500/cpu-db8500.c
··· 12 12 #include <linux/init.h> 13 13 #include <linux/device.h> 14 14 #include <linux/amba/bus.h> 15 + #include <linux/init.h> 15 16 #include <linux/interrupt.h> 16 17 #include <linux/irq.h> 18 + #include <linux/irqchip.h> 19 + #include <linux/irqchip/arm-gic.h> 20 + #include <linux/mfd/dbx500-prcmu.h> 21 + #include <linux/platform_data/arm-ux500-pm.h> 17 22 #include <linux/platform_device.h> 18 23 #include <linux/io.h> 19 - #include <linux/mfd/abx500/ab8500.h> 20 - #include <linux/mfd/dbx500-prcmu.h> 21 24 #include <linux/of.h> 25 + #include <linux/of_address.h> 22 26 #include <linux/of_platform.h> 23 27 #include <linux/perf/arm_pmu.h> 24 28 #include <linux/regulator/machine.h> 25 - #include <linux/random.h> 26 29 30 + #include <asm/outercache.h> 31 + #include <asm/hardware/cache-l2x0.h> 27 32 #include <asm/mach/map.h> 33 + #include <asm/mach/arch.h> 28 34 29 35 #include "setup.h" 30 36 31 - #include "board-mop500-regulators.h" 32 37 #include "board-mop500.h" 33 38 #include "db8500-regs.h" 34 - #include "id.h" 35 39 36 - static struct ab8500_platform_data ab8500_platdata = { 37 - .regulator = &ab8500_regulator_plat_data, 38 - }; 39 - 40 - static struct prcmu_pdata db8500_prcmu_pdata = { 41 - .ab_platdata = &ab8500_platdata, 42 - .version_offset = DB8500_PRCMU_FW_VERSION_OFFSET, 43 - .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET, 44 - }; 45 - 46 - static void __init u8500_map_io(void) 40 + static int __init ux500_l2x0_unlock(void) 47 41 { 48 - debug_ll_io_init(); 49 - ux500_setup_id(); 42 + int i; 43 + struct device_node *np; 44 + void __iomem *l2x0_base; 45 + 46 + np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache"); 47 + l2x0_base = of_iomap(np, 0); 48 + of_node_put(np); 49 + if (!l2x0_base) 50 + return -ENODEV; 51 + 52 + /* 53 + * Unlock Data and Instruction Lock if locked. Ux500 U-Boot versions 54 + * apparently locks both caches before jumping to the kernel. The 55 + * l2x0 core will not touch the unlock registers if the l2x0 is 56 + * already enabled, so we do it right here instead. The PL310 has 57 + * 8 sets of registers, one per possible CPU. 58 + */ 59 + for (i = 0; i < 8; i++) { 60 + writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE + 61 + i * L2X0_LOCKDOWN_STRIDE); 62 + writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_I_BASE + 63 + i * L2X0_LOCKDOWN_STRIDE); 64 + } 65 + iounmap(l2x0_base); 66 + return 0; 67 + } 68 + 69 + static void ux500_l2c310_write_sec(unsigned long val, unsigned reg) 70 + { 71 + /* 72 + * We can't write to secure registers as we are in non-secure 73 + * mode, until we have some SMI service available. 74 + */ 75 + } 76 + 77 + /* 78 + * FIXME: Should we set up the GPIO domain here? 79 + * 80 + * The problem is that we cannot put the interrupt resources into the platform 81 + * device until the irqdomain has been added. Right now, we set the GIC interrupt 82 + * domain from init_irq(), then load the gpio driver from 83 + * core_initcall(nmk_gpio_init) and add the platform devices from 84 + * arch_initcall(customize_machine). 85 + * 86 + * This feels fragile because it depends on the gpio device getting probed 87 + * _before_ any device uses the gpio interrupts. 88 + */ 89 + static void __init ux500_init_irq(void) 90 + { 91 + struct device_node *np; 92 + struct resource r; 93 + 94 + irqchip_init(); 95 + np = of_find_compatible_node(NULL, NULL, "stericsson,db8500-prcmu"); 96 + of_address_to_resource(np, 0, &r); 97 + of_node_put(np); 98 + if (!r.start) { 99 + pr_err("could not find PRCMU base resource\n"); 100 + return; 101 + } 102 + prcmu_early_init(r.start, r.end-r.start); 103 + ux500_pm_init(r.start, r.end-r.start); 104 + 105 + /* Unlock before init */ 106 + ux500_l2x0_unlock(); 107 + outer_cache.write_sec = ux500_l2c310_write_sec; 108 + } 109 + 110 + static void ux500_restart(enum reboot_mode mode, const char *cmd) 111 + { 112 + local_irq_disable(); 113 + local_fiq_disable(); 114 + 115 + prcmu_system_reset(0); 50 116 } 51 117 52 118 /* ··· 139 73 .handle_irq = db8500_pmu_handler, 140 74 }; 141 75 142 - static const char *db8500_read_soc_id(void) 143 - { 144 - void __iomem *uid; 145 - const char *retstr; 146 - 147 - uid = ioremap(U8500_BB_UID_BASE, 0x20); 148 - if (!uid) 149 - return NULL; 150 - /* Throw these device-specific numbers into the entropy pool */ 151 - add_device_randomness(uid, 0x14); 152 - retstr = kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x", 153 - readl((u32 *)uid+0), 154 - readl((u32 *)uid+1), readl((u32 *)uid+2), 155 - readl((u32 *)uid+3), readl((u32 *)uid+4)); 156 - iounmap(uid); 157 - return retstr; 158 - } 159 - 160 - static struct device * __init db8500_soc_device_init(void) 161 - { 162 - const char *soc_id = db8500_read_soc_id(); 163 - 164 - return ux500_soc_device_init(soc_id); 165 - } 166 - 167 76 static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = { 168 77 /* Requires call-back bindings. */ 169 78 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), ··· 152 111 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80125000, 153 112 "ux500-msp-i2s.3", &msp3_platform_data), 154 113 /* Requires non-DT:able platform data. */ 155 - OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", 156 - &db8500_prcmu_pdata), 114 + OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", NULL), 157 115 OF_DEV_AUXDATA("stericsson,ux500-cryp", 0xa03cb000, "cryp1", NULL), 158 116 OF_DEV_AUXDATA("stericsson,ux500-hash", 0xa03c2000, "hash1", NULL), 159 117 OF_DEV_AUXDATA("stericsson,snd-soc-mop500", 0, "snd-soc-mop500.0", ··· 161 121 }; 162 122 163 123 static struct of_dev_auxdata u8540_auxdata_lookup[] __initdata = { 164 - OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", 165 - &db8500_prcmu_pdata), 124 + OF_DEV_AUXDATA("stericsson,db8500-prcmu", 0x80157000, "db8500-prcmu", NULL), 166 125 {}, 167 126 }; 168 127 ··· 175 136 176 137 static void __init u8500_init_machine(void) 177 138 { 178 - struct device *parent = db8500_soc_device_init(); 179 - 180 139 /* automatically probe child nodes of dbx5x0 devices */ 181 140 if (of_machine_is_compatible("st-ericsson,u8540")) 182 141 of_platform_populate(NULL, u8500_local_bus_nodes, 183 - u8540_auxdata_lookup, parent); 142 + u8540_auxdata_lookup, NULL); 184 143 else 185 144 of_platform_populate(NULL, u8500_local_bus_nodes, 186 - u8500_auxdata_lookup, parent); 145 + u8500_auxdata_lookup, NULL); 187 146 } 188 147 189 148 static const char * stericsson_dt_platform_compat[] = { ··· 193 156 }; 194 157 195 158 DT_MACHINE_START(U8500_DT, "ST-Ericsson Ux5x0 platform (Device Tree Support)") 196 - .map_io = u8500_map_io, 159 + .l2c_aux_val = 0, 160 + .l2c_aux_mask = ~0, 197 161 .init_irq = ux500_init_irq, 198 162 .init_machine = u8500_init_machine, 199 - .init_late = NULL, 200 163 .dt_compat = stericsson_dt_platform_compat, 201 164 .restart = ux500_restart, 202 165 MACHINE_END
-148
arch/arm/mach-ux500/cpu.c
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2010 3 - * 4 - * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 5 - * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson 6 - * License terms: GNU General Public License (GPL) version 2 7 - */ 8 - 9 - #include <linux/platform_device.h> 10 - #include <linux/io.h> 11 - #include <linux/mfd/dbx500-prcmu.h> 12 - #include <linux/sys_soc.h> 13 - #include <linux/err.h> 14 - #include <linux/slab.h> 15 - #include <linux/stat.h> 16 - #include <linux/of.h> 17 - #include <linux/of_irq.h> 18 - #include <linux/of_address.h> 19 - #include <linux/irq.h> 20 - #include <linux/irqchip.h> 21 - #include <linux/irqchip/arm-gic.h> 22 - #include <linux/platform_data/clk-ux500.h> 23 - #include <linux/platform_data/arm-ux500-pm.h> 24 - 25 - #include <asm/mach/map.h> 26 - 27 - #include "setup.h" 28 - 29 - #include "board-mop500.h" 30 - #include "db8500-regs.h" 31 - #include "id.h" 32 - 33 - void ux500_restart(enum reboot_mode mode, const char *cmd) 34 - { 35 - local_irq_disable(); 36 - local_fiq_disable(); 37 - 38 - prcmu_system_reset(0); 39 - } 40 - 41 - /* 42 - * FIXME: Should we set up the GPIO domain here? 43 - * 44 - * The problem is that we cannot put the interrupt resources into the platform 45 - * device until the irqdomain has been added. Right now, we set the GIC interrupt 46 - * domain from init_irq(), then load the gpio driver from 47 - * core_initcall(nmk_gpio_init) and add the platform devices from 48 - * arch_initcall(customize_machine). 49 - * 50 - * This feels fragile because it depends on the gpio device getting probed 51 - * _before_ any device uses the gpio interrupts. 52 - */ 53 - void __init ux500_init_irq(void) 54 - { 55 - struct device_node *np; 56 - struct resource r; 57 - 58 - irqchip_init(); 59 - np = of_find_compatible_node(NULL, NULL, "stericsson,db8500-prcmu"); 60 - of_address_to_resource(np, 0, &r); 61 - of_node_put(np); 62 - if (!r.start) { 63 - pr_err("could not find PRCMU base resource\n"); 64 - return; 65 - } 66 - prcmu_early_init(r.start, r.end-r.start); 67 - ux500_pm_init(r.start, r.end-r.start); 68 - 69 - /* 70 - * Init clocks here so that they are available for system timer 71 - * initialization. 72 - */ 73 - if (cpu_is_u8500_family()) 74 - u8500_clk_init(); 75 - else if (cpu_is_u9540()) 76 - u9540_clk_init(); 77 - else if (cpu_is_u8540()) 78 - u8540_clk_init(); 79 - } 80 - 81 - static const char * __init ux500_get_machine(void) 82 - { 83 - return kasprintf(GFP_KERNEL, "DB%4x", dbx500_partnumber()); 84 - } 85 - 86 - static const char * __init ux500_get_family(void) 87 - { 88 - return kasprintf(GFP_KERNEL, "ux500"); 89 - } 90 - 91 - static const char * __init ux500_get_revision(void) 92 - { 93 - unsigned int rev = dbx500_revision(); 94 - 95 - if (rev == 0x01) 96 - return kasprintf(GFP_KERNEL, "%s", "ED"); 97 - else if (rev >= 0xA0) 98 - return kasprintf(GFP_KERNEL, "%d.%d", 99 - (rev >> 4) - 0xA + 1, rev & 0xf); 100 - 101 - return kasprintf(GFP_KERNEL, "%s", "Unknown"); 102 - } 103 - 104 - static ssize_t ux500_get_process(struct device *dev, 105 - struct device_attribute *attr, 106 - char *buf) 107 - { 108 - if (dbx500_id.process == 0x00) 109 - return sprintf(buf, "Standard\n"); 110 - 111 - return sprintf(buf, "%02xnm\n", dbx500_id.process); 112 - } 113 - 114 - static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr, 115 - const char *soc_id) 116 - { 117 - soc_dev_attr->soc_id = soc_id; 118 - soc_dev_attr->machine = ux500_get_machine(); 119 - soc_dev_attr->family = ux500_get_family(); 120 - soc_dev_attr->revision = ux500_get_revision(); 121 - } 122 - 123 - static const struct device_attribute ux500_soc_attr = 124 - __ATTR(process, S_IRUGO, ux500_get_process, NULL); 125 - 126 - struct device * __init ux500_soc_device_init(const char *soc_id) 127 - { 128 - struct device *parent; 129 - struct soc_device *soc_dev; 130 - struct soc_device_attribute *soc_dev_attr; 131 - 132 - soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 133 - if (!soc_dev_attr) 134 - return ERR_PTR(-ENOMEM); 135 - 136 - soc_info_populate(soc_dev_attr, soc_id); 137 - 138 - soc_dev = soc_device_register(soc_dev_attr); 139 - if (IS_ERR(soc_dev)) { 140 - kfree(soc_dev_attr); 141 - return NULL; 142 - } 143 - 144 - parent = soc_device_to_device(soc_dev); 145 - device_create_file(parent, &ux500_soc_attr); 146 - 147 - return parent; 148 - }
-116
arch/arm/mach-ux500/id.c
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2010 3 - * 4 - * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 5 - * License terms: GNU General Public License (GPL) version 2 6 - */ 7 - 8 - #include <linux/kernel.h> 9 - #include <linux/init.h> 10 - #include <linux/io.h> 11 - 12 - #include <asm/cputype.h> 13 - #include <asm/tlbflush.h> 14 - #include <asm/cacheflush.h> 15 - #include <asm/mach/map.h> 16 - 17 - #include "setup.h" 18 - 19 - #include "db8500-regs.h" 20 - #include "id.h" 21 - 22 - struct dbx500_asic_id dbx500_id; 23 - 24 - static unsigned int __init ux500_read_asicid(phys_addr_t addr) 25 - { 26 - phys_addr_t base = addr & ~0xfff; 27 - struct map_desc desc = { 28 - .virtual = (unsigned long)UX500_VIRT_ROM, 29 - .pfn = __phys_to_pfn(base), 30 - .length = SZ_16K, 31 - .type = MT_DEVICE, 32 - }; 33 - 34 - iotable_init(&desc, 1); 35 - 36 - /* As in devicemaps_init() */ 37 - local_flush_tlb_all(); 38 - flush_cache_all(); 39 - 40 - return readl(UX500_VIRT_ROM + (addr & 0xfff)); 41 - } 42 - 43 - static void ux500_print_soc_info(unsigned int asicid) 44 - { 45 - unsigned int rev = dbx500_revision(); 46 - 47 - pr_info("DB%4x ", dbx500_partnumber()); 48 - 49 - if (rev == 0x01) 50 - pr_cont("Early Drop"); 51 - else if (rev >= 0xA0) 52 - pr_cont("v%d.%d" , (rev >> 4) - 0xA + 1, rev & 0xf); 53 - else 54 - pr_cont("Unknown"); 55 - 56 - pr_cont(" [%#010x]\n", asicid); 57 - } 58 - 59 - static unsigned int partnumber(unsigned int asicid) 60 - { 61 - return (asicid >> 8) & 0xffff; 62 - } 63 - 64 - /* 65 - * SOC MIDR ASICID ADDRESS ASICID VALUE 66 - * DB8500ed 0x410fc090 0x9001FFF4 0x00850001 67 - * DB8500v1 0x411fc091 0x9001FFF4 0x008500A0 68 - * DB8500v1.1 0x411fc091 0x9001FFF4 0x008500A1 69 - * DB8500v2 0x412fc091 0x9001DBF4 0x008500B0 70 - * DB8520v2.2 0x412fc091 0x9001DBF4 0x008500B2 71 - * DB5500v1 0x412fc091 0x9001FFF4 0x005500A0 72 - * DB9540 0x413fc090 0xFFFFDBF4 0x009540xx 73 - */ 74 - 75 - void __init ux500_setup_id(void) 76 - { 77 - unsigned int cpuid = read_cpuid_id(); 78 - unsigned int asicid = 0; 79 - phys_addr_t addr = 0; 80 - 81 - switch (cpuid) { 82 - case 0x410fc090: /* DB8500ed */ 83 - case 0x411fc091: /* DB8500v1 */ 84 - addr = 0x9001FFF4; 85 - break; 86 - 87 - case 0x412fc091: /* DB8520 / DB8500v2 / DB5500v1 */ 88 - asicid = ux500_read_asicid(0x9001DBF4); 89 - if (partnumber(asicid) == 0x8500 || 90 - partnumber(asicid) == 0x8520) 91 - /* DB8500v2 */ 92 - break; 93 - 94 - /* DB5500v1 */ 95 - addr = 0x9001FFF4; 96 - break; 97 - 98 - case 0x413fc090: /* DB9540 */ 99 - addr = 0xFFFFDBF4; 100 - break; 101 - } 102 - 103 - if (addr) 104 - asicid = ux500_read_asicid(addr); 105 - 106 - if (!asicid) { 107 - pr_err("Unable to identify SoC\n"); 108 - ux500_unknown_soc(); 109 - } 110 - 111 - dbx500_id.process = asicid >> 24; 112 - dbx500_id.partnumber = partnumber(asicid); 113 - dbx500_id.revision = asicid & 0xff; 114 - 115 - ux500_print_soc_info(asicid); 116 - }
-144
arch/arm/mach-ux500/id.h
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2010 3 - * 4 - * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 5 - * License terms: GNU General Public License (GPL) version 2 6 - */ 7 - 8 - #ifndef __MACH_UX500_ID 9 - #define __MACH_UX500_ID 10 - 11 - /** 12 - * struct dbx500_asic_id - fields of the ASIC ID 13 - * @process: the manufacturing process, 0x40 is 40 nm 0x00 is "standard" 14 - * @partnumber: hithereto 0x8500 for DB8500 15 - * @revision: version code in the series 16 - */ 17 - struct dbx500_asic_id { 18 - u16 partnumber; 19 - u8 revision; 20 - u8 process; 21 - }; 22 - 23 - extern struct dbx500_asic_id dbx500_id; 24 - 25 - static inline unsigned int __attribute_const__ dbx500_partnumber(void) 26 - { 27 - return dbx500_id.partnumber; 28 - } 29 - 30 - static inline unsigned int __attribute_const__ dbx500_revision(void) 31 - { 32 - return dbx500_id.revision; 33 - } 34 - 35 - /* 36 - * SOCs 37 - */ 38 - 39 - static inline bool __attribute_const__ cpu_is_u8500(void) 40 - { 41 - return dbx500_partnumber() == 0x8500; 42 - } 43 - 44 - static inline bool __attribute_const__ cpu_is_u8520(void) 45 - { 46 - return dbx500_partnumber() == 0x8520; 47 - } 48 - 49 - static inline bool cpu_is_u8500_family(void) 50 - { 51 - return cpu_is_u8500() || cpu_is_u8520(); 52 - } 53 - 54 - static inline bool __attribute_const__ cpu_is_u9540(void) 55 - { 56 - return dbx500_partnumber() == 0x9540; 57 - } 58 - 59 - static inline bool __attribute_const__ cpu_is_u8540(void) 60 - { 61 - return dbx500_partnumber() == 0x8540; 62 - } 63 - 64 - static inline bool __attribute_const__ cpu_is_u8580(void) 65 - { 66 - return dbx500_partnumber() == 0x8580; 67 - } 68 - 69 - static inline bool cpu_is_ux540_family(void) 70 - { 71 - return cpu_is_u9540() || cpu_is_u8540() || cpu_is_u8580(); 72 - } 73 - 74 - /* 75 - * 8500 revisions 76 - */ 77 - 78 - static inline bool __attribute_const__ cpu_is_u8500ed(void) 79 - { 80 - return cpu_is_u8500() && dbx500_revision() == 0x00; 81 - } 82 - 83 - static inline bool __attribute_const__ cpu_is_u8500v1(void) 84 - { 85 - return cpu_is_u8500() && (dbx500_revision() & 0xf0) == 0xA0; 86 - } 87 - 88 - static inline bool __attribute_const__ cpu_is_u8500v10(void) 89 - { 90 - return cpu_is_u8500() && dbx500_revision() == 0xA0; 91 - } 92 - 93 - static inline bool __attribute_const__ cpu_is_u8500v11(void) 94 - { 95 - return cpu_is_u8500() && dbx500_revision() == 0xA1; 96 - } 97 - 98 - static inline bool __attribute_const__ cpu_is_u8500v2(void) 99 - { 100 - return cpu_is_u8500() && ((dbx500_revision() & 0xf0) == 0xB0); 101 - } 102 - 103 - static inline bool cpu_is_u8500v20(void) 104 - { 105 - return cpu_is_u8500() && (dbx500_revision() == 0xB0); 106 - } 107 - 108 - static inline bool cpu_is_u8500v21(void) 109 - { 110 - return cpu_is_u8500() && (dbx500_revision() == 0xB1); 111 - } 112 - 113 - static inline bool cpu_is_u8500v22(void) 114 - { 115 - return cpu_is_u8500() && (dbx500_revision() == 0xB2); 116 - } 117 - 118 - static inline bool cpu_is_u8500v20_or_later(void) 119 - { 120 - return (cpu_is_u8500() && !cpu_is_u8500v10() && !cpu_is_u8500v11()); 121 - } 122 - 123 - /* 124 - * 8540 revisions 125 - */ 126 - 127 - static inline bool __attribute_const__ cpu_is_u8540v10(void) 128 - { 129 - return cpu_is_u8540() && dbx500_revision() == 0xA0; 130 - } 131 - 132 - static inline bool __attribute_const__ cpu_is_u8580v10(void) 133 - { 134 - return cpu_is_u8580() && dbx500_revision() == 0xA0; 135 - } 136 - 137 - static inline bool ux500_is_svp(void) 138 - { 139 - return false; 140 - } 141 - 142 - #define ux500_unknown_soc() BUG() 143 - 144 - #endif
-1
arch/arm/mach-ux500/platsmp.c
··· 26 26 #include "setup.h" 27 27 28 28 #include "db8500-regs.h" 29 - #include "id.h" 30 29 31 30 /* Magic triggers in backup RAM */ 32 31 #define UX500_CPU1_JUMPADDR_OFFSET 0x1FF4
-12
arch/arm/mach-ux500/setup.h
··· 11 11 #ifndef __ASM_ARCH_SETUP_H 12 12 #define __ASM_ARCH_SETUP_H 13 13 14 - #include <asm/mach/arch.h> 15 - #include <linux/init.h> 16 - #include <linux/mfd/abx500/ab8500.h> 17 - 18 - void ux500_restart(enum reboot_mode mode, const char *cmd); 19 - 20 - void __init ux500_setup_id(void); 21 - 22 - extern void __init ux500_init_irq(void); 23 - 24 - extern struct device *ux500_soc_device_init(const char *soc_id); 25 - 26 14 extern void ux500_cpu_die(unsigned int cpu); 27 15 28 16 #endif /* __ASM_ARCH_SETUP_H */
+2
arch/arm64/boot/dts/hisilicon/hi6220.dtsi
··· 5 5 */ 6 6 7 7 #include <dt-bindings/interrupt-controller/arm-gic.h> 8 + #include <dt-bindings/reset/hisi,hi6220-resets.h> 8 9 #include <dt-bindings/clock/hi6220-clock.h> 9 10 #include <dt-bindings/pinctrl/hisi.h> 10 11 #include <dt-bindings/thermal/thermal.h> ··· 253 252 compatible = "hisilicon,hi6220-mediactrl", "syscon"; 254 253 reg = <0x0 0xf4410000 0x0 0x1000>; 255 254 #clock-cells = <1>; 255 + #reset-cells = <1>; 256 256 }; 257 257 258 258 pm_ctrl: pm_ctrl@f7032000 {
+13
drivers/bus/Kconfig
··· 132 132 with various RSB based devices, such as AXP223, AXP8XX PMICs, 133 133 and AC100/AC200 ICs. 134 134 135 + # TODO: This uses pm_clk_*() symbols that aren't exported in v4.7 and hence 136 + # the driver will fail to build as a module. However there are patches to 137 + # address that queued for v4.8, so this can be turned into a tristate symbol 138 + # after v4.8-rc1. 139 + config TEGRA_ACONNECT 140 + bool "Tegra ACONNECT Bus Driver" 141 + depends on ARCH_TEGRA_210_SOC 142 + depends on OF && PM 143 + select PM_CLK 144 + help 145 + Driver for the Tegra ACONNECT bus which is used to interface with 146 + the devices inside the Audio Processing Engine (APE) for Tegra210. 147 + 135 148 config UNIPHIER_SYSTEM_BUS 136 149 tristate "UniPhier System Bus driver" 137 150 depends on ARCH_UNIPHIER && OF
+1
drivers/bus/Makefile
··· 17 17 obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o 18 18 obj-$(CONFIG_SUNXI_RSB) += sunxi-rsb.o 19 19 obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o 20 + obj-$(CONFIG_TEGRA_ACONNECT) += tegra-aconnect.o 20 21 obj-$(CONFIG_UNIPHIER_SYSTEM_BUS) += uniphier-system-bus.o 21 22 obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o
+112
drivers/bus/tegra-aconnect.c
··· 1 + /* 2 + * Tegra ACONNECT Bus Driver 3 + * 4 + * Copyright (C) 2016, NVIDIA CORPORATION. All rights reserved. 5 + * 6 + * This file is subject to the terms and conditions of the GNU General Public 7 + * License. See the file "COPYING" in the main directory of this archive 8 + * for more details. 9 + */ 10 + 11 + #include <linux/clk.h> 12 + #include <linux/module.h> 13 + #include <linux/of_platform.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/pm_clock.h> 16 + #include <linux/pm_runtime.h> 17 + 18 + static int tegra_aconnect_add_clock(struct device *dev, char *name) 19 + { 20 + struct clk *clk; 21 + int ret; 22 + 23 + clk = clk_get(dev, name); 24 + if (IS_ERR(clk)) { 25 + dev_err(dev, "%s clock not found\n", name); 26 + return PTR_ERR(clk); 27 + } 28 + 29 + ret = pm_clk_add_clk(dev, clk); 30 + if (ret) 31 + clk_put(clk); 32 + 33 + return ret; 34 + } 35 + 36 + static int tegra_aconnect_probe(struct platform_device *pdev) 37 + { 38 + int ret; 39 + 40 + if (!pdev->dev.of_node) 41 + return -EINVAL; 42 + 43 + ret = pm_clk_create(&pdev->dev); 44 + if (ret) 45 + return ret; 46 + 47 + ret = tegra_aconnect_add_clock(&pdev->dev, "ape"); 48 + if (ret) 49 + goto clk_destroy; 50 + 51 + ret = tegra_aconnect_add_clock(&pdev->dev, "apb2ape"); 52 + if (ret) 53 + goto clk_destroy; 54 + 55 + pm_runtime_enable(&pdev->dev); 56 + 57 + of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); 58 + 59 + dev_info(&pdev->dev, "Tegra ACONNECT bus registered\n"); 60 + 61 + return 0; 62 + 63 + clk_destroy: 64 + pm_clk_destroy(&pdev->dev); 65 + 66 + return ret; 67 + } 68 + 69 + static int tegra_aconnect_remove(struct platform_device *pdev) 70 + { 71 + pm_runtime_disable(&pdev->dev); 72 + 73 + pm_clk_destroy(&pdev->dev); 74 + 75 + return 0; 76 + } 77 + 78 + static int tegra_aconnect_runtime_resume(struct device *dev) 79 + { 80 + return pm_clk_resume(dev); 81 + } 82 + 83 + static int tegra_aconnect_runtime_suspend(struct device *dev) 84 + { 85 + return pm_clk_suspend(dev); 86 + } 87 + 88 + static const struct dev_pm_ops tegra_aconnect_pm_ops = { 89 + SET_RUNTIME_PM_OPS(tegra_aconnect_runtime_suspend, 90 + tegra_aconnect_runtime_resume, NULL) 91 + }; 92 + 93 + static const struct of_device_id tegra_aconnect_of_match[] = { 94 + { .compatible = "nvidia,tegra210-aconnect", }, 95 + { } 96 + }; 97 + MODULE_DEVICE_TABLE(of, tegra_aconnect_of_match); 98 + 99 + static struct platform_driver tegra_aconnect_driver = { 100 + .probe = tegra_aconnect_probe, 101 + .remove = tegra_aconnect_remove, 102 + .driver = { 103 + .name = "tegra-aconnect", 104 + .of_match_table = tegra_aconnect_of_match, 105 + .pm = &tegra_aconnect_pm_ops, 106 + }, 107 + }; 108 + module_platform_driver(tegra_aconnect_driver); 109 + 110 + MODULE_DESCRIPTION("NVIDIA Tegra ACONNECT Bus Driver"); 111 + MODULE_AUTHOR("Jon Hunter <jonathanh@nvidia.com>"); 112 + MODULE_LICENSE("GPL v2");
+1 -1
drivers/clk/clk-clps711x.c
··· 184 184 of_clk_add_provider(np, of_clk_src_onecell_get, 185 185 &clps711x_clk->clk_data); 186 186 } 187 - CLK_OF_DECLARE(clps711x, "cirrus,clps711x-clk", clps711x_clk_init_dt); 187 + CLK_OF_DECLARE(clps711x, "cirrus,ep7209-clk", clps711x_clk_init_dt); 188 188 #endif
+2 -14
drivers/clk/ux500/u8500_of_clk.c
··· 11 11 #include <linux/of_address.h> 12 12 #include <linux/clk-provider.h> 13 13 #include <linux/mfd/dbx500-prcmu.h> 14 - #include <linux/platform_data/clk-ux500.h> 15 14 #include "clk.h" 16 15 17 16 #define PRCC_NUM_PERIPH_CLUSTERS 6 ··· 47 48 return PRCC_SHOW(clk_data, base, bit); 48 49 } 49 50 50 - static const struct of_device_id u8500_clk_of_match[] = { 51 - { .compatible = "stericsson,u8500-clks", }, 52 - { }, 53 - }; 54 - 55 51 /* CLKRST4 is missing making it hard to index things */ 56 52 enum clkrst_index { 57 53 CLKRST1_INDEX = 0, ··· 57 63 CLKRST_MAX, 58 64 }; 59 65 60 - void u8500_clk_init(void) 66 + static void u8500_clk_init(struct device_node *np) 61 67 { 62 68 struct prcmu_fw_version *fw_version; 63 - struct device_node *np = NULL; 64 69 struct device_node *child = NULL; 65 70 const char *sgaclk_parent = NULL; 66 71 struct clk *clk, *rtc_clk, *twd_clk; 67 72 u32 bases[CLKRST_MAX]; 68 73 int i; 69 74 70 - if (of_have_populated_dt()) 71 - np = of_find_matching_node(NULL, u8500_clk_of_match); 72 - if (!np) { 73 - pr_err("Either DT or U8500 Clock node not found\n"); 74 - return; 75 - } 76 75 for (i = 0; i < ARRAY_SIZE(bases); i++) { 77 76 struct resource r; 78 77 ··· 560 573 of_clk_add_provider(child, of_clk_src_simple_get, twd_clk); 561 574 } 562 575 } 576 + CLK_OF_DECLARE(u8500_clks, "stericsson,u8500-clks", u8500_clk_init);
+2 -14
drivers/clk/ux500/u8540_clk.c
··· 12 12 #include <linux/clkdev.h> 13 13 #include <linux/clk-provider.h> 14 14 #include <linux/mfd/dbx500-prcmu.h> 15 - #include <linux/platform_data/clk-ux500.h> 16 15 #include "clk.h" 17 - 18 - static const struct of_device_id u8540_clk_of_match[] = { 19 - { .compatible = "stericsson,u8540-clks", }, 20 - { } 21 - }; 22 16 23 17 /* CLKRST4 is missing making it hard to index things */ 24 18 enum clkrst_index { ··· 24 30 CLKRST_MAX, 25 31 }; 26 32 27 - void u8540_clk_init(void) 33 + static void u8540_clk_init(struct device_node *np) 28 34 { 29 35 struct clk *clk; 30 - struct device_node *np = NULL; 31 36 u32 bases[CLKRST_MAX]; 32 37 int i; 33 38 34 - if (of_have_populated_dt()) 35 - np = of_find_matching_node(NULL, u8540_clk_of_match); 36 - if (!np) { 37 - pr_err("Either DT or U8540 Clock node not found\n"); 38 - return; 39 - } 40 39 for (i = 0; i < ARRAY_SIZE(bases); i++) { 41 40 struct resource r; 42 41 ··· 594 607 bases[CLKRST6_INDEX], BIT(0), CLK_SET_RATE_GATE); 595 608 clk_register_clkdev(clk, NULL, "rng"); 596 609 } 610 + CLK_OF_DECLARE(u8540_clks, "stericsson,u8540-clks", u8540_clk_init);
+2 -2
drivers/clk/ux500/u9540_clk.c
··· 9 9 10 10 #include <linux/clk-provider.h> 11 11 #include <linux/mfd/dbx500-prcmu.h> 12 - #include <linux/platform_data/clk-ux500.h> 13 12 #include "clk.h" 14 13 15 - void u9540_clk_init(void) 14 + static void u9540_clk_init(struct device_node *np) 16 15 { 17 16 /* register clocks here */ 18 17 } 18 + CLK_OF_DECLARE(u9540_clks, "stericsson,u9540-clks", u9540_clk_init);
+1 -1
drivers/clocksource/clps711x-timer.c
··· 119 119 return -EINVAL; 120 120 } 121 121 } 122 - CLOCKSOURCE_OF_DECLARE(clps711x, "cirrus,clps711x-timer", clps711x_timer_init); 122 + CLOCKSOURCE_OF_DECLARE(clps711x, "cirrus,ep7209-timer", clps711x_timer_init); 123 123 #endif
+34 -34
drivers/cpufreq/s5pv210-cpufreq.c
··· 220 220 221 221 tmp1 /= tmp; 222 222 223 - __raw_writel(tmp1, reg); 223 + writel_relaxed(tmp1, reg); 224 224 } 225 225 226 226 static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index) ··· 296 296 * 1. Temporary Change divider for MFC and G3D 297 297 * SCLKA2M(200/1=200)->(200/4=50)Mhz 298 298 */ 299 - reg = __raw_readl(S5P_CLK_DIV2); 299 + reg = readl_relaxed(S5P_CLK_DIV2); 300 300 reg &= ~(S5P_CLKDIV2_G3D_MASK | S5P_CLKDIV2_MFC_MASK); 301 301 reg |= (3 << S5P_CLKDIV2_G3D_SHIFT) | 302 302 (3 << S5P_CLKDIV2_MFC_SHIFT); 303 - __raw_writel(reg, S5P_CLK_DIV2); 303 + writel_relaxed(reg, S5P_CLK_DIV2); 304 304 305 305 /* For MFC, G3D dividing */ 306 306 do { 307 - reg = __raw_readl(S5P_CLKDIV_STAT0); 307 + reg = readl_relaxed(S5P_CLKDIV_STAT0); 308 308 } while (reg & ((1 << 16) | (1 << 17))); 309 309 310 310 /* 311 311 * 2. Change SCLKA2M(200Mhz)to SCLKMPLL in MFC_MUX, G3D MUX 312 312 * (200/4=50)->(667/4=166)Mhz 313 313 */ 314 - reg = __raw_readl(S5P_CLK_SRC2); 314 + reg = readl_relaxed(S5P_CLK_SRC2); 315 315 reg &= ~(S5P_CLKSRC2_G3D_MASK | S5P_CLKSRC2_MFC_MASK); 316 316 reg |= (1 << S5P_CLKSRC2_G3D_SHIFT) | 317 317 (1 << S5P_CLKSRC2_MFC_SHIFT); 318 - __raw_writel(reg, S5P_CLK_SRC2); 318 + writel_relaxed(reg, S5P_CLK_SRC2); 319 319 320 320 do { 321 - reg = __raw_readl(S5P_CLKMUX_STAT1); 321 + reg = readl_relaxed(S5P_CLKMUX_STAT1); 322 322 } while (reg & ((1 << 7) | (1 << 3))); 323 323 324 324 /* ··· 330 330 s5pv210_set_refresh(DMC1, 133000); 331 331 332 332 /* 4. SCLKAPLL -> SCLKMPLL */ 333 - reg = __raw_readl(S5P_CLK_SRC0); 333 + reg = readl_relaxed(S5P_CLK_SRC0); 334 334 reg &= ~(S5P_CLKSRC0_MUX200_MASK); 335 335 reg |= (0x1 << S5P_CLKSRC0_MUX200_SHIFT); 336 - __raw_writel(reg, S5P_CLK_SRC0); 336 + writel_relaxed(reg, S5P_CLK_SRC0); 337 337 338 338 do { 339 - reg = __raw_readl(S5P_CLKMUX_STAT0); 339 + reg = readl_relaxed(S5P_CLKMUX_STAT0); 340 340 } while (reg & (0x1 << 18)); 341 341 342 342 } 343 343 344 344 /* Change divider */ 345 - reg = __raw_readl(S5P_CLK_DIV0); 345 + reg = readl_relaxed(S5P_CLK_DIV0); 346 346 347 347 reg &= ~(S5P_CLKDIV0_APLL_MASK | S5P_CLKDIV0_A2M_MASK | 348 348 S5P_CLKDIV0_HCLK200_MASK | S5P_CLKDIV0_PCLK100_MASK | ··· 358 358 (clkdiv_val[index][6] << S5P_CLKDIV0_HCLK133_SHIFT) | 359 359 (clkdiv_val[index][7] << S5P_CLKDIV0_PCLK66_SHIFT)); 360 360 361 - __raw_writel(reg, S5P_CLK_DIV0); 361 + writel_relaxed(reg, S5P_CLK_DIV0); 362 362 363 363 do { 364 - reg = __raw_readl(S5P_CLKDIV_STAT0); 364 + reg = readl_relaxed(S5P_CLKDIV_STAT0); 365 365 } while (reg & 0xff); 366 366 367 367 /* ARM MCS value changed */ 368 - reg = __raw_readl(S5P_ARM_MCS_CON); 368 + reg = readl_relaxed(S5P_ARM_MCS_CON); 369 369 reg &= ~0x3; 370 370 if (index >= L3) 371 371 reg |= 0x3; 372 372 else 373 373 reg |= 0x1; 374 374 375 - __raw_writel(reg, S5P_ARM_MCS_CON); 375 + writel_relaxed(reg, S5P_ARM_MCS_CON); 376 376 377 377 if (pll_changing) { 378 378 /* 5. Set Lock time = 30us*24Mhz = 0x2cf */ 379 - __raw_writel(0x2cf, S5P_APLL_LOCK); 379 + writel_relaxed(0x2cf, S5P_APLL_LOCK); 380 380 381 381 /* 382 382 * 6. Turn on APLL ··· 384 384 * 6-2. Wait untile the PLL is locked 385 385 */ 386 386 if (index == L0) 387 - __raw_writel(APLL_VAL_1000, S5P_APLL_CON); 387 + writel_relaxed(APLL_VAL_1000, S5P_APLL_CON); 388 388 else 389 - __raw_writel(APLL_VAL_800, S5P_APLL_CON); 389 + writel_relaxed(APLL_VAL_800, S5P_APLL_CON); 390 390 391 391 do { 392 - reg = __raw_readl(S5P_APLL_CON); 392 + reg = readl_relaxed(S5P_APLL_CON); 393 393 } while (!(reg & (0x1 << 29))); 394 394 395 395 /* ··· 397 397 * to SCLKA2M(200Mhz) in MFC_MUX and G3D MUX 398 398 * (667/4=166)->(200/4=50)Mhz 399 399 */ 400 - reg = __raw_readl(S5P_CLK_SRC2); 400 + reg = readl_relaxed(S5P_CLK_SRC2); 401 401 reg &= ~(S5P_CLKSRC2_G3D_MASK | S5P_CLKSRC2_MFC_MASK); 402 402 reg |= (0 << S5P_CLKSRC2_G3D_SHIFT) | 403 403 (0 << S5P_CLKSRC2_MFC_SHIFT); 404 - __raw_writel(reg, S5P_CLK_SRC2); 404 + writel_relaxed(reg, S5P_CLK_SRC2); 405 405 406 406 do { 407 - reg = __raw_readl(S5P_CLKMUX_STAT1); 407 + reg = readl_relaxed(S5P_CLKMUX_STAT1); 408 408 } while (reg & ((1 << 7) | (1 << 3))); 409 409 410 410 /* 411 411 * 8. Change divider for MFC and G3D 412 412 * (200/4=50)->(200/1=200)Mhz 413 413 */ 414 - reg = __raw_readl(S5P_CLK_DIV2); 414 + reg = readl_relaxed(S5P_CLK_DIV2); 415 415 reg &= ~(S5P_CLKDIV2_G3D_MASK | S5P_CLKDIV2_MFC_MASK); 416 416 reg |= (clkdiv_val[index][10] << S5P_CLKDIV2_G3D_SHIFT) | 417 417 (clkdiv_val[index][9] << S5P_CLKDIV2_MFC_SHIFT); 418 - __raw_writel(reg, S5P_CLK_DIV2); 418 + writel_relaxed(reg, S5P_CLK_DIV2); 419 419 420 420 /* For MFC, G3D dividing */ 421 421 do { 422 - reg = __raw_readl(S5P_CLKDIV_STAT0); 422 + reg = readl_relaxed(S5P_CLKDIV_STAT0); 423 423 } while (reg & ((1 << 16) | (1 << 17))); 424 424 425 425 /* 9. Change MPLL to APLL in MSYS_MUX */ 426 - reg = __raw_readl(S5P_CLK_SRC0); 426 + reg = readl_relaxed(S5P_CLK_SRC0); 427 427 reg &= ~(S5P_CLKSRC0_MUX200_MASK); 428 428 reg |= (0x0 << S5P_CLKSRC0_MUX200_SHIFT); 429 - __raw_writel(reg, S5P_CLK_SRC0); 429 + writel_relaxed(reg, S5P_CLK_SRC0); 430 430 431 431 do { 432 - reg = __raw_readl(S5P_CLKMUX_STAT0); 432 + reg = readl_relaxed(S5P_CLKMUX_STAT0); 433 433 } while (reg & (0x1 << 18)); 434 434 435 435 /* ··· 446 446 * and memory refresh parameter should be changed 447 447 */ 448 448 if (bus_speed_changing) { 449 - reg = __raw_readl(S5P_CLK_DIV6); 449 + reg = readl_relaxed(S5P_CLK_DIV6); 450 450 reg &= ~S5P_CLKDIV6_ONEDRAM_MASK; 451 451 reg |= (clkdiv_val[index][8] << S5P_CLKDIV6_ONEDRAM_SHIFT); 452 - __raw_writel(reg, S5P_CLK_DIV6); 452 + writel_relaxed(reg, S5P_CLK_DIV6); 453 453 454 454 do { 455 - reg = __raw_readl(S5P_CLKDIV_STAT1); 455 + reg = readl_relaxed(S5P_CLKDIV_STAT1); 456 456 } while (reg & (1 << 15)); 457 457 458 458 /* Reconfigure DRAM refresh counter value */ ··· 492 492 { 493 493 unsigned long val; 494 494 495 - val = __raw_readl(dmc_reg + 0x4); 495 + val = readl_relaxed(dmc_reg + 0x4); 496 496 val = (val & (0xf << 8)); 497 497 498 498 return val >> 8; ··· 537 537 } 538 538 539 539 /* Find current refresh counter and frequency each DMC */ 540 - s5pv210_dram_conf[0].refresh = (__raw_readl(dmc_base[0] + 0x30) * 1000); 540 + s5pv210_dram_conf[0].refresh = (readl_relaxed(dmc_base[0] + 0x30) * 1000); 541 541 s5pv210_dram_conf[0].freq = clk_get_rate(dmc0_clk); 542 542 543 - s5pv210_dram_conf[1].refresh = (__raw_readl(dmc_base[1] + 0x30) * 1000); 543 + s5pv210_dram_conf[1].refresh = (readl_relaxed(dmc_base[1] + 0x30) * 1000); 544 544 s5pv210_dram_conf[1].freq = clk_get_rate(dmc1_clk); 545 545 546 546 policy->suspend_freq = SLEEP_FREQ;
+11 -1
drivers/firmware/Kconfig
··· 10 10 11 11 config ARM_SCPI_PROTOCOL 12 12 tristate "ARM System Control and Power Interface (SCPI) Message Protocol" 13 - depends on ARM_MHU 13 + depends on MAILBOX 14 14 help 15 15 System Control and Power Interface (SCPI) Message Protocol is 16 16 defined for the purpose of communication between the Application ··· 26 26 27 27 This protocol library provides interface for all the client drivers 28 28 making use of the features offered by the SCP. 29 + 30 + config ARM_SCPI_POWER_DOMAIN 31 + tristate "SCPI power domain driver" 32 + depends on ARM_SCPI_PROTOCOL || (COMPILE_TEST && OF) 33 + default y 34 + select PM_GENERIC_DOMAINS if PM 35 + help 36 + This enables support for the SCPI power domains which can be 37 + enabled or disabled via the SCP firmware 29 38 30 39 config EDD 31 40 tristate "BIOS Enhanced Disk Drive calls determine boot disk" ··· 193 184 config QCOM_SCM 194 185 bool 195 186 depends on ARM || ARM64 187 + select RESET_CONTROLLER 196 188 197 189 config QCOM_SCM_32 198 190 def_bool y
+1
drivers/firmware/Makefile
··· 3 3 # 4 4 obj-$(CONFIG_ARM_PSCI_FW) += psci.o 5 5 obj-$(CONFIG_ARM_SCPI_PROTOCOL) += arm_scpi.o 6 + obj-$(CONFIG_ARM_SCPI_POWER_DOMAIN) += scpi_pm_domain.o 6 7 obj-$(CONFIG_DMI) += dmi_scan.o 7 8 obj-$(CONFIG_DMI_SYSFS) += dmi-sysfs.o 8 9 obj-$(CONFIG_EDD) += edd.o
+34 -8
drivers/firmware/arm_scpi.c
··· 210 210 } opps[MAX_DVFS_OPPS]; 211 211 } __packed; 212 212 213 - struct dvfs_get { 214 - u8 index; 215 - } __packed; 216 - 217 213 struct dvfs_set { 218 214 u8 domain; 219 215 u8 index; ··· 229 233 struct sensor_value { 230 234 __le32 lo_val; 231 235 __le32 hi_val; 236 + } __packed; 237 + 238 + struct dev_pstate_set { 239 + u16 dev_id; 240 + u8 pstate; 232 241 } __packed; 233 242 234 243 static struct scpi_drvinfo *scpi_info; ··· 432 431 static int scpi_dvfs_get_idx(u8 domain) 433 432 { 434 433 int ret; 435 - struct dvfs_get dvfs; 434 + u8 dvfs_idx; 436 435 437 436 ret = scpi_send_message(SCPI_CMD_GET_DVFS, &domain, sizeof(domain), 438 - &dvfs, sizeof(dvfs)); 439 - return ret ? ret : dvfs.index; 437 + &dvfs_idx, sizeof(dvfs_idx)); 438 + return ret ? ret : dvfs_idx; 440 439 } 441 440 442 441 static int scpi_dvfs_set_idx(u8 domain, u8 index) ··· 527 526 return ret; 528 527 } 529 528 530 - int scpi_sensor_get_value(u16 sensor, u64 *val) 529 + static int scpi_sensor_get_value(u16 sensor, u64 *val) 531 530 { 532 531 __le16 id = cpu_to_le16(sensor); 533 532 struct sensor_value buf; ··· 542 541 return ret; 543 542 } 544 543 544 + static int scpi_device_get_power_state(u16 dev_id) 545 + { 546 + int ret; 547 + u8 pstate; 548 + __le16 id = cpu_to_le16(dev_id); 549 + 550 + ret = scpi_send_message(SCPI_CMD_GET_DEVICE_PWR_STATE, &id, 551 + sizeof(id), &pstate, sizeof(pstate)); 552 + return ret ? ret : pstate; 553 + } 554 + 555 + static int scpi_device_set_power_state(u16 dev_id, u8 pstate) 556 + { 557 + int stat; 558 + struct dev_pstate_set dev_set = { 559 + .dev_id = cpu_to_le16(dev_id), 560 + .pstate = pstate, 561 + }; 562 + 563 + return scpi_send_message(SCPI_CMD_SET_DEVICE_PWR_STATE, &dev_set, 564 + sizeof(dev_set), &stat, sizeof(stat)); 565 + } 566 + 545 567 static struct scpi_ops scpi_ops = { 546 568 .get_version = scpi_get_version, 547 569 .clk_get_range = scpi_clk_get_range, ··· 576 552 .sensor_get_capability = scpi_sensor_get_capability, 577 553 .sensor_get_info = scpi_sensor_get_info, 578 554 .sensor_get_value = scpi_sensor_get_value, 555 + .device_get_power_state = scpi_device_get_power_state, 556 + .device_set_power_state = scpi_device_set_power_state, 579 557 }; 580 558 581 559 struct scpi_ops *get_scpi_ops(void)
+194 -133
drivers/firmware/qcom_scm-32.c
··· 23 23 #include <linux/errno.h> 24 24 #include <linux/err.h> 25 25 #include <linux/qcom_scm.h> 26 - 27 - #include <asm/cacheflush.h> 26 + #include <linux/dma-mapping.h> 28 27 29 28 #include "qcom_scm.h" 30 29 ··· 96 97 }; 97 98 98 99 /** 99 - * alloc_qcom_scm_command() - Allocate an SCM command 100 - * @cmd_size: size of the command buffer 101 - * @resp_size: size of the response buffer 102 - * 103 - * Allocate an SCM command, including enough room for the command 104 - * and response headers as well as the command and response buffers. 105 - * 106 - * Returns a valid &qcom_scm_command on success or %NULL if the allocation fails. 107 - */ 108 - static struct qcom_scm_command *alloc_qcom_scm_command(size_t cmd_size, size_t resp_size) 109 - { 110 - struct qcom_scm_command *cmd; 111 - size_t len = sizeof(*cmd) + sizeof(struct qcom_scm_response) + cmd_size + 112 - resp_size; 113 - u32 offset; 114 - 115 - cmd = kzalloc(PAGE_ALIGN(len), GFP_KERNEL); 116 - if (cmd) { 117 - cmd->len = cpu_to_le32(len); 118 - offset = offsetof(struct qcom_scm_command, buf); 119 - cmd->buf_offset = cpu_to_le32(offset); 120 - cmd->resp_hdr_offset = cpu_to_le32(offset + cmd_size); 121 - } 122 - return cmd; 123 - } 124 - 125 - /** 126 - * free_qcom_scm_command() - Free an SCM command 127 - * @cmd: command to free 128 - * 129 - * Free an SCM command. 130 - */ 131 - static inline void free_qcom_scm_command(struct qcom_scm_command *cmd) 132 - { 133 - kfree(cmd); 134 - } 135 - 136 - /** 137 100 * qcom_scm_command_to_response() - Get a pointer to a qcom_scm_response 138 101 * @cmd: command 139 102 * ··· 129 168 return (void *)rsp + le32_to_cpu(rsp->buf_offset); 130 169 } 131 170 132 - static int qcom_scm_remap_error(int err) 133 - { 134 - pr_err("qcom_scm_call failed with error code %d\n", err); 135 - switch (err) { 136 - case QCOM_SCM_ERROR: 137 - return -EIO; 138 - case QCOM_SCM_EINVAL_ADDR: 139 - case QCOM_SCM_EINVAL_ARG: 140 - return -EINVAL; 141 - case QCOM_SCM_EOPNOTSUPP: 142 - return -EOPNOTSUPP; 143 - case QCOM_SCM_ENOMEM: 144 - return -ENOMEM; 145 - } 146 - return -EINVAL; 147 - } 148 - 149 171 static u32 smc(u32 cmd_addr) 150 172 { 151 173 int context_id; ··· 153 209 return r0; 154 210 } 155 211 156 - static int __qcom_scm_call(const struct qcom_scm_command *cmd) 157 - { 158 - int ret; 159 - u32 cmd_addr = virt_to_phys(cmd); 160 - 161 - /* 162 - * Flush the command buffer so that the secure world sees 163 - * the correct data. 164 - */ 165 - secure_flush_area(cmd, cmd->len); 166 - 167 - ret = smc(cmd_addr); 168 - if (ret < 0) 169 - ret = qcom_scm_remap_error(ret); 170 - 171 - return ret; 172 - } 173 - 174 - static void qcom_scm_inv_range(unsigned long start, unsigned long end) 175 - { 176 - u32 cacheline_size, ctr; 177 - 178 - asm volatile("mrc p15, 0, %0, c0, c0, 1" : "=r" (ctr)); 179 - cacheline_size = 4 << ((ctr >> 16) & 0xf); 180 - 181 - start = round_down(start, cacheline_size); 182 - end = round_up(end, cacheline_size); 183 - outer_inv_range(start, end); 184 - while (start < end) { 185 - asm ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start) 186 - : "memory"); 187 - start += cacheline_size; 188 - } 189 - dsb(); 190 - isb(); 191 - } 192 - 193 212 /** 194 213 * qcom_scm_call() - Send an SCM command 214 + * @dev: struct device 195 215 * @svc_id: service identifier 196 216 * @cmd_id: command identifier 197 217 * @cmd_buf: command buffer ··· 172 264 * and response buffers is taken care of by qcom_scm_call; however, callers are 173 265 * responsible for any other cached buffers passed over to the secure world. 174 266 */ 175 - static int qcom_scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, 176 - size_t cmd_len, void *resp_buf, size_t resp_len) 267 + static int qcom_scm_call(struct device *dev, u32 svc_id, u32 cmd_id, 268 + const void *cmd_buf, size_t cmd_len, void *resp_buf, 269 + size_t resp_len) 177 270 { 178 271 int ret; 179 272 struct qcom_scm_command *cmd; 180 273 struct qcom_scm_response *rsp; 181 - unsigned long start, end; 274 + size_t alloc_len = sizeof(*cmd) + cmd_len + sizeof(*rsp) + resp_len; 275 + dma_addr_t cmd_phys; 182 276 183 - cmd = alloc_qcom_scm_command(cmd_len, resp_len); 277 + cmd = kzalloc(PAGE_ALIGN(alloc_len), GFP_KERNEL); 184 278 if (!cmd) 185 279 return -ENOMEM; 280 + 281 + cmd->len = cpu_to_le32(alloc_len); 282 + cmd->buf_offset = cpu_to_le32(sizeof(*cmd)); 283 + cmd->resp_hdr_offset = cpu_to_le32(sizeof(*cmd) + cmd_len); 186 284 187 285 cmd->id = cpu_to_le32((svc_id << 10) | cmd_id); 188 286 if (cmd_buf) 189 287 memcpy(qcom_scm_get_command_buffer(cmd), cmd_buf, cmd_len); 190 288 289 + rsp = qcom_scm_command_to_response(cmd); 290 + 291 + cmd_phys = dma_map_single(dev, cmd, alloc_len, DMA_TO_DEVICE); 292 + if (dma_mapping_error(dev, cmd_phys)) { 293 + kfree(cmd); 294 + return -ENOMEM; 295 + } 296 + 191 297 mutex_lock(&qcom_scm_lock); 192 - ret = __qcom_scm_call(cmd); 298 + ret = smc(cmd_phys); 299 + if (ret < 0) 300 + ret = qcom_scm_remap_error(ret); 193 301 mutex_unlock(&qcom_scm_lock); 194 302 if (ret) 195 303 goto out; 196 304 197 - rsp = qcom_scm_command_to_response(cmd); 198 - start = (unsigned long)rsp; 199 - 200 305 do { 201 - qcom_scm_inv_range(start, start + sizeof(*rsp)); 306 + dma_sync_single_for_cpu(dev, cmd_phys + sizeof(*cmd) + cmd_len, 307 + sizeof(*rsp), DMA_FROM_DEVICE); 202 308 } while (!rsp->is_complete); 203 309 204 - end = (unsigned long)qcom_scm_get_response_buffer(rsp) + resp_len; 205 - qcom_scm_inv_range(start, end); 206 - 207 - if (resp_buf) 208 - memcpy(resp_buf, qcom_scm_get_response_buffer(rsp), resp_len); 310 + if (resp_buf) { 311 + dma_sync_single_for_cpu(dev, cmd_phys + sizeof(*cmd) + cmd_len + 312 + le32_to_cpu(rsp->buf_offset), 313 + resp_len, DMA_FROM_DEVICE); 314 + memcpy(resp_buf, qcom_scm_get_response_buffer(rsp), 315 + resp_len); 316 + } 209 317 out: 210 - free_qcom_scm_command(cmd); 318 + dma_unmap_single(dev, cmd_phys, alloc_len, DMA_TO_DEVICE); 319 + kfree(cmd); 211 320 return ret; 212 321 } 213 322 ··· 267 342 return r0; 268 343 } 269 344 345 + /** 346 + * qcom_scm_call_atomic2() - Send an atomic SCM command with two arguments 347 + * @svc_id: service identifier 348 + * @cmd_id: command identifier 349 + * @arg1: first argument 350 + * @arg2: second argument 351 + * 352 + * This shall only be used with commands that are guaranteed to be 353 + * uninterruptable, atomic and SMP safe. 354 + */ 355 + static s32 qcom_scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2) 356 + { 357 + int context_id; 358 + 359 + register u32 r0 asm("r0") = SCM_ATOMIC(svc, cmd, 2); 360 + register u32 r1 asm("r1") = (u32)&context_id; 361 + register u32 r2 asm("r2") = arg1; 362 + register u32 r3 asm("r3") = arg2; 363 + 364 + asm volatile( 365 + __asmeq("%0", "r0") 366 + __asmeq("%1", "r0") 367 + __asmeq("%2", "r1") 368 + __asmeq("%3", "r2") 369 + __asmeq("%4", "r3") 370 + #ifdef REQUIRES_SEC 371 + ".arch_extension sec\n" 372 + #endif 373 + "smc #0 @ switch to secure world\n" 374 + : "=r" (r0) 375 + : "r" (r0), "r" (r1), "r" (r2), "r" (r3) 376 + ); 377 + return r0; 378 + } 379 + 270 380 u32 qcom_scm_get_version(void) 271 381 { 272 382 int context_id; ··· 338 378 } 339 379 EXPORT_SYMBOL(qcom_scm_get_version); 340 380 341 - /* 342 - * Set the cold/warm boot address for one of the CPU cores. 343 - */ 344 - static int qcom_scm_set_boot_addr(u32 addr, int flags) 345 - { 346 - struct { 347 - __le32 flags; 348 - __le32 addr; 349 - } cmd; 350 - 351 - cmd.addr = cpu_to_le32(addr); 352 - cmd.flags = cpu_to_le32(flags); 353 - return qcom_scm_call(QCOM_SCM_SVC_BOOT, QCOM_SCM_BOOT_ADDR, 354 - &cmd, sizeof(cmd), NULL, 0); 355 - } 356 - 357 381 /** 358 382 * qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus 359 383 * @entry: Entry point function for the cpus ··· 367 423 set_cpu_present(cpu, false); 368 424 } 369 425 370 - return qcom_scm_set_boot_addr(virt_to_phys(entry), flags); 426 + return qcom_scm_call_atomic2(QCOM_SCM_SVC_BOOT, QCOM_SCM_BOOT_ADDR, 427 + flags, virt_to_phys(entry)); 371 428 } 372 429 373 430 /** ··· 379 434 * Set the Linux entry point for the SCM to transfer control to when coming 380 435 * out of a power down. CPU power down may be executed on cpuidle or hotplug. 381 436 */ 382 - int __qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus) 437 + int __qcom_scm_set_warm_boot_addr(struct device *dev, void *entry, 438 + const cpumask_t *cpus) 383 439 { 384 440 int ret; 385 441 int flags = 0; 386 442 int cpu; 443 + struct { 444 + __le32 flags; 445 + __le32 addr; 446 + } cmd; 387 447 388 448 /* 389 449 * Reassign only if we are switching from hotplug entry point ··· 404 454 if (!flags) 405 455 return 0; 406 456 407 - ret = qcom_scm_set_boot_addr(virt_to_phys(entry), flags); 457 + cmd.addr = cpu_to_le32(virt_to_phys(entry)); 458 + cmd.flags = cpu_to_le32(flags); 459 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_BOOT, QCOM_SCM_BOOT_ADDR, 460 + &cmd, sizeof(cmd), NULL, 0); 408 461 if (!ret) { 409 462 for_each_cpu(cpu, cpus) 410 463 qcom_scm_wb[cpu].entry = entry; ··· 430 477 flags & QCOM_SCM_FLUSH_FLAG_MASK); 431 478 } 432 479 433 - int __qcom_scm_is_call_available(u32 svc_id, u32 cmd_id) 480 + int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, u32 cmd_id) 434 481 { 435 482 int ret; 436 483 __le32 svc_cmd = cpu_to_le32((svc_id << 10) | cmd_id); 437 484 __le32 ret_val = 0; 438 485 439 - ret = qcom_scm_call(QCOM_SCM_SVC_INFO, QCOM_IS_CALL_AVAIL_CMD, &svc_cmd, 440 - sizeof(svc_cmd), &ret_val, sizeof(ret_val)); 486 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_INFO, QCOM_IS_CALL_AVAIL_CMD, 487 + &svc_cmd, sizeof(svc_cmd), &ret_val, 488 + sizeof(ret_val)); 441 489 if (ret) 442 490 return ret; 443 491 444 492 return le32_to_cpu(ret_val); 445 493 } 446 494 447 - int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) 495 + int __qcom_scm_hdcp_req(struct device *dev, struct qcom_scm_hdcp_req *req, 496 + u32 req_cnt, u32 *resp) 448 497 { 449 498 if (req_cnt > QCOM_SCM_HDCP_MAX_REQ_CNT) 450 499 return -ERANGE; 451 500 452 - return qcom_scm_call(QCOM_SCM_SVC_HDCP, QCOM_SCM_CMD_HDCP, 501 + return qcom_scm_call(dev, QCOM_SCM_SVC_HDCP, QCOM_SCM_CMD_HDCP, 453 502 req, req_cnt * sizeof(*req), resp, sizeof(*resp)); 503 + } 504 + 505 + void __qcom_scm_init(void) 506 + { 507 + } 508 + 509 + bool __qcom_scm_pas_supported(struct device *dev, u32 peripheral) 510 + { 511 + __le32 out; 512 + __le32 in; 513 + int ret; 514 + 515 + in = cpu_to_le32(peripheral); 516 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, 517 + QCOM_SCM_PAS_IS_SUPPORTED_CMD, 518 + &in, sizeof(in), 519 + &out, sizeof(out)); 520 + 521 + return ret ? false : !!out; 522 + } 523 + 524 + int __qcom_scm_pas_init_image(struct device *dev, u32 peripheral, 525 + dma_addr_t metadata_phys) 526 + { 527 + __le32 scm_ret; 528 + int ret; 529 + struct { 530 + __le32 proc; 531 + __le32 image_addr; 532 + } request; 533 + 534 + request.proc = cpu_to_le32(peripheral); 535 + request.image_addr = cpu_to_le32(metadata_phys); 536 + 537 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, 538 + QCOM_SCM_PAS_INIT_IMAGE_CMD, 539 + &request, sizeof(request), 540 + &scm_ret, sizeof(scm_ret)); 541 + 542 + return ret ? : le32_to_cpu(scm_ret); 543 + } 544 + 545 + int __qcom_scm_pas_mem_setup(struct device *dev, u32 peripheral, 546 + phys_addr_t addr, phys_addr_t size) 547 + { 548 + __le32 scm_ret; 549 + int ret; 550 + struct { 551 + __le32 proc; 552 + __le32 addr; 553 + __le32 len; 554 + } request; 555 + 556 + request.proc = cpu_to_le32(peripheral); 557 + request.addr = cpu_to_le32(addr); 558 + request.len = cpu_to_le32(size); 559 + 560 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, 561 + QCOM_SCM_PAS_MEM_SETUP_CMD, 562 + &request, sizeof(request), 563 + &scm_ret, sizeof(scm_ret)); 564 + 565 + return ret ? : le32_to_cpu(scm_ret); 566 + } 567 + 568 + int __qcom_scm_pas_auth_and_reset(struct device *dev, u32 peripheral) 569 + { 570 + __le32 out; 571 + __le32 in; 572 + int ret; 573 + 574 + in = cpu_to_le32(peripheral); 575 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, 576 + QCOM_SCM_PAS_AUTH_AND_RESET_CMD, 577 + &in, sizeof(in), 578 + &out, sizeof(out)); 579 + 580 + return ret ? : le32_to_cpu(out); 581 + } 582 + 583 + int __qcom_scm_pas_shutdown(struct device *dev, u32 peripheral) 584 + { 585 + __le32 out; 586 + __le32 in; 587 + int ret; 588 + 589 + in = cpu_to_le32(peripheral); 590 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, 591 + QCOM_SCM_PAS_SHUTDOWN_CMD, 592 + &in, sizeof(in), 593 + &out, sizeof(out)); 594 + 595 + return ret ? : le32_to_cpu(out); 596 + } 597 + 598 + int __qcom_scm_pas_mss_reset(struct device *dev, bool reset) 599 + { 600 + __le32 out; 601 + __le32 in = cpu_to_le32(reset); 602 + int ret; 603 + 604 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, QCOM_SCM_PAS_MSS_RESET, 605 + &in, sizeof(in), 606 + &out, sizeof(out)); 607 + 608 + return ret ? : le32_to_cpu(out); 454 609 }
+302 -5
drivers/firmware/qcom_scm-64.c
··· 12 12 13 13 #include <linux/io.h> 14 14 #include <linux/errno.h> 15 + #include <linux/delay.h> 16 + #include <linux/mutex.h> 17 + #include <linux/slab.h> 18 + #include <linux/types.h> 15 19 #include <linux/qcom_scm.h> 20 + #include <linux/arm-smccc.h> 21 + #include <linux/dma-mapping.h> 22 + 23 + #include "qcom_scm.h" 24 + 25 + #define QCOM_SCM_FNID(s, c) ((((s) & 0xFF) << 8) | ((c) & 0xFF)) 26 + 27 + #define MAX_QCOM_SCM_ARGS 10 28 + #define MAX_QCOM_SCM_RETS 3 29 + 30 + enum qcom_scm_arg_types { 31 + QCOM_SCM_VAL, 32 + QCOM_SCM_RO, 33 + QCOM_SCM_RW, 34 + QCOM_SCM_BUFVAL, 35 + }; 36 + 37 + #define QCOM_SCM_ARGS_IMPL(num, a, b, c, d, e, f, g, h, i, j, ...) (\ 38 + (((a) & 0x3) << 4) | \ 39 + (((b) & 0x3) << 6) | \ 40 + (((c) & 0x3) << 8) | \ 41 + (((d) & 0x3) << 10) | \ 42 + (((e) & 0x3) << 12) | \ 43 + (((f) & 0x3) << 14) | \ 44 + (((g) & 0x3) << 16) | \ 45 + (((h) & 0x3) << 18) | \ 46 + (((i) & 0x3) << 20) | \ 47 + (((j) & 0x3) << 22) | \ 48 + ((num) & 0xf)) 49 + 50 + #define QCOM_SCM_ARGS(...) QCOM_SCM_ARGS_IMPL(__VA_ARGS__, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) 51 + 52 + /** 53 + * struct qcom_scm_desc 54 + * @arginfo: Metadata describing the arguments in args[] 55 + * @args: The array of arguments for the secure syscall 56 + * @res: The values returned by the secure syscall 57 + */ 58 + struct qcom_scm_desc { 59 + u32 arginfo; 60 + u64 args[MAX_QCOM_SCM_ARGS]; 61 + }; 62 + 63 + static u64 qcom_smccc_convention = -1; 64 + static DEFINE_MUTEX(qcom_scm_lock); 65 + 66 + #define QCOM_SCM_EBUSY_WAIT_MS 30 67 + #define QCOM_SCM_EBUSY_MAX_RETRY 20 68 + 69 + #define N_EXT_QCOM_SCM_ARGS 7 70 + #define FIRST_EXT_ARG_IDX 3 71 + #define N_REGISTER_ARGS (MAX_QCOM_SCM_ARGS - N_EXT_QCOM_SCM_ARGS + 1) 72 + 73 + /** 74 + * qcom_scm_call() - Invoke a syscall in the secure world 75 + * @dev: device 76 + * @svc_id: service identifier 77 + * @cmd_id: command identifier 78 + * @desc: Descriptor structure containing arguments and return values 79 + * 80 + * Sends a command to the SCM and waits for the command to finish processing. 81 + * This should *only* be called in pre-emptible context. 82 + */ 83 + static int qcom_scm_call(struct device *dev, u32 svc_id, u32 cmd_id, 84 + const struct qcom_scm_desc *desc, 85 + struct arm_smccc_res *res) 86 + { 87 + int arglen = desc->arginfo & 0xf; 88 + int retry_count = 0, i; 89 + u32 fn_id = QCOM_SCM_FNID(svc_id, cmd_id); 90 + u64 cmd, x5 = desc->args[FIRST_EXT_ARG_IDX]; 91 + dma_addr_t args_phys = 0; 92 + void *args_virt = NULL; 93 + size_t alloc_len; 94 + 95 + if (unlikely(arglen > N_REGISTER_ARGS)) { 96 + alloc_len = N_EXT_QCOM_SCM_ARGS * sizeof(u64); 97 + args_virt = kzalloc(PAGE_ALIGN(alloc_len), GFP_KERNEL); 98 + 99 + if (!args_virt) 100 + return -ENOMEM; 101 + 102 + if (qcom_smccc_convention == ARM_SMCCC_SMC_32) { 103 + __le32 *args = args_virt; 104 + 105 + for (i = 0; i < N_EXT_QCOM_SCM_ARGS; i++) 106 + args[i] = cpu_to_le32(desc->args[i + 107 + FIRST_EXT_ARG_IDX]); 108 + } else { 109 + __le64 *args = args_virt; 110 + 111 + for (i = 0; i < N_EXT_QCOM_SCM_ARGS; i++) 112 + args[i] = cpu_to_le64(desc->args[i + 113 + FIRST_EXT_ARG_IDX]); 114 + } 115 + 116 + args_phys = dma_map_single(dev, args_virt, alloc_len, 117 + DMA_TO_DEVICE); 118 + 119 + if (dma_mapping_error(dev, args_phys)) { 120 + kfree(args_virt); 121 + return -ENOMEM; 122 + } 123 + 124 + x5 = args_phys; 125 + } 126 + 127 + do { 128 + mutex_lock(&qcom_scm_lock); 129 + 130 + cmd = ARM_SMCCC_CALL_VAL(ARM_SMCCC_STD_CALL, 131 + qcom_smccc_convention, 132 + ARM_SMCCC_OWNER_SIP, fn_id); 133 + 134 + do { 135 + arm_smccc_smc(cmd, desc->arginfo, desc->args[0], 136 + desc->args[1], desc->args[2], x5, 0, 0, 137 + res); 138 + } while (res->a0 == QCOM_SCM_INTERRUPTED); 139 + 140 + mutex_unlock(&qcom_scm_lock); 141 + 142 + if (res->a0 == QCOM_SCM_V2_EBUSY) { 143 + if (retry_count++ > QCOM_SCM_EBUSY_MAX_RETRY) 144 + break; 145 + msleep(QCOM_SCM_EBUSY_WAIT_MS); 146 + } 147 + } while (res->a0 == QCOM_SCM_V2_EBUSY); 148 + 149 + if (args_virt) { 150 + dma_unmap_single(dev, args_phys, alloc_len, DMA_TO_DEVICE); 151 + kfree(args_virt); 152 + } 153 + 154 + if (res->a0 < 0) 155 + return qcom_scm_remap_error(res->a0); 156 + 157 + return 0; 158 + } 16 159 17 160 /** 18 161 * qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus ··· 172 29 173 30 /** 174 31 * qcom_scm_set_warm_boot_addr() - Set the warm boot address for cpus 32 + * @dev: Device pointer 175 33 * @entry: Entry point function for the cpus 176 34 * @cpus: The cpumask of cpus that will use the entry point 177 35 * 178 36 * Set the Linux entry point for the SCM to transfer control to when coming 179 37 * out of a power down. CPU power down may be executed on cpuidle or hotplug. 180 38 */ 181 - int __qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus) 39 + int __qcom_scm_set_warm_boot_addr(struct device *dev, void *entry, 40 + const cpumask_t *cpus) 182 41 { 183 42 return -ENOTSUPP; 184 43 } ··· 197 52 { 198 53 } 199 54 200 - int __qcom_scm_is_call_available(u32 svc_id, u32 cmd_id) 55 + int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, u32 cmd_id) 201 56 { 202 - return -ENOTSUPP; 57 + int ret; 58 + struct qcom_scm_desc desc = {0}; 59 + struct arm_smccc_res res; 60 + 61 + desc.arginfo = QCOM_SCM_ARGS(1); 62 + desc.args[0] = QCOM_SCM_FNID(svc_id, cmd_id) | 63 + (ARM_SMCCC_OWNER_SIP << ARM_SMCCC_OWNER_SHIFT); 64 + 65 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_INFO, QCOM_IS_CALL_AVAIL_CMD, 66 + &desc, &res); 67 + 68 + return ret ? : res.a1; 203 69 } 204 70 205 - int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) 71 + int __qcom_scm_hdcp_req(struct device *dev, struct qcom_scm_hdcp_req *req, 72 + u32 req_cnt, u32 *resp) 206 73 { 207 - return -ENOTSUPP; 74 + int ret; 75 + struct qcom_scm_desc desc = {0}; 76 + struct arm_smccc_res res; 77 + 78 + if (req_cnt > QCOM_SCM_HDCP_MAX_REQ_CNT) 79 + return -ERANGE; 80 + 81 + desc.args[0] = req[0].addr; 82 + desc.args[1] = req[0].val; 83 + desc.args[2] = req[1].addr; 84 + desc.args[3] = req[1].val; 85 + desc.args[4] = req[2].addr; 86 + desc.args[5] = req[2].val; 87 + desc.args[6] = req[3].addr; 88 + desc.args[7] = req[3].val; 89 + desc.args[8] = req[4].addr; 90 + desc.args[9] = req[4].val; 91 + desc.arginfo = QCOM_SCM_ARGS(10); 92 + 93 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_HDCP, QCOM_SCM_CMD_HDCP, &desc, 94 + &res); 95 + *resp = res.a1; 96 + 97 + return ret; 98 + } 99 + 100 + void __qcom_scm_init(void) 101 + { 102 + u64 cmd; 103 + struct arm_smccc_res res; 104 + u32 function = QCOM_SCM_FNID(QCOM_SCM_SVC_INFO, QCOM_IS_CALL_AVAIL_CMD); 105 + 106 + /* First try a SMC64 call */ 107 + cmd = ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64, 108 + ARM_SMCCC_OWNER_SIP, function); 109 + 110 + arm_smccc_smc(cmd, QCOM_SCM_ARGS(1), cmd & (~BIT(ARM_SMCCC_TYPE_SHIFT)), 111 + 0, 0, 0, 0, 0, &res); 112 + 113 + if (!res.a0 && res.a1) 114 + qcom_smccc_convention = ARM_SMCCC_SMC_64; 115 + else 116 + qcom_smccc_convention = ARM_SMCCC_SMC_32; 117 + } 118 + 119 + bool __qcom_scm_pas_supported(struct device *dev, u32 peripheral) 120 + { 121 + int ret; 122 + struct qcom_scm_desc desc = {0}; 123 + struct arm_smccc_res res; 124 + 125 + desc.args[0] = peripheral; 126 + desc.arginfo = QCOM_SCM_ARGS(1); 127 + 128 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, 129 + QCOM_SCM_PAS_IS_SUPPORTED_CMD, 130 + &desc, &res); 131 + 132 + return ret ? false : !!res.a1; 133 + } 134 + 135 + int __qcom_scm_pas_init_image(struct device *dev, u32 peripheral, 136 + dma_addr_t metadata_phys) 137 + { 138 + int ret; 139 + struct qcom_scm_desc desc = {0}; 140 + struct arm_smccc_res res; 141 + 142 + desc.args[0] = peripheral; 143 + desc.args[1] = metadata_phys; 144 + desc.arginfo = QCOM_SCM_ARGS(2, QCOM_SCM_VAL, QCOM_SCM_RW); 145 + 146 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, QCOM_SCM_PAS_INIT_IMAGE_CMD, 147 + &desc, &res); 148 + 149 + return ret ? : res.a1; 150 + } 151 + 152 + int __qcom_scm_pas_mem_setup(struct device *dev, u32 peripheral, 153 + phys_addr_t addr, phys_addr_t size) 154 + { 155 + int ret; 156 + struct qcom_scm_desc desc = {0}; 157 + struct arm_smccc_res res; 158 + 159 + desc.args[0] = peripheral; 160 + desc.args[1] = addr; 161 + desc.args[2] = size; 162 + desc.arginfo = QCOM_SCM_ARGS(3); 163 + 164 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, QCOM_SCM_PAS_MEM_SETUP_CMD, 165 + &desc, &res); 166 + 167 + return ret ? : res.a1; 168 + } 169 + 170 + int __qcom_scm_pas_auth_and_reset(struct device *dev, u32 peripheral) 171 + { 172 + int ret; 173 + struct qcom_scm_desc desc = {0}; 174 + struct arm_smccc_res res; 175 + 176 + desc.args[0] = peripheral; 177 + desc.arginfo = QCOM_SCM_ARGS(1); 178 + 179 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, 180 + QCOM_SCM_PAS_AUTH_AND_RESET_CMD, 181 + &desc, &res); 182 + 183 + return ret ? : res.a1; 184 + } 185 + 186 + int __qcom_scm_pas_shutdown(struct device *dev, u32 peripheral) 187 + { 188 + int ret; 189 + struct qcom_scm_desc desc = {0}; 190 + struct arm_smccc_res res; 191 + 192 + desc.args[0] = peripheral; 193 + desc.arginfo = QCOM_SCM_ARGS(1); 194 + 195 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, QCOM_SCM_PAS_SHUTDOWN_CMD, 196 + &desc, &res); 197 + 198 + return ret ? : res.a1; 199 + } 200 + 201 + int __qcom_scm_pas_mss_reset(struct device *dev, bool reset) 202 + { 203 + struct qcom_scm_desc desc = {0}; 204 + struct arm_smccc_res res; 205 + int ret; 206 + 207 + desc.args[0] = reset; 208 + desc.args[1] = 0; 209 + desc.arginfo = QCOM_SCM_ARGS(2); 210 + 211 + ret = qcom_scm_call(dev, QCOM_SCM_SVC_PIL, QCOM_SCM_PAS_MSS_RESET, &desc, 212 + &res); 213 + 214 + return ret ? : res.a1; 208 215 }
+342 -11
drivers/firmware/qcom_scm.c
··· 10 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * GNU General Public License for more details. 12 12 * 13 - * You should have received a copy of the GNU General Public License 14 - * along with this program; if not, write to the Free Software 15 - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 - * 02110-1301, USA. 17 13 */ 18 - 14 + #include <linux/platform_device.h> 15 + #include <linux/module.h> 19 16 #include <linux/cpumask.h> 20 17 #include <linux/export.h> 18 + #include <linux/dma-mapping.h> 21 19 #include <linux/types.h> 22 20 #include <linux/qcom_scm.h> 21 + #include <linux/of.h> 22 + #include <linux/of_platform.h> 23 + #include <linux/clk.h> 24 + #include <linux/reset-controller.h> 23 25 24 26 #include "qcom_scm.h" 27 + 28 + struct qcom_scm { 29 + struct device *dev; 30 + struct clk *core_clk; 31 + struct clk *iface_clk; 32 + struct clk *bus_clk; 33 + struct reset_controller_dev reset; 34 + }; 35 + 36 + static struct qcom_scm *__scm; 37 + 38 + static int qcom_scm_clk_enable(void) 39 + { 40 + int ret; 41 + 42 + ret = clk_prepare_enable(__scm->core_clk); 43 + if (ret) 44 + goto bail; 45 + 46 + ret = clk_prepare_enable(__scm->iface_clk); 47 + if (ret) 48 + goto disable_core; 49 + 50 + ret = clk_prepare_enable(__scm->bus_clk); 51 + if (ret) 52 + goto disable_iface; 53 + 54 + return 0; 55 + 56 + disable_iface: 57 + clk_disable_unprepare(__scm->iface_clk); 58 + disable_core: 59 + clk_disable_unprepare(__scm->core_clk); 60 + bail: 61 + return ret; 62 + } 63 + 64 + static void qcom_scm_clk_disable(void) 65 + { 66 + clk_disable_unprepare(__scm->core_clk); 67 + clk_disable_unprepare(__scm->iface_clk); 68 + clk_disable_unprepare(__scm->bus_clk); 69 + } 25 70 26 71 /** 27 72 * qcom_scm_set_cold_boot_addr() - Set the cold boot address for cpus ··· 92 47 */ 93 48 int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus) 94 49 { 95 - return __qcom_scm_set_warm_boot_addr(entry, cpus); 50 + return __qcom_scm_set_warm_boot_addr(__scm->dev, entry, cpus); 96 51 } 97 52 EXPORT_SYMBOL(qcom_scm_set_warm_boot_addr); 98 53 ··· 117 72 */ 118 73 bool qcom_scm_hdcp_available(void) 119 74 { 120 - int ret; 75 + int ret = qcom_scm_clk_enable(); 121 76 122 - ret = __qcom_scm_is_call_available(QCOM_SCM_SVC_HDCP, 123 - QCOM_SCM_CMD_HDCP); 77 + if (ret) 78 + return ret; 124 79 125 - return (ret > 0) ? true : false; 80 + ret = __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_HDCP, 81 + QCOM_SCM_CMD_HDCP); 82 + 83 + qcom_scm_clk_disable(); 84 + 85 + return ret > 0 ? true : false; 126 86 } 127 87 EXPORT_SYMBOL(qcom_scm_hdcp_available); 128 88 ··· 141 91 */ 142 92 int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp) 143 93 { 144 - return __qcom_scm_hdcp_req(req, req_cnt, resp); 94 + int ret = qcom_scm_clk_enable(); 95 + 96 + if (ret) 97 + return ret; 98 + 99 + ret = __qcom_scm_hdcp_req(__scm->dev, req, req_cnt, resp); 100 + qcom_scm_clk_disable(); 101 + return ret; 145 102 } 146 103 EXPORT_SYMBOL(qcom_scm_hdcp_req); 104 + 105 + /** 106 + * qcom_scm_pas_supported() - Check if the peripheral authentication service is 107 + * available for the given peripherial 108 + * @peripheral: peripheral id 109 + * 110 + * Returns true if PAS is supported for this peripheral, otherwise false. 111 + */ 112 + bool qcom_scm_pas_supported(u32 peripheral) 113 + { 114 + int ret; 115 + 116 + ret = __qcom_scm_is_call_available(__scm->dev, QCOM_SCM_SVC_PIL, 117 + QCOM_SCM_PAS_IS_SUPPORTED_CMD); 118 + if (ret <= 0) 119 + return false; 120 + 121 + return __qcom_scm_pas_supported(__scm->dev, peripheral); 122 + } 123 + EXPORT_SYMBOL(qcom_scm_pas_supported); 124 + 125 + /** 126 + * qcom_scm_pas_init_image() - Initialize peripheral authentication service 127 + * state machine for a given peripheral, using the 128 + * metadata 129 + * @peripheral: peripheral id 130 + * @metadata: pointer to memory containing ELF header, program header table 131 + * and optional blob of data used for authenticating the metadata 132 + * and the rest of the firmware 133 + * @size: size of the metadata 134 + * 135 + * Returns 0 on success. 136 + */ 137 + int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size) 138 + { 139 + dma_addr_t mdata_phys; 140 + void *mdata_buf; 141 + int ret; 142 + 143 + /* 144 + * During the scm call memory protection will be enabled for the meta 145 + * data blob, so make sure it's physically contiguous, 4K aligned and 146 + * non-cachable to avoid XPU violations. 147 + */ 148 + mdata_buf = dma_alloc_coherent(__scm->dev, size, &mdata_phys, 149 + GFP_KERNEL); 150 + if (!mdata_buf) { 151 + dev_err(__scm->dev, "Allocation of metadata buffer failed.\n"); 152 + return -ENOMEM; 153 + } 154 + memcpy(mdata_buf, metadata, size); 155 + 156 + ret = qcom_scm_clk_enable(); 157 + if (ret) 158 + goto free_metadata; 159 + 160 + ret = __qcom_scm_pas_init_image(__scm->dev, peripheral, mdata_phys); 161 + 162 + qcom_scm_clk_disable(); 163 + 164 + free_metadata: 165 + dma_free_coherent(__scm->dev, size, mdata_buf, mdata_phys); 166 + 167 + return ret; 168 + } 169 + EXPORT_SYMBOL(qcom_scm_pas_init_image); 170 + 171 + /** 172 + * qcom_scm_pas_mem_setup() - Prepare the memory related to a given peripheral 173 + * for firmware loading 174 + * @peripheral: peripheral id 175 + * @addr: start address of memory area to prepare 176 + * @size: size of the memory area to prepare 177 + * 178 + * Returns 0 on success. 179 + */ 180 + int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, phys_addr_t size) 181 + { 182 + int ret; 183 + 184 + ret = qcom_scm_clk_enable(); 185 + if (ret) 186 + return ret; 187 + 188 + ret = __qcom_scm_pas_mem_setup(__scm->dev, peripheral, addr, size); 189 + qcom_scm_clk_disable(); 190 + 191 + return ret; 192 + } 193 + EXPORT_SYMBOL(qcom_scm_pas_mem_setup); 194 + 195 + /** 196 + * qcom_scm_pas_auth_and_reset() - Authenticate the given peripheral firmware 197 + * and reset the remote processor 198 + * @peripheral: peripheral id 199 + * 200 + * Return 0 on success. 201 + */ 202 + int qcom_scm_pas_auth_and_reset(u32 peripheral) 203 + { 204 + int ret; 205 + 206 + ret = qcom_scm_clk_enable(); 207 + if (ret) 208 + return ret; 209 + 210 + ret = __qcom_scm_pas_auth_and_reset(__scm->dev, peripheral); 211 + qcom_scm_clk_disable(); 212 + 213 + return ret; 214 + } 215 + EXPORT_SYMBOL(qcom_scm_pas_auth_and_reset); 216 + 217 + /** 218 + * qcom_scm_pas_shutdown() - Shut down the remote processor 219 + * @peripheral: peripheral id 220 + * 221 + * Returns 0 on success. 222 + */ 223 + int qcom_scm_pas_shutdown(u32 peripheral) 224 + { 225 + int ret; 226 + 227 + ret = qcom_scm_clk_enable(); 228 + if (ret) 229 + return ret; 230 + 231 + ret = __qcom_scm_pas_shutdown(__scm->dev, peripheral); 232 + qcom_scm_clk_disable(); 233 + 234 + return ret; 235 + } 236 + EXPORT_SYMBOL(qcom_scm_pas_shutdown); 237 + 238 + static int qcom_scm_pas_reset_assert(struct reset_controller_dev *rcdev, 239 + unsigned long idx) 240 + { 241 + if (idx != 0) 242 + return -EINVAL; 243 + 244 + return __qcom_scm_pas_mss_reset(__scm->dev, 1); 245 + } 246 + 247 + static int qcom_scm_pas_reset_deassert(struct reset_controller_dev *rcdev, 248 + unsigned long idx) 249 + { 250 + if (idx != 0) 251 + return -EINVAL; 252 + 253 + return __qcom_scm_pas_mss_reset(__scm->dev, 0); 254 + } 255 + 256 + static const struct reset_control_ops qcom_scm_pas_reset_ops = { 257 + .assert = qcom_scm_pas_reset_assert, 258 + .deassert = qcom_scm_pas_reset_deassert, 259 + }; 260 + 261 + /** 262 + * qcom_scm_is_available() - Checks if SCM is available 263 + */ 264 + bool qcom_scm_is_available(void) 265 + { 266 + return !!__scm; 267 + } 268 + EXPORT_SYMBOL(qcom_scm_is_available); 269 + 270 + static int qcom_scm_probe(struct platform_device *pdev) 271 + { 272 + struct qcom_scm *scm; 273 + int ret; 274 + 275 + scm = devm_kzalloc(&pdev->dev, sizeof(*scm), GFP_KERNEL); 276 + if (!scm) 277 + return -ENOMEM; 278 + 279 + scm->core_clk = devm_clk_get(&pdev->dev, "core"); 280 + if (IS_ERR(scm->core_clk)) { 281 + if (PTR_ERR(scm->core_clk) == -EPROBE_DEFER) 282 + return PTR_ERR(scm->core_clk); 283 + 284 + scm->core_clk = NULL; 285 + } 286 + 287 + if (of_device_is_compatible(pdev->dev.of_node, "qcom,scm")) { 288 + scm->iface_clk = devm_clk_get(&pdev->dev, "iface"); 289 + if (IS_ERR(scm->iface_clk)) { 290 + if (PTR_ERR(scm->iface_clk) != -EPROBE_DEFER) 291 + dev_err(&pdev->dev, "failed to acquire iface clk\n"); 292 + return PTR_ERR(scm->iface_clk); 293 + } 294 + 295 + scm->bus_clk = devm_clk_get(&pdev->dev, "bus"); 296 + if (IS_ERR(scm->bus_clk)) { 297 + if (PTR_ERR(scm->bus_clk) != -EPROBE_DEFER) 298 + dev_err(&pdev->dev, "failed to acquire bus clk\n"); 299 + return PTR_ERR(scm->bus_clk); 300 + } 301 + } 302 + 303 + scm->reset.ops = &qcom_scm_pas_reset_ops; 304 + scm->reset.nr_resets = 1; 305 + scm->reset.of_node = pdev->dev.of_node; 306 + reset_controller_register(&scm->reset); 307 + 308 + /* vote for max clk rate for highest performance */ 309 + ret = clk_set_rate(scm->core_clk, INT_MAX); 310 + if (ret) 311 + return ret; 312 + 313 + __scm = scm; 314 + __scm->dev = &pdev->dev; 315 + 316 + __qcom_scm_init(); 317 + 318 + return 0; 319 + } 320 + 321 + static const struct of_device_id qcom_scm_dt_match[] = { 322 + { .compatible = "qcom,scm-apq8064",}, 323 + { .compatible = "qcom,scm-msm8660",}, 324 + { .compatible = "qcom,scm-msm8960",}, 325 + { .compatible = "qcom,scm",}, 326 + {} 327 + }; 328 + 329 + MODULE_DEVICE_TABLE(of, qcom_scm_dt_match); 330 + 331 + static struct platform_driver qcom_scm_driver = { 332 + .driver = { 333 + .name = "qcom_scm", 334 + .of_match_table = qcom_scm_dt_match, 335 + }, 336 + .probe = qcom_scm_probe, 337 + }; 338 + 339 + static int __init qcom_scm_init(void) 340 + { 341 + struct device_node *np, *fw_np; 342 + int ret; 343 + 344 + fw_np = of_find_node_by_name(NULL, "firmware"); 345 + 346 + if (!fw_np) 347 + return -ENODEV; 348 + 349 + np = of_find_matching_node(fw_np, qcom_scm_dt_match); 350 + 351 + if (!np) { 352 + of_node_put(fw_np); 353 + return -ENODEV; 354 + } 355 + 356 + of_node_put(np); 357 + 358 + ret = of_platform_populate(fw_np, qcom_scm_dt_match, NULL, NULL); 359 + 360 + of_node_put(fw_np); 361 + 362 + if (ret) 363 + return ret; 364 + 365 + return platform_driver_register(&qcom_scm_driver); 366 + } 367 + 368 + subsys_initcall(qcom_scm_init); 369 + 370 + static void __exit qcom_scm_exit(void) 371 + { 372 + platform_driver_unregister(&qcom_scm_driver); 373 + } 374 + module_exit(qcom_scm_exit); 375 + 376 + MODULE_DESCRIPTION("Qualcomm SCM driver"); 377 + MODULE_LICENSE("GPL v2");
+43 -4
drivers/firmware/qcom_scm.h
··· 19 19 #define QCOM_SCM_FLAG_HLOS 0x01 20 20 #define QCOM_SCM_FLAG_COLDBOOT_MC 0x02 21 21 #define QCOM_SCM_FLAG_WARMBOOT_MC 0x04 22 - extern int __qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus); 22 + extern int __qcom_scm_set_warm_boot_addr(struct device *dev, void *entry, 23 + const cpumask_t *cpus); 23 24 extern int __qcom_scm_set_cold_boot_addr(void *entry, const cpumask_t *cpus); 24 25 25 26 #define QCOM_SCM_CMD_TERMINATE_PC 0x2 ··· 30 29 31 30 #define QCOM_SCM_SVC_INFO 0x6 32 31 #define QCOM_IS_CALL_AVAIL_CMD 0x1 33 - extern int __qcom_scm_is_call_available(u32 svc_id, u32 cmd_id); 32 + extern int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, 33 + u32 cmd_id); 34 34 35 35 #define QCOM_SCM_SVC_HDCP 0x11 36 36 #define QCOM_SCM_CMD_HDCP 0x01 37 - extern int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, 38 - u32 *resp); 37 + extern int __qcom_scm_hdcp_req(struct device *dev, 38 + struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp); 39 + 40 + extern void __qcom_scm_init(void); 41 + 42 + #define QCOM_SCM_SVC_PIL 0x2 43 + #define QCOM_SCM_PAS_INIT_IMAGE_CMD 0x1 44 + #define QCOM_SCM_PAS_MEM_SETUP_CMD 0x2 45 + #define QCOM_SCM_PAS_AUTH_AND_RESET_CMD 0x5 46 + #define QCOM_SCM_PAS_SHUTDOWN_CMD 0x6 47 + #define QCOM_SCM_PAS_IS_SUPPORTED_CMD 0x7 48 + #define QCOM_SCM_PAS_MSS_RESET 0xa 49 + extern bool __qcom_scm_pas_supported(struct device *dev, u32 peripheral); 50 + extern int __qcom_scm_pas_init_image(struct device *dev, u32 peripheral, 51 + dma_addr_t metadata_phys); 52 + extern int __qcom_scm_pas_mem_setup(struct device *dev, u32 peripheral, 53 + phys_addr_t addr, phys_addr_t size); 54 + extern int __qcom_scm_pas_auth_and_reset(struct device *dev, u32 peripheral); 55 + extern int __qcom_scm_pas_shutdown(struct device *dev, u32 peripheral); 56 + extern int __qcom_scm_pas_mss_reset(struct device *dev, bool reset); 39 57 40 58 /* common error codes */ 59 + #define QCOM_SCM_V2_EBUSY -12 41 60 #define QCOM_SCM_ENOMEM -5 42 61 #define QCOM_SCM_EOPNOTSUPP -4 43 62 #define QCOM_SCM_EINVAL_ADDR -3 44 63 #define QCOM_SCM_EINVAL_ARG -2 45 64 #define QCOM_SCM_ERROR -1 46 65 #define QCOM_SCM_INTERRUPTED 1 66 + 67 + static inline int qcom_scm_remap_error(int err) 68 + { 69 + switch (err) { 70 + case QCOM_SCM_ERROR: 71 + return -EIO; 72 + case QCOM_SCM_EINVAL_ADDR: 73 + case QCOM_SCM_EINVAL_ARG: 74 + return -EINVAL; 75 + case QCOM_SCM_EOPNOTSUPP: 76 + return -EOPNOTSUPP; 77 + case QCOM_SCM_ENOMEM: 78 + return -ENOMEM; 79 + case QCOM_SCM_V2_EBUSY: 80 + return -EBUSY; 81 + } 82 + return -EINVAL; 83 + } 47 84 48 85 #endif
+163
drivers/firmware/scpi_pm_domain.c
··· 1 + /* 2 + * SCPI Generic power domain support. 3 + * 4 + * Copyright (C) 2016 ARM Ltd. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms and conditions of the GNU General Public License, 8 + * version 2, as published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + * 15 + * You should have received a copy of the GNU General Public License along 16 + * with this program. If not, see <http://www.gnu.org/licenses/>. 17 + */ 18 + 19 + #include <linux/err.h> 20 + #include <linux/io.h> 21 + #include <linux/module.h> 22 + #include <linux/of_platform.h> 23 + #include <linux/pm_domain.h> 24 + #include <linux/scpi_protocol.h> 25 + 26 + struct scpi_pm_domain { 27 + struct generic_pm_domain genpd; 28 + struct scpi_ops *ops; 29 + u32 domain; 30 + char name[30]; 31 + }; 32 + 33 + /* 34 + * These device power state values are not well-defined in the specification. 35 + * In case, different implementations use different values, we can make these 36 + * specific to compatibles rather than getting these values from device tree. 37 + */ 38 + enum scpi_power_domain_state { 39 + SCPI_PD_STATE_ON = 0, 40 + SCPI_PD_STATE_OFF = 3, 41 + }; 42 + 43 + #define to_scpi_pd(gpd) container_of(gpd, struct scpi_pm_domain, genpd) 44 + 45 + static int scpi_pd_power(struct scpi_pm_domain *pd, bool power_on) 46 + { 47 + int ret; 48 + enum scpi_power_domain_state state; 49 + 50 + if (power_on) 51 + state = SCPI_PD_STATE_ON; 52 + else 53 + state = SCPI_PD_STATE_OFF; 54 + 55 + ret = pd->ops->device_set_power_state(pd->domain, state); 56 + if (ret) 57 + return ret; 58 + 59 + return !(state == pd->ops->device_get_power_state(pd->domain)); 60 + } 61 + 62 + static int scpi_pd_power_on(struct generic_pm_domain *domain) 63 + { 64 + struct scpi_pm_domain *pd = to_scpi_pd(domain); 65 + 66 + return scpi_pd_power(pd, true); 67 + } 68 + 69 + static int scpi_pd_power_off(struct generic_pm_domain *domain) 70 + { 71 + struct scpi_pm_domain *pd = to_scpi_pd(domain); 72 + 73 + return scpi_pd_power(pd, false); 74 + } 75 + 76 + static int scpi_pm_domain_probe(struct platform_device *pdev) 77 + { 78 + struct device *dev = &pdev->dev; 79 + struct device_node *np = dev->of_node; 80 + struct scpi_pm_domain *scpi_pd; 81 + struct genpd_onecell_data *scpi_pd_data; 82 + struct generic_pm_domain **domains; 83 + struct scpi_ops *scpi_ops; 84 + int ret, num_domains, i; 85 + 86 + scpi_ops = get_scpi_ops(); 87 + if (!scpi_ops) 88 + return -EPROBE_DEFER; 89 + 90 + if (!np) { 91 + dev_err(dev, "device tree node not found\n"); 92 + return -ENODEV; 93 + } 94 + 95 + if (!scpi_ops->device_set_power_state || 96 + !scpi_ops->device_get_power_state) { 97 + dev_err(dev, "power domains not supported in the firmware\n"); 98 + return -ENODEV; 99 + } 100 + 101 + ret = of_property_read_u32(np, "num-domains", &num_domains); 102 + if (ret) { 103 + dev_err(dev, "number of domains not found\n"); 104 + return -EINVAL; 105 + } 106 + 107 + scpi_pd = devm_kcalloc(dev, num_domains, sizeof(*scpi_pd), GFP_KERNEL); 108 + if (!scpi_pd) 109 + return -ENOMEM; 110 + 111 + scpi_pd_data = devm_kzalloc(dev, sizeof(*scpi_pd_data), GFP_KERNEL); 112 + if (!scpi_pd_data) 113 + return -ENOMEM; 114 + 115 + domains = devm_kcalloc(dev, num_domains, sizeof(*domains), GFP_KERNEL); 116 + if (!domains) 117 + return -ENOMEM; 118 + 119 + for (i = 0; i < num_domains; i++, scpi_pd++) { 120 + domains[i] = &scpi_pd->genpd; 121 + 122 + scpi_pd->domain = i; 123 + scpi_pd->ops = scpi_ops; 124 + sprintf(scpi_pd->name, "%s.%d", np->name, i); 125 + scpi_pd->genpd.name = scpi_pd->name; 126 + scpi_pd->genpd.power_off = scpi_pd_power_off; 127 + scpi_pd->genpd.power_on = scpi_pd_power_on; 128 + 129 + /* 130 + * Treat all power domains as off at boot. 131 + * 132 + * The SCP firmware itself may have switched on some domains, 133 + * but for reference counting purpose, keep it this way. 134 + */ 135 + pm_genpd_init(&scpi_pd->genpd, NULL, true); 136 + } 137 + 138 + scpi_pd_data->domains = domains; 139 + scpi_pd_data->num_domains = num_domains; 140 + 141 + of_genpd_add_provider_onecell(np, scpi_pd_data); 142 + 143 + return 0; 144 + } 145 + 146 + static const struct of_device_id scpi_power_domain_ids[] = { 147 + { .compatible = "arm,scpi-power-domains", }, 148 + { /* sentinel */ } 149 + }; 150 + MODULE_DEVICE_TABLE(of, scpi_power_domain_ids); 151 + 152 + static struct platform_driver scpi_power_domain_driver = { 153 + .driver = { 154 + .name = "scpi_power_domain", 155 + .of_match_table = scpi_power_domain_ids, 156 + }, 157 + .probe = scpi_pm_domain_probe, 158 + }; 159 + module_platform_driver(scpi_power_domain_driver); 160 + 161 + MODULE_AUTHOR("Sudeep Holla <sudeep.holla@arm.com>"); 162 + MODULE_DESCRIPTION("ARM SCPI power domain driver"); 163 + MODULE_LICENSE("GPL v2");
+2 -2
drivers/input/keyboard/clps711x-keypad.c
··· 101 101 return -ENOMEM; 102 102 103 103 priv->syscon = 104 - syscon_regmap_lookup_by_compatible("cirrus,clps711x-syscon1"); 104 + syscon_regmap_lookup_by_compatible("cirrus,ep7209-syscon1"); 105 105 if (IS_ERR(priv->syscon)) 106 106 return PTR_ERR(priv->syscon); 107 107 ··· 181 181 } 182 182 183 183 static const struct of_device_id clps711x_keypad_of_match[] = { 184 - { .compatible = "cirrus,clps711x-keypad", }, 184 + { .compatible = "cirrus,ep7209-keypad", }, 185 185 { } 186 186 }; 187 187 MODULE_DEVICE_TABLE(of, clps711x_keypad_of_match);
+1 -1
drivers/irqchip/irq-clps711x.c
··· 234 234 235 235 return _clps711x_intc_init(np, res.start, resource_size(&res)); 236 236 } 237 - IRQCHIP_DECLARE(clps711x, "cirrus,clps711x-intc", clps711x_intc_init_dt); 237 + IRQCHIP_DECLARE(clps711x, "cirrus,ep7209-intc", clps711x_intc_init_dt); 238 238 #endif
+1 -1
drivers/media/rc/Kconfig
··· 336 336 337 337 config IR_RX51 338 338 tristate "Nokia N900 IR transmitter diode" 339 - depends on OMAP_DM_TIMER && ARCH_OMAP2PLUS && LIRC && !ARCH_MULTIPLATFORM 339 + depends on OMAP_DM_TIMER && PWM_OMAP_DMTIMER && ARCH_OMAP2PLUS && LIRC 340 340 ---help--- 341 341 Say Y or M here if you want to enable support for the IR 342 342 transmitter diode built in the Nokia N900 (RX51) device.
+78 -151
drivers/media/rc/ir-rx51.c
··· 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 - * 20 15 */ 21 - 16 + #include <linux/clk.h> 22 17 #include <linux/module.h> 23 18 #include <linux/interrupt.h> 24 19 #include <linux/uaccess.h> 25 20 #include <linux/platform_device.h> 26 21 #include <linux/sched.h> 27 22 #include <linux/wait.h> 28 - 29 - #include <plat/dmtimer.h> 30 - #include <plat/clock.h> 23 + #include <linux/pwm.h> 24 + #include <linux/of.h> 25 + #include <linux/hrtimer.h> 31 26 32 27 #include <media/lirc.h> 33 28 #include <media/lirc_dev.h> ··· 36 41 37 42 #define WBUF_LEN 256 38 43 39 - #define TIMER_MAX_VALUE 0xffffffff 40 - 41 44 struct lirc_rx51 { 42 - struct omap_dm_timer *pwm_timer; 43 - struct omap_dm_timer *pulse_timer; 45 + struct pwm_device *pwm; 46 + struct hrtimer timer; 44 47 struct device *dev; 45 48 struct lirc_rx51_platform_data *pdata; 46 49 wait_queue_head_t wqueue; 47 50 48 - unsigned long fclk_khz; 49 51 unsigned int freq; /* carrier frequency */ 50 52 unsigned int duty_cycle; /* carrier duty cycle */ 51 - unsigned int irq_num; 52 - unsigned int match; 53 53 int wbuf[WBUF_LEN]; 54 54 int wbuf_index; 55 55 unsigned long device_is_open; 56 - int pwm_timer_num; 57 56 }; 58 57 59 - static void lirc_rx51_on(struct lirc_rx51 *lirc_rx51) 58 + static inline void lirc_rx51_on(struct lirc_rx51 *lirc_rx51) 60 59 { 61 - omap_dm_timer_set_pwm(lirc_rx51->pwm_timer, 0, 1, 62 - OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE); 60 + pwm_enable(lirc_rx51->pwm); 63 61 } 64 62 65 - static void lirc_rx51_off(struct lirc_rx51 *lirc_rx51) 63 + static inline void lirc_rx51_off(struct lirc_rx51 *lirc_rx51) 66 64 { 67 - omap_dm_timer_set_pwm(lirc_rx51->pwm_timer, 0, 1, 68 - OMAP_TIMER_TRIGGER_NONE); 65 + pwm_disable(lirc_rx51->pwm); 69 66 } 70 67 71 68 static int init_timing_params(struct lirc_rx51 *lirc_rx51) 72 69 { 73 - u32 load, match; 70 + struct pwm_device *pwm = lirc_rx51->pwm; 71 + int duty, period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, lirc_rx51->freq); 74 72 75 - load = -(lirc_rx51->fclk_khz * 1000 / lirc_rx51->freq); 76 - match = -(lirc_rx51->duty_cycle * -load / 100); 77 - omap_dm_timer_set_load(lirc_rx51->pwm_timer, 1, load); 78 - omap_dm_timer_set_match(lirc_rx51->pwm_timer, 1, match); 79 - omap_dm_timer_write_counter(lirc_rx51->pwm_timer, TIMER_MAX_VALUE - 2); 80 - omap_dm_timer_start(lirc_rx51->pwm_timer); 81 - omap_dm_timer_set_int_enable(lirc_rx51->pulse_timer, 0); 82 - omap_dm_timer_start(lirc_rx51->pulse_timer); 73 + duty = DIV_ROUND_CLOSEST(lirc_rx51->duty_cycle * period, 100); 83 74 84 - lirc_rx51->match = 0; 75 + pwm_config(pwm, duty, period); 85 76 86 77 return 0; 87 78 } 88 79 89 - #define tics_after(a, b) ((long)(b) - (long)(a) < 0) 90 - 91 - static int pulse_timer_set_timeout(struct lirc_rx51 *lirc_rx51, int usec) 80 + static enum hrtimer_restart lirc_rx51_timer_cb(struct hrtimer *timer) 92 81 { 93 - int counter; 82 + struct lirc_rx51 *lirc_rx51 = 83 + container_of(timer, struct lirc_rx51, timer); 84 + ktime_t now; 94 85 95 - BUG_ON(usec < 0); 96 - 97 - if (lirc_rx51->match == 0) 98 - counter = omap_dm_timer_read_counter(lirc_rx51->pulse_timer); 99 - else 100 - counter = lirc_rx51->match; 101 - 102 - counter += (u32)(lirc_rx51->fclk_khz * usec / (1000)); 103 - omap_dm_timer_set_match(lirc_rx51->pulse_timer, 1, counter); 104 - omap_dm_timer_set_int_enable(lirc_rx51->pulse_timer, 105 - OMAP_TIMER_INT_MATCH); 106 - if (tics_after(omap_dm_timer_read_counter(lirc_rx51->pulse_timer), 107 - counter)) { 108 - return 1; 109 - } 110 - return 0; 111 - } 112 - 113 - static irqreturn_t lirc_rx51_interrupt_handler(int irq, void *ptr) 114 - { 115 - unsigned int retval; 116 - struct lirc_rx51 *lirc_rx51 = ptr; 117 - 118 - retval = omap_dm_timer_read_status(lirc_rx51->pulse_timer); 119 - if (!retval) 120 - return IRQ_NONE; 121 - 122 - if (retval & ~OMAP_TIMER_INT_MATCH) 123 - dev_err_ratelimited(lirc_rx51->dev, 124 - ": Unexpected interrupt source: %x\n", retval); 125 - 126 - omap_dm_timer_write_status(lirc_rx51->pulse_timer, 127 - OMAP_TIMER_INT_MATCH | 128 - OMAP_TIMER_INT_OVERFLOW | 129 - OMAP_TIMER_INT_CAPTURE); 130 86 if (lirc_rx51->wbuf_index < 0) { 131 87 dev_err_ratelimited(lirc_rx51->dev, 132 - ": BUG wbuf_index has value of %i\n", 88 + "BUG wbuf_index has value of %i\n", 133 89 lirc_rx51->wbuf_index); 134 90 goto end; 135 91 } ··· 90 144 * pulses until we catch up. 91 145 */ 92 146 do { 147 + u64 ns; 148 + 93 149 if (lirc_rx51->wbuf_index >= WBUF_LEN) 94 150 goto end; 95 151 if (lirc_rx51->wbuf[lirc_rx51->wbuf_index] == -1) ··· 102 154 else 103 155 lirc_rx51_on(lirc_rx51); 104 156 105 - retval = pulse_timer_set_timeout(lirc_rx51, 106 - lirc_rx51->wbuf[lirc_rx51->wbuf_index]); 157 + ns = 1000 * lirc_rx51->wbuf[lirc_rx51->wbuf_index]; 158 + hrtimer_add_expires_ns(timer, ns); 159 + 107 160 lirc_rx51->wbuf_index++; 108 161 109 - } while (retval); 162 + now = timer->base->get_time(); 110 163 111 - return IRQ_HANDLED; 164 + } while (hrtimer_get_expires_tv64(timer) < now.tv64); 165 + 166 + return HRTIMER_RESTART; 112 167 end: 113 168 /* Stop TX here */ 114 169 lirc_rx51_off(lirc_rx51); 115 170 lirc_rx51->wbuf_index = -1; 116 - omap_dm_timer_stop(lirc_rx51->pwm_timer); 117 - omap_dm_timer_stop(lirc_rx51->pulse_timer); 118 - omap_dm_timer_set_int_enable(lirc_rx51->pulse_timer, 0); 171 + 119 172 wake_up_interruptible(&lirc_rx51->wqueue); 120 173 121 - return IRQ_HANDLED; 122 - } 123 - 124 - static int lirc_rx51_init_port(struct lirc_rx51 *lirc_rx51) 125 - { 126 - struct clk *clk_fclk; 127 - int retval, pwm_timer = lirc_rx51->pwm_timer_num; 128 - 129 - lirc_rx51->pwm_timer = omap_dm_timer_request_specific(pwm_timer); 130 - if (lirc_rx51->pwm_timer == NULL) { 131 - dev_err(lirc_rx51->dev, ": Error requesting GPT%d timer\n", 132 - pwm_timer); 133 - return -EBUSY; 134 - } 135 - 136 - lirc_rx51->pulse_timer = omap_dm_timer_request(); 137 - if (lirc_rx51->pulse_timer == NULL) { 138 - dev_err(lirc_rx51->dev, ": Error requesting pulse timer\n"); 139 - retval = -EBUSY; 140 - goto err1; 141 - } 142 - 143 - omap_dm_timer_set_source(lirc_rx51->pwm_timer, OMAP_TIMER_SRC_SYS_CLK); 144 - omap_dm_timer_set_source(lirc_rx51->pulse_timer, 145 - OMAP_TIMER_SRC_SYS_CLK); 146 - 147 - omap_dm_timer_enable(lirc_rx51->pwm_timer); 148 - omap_dm_timer_enable(lirc_rx51->pulse_timer); 149 - 150 - lirc_rx51->irq_num = omap_dm_timer_get_irq(lirc_rx51->pulse_timer); 151 - retval = request_irq(lirc_rx51->irq_num, lirc_rx51_interrupt_handler, 152 - IRQF_SHARED, "lirc_pulse_timer", lirc_rx51); 153 - if (retval) { 154 - dev_err(lirc_rx51->dev, ": Failed to request interrupt line\n"); 155 - goto err2; 156 - } 157 - 158 - clk_fclk = omap_dm_timer_get_fclk(lirc_rx51->pwm_timer); 159 - lirc_rx51->fclk_khz = clk_fclk->rate / 1000; 160 - 161 - return 0; 162 - 163 - err2: 164 - omap_dm_timer_free(lirc_rx51->pulse_timer); 165 - err1: 166 - omap_dm_timer_free(lirc_rx51->pwm_timer); 167 - 168 - return retval; 169 - } 170 - 171 - static int lirc_rx51_free_port(struct lirc_rx51 *lirc_rx51) 172 - { 173 - omap_dm_timer_set_int_enable(lirc_rx51->pulse_timer, 0); 174 - free_irq(lirc_rx51->irq_num, lirc_rx51); 175 - lirc_rx51_off(lirc_rx51); 176 - omap_dm_timer_disable(lirc_rx51->pwm_timer); 177 - omap_dm_timer_disable(lirc_rx51->pulse_timer); 178 - omap_dm_timer_free(lirc_rx51->pwm_timer); 179 - omap_dm_timer_free(lirc_rx51->pulse_timer); 180 - lirc_rx51->wbuf_index = -1; 181 - 182 - return 0; 174 + return HRTIMER_NORESTART; 183 175 } 184 176 185 177 static ssize_t lirc_rx51_write(struct file *file, const char *buf, ··· 158 270 159 271 lirc_rx51_on(lirc_rx51); 160 272 lirc_rx51->wbuf_index = 1; 161 - pulse_timer_set_timeout(lirc_rx51, lirc_rx51->wbuf[0]); 162 - 273 + hrtimer_start(&lirc_rx51->timer, 274 + ns_to_ktime(1000 * lirc_rx51->wbuf[0]), 275 + HRTIMER_MODE_REL); 163 276 /* 164 277 * Don't return back to the userspace until the transfer has 165 278 * finished ··· 260 371 if (test_and_set_bit(1, &lirc_rx51->device_is_open)) 261 372 return -EBUSY; 262 373 263 - return lirc_rx51_init_port(lirc_rx51); 374 + lirc_rx51->pwm = pwm_get(lirc_rx51->dev, NULL); 375 + if (IS_ERR(lirc_rx51->pwm)) { 376 + int res = PTR_ERR(lirc_rx51->pwm); 377 + 378 + dev_err(lirc_rx51->dev, "pwm_get failed: %d\n", res); 379 + return res; 380 + } 381 + 382 + return 0; 264 383 } 265 384 266 385 static int lirc_rx51_release(struct inode *inode, struct file *file) 267 386 { 268 387 struct lirc_rx51 *lirc_rx51 = file->private_data; 269 388 270 - lirc_rx51_free_port(lirc_rx51); 389 + hrtimer_cancel(&lirc_rx51->timer); 390 + lirc_rx51_off(lirc_rx51); 391 + pwm_put(lirc_rx51->pwm); 271 392 272 393 clear_bit(1, &lirc_rx51->device_is_open); 273 394 ··· 285 386 } 286 387 287 388 static struct lirc_rx51 lirc_rx51 = { 288 - .freq = 38000, 289 389 .duty_cycle = 50, 290 390 .wbuf_index = -1, 291 391 }; ··· 342 444 343 445 static int lirc_rx51_probe(struct platform_device *dev) 344 446 { 447 + struct pwm_device *pwm; 448 + 345 449 lirc_rx51_driver.features = LIRC_RX51_DRIVER_FEATURES; 346 450 lirc_rx51.pdata = dev->dev.platform_data; 347 - lirc_rx51.pwm_timer_num = lirc_rx51.pdata->pwm_timer; 451 + 452 + if (!lirc_rx51.pdata) { 453 + dev_err(&dev->dev, "Platform Data is missing\n"); 454 + return -ENXIO; 455 + } 456 + 457 + pwm = pwm_get(&dev->dev, NULL); 458 + if (IS_ERR(pwm)) { 459 + int err = PTR_ERR(pwm); 460 + 461 + if (err != -EPROBE_DEFER) 462 + dev_err(&dev->dev, "pwm_get failed: %d\n", err); 463 + return err; 464 + } 465 + 466 + /* Use default, in case userspace does not set the carrier */ 467 + lirc_rx51.freq = DIV_ROUND_CLOSEST(pwm_get_period(pwm), NSEC_PER_SEC); 468 + pwm_put(pwm); 469 + 470 + hrtimer_init(&lirc_rx51.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 471 + lirc_rx51.timer.function = lirc_rx51_timer_cb; 472 + 348 473 lirc_rx51.dev = &dev->dev; 349 474 lirc_rx51_driver.dev = &dev->dev; 350 475 lirc_rx51_driver.minor = lirc_register_driver(&lirc_rx51_driver); ··· 378 457 lirc_rx51_driver.minor); 379 458 return lirc_rx51_driver.minor; 380 459 } 381 - dev_info(lirc_rx51.dev, "registration ok, minor: %d, pwm: %d\n", 382 - lirc_rx51_driver.minor, lirc_rx51.pwm_timer_num); 383 460 384 461 return 0; 385 462 } ··· 387 468 return lirc_unregister_driver(lirc_rx51_driver.minor); 388 469 } 389 470 471 + static const struct of_device_id lirc_rx51_match[] = { 472 + { 473 + .compatible = "nokia,n900-ir", 474 + }, 475 + {}, 476 + }; 477 + MODULE_DEVICE_TABLE(of, lirc_rx51_match); 478 + 390 479 struct platform_driver lirc_rx51_platform_driver = { 391 480 .probe = lirc_rx51_probe, 392 481 .remove = lirc_rx51_remove, ··· 402 475 .resume = lirc_rx51_resume, 403 476 .driver = { 404 477 .name = DRIVER_NAME, 405 - .owner = THIS_MODULE, 478 + .of_match_table = of_match_ptr(lirc_rx51_match), 406 479 }, 407 480 }; 408 481 module_platform_driver(lirc_rx51_platform_driver);
+11
drivers/memory/Kconfig
··· 25 25 Starting with the at91sam9g45, this controller supports SDR, DDR and 26 26 LP-DDR memories. 27 27 28 + config ATMEL_EBI 29 + bool "Atmel EBI driver" 30 + default y 31 + depends on ARCH_AT91 && OF 32 + select MFD_SYSCON 33 + help 34 + Driver for Atmel EBI controller. 35 + Used to configure the EBI (external bus interface) when the device- 36 + tree is used. This bus supports NANDs, external ethernet controller, 37 + SRAMs, ATA devices, etc. 38 + 28 39 config TI_AEMIF 29 40 tristate "Texas Instruments AEMIF driver" 30 41 depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF
+1
drivers/memory/Makefile
··· 7 7 endif 8 8 obj-$(CONFIG_ARM_PL172_MPMC) += pl172.o 9 9 obj-$(CONFIG_ATMEL_SDRAMC) += atmel-sdramc.o 10 + obj-$(CONFIG_ATMEL_EBI) += atmel-ebi.o 10 11 obj-$(CONFIG_TI_AEMIF) += ti-aemif.o 11 12 obj-$(CONFIG_TI_EMIF) += emif.o 12 13 obj-$(CONFIG_OMAP_GPMC) += omap-gpmc.o
+766
drivers/memory/atmel-ebi.c
··· 1 + /* 2 + * EBI driver for Atmel chips 3 + * inspired by the fsl weim bus driver 4 + * 5 + * Copyright (C) 2013 Jean-Jacques Hiblot <jjhiblot@traphandler.com> 6 + * 7 + * This file is licensed under the terms of the GNU General Public 8 + * License version 2. This program is licensed "as is" without any 9 + * warranty of any kind, whether express or implied. 10 + */ 11 + 12 + #include <linux/clk.h> 13 + #include <linux/io.h> 14 + #include <linux/mfd/syscon.h> 15 + #include <linux/mfd/syscon/atmel-matrix.h> 16 + #include <linux/mfd/syscon/atmel-smc.h> 17 + #include <linux/init.h> 18 + #include <linux/of_device.h> 19 + #include <linux/regmap.h> 20 + 21 + struct at91sam9_smc_timings { 22 + u32 ncs_rd_setup_ns; 23 + u32 nrd_setup_ns; 24 + u32 ncs_wr_setup_ns; 25 + u32 nwe_setup_ns; 26 + u32 ncs_rd_pulse_ns; 27 + u32 nrd_pulse_ns; 28 + u32 ncs_wr_pulse_ns; 29 + u32 nwe_pulse_ns; 30 + u32 nrd_cycle_ns; 31 + u32 nwe_cycle_ns; 32 + u32 tdf_ns; 33 + }; 34 + 35 + struct at91sam9_smc_generic_fields { 36 + struct regmap_field *setup; 37 + struct regmap_field *pulse; 38 + struct regmap_field *cycle; 39 + struct regmap_field *mode; 40 + }; 41 + 42 + struct at91sam9_ebi_dev_config { 43 + struct at91sam9_smc_timings timings; 44 + u32 mode; 45 + }; 46 + 47 + struct at91_ebi_dev_config { 48 + int cs; 49 + union { 50 + struct at91sam9_ebi_dev_config sam9; 51 + }; 52 + }; 53 + 54 + struct at91_ebi; 55 + 56 + struct at91_ebi_dev { 57 + struct list_head node; 58 + struct at91_ebi *ebi; 59 + u32 mode; 60 + int numcs; 61 + struct at91_ebi_dev_config configs[]; 62 + }; 63 + 64 + struct at91_ebi_caps { 65 + unsigned int available_cs; 66 + const struct reg_field *ebi_csa; 67 + void (*get_config)(struct at91_ebi_dev *ebid, 68 + struct at91_ebi_dev_config *conf); 69 + int (*xlate_config)(struct at91_ebi_dev *ebid, 70 + struct device_node *configs_np, 71 + struct at91_ebi_dev_config *conf); 72 + int (*apply_config)(struct at91_ebi_dev *ebid, 73 + struct at91_ebi_dev_config *conf); 74 + int (*init)(struct at91_ebi *ebi); 75 + }; 76 + 77 + struct at91_ebi { 78 + struct clk *clk; 79 + struct regmap *smc; 80 + struct regmap *matrix; 81 + 82 + struct regmap_field *ebi_csa; 83 + 84 + struct device *dev; 85 + const struct at91_ebi_caps *caps; 86 + struct list_head devs; 87 + union { 88 + struct at91sam9_smc_generic_fields sam9; 89 + }; 90 + }; 91 + 92 + static void at91sam9_ebi_get_config(struct at91_ebi_dev *ebid, 93 + struct at91_ebi_dev_config *conf) 94 + { 95 + struct at91sam9_smc_generic_fields *fields = &ebid->ebi->sam9; 96 + unsigned int clk_rate = clk_get_rate(ebid->ebi->clk); 97 + struct at91sam9_ebi_dev_config *config = &conf->sam9; 98 + struct at91sam9_smc_timings *timings = &config->timings; 99 + unsigned int val; 100 + 101 + regmap_fields_read(fields->mode, conf->cs, &val); 102 + config->mode = val & ~AT91_SMC_TDF; 103 + 104 + val = (val & AT91_SMC_TDF) >> 16; 105 + timings->tdf_ns = clk_rate * val; 106 + 107 + regmap_fields_read(fields->setup, conf->cs, &val); 108 + timings->ncs_rd_setup_ns = (val >> 24) & 0x1f; 109 + timings->ncs_rd_setup_ns += ((val >> 29) & 0x1) * 128; 110 + timings->ncs_rd_setup_ns *= clk_rate; 111 + timings->nrd_setup_ns = (val >> 16) & 0x1f; 112 + timings->nrd_setup_ns += ((val >> 21) & 0x1) * 128; 113 + timings->nrd_setup_ns *= clk_rate; 114 + timings->ncs_wr_setup_ns = (val >> 8) & 0x1f; 115 + timings->ncs_wr_setup_ns += ((val >> 13) & 0x1) * 128; 116 + timings->ncs_wr_setup_ns *= clk_rate; 117 + timings->nwe_setup_ns = val & 0x1f; 118 + timings->nwe_setup_ns += ((val >> 5) & 0x1) * 128; 119 + timings->nwe_setup_ns *= clk_rate; 120 + 121 + regmap_fields_read(fields->pulse, conf->cs, &val); 122 + timings->ncs_rd_pulse_ns = (val >> 24) & 0x3f; 123 + timings->ncs_rd_pulse_ns += ((val >> 30) & 0x1) * 256; 124 + timings->ncs_rd_pulse_ns *= clk_rate; 125 + timings->nrd_pulse_ns = (val >> 16) & 0x3f; 126 + timings->nrd_pulse_ns += ((val >> 22) & 0x1) * 256; 127 + timings->nrd_pulse_ns *= clk_rate; 128 + timings->ncs_wr_pulse_ns = (val >> 8) & 0x3f; 129 + timings->ncs_wr_pulse_ns += ((val >> 14) & 0x1) * 256; 130 + timings->ncs_wr_pulse_ns *= clk_rate; 131 + timings->nwe_pulse_ns = val & 0x3f; 132 + timings->nwe_pulse_ns += ((val >> 6) & 0x1) * 256; 133 + timings->nwe_pulse_ns *= clk_rate; 134 + 135 + regmap_fields_read(fields->cycle, conf->cs, &val); 136 + timings->nrd_cycle_ns = (val >> 16) & 0x7f; 137 + timings->nrd_cycle_ns += ((val >> 23) & 0x3) * 256; 138 + timings->nrd_cycle_ns *= clk_rate; 139 + timings->nwe_cycle_ns = val & 0x7f; 140 + timings->nwe_cycle_ns += ((val >> 7) & 0x3) * 256; 141 + timings->nwe_cycle_ns *= clk_rate; 142 + } 143 + 144 + static int at91_xlate_timing(struct device_node *np, const char *prop, 145 + u32 *val, bool *required) 146 + { 147 + if (!of_property_read_u32(np, prop, val)) { 148 + *required = true; 149 + return 0; 150 + } 151 + 152 + if (*required) 153 + return -EINVAL; 154 + 155 + return 0; 156 + } 157 + 158 + static int at91sam9_smc_xslate_timings(struct at91_ebi_dev *ebid, 159 + struct device_node *np, 160 + struct at91sam9_smc_timings *timings, 161 + bool *required) 162 + { 163 + int ret; 164 + 165 + ret = at91_xlate_timing(np, "atmel,smc-ncs-rd-setup-ns", 166 + &timings->ncs_rd_setup_ns, required); 167 + if (ret) 168 + goto out; 169 + 170 + ret = at91_xlate_timing(np, "atmel,smc-nrd-setup-ns", 171 + &timings->nrd_setup_ns, required); 172 + if (ret) 173 + goto out; 174 + 175 + ret = at91_xlate_timing(np, "atmel,smc-ncs-wr-setup-ns", 176 + &timings->ncs_wr_setup_ns, required); 177 + if (ret) 178 + goto out; 179 + 180 + ret = at91_xlate_timing(np, "atmel,smc-nwe-setup-ns", 181 + &timings->nwe_setup_ns, required); 182 + if (ret) 183 + goto out; 184 + 185 + ret = at91_xlate_timing(np, "atmel,smc-ncs-rd-pulse-ns", 186 + &timings->ncs_rd_pulse_ns, required); 187 + if (ret) 188 + goto out; 189 + 190 + ret = at91_xlate_timing(np, "atmel,smc-nrd-pulse-ns", 191 + &timings->nrd_pulse_ns, required); 192 + if (ret) 193 + goto out; 194 + 195 + ret = at91_xlate_timing(np, "atmel,smc-ncs-wr-pulse-ns", 196 + &timings->ncs_wr_pulse_ns, required); 197 + if (ret) 198 + goto out; 199 + 200 + ret = at91_xlate_timing(np, "atmel,smc-nwe-pulse-ns", 201 + &timings->nwe_pulse_ns, required); 202 + if (ret) 203 + goto out; 204 + 205 + ret = at91_xlate_timing(np, "atmel,smc-nwe-cycle-ns", 206 + &timings->nwe_cycle_ns, required); 207 + if (ret) 208 + goto out; 209 + 210 + ret = at91_xlate_timing(np, "atmel,smc-nrd-cycle-ns", 211 + &timings->nrd_cycle_ns, required); 212 + if (ret) 213 + goto out; 214 + 215 + ret = at91_xlate_timing(np, "atmel,smc-tdf-ns", 216 + &timings->tdf_ns, required); 217 + 218 + out: 219 + if (ret) 220 + dev_err(ebid->ebi->dev, 221 + "missing or invalid timings definition in %s", 222 + np->full_name); 223 + 224 + return ret; 225 + } 226 + 227 + static int at91sam9_ebi_xslate_config(struct at91_ebi_dev *ebid, 228 + struct device_node *np, 229 + struct at91_ebi_dev_config *conf) 230 + { 231 + struct at91sam9_ebi_dev_config *config = &conf->sam9; 232 + bool required = false; 233 + const char *tmp_str; 234 + u32 tmp; 235 + int ret; 236 + 237 + ret = of_property_read_u32(np, "atmel,smc-bus-width", &tmp); 238 + if (!ret) { 239 + switch (tmp) { 240 + case 8: 241 + config->mode |= AT91_SMC_DBW_8; 242 + break; 243 + 244 + case 16: 245 + config->mode |= AT91_SMC_DBW_16; 246 + break; 247 + 248 + case 32: 249 + config->mode |= AT91_SMC_DBW_32; 250 + break; 251 + 252 + default: 253 + return -EINVAL; 254 + } 255 + 256 + required = true; 257 + } 258 + 259 + if (of_property_read_bool(np, "atmel,smc-tdf-optimized")) { 260 + config->mode |= AT91_SMC_TDFMODE_OPTIMIZED; 261 + required = true; 262 + } 263 + 264 + tmp_str = NULL; 265 + of_property_read_string(np, "atmel,smc-byte-access-type", &tmp_str); 266 + if (tmp_str && !strcmp(tmp_str, "write")) { 267 + config->mode |= AT91_SMC_BAT_WRITE; 268 + required = true; 269 + } 270 + 271 + tmp_str = NULL; 272 + of_property_read_string(np, "atmel,smc-read-mode", &tmp_str); 273 + if (tmp_str && !strcmp(tmp_str, "nrd")) { 274 + config->mode |= AT91_SMC_READMODE_NRD; 275 + required = true; 276 + } 277 + 278 + tmp_str = NULL; 279 + of_property_read_string(np, "atmel,smc-write-mode", &tmp_str); 280 + if (tmp_str && !strcmp(tmp_str, "nwe")) { 281 + config->mode |= AT91_SMC_WRITEMODE_NWE; 282 + required = true; 283 + } 284 + 285 + tmp_str = NULL; 286 + of_property_read_string(np, "atmel,smc-exnw-mode", &tmp_str); 287 + if (tmp_str) { 288 + if (!strcmp(tmp_str, "frozen")) 289 + config->mode |= AT91_SMC_EXNWMODE_FROZEN; 290 + else if (!strcmp(tmp_str, "ready")) 291 + config->mode |= AT91_SMC_EXNWMODE_READY; 292 + else if (strcmp(tmp_str, "disabled")) 293 + return -EINVAL; 294 + 295 + required = true; 296 + } 297 + 298 + ret = of_property_read_u32(np, "atmel,smc-page-mode", &tmp); 299 + if (!ret) { 300 + switch (tmp) { 301 + case 4: 302 + config->mode |= AT91_SMC_PS_4; 303 + break; 304 + 305 + case 8: 306 + config->mode |= AT91_SMC_PS_8; 307 + break; 308 + 309 + case 16: 310 + config->mode |= AT91_SMC_PS_16; 311 + break; 312 + 313 + case 32: 314 + config->mode |= AT91_SMC_PS_32; 315 + break; 316 + 317 + default: 318 + return -EINVAL; 319 + } 320 + 321 + config->mode |= AT91_SMC_PMEN; 322 + required = true; 323 + } 324 + 325 + ret = at91sam9_smc_xslate_timings(ebid, np, &config->timings, 326 + &required); 327 + if (ret) 328 + return ret; 329 + 330 + return required; 331 + } 332 + 333 + static int at91sam9_ebi_apply_config(struct at91_ebi_dev *ebid, 334 + struct at91_ebi_dev_config *conf) 335 + { 336 + unsigned int clk_rate = clk_get_rate(ebid->ebi->clk); 337 + struct at91sam9_ebi_dev_config *config = &conf->sam9; 338 + struct at91sam9_smc_timings *timings = &config->timings; 339 + struct at91sam9_smc_generic_fields *fields = &ebid->ebi->sam9; 340 + u32 coded_val; 341 + u32 val; 342 + 343 + coded_val = at91sam9_smc_setup_ns_to_cycles(clk_rate, 344 + timings->ncs_rd_setup_ns); 345 + val = AT91SAM9_SMC_NCS_NRDSETUP(coded_val); 346 + coded_val = at91sam9_smc_setup_ns_to_cycles(clk_rate, 347 + timings->nrd_setup_ns); 348 + val |= AT91SAM9_SMC_NRDSETUP(coded_val); 349 + coded_val = at91sam9_smc_setup_ns_to_cycles(clk_rate, 350 + timings->ncs_wr_setup_ns); 351 + val |= AT91SAM9_SMC_NCS_WRSETUP(coded_val); 352 + coded_val = at91sam9_smc_setup_ns_to_cycles(clk_rate, 353 + timings->nwe_setup_ns); 354 + val |= AT91SAM9_SMC_NWESETUP(coded_val); 355 + regmap_fields_write(fields->setup, conf->cs, val); 356 + 357 + coded_val = at91sam9_smc_pulse_ns_to_cycles(clk_rate, 358 + timings->ncs_rd_pulse_ns); 359 + val = AT91SAM9_SMC_NCS_NRDPULSE(coded_val); 360 + coded_val = at91sam9_smc_pulse_ns_to_cycles(clk_rate, 361 + timings->nrd_pulse_ns); 362 + val |= AT91SAM9_SMC_NRDPULSE(coded_val); 363 + coded_val = at91sam9_smc_pulse_ns_to_cycles(clk_rate, 364 + timings->ncs_wr_pulse_ns); 365 + val |= AT91SAM9_SMC_NCS_WRPULSE(coded_val); 366 + coded_val = at91sam9_smc_pulse_ns_to_cycles(clk_rate, 367 + timings->nwe_pulse_ns); 368 + val |= AT91SAM9_SMC_NWEPULSE(coded_val); 369 + regmap_fields_write(fields->pulse, conf->cs, val); 370 + 371 + coded_val = at91sam9_smc_cycle_ns_to_cycles(clk_rate, 372 + timings->nrd_cycle_ns); 373 + val = AT91SAM9_SMC_NRDCYCLE(coded_val); 374 + coded_val = at91sam9_smc_cycle_ns_to_cycles(clk_rate, 375 + timings->nwe_cycle_ns); 376 + val |= AT91SAM9_SMC_NWECYCLE(coded_val); 377 + regmap_fields_write(fields->cycle, conf->cs, val); 378 + 379 + val = DIV_ROUND_UP(timings->tdf_ns, clk_rate); 380 + if (val > AT91_SMC_TDF_MAX) 381 + val = AT91_SMC_TDF_MAX; 382 + regmap_fields_write(fields->mode, conf->cs, 383 + config->mode | AT91_SMC_TDF_(val)); 384 + 385 + return 0; 386 + } 387 + 388 + static int at91sam9_ebi_init(struct at91_ebi *ebi) 389 + { 390 + struct at91sam9_smc_generic_fields *fields = &ebi->sam9; 391 + struct reg_field field = REG_FIELD(0, 0, 31); 392 + 393 + field.id_size = fls(ebi->caps->available_cs); 394 + field.id_offset = AT91SAM9_SMC_GENERIC_BLK_SZ; 395 + 396 + field.reg = AT91SAM9_SMC_SETUP(AT91SAM9_SMC_GENERIC); 397 + fields->setup = devm_regmap_field_alloc(ebi->dev, ebi->smc, field); 398 + if (IS_ERR(fields->setup)) 399 + return PTR_ERR(fields->setup); 400 + 401 + field.reg = AT91SAM9_SMC_PULSE(AT91SAM9_SMC_GENERIC); 402 + fields->pulse = devm_regmap_field_alloc(ebi->dev, ebi->smc, field); 403 + if (IS_ERR(fields->pulse)) 404 + return PTR_ERR(fields->pulse); 405 + 406 + field.reg = AT91SAM9_SMC_CYCLE(AT91SAM9_SMC_GENERIC); 407 + fields->cycle = devm_regmap_field_alloc(ebi->dev, ebi->smc, field); 408 + if (IS_ERR(fields->cycle)) 409 + return PTR_ERR(fields->cycle); 410 + 411 + field.reg = AT91SAM9_SMC_MODE(AT91SAM9_SMC_GENERIC); 412 + fields->mode = devm_regmap_field_alloc(ebi->dev, ebi->smc, field); 413 + if (IS_ERR(fields->mode)) 414 + return PTR_ERR(fields->mode); 415 + 416 + return 0; 417 + } 418 + 419 + static int sama5d3_ebi_init(struct at91_ebi *ebi) 420 + { 421 + struct at91sam9_smc_generic_fields *fields = &ebi->sam9; 422 + struct reg_field field = REG_FIELD(0, 0, 31); 423 + 424 + field.id_size = fls(ebi->caps->available_cs); 425 + field.id_offset = SAMA5_SMC_GENERIC_BLK_SZ; 426 + 427 + field.reg = AT91SAM9_SMC_SETUP(SAMA5_SMC_GENERIC); 428 + fields->setup = devm_regmap_field_alloc(ebi->dev, ebi->smc, field); 429 + if (IS_ERR(fields->setup)) 430 + return PTR_ERR(fields->setup); 431 + 432 + field.reg = AT91SAM9_SMC_PULSE(SAMA5_SMC_GENERIC); 433 + fields->pulse = devm_regmap_field_alloc(ebi->dev, ebi->smc, field); 434 + if (IS_ERR(fields->pulse)) 435 + return PTR_ERR(fields->pulse); 436 + 437 + field.reg = AT91SAM9_SMC_CYCLE(SAMA5_SMC_GENERIC); 438 + fields->cycle = devm_regmap_field_alloc(ebi->dev, ebi->smc, field); 439 + if (IS_ERR(fields->cycle)) 440 + return PTR_ERR(fields->cycle); 441 + 442 + field.reg = SAMA5_SMC_MODE(SAMA5_SMC_GENERIC); 443 + fields->mode = devm_regmap_field_alloc(ebi->dev, ebi->smc, field); 444 + if (IS_ERR(fields->mode)) 445 + return PTR_ERR(fields->mode); 446 + 447 + return 0; 448 + } 449 + 450 + static int at91_ebi_dev_setup(struct at91_ebi *ebi, struct device_node *np, 451 + int reg_cells) 452 + { 453 + const struct at91_ebi_caps *caps = ebi->caps; 454 + struct at91_ebi_dev_config conf = { }; 455 + struct device *dev = ebi->dev; 456 + struct at91_ebi_dev *ebid; 457 + int ret, numcs = 0, i; 458 + bool apply = false; 459 + 460 + numcs = of_property_count_elems_of_size(np, "reg", 461 + reg_cells * sizeof(u32)); 462 + if (numcs <= 0) { 463 + dev_err(dev, "invalid reg property in %s\n", np->full_name); 464 + return -EINVAL; 465 + } 466 + 467 + ebid = devm_kzalloc(ebi->dev, 468 + sizeof(*ebid) + (numcs * sizeof(*ebid->configs)), 469 + GFP_KERNEL); 470 + if (!ebid) 471 + return -ENOMEM; 472 + 473 + ebid->ebi = ebi; 474 + 475 + ret = caps->xlate_config(ebid, np, &conf); 476 + if (ret < 0) 477 + return ret; 478 + else if (ret) 479 + apply = true; 480 + 481 + for (i = 0; i < numcs; i++) { 482 + u32 cs; 483 + 484 + ret = of_property_read_u32_index(np, "reg", i * reg_cells, 485 + &cs); 486 + if (ret) 487 + return ret; 488 + 489 + if (cs > AT91_MATRIX_EBI_NUM_CS || 490 + !(ebi->caps->available_cs & BIT(cs))) { 491 + dev_err(dev, "invalid reg property in %s\n", 492 + np->full_name); 493 + return -EINVAL; 494 + } 495 + 496 + ebid->configs[i].cs = cs; 497 + 498 + if (apply) { 499 + conf.cs = cs; 500 + ret = caps->apply_config(ebid, &conf); 501 + if (ret) 502 + return ret; 503 + } 504 + 505 + caps->get_config(ebid, &ebid->configs[i]); 506 + 507 + /* 508 + * Attach the EBI device to the generic SMC logic if at least 509 + * one "atmel,smc-" property is present. 510 + */ 511 + if (ebi->ebi_csa && ret) 512 + regmap_field_update_bits(ebi->ebi_csa, 513 + BIT(cs), 0); 514 + } 515 + 516 + list_add_tail(&ebid->node, &ebi->devs); 517 + 518 + return 0; 519 + } 520 + 521 + static const struct reg_field at91sam9260_ebi_csa = 522 + REG_FIELD(AT91SAM9260_MATRIX_EBICSA, 0, 523 + AT91_MATRIX_EBI_NUM_CS - 1); 524 + 525 + static const struct at91_ebi_caps at91sam9260_ebi_caps = { 526 + .available_cs = 0xff, 527 + .ebi_csa = &at91sam9260_ebi_csa, 528 + .get_config = at91sam9_ebi_get_config, 529 + .xlate_config = at91sam9_ebi_xslate_config, 530 + .apply_config = at91sam9_ebi_apply_config, 531 + .init = at91sam9_ebi_init, 532 + }; 533 + 534 + static const struct reg_field at91sam9261_ebi_csa = 535 + REG_FIELD(AT91SAM9261_MATRIX_EBICSA, 0, 536 + AT91_MATRIX_EBI_NUM_CS - 1); 537 + 538 + static const struct at91_ebi_caps at91sam9261_ebi_caps = { 539 + .available_cs = 0xff, 540 + .ebi_csa = &at91sam9261_ebi_csa, 541 + .get_config = at91sam9_ebi_get_config, 542 + .xlate_config = at91sam9_ebi_xslate_config, 543 + .apply_config = at91sam9_ebi_apply_config, 544 + .init = at91sam9_ebi_init, 545 + }; 546 + 547 + static const struct reg_field at91sam9263_ebi0_csa = 548 + REG_FIELD(AT91SAM9263_MATRIX_EBI0CSA, 0, 549 + AT91_MATRIX_EBI_NUM_CS - 1); 550 + 551 + static const struct at91_ebi_caps at91sam9263_ebi0_caps = { 552 + .available_cs = 0x3f, 553 + .ebi_csa = &at91sam9263_ebi0_csa, 554 + .get_config = at91sam9_ebi_get_config, 555 + .xlate_config = at91sam9_ebi_xslate_config, 556 + .apply_config = at91sam9_ebi_apply_config, 557 + .init = at91sam9_ebi_init, 558 + }; 559 + 560 + static const struct reg_field at91sam9263_ebi1_csa = 561 + REG_FIELD(AT91SAM9263_MATRIX_EBI1CSA, 0, 562 + AT91_MATRIX_EBI_NUM_CS - 1); 563 + 564 + static const struct at91_ebi_caps at91sam9263_ebi1_caps = { 565 + .available_cs = 0x7, 566 + .ebi_csa = &at91sam9263_ebi1_csa, 567 + .get_config = at91sam9_ebi_get_config, 568 + .xlate_config = at91sam9_ebi_xslate_config, 569 + .apply_config = at91sam9_ebi_apply_config, 570 + .init = at91sam9_ebi_init, 571 + }; 572 + 573 + static const struct reg_field at91sam9rl_ebi_csa = 574 + REG_FIELD(AT91SAM9RL_MATRIX_EBICSA, 0, 575 + AT91_MATRIX_EBI_NUM_CS - 1); 576 + 577 + static const struct at91_ebi_caps at91sam9rl_ebi_caps = { 578 + .available_cs = 0x3f, 579 + .ebi_csa = &at91sam9rl_ebi_csa, 580 + .get_config = at91sam9_ebi_get_config, 581 + .xlate_config = at91sam9_ebi_xslate_config, 582 + .apply_config = at91sam9_ebi_apply_config, 583 + .init = at91sam9_ebi_init, 584 + }; 585 + 586 + static const struct reg_field at91sam9g45_ebi_csa = 587 + REG_FIELD(AT91SAM9G45_MATRIX_EBICSA, 0, 588 + AT91_MATRIX_EBI_NUM_CS - 1); 589 + 590 + static const struct at91_ebi_caps at91sam9g45_ebi_caps = { 591 + .available_cs = 0x3f, 592 + .ebi_csa = &at91sam9g45_ebi_csa, 593 + .get_config = at91sam9_ebi_get_config, 594 + .xlate_config = at91sam9_ebi_xslate_config, 595 + .apply_config = at91sam9_ebi_apply_config, 596 + .init = at91sam9_ebi_init, 597 + }; 598 + 599 + static const struct at91_ebi_caps at91sam9x5_ebi_caps = { 600 + .available_cs = 0x3f, 601 + .ebi_csa = &at91sam9263_ebi0_csa, 602 + .get_config = at91sam9_ebi_get_config, 603 + .xlate_config = at91sam9_ebi_xslate_config, 604 + .apply_config = at91sam9_ebi_apply_config, 605 + .init = at91sam9_ebi_init, 606 + }; 607 + 608 + static const struct at91_ebi_caps sama5d3_ebi_caps = { 609 + .available_cs = 0xf, 610 + .get_config = at91sam9_ebi_get_config, 611 + .xlate_config = at91sam9_ebi_xslate_config, 612 + .apply_config = at91sam9_ebi_apply_config, 613 + .init = sama5d3_ebi_init, 614 + }; 615 + 616 + static const struct of_device_id at91_ebi_id_table[] = { 617 + { 618 + .compatible = "atmel,at91sam9260-ebi", 619 + .data = &at91sam9260_ebi_caps, 620 + }, 621 + { 622 + .compatible = "atmel,at91sam9261-ebi", 623 + .data = &at91sam9261_ebi_caps, 624 + }, 625 + { 626 + .compatible = "atmel,at91sam9263-ebi0", 627 + .data = &at91sam9263_ebi0_caps, 628 + }, 629 + { 630 + .compatible = "atmel,at91sam9263-ebi1", 631 + .data = &at91sam9263_ebi1_caps, 632 + }, 633 + { 634 + .compatible = "atmel,at91sam9rl-ebi", 635 + .data = &at91sam9rl_ebi_caps, 636 + }, 637 + { 638 + .compatible = "atmel,at91sam9g45-ebi", 639 + .data = &at91sam9g45_ebi_caps, 640 + }, 641 + { 642 + .compatible = "atmel,at91sam9x5-ebi", 643 + .data = &at91sam9x5_ebi_caps, 644 + }, 645 + { 646 + .compatible = "atmel,sama5d3-ebi", 647 + .data = &sama5d3_ebi_caps, 648 + }, 649 + { /* sentinel */ } 650 + }; 651 + 652 + static int at91_ebi_dev_disable(struct at91_ebi *ebi, struct device_node *np) 653 + { 654 + struct device *dev = ebi->dev; 655 + struct property *newprop; 656 + 657 + newprop = devm_kzalloc(dev, sizeof(*newprop), GFP_KERNEL); 658 + if (!newprop) 659 + return -ENOMEM; 660 + 661 + newprop->name = devm_kstrdup(dev, "status", GFP_KERNEL); 662 + if (!newprop->name) 663 + return -ENOMEM; 664 + 665 + newprop->value = devm_kstrdup(dev, "disabled", GFP_KERNEL); 666 + if (!newprop->name) 667 + return -ENOMEM; 668 + 669 + newprop->length = sizeof("disabled"); 670 + 671 + return of_update_property(np, newprop); 672 + } 673 + 674 + static int at91_ebi_probe(struct platform_device *pdev) 675 + { 676 + struct device *dev = &pdev->dev; 677 + struct device_node *child, *np = dev->of_node; 678 + const struct of_device_id *match; 679 + struct at91_ebi *ebi; 680 + int ret, reg_cells; 681 + struct clk *clk; 682 + u32 val; 683 + 684 + match = of_match_device(at91_ebi_id_table, dev); 685 + if (!match || !match->data) 686 + return -EINVAL; 687 + 688 + ebi = devm_kzalloc(dev, sizeof(*ebi), GFP_KERNEL); 689 + if (!ebi) 690 + return -ENOMEM; 691 + 692 + INIT_LIST_HEAD(&ebi->devs); 693 + ebi->caps = match->data; 694 + ebi->dev = dev; 695 + 696 + clk = devm_clk_get(dev, NULL); 697 + if (IS_ERR(clk)) 698 + return PTR_ERR(clk); 699 + 700 + ebi->clk = clk; 701 + 702 + ebi->smc = syscon_regmap_lookup_by_phandle(np, "atmel,smc"); 703 + if (IS_ERR(ebi->smc)) 704 + return PTR_ERR(ebi->smc); 705 + 706 + /* 707 + * The sama5d3 does not provide an EBICSA register and thus does need 708 + * to access the matrix registers. 709 + */ 710 + if (ebi->caps->ebi_csa) { 711 + ebi->matrix = 712 + syscon_regmap_lookup_by_phandle(np, "atmel,matrix"); 713 + if (IS_ERR(ebi->matrix)) 714 + return PTR_ERR(ebi->matrix); 715 + 716 + ebi->ebi_csa = regmap_field_alloc(ebi->matrix, 717 + *ebi->caps->ebi_csa); 718 + if (IS_ERR(ebi->ebi_csa)) 719 + return PTR_ERR(ebi->ebi_csa); 720 + } 721 + 722 + ret = ebi->caps->init(ebi); 723 + if (ret) 724 + return ret; 725 + 726 + ret = of_property_read_u32(np, "#address-cells", &val); 727 + if (ret) { 728 + dev_err(dev, "missing #address-cells property\n"); 729 + return ret; 730 + } 731 + 732 + reg_cells = val; 733 + 734 + ret = of_property_read_u32(np, "#size-cells", &val); 735 + if (ret) { 736 + dev_err(dev, "missing #address-cells property\n"); 737 + return ret; 738 + } 739 + 740 + reg_cells += val; 741 + 742 + for_each_available_child_of_node(np, child) { 743 + if (!of_find_property(child, "reg", NULL)) 744 + continue; 745 + 746 + ret = at91_ebi_dev_setup(ebi, child, reg_cells); 747 + if (ret) { 748 + dev_err(dev, "failed to configure EBI bus for %s, disabling the device", 749 + child->full_name); 750 + 751 + ret = at91_ebi_dev_disable(ebi, child); 752 + if (ret) 753 + return ret; 754 + } 755 + } 756 + 757 + return of_platform_populate(np, NULL, NULL, dev); 758 + } 759 + 760 + static struct platform_driver at91_ebi_driver = { 761 + .driver = { 762 + .name = "atmel-ebi", 763 + .of_match_table = at91_ebi_id_table, 764 + }, 765 + }; 766 + builtin_platform_driver_probe(at91_ebi_driver, at91_ebi_probe);
+4 -7
drivers/memory/atmel-sdramc.c
··· 1 1 /* 2 2 * Atmel (Multi-port DDR-)SDRAM Controller driver 3 3 * 4 + * Author: Alexandre Belloni <alexandre.belloni@free-electrons.com> 5 + * 4 6 * Copyright (C) 2014 Atmel 5 7 * 6 8 * This program is free software: you can redistribute it and/or modify ··· 22 20 #include <linux/clk.h> 23 21 #include <linux/err.h> 24 22 #include <linux/kernel.h> 25 - #include <linux/module.h> 23 + #include <linux/init.h> 26 24 #include <linux/of_platform.h> 27 25 #include <linux/platform_device.h> 28 26 ··· 50 48 { .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, }, 51 49 {}, 52 50 }; 53 - MODULE_DEVICE_TABLE(of, atmel_ramc_of_match); 54 51 55 52 static int atmel_ramc_probe(struct platform_device *pdev) 56 53 { ··· 91 90 { 92 91 return platform_driver_register(&atmel_ramc_driver); 93 92 } 94 - module_init(atmel_ramc_init); 95 - 96 - MODULE_LICENSE("GPL v2"); 97 - MODULE_AUTHOR("Alexandre Belloni <alexandre.belloni@free-electrons.com>"); 98 - MODULE_DESCRIPTION("Atmel (Multi-port DDR-)SDRAM Controller"); 93 + device_initcall(atmel_ramc_init);
+63 -73
drivers/memory/omap-gpmc.c
··· 20 20 #include <linux/ioport.h> 21 21 #include <linux/spinlock.h> 22 22 #include <linux/io.h> 23 - #include <linux/module.h> 24 23 #include <linux/gpio/driver.h> 25 24 #include <linux/interrupt.h> 26 25 #include <linux/irqdomain.h> ··· 1806 1807 { .compatible = "ti,am3352-gpmc" }, /* am335x devices */ 1807 1808 { } 1808 1809 }; 1809 - MODULE_DEVICE_TABLE(of, gpmc_dt_ids); 1810 1810 1811 1811 /** 1812 1812 * gpmc_read_settings_dt - read gpmc settings from device-tree ··· 2152 2154 return ret; 2153 2155 } 2154 2156 2155 - static int gpmc_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) 2156 - { 2157 - return 1; /* we're input only */ 2158 - } 2159 - 2160 - static int gpmc_gpio_direction_input(struct gpio_chip *chip, 2161 - unsigned int offset) 2162 - { 2163 - return 0; /* we're input only */ 2164 - } 2165 - 2166 - static int gpmc_gpio_direction_output(struct gpio_chip *chip, 2167 - unsigned int offset, int value) 2168 - { 2169 - return -EINVAL; /* we're input only */ 2170 - } 2171 - 2172 - static void gpmc_gpio_set(struct gpio_chip *chip, unsigned int offset, 2173 - int value) 2174 - { 2175 - } 2176 - 2177 - static int gpmc_gpio_get(struct gpio_chip *chip, unsigned int offset) 2178 - { 2179 - u32 reg; 2180 - 2181 - offset += 8; 2182 - 2183 - reg = gpmc_read_reg(GPMC_STATUS) & BIT(offset); 2184 - 2185 - return !!reg; 2186 - } 2187 - 2188 - static int gpmc_gpio_init(struct gpmc_device *gpmc) 2189 - { 2190 - int ret; 2191 - 2192 - gpmc->gpio_chip.parent = gpmc->dev; 2193 - gpmc->gpio_chip.owner = THIS_MODULE; 2194 - gpmc->gpio_chip.label = DEVICE_NAME; 2195 - gpmc->gpio_chip.ngpio = gpmc_nr_waitpins; 2196 - gpmc->gpio_chip.get_direction = gpmc_gpio_get_direction; 2197 - gpmc->gpio_chip.direction_input = gpmc_gpio_direction_input; 2198 - gpmc->gpio_chip.direction_output = gpmc_gpio_direction_output; 2199 - gpmc->gpio_chip.set = gpmc_gpio_set; 2200 - gpmc->gpio_chip.get = gpmc_gpio_get; 2201 - gpmc->gpio_chip.base = -1; 2202 - 2203 - ret = gpiochip_add(&gpmc->gpio_chip); 2204 - if (ret < 0) { 2205 - dev_err(gpmc->dev, "could not register gpio chip: %d\n", ret); 2206 - return ret; 2207 - } 2208 - 2209 - return 0; 2210 - } 2211 - 2212 - static void gpmc_gpio_exit(struct gpmc_device *gpmc) 2213 - { 2214 - gpiochip_remove(&gpmc->gpio_chip); 2215 - } 2216 - 2217 2157 static int gpmc_probe_dt(struct platform_device *pdev) 2218 2158 { 2219 2159 int ret; ··· 2216 2280 { 2217 2281 return 0; 2218 2282 } 2219 - #endif 2283 + #endif /* CONFIG_OF */ 2284 + 2285 + static int gpmc_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) 2286 + { 2287 + return 1; /* we're input only */ 2288 + } 2289 + 2290 + static int gpmc_gpio_direction_input(struct gpio_chip *chip, 2291 + unsigned int offset) 2292 + { 2293 + return 0; /* we're input only */ 2294 + } 2295 + 2296 + static int gpmc_gpio_direction_output(struct gpio_chip *chip, 2297 + unsigned int offset, int value) 2298 + { 2299 + return -EINVAL; /* we're input only */ 2300 + } 2301 + 2302 + static void gpmc_gpio_set(struct gpio_chip *chip, unsigned int offset, 2303 + int value) 2304 + { 2305 + } 2306 + 2307 + static int gpmc_gpio_get(struct gpio_chip *chip, unsigned int offset) 2308 + { 2309 + u32 reg; 2310 + 2311 + offset += 8; 2312 + 2313 + reg = gpmc_read_reg(GPMC_STATUS) & BIT(offset); 2314 + 2315 + return !!reg; 2316 + } 2317 + 2318 + static int gpmc_gpio_init(struct gpmc_device *gpmc) 2319 + { 2320 + int ret; 2321 + 2322 + gpmc->gpio_chip.parent = gpmc->dev; 2323 + gpmc->gpio_chip.owner = THIS_MODULE; 2324 + gpmc->gpio_chip.label = DEVICE_NAME; 2325 + gpmc->gpio_chip.ngpio = gpmc_nr_waitpins; 2326 + gpmc->gpio_chip.get_direction = gpmc_gpio_get_direction; 2327 + gpmc->gpio_chip.direction_input = gpmc_gpio_direction_input; 2328 + gpmc->gpio_chip.direction_output = gpmc_gpio_direction_output; 2329 + gpmc->gpio_chip.set = gpmc_gpio_set; 2330 + gpmc->gpio_chip.get = gpmc_gpio_get; 2331 + gpmc->gpio_chip.base = -1; 2332 + 2333 + ret = gpiochip_add(&gpmc->gpio_chip); 2334 + if (ret < 0) { 2335 + dev_err(gpmc->dev, "could not register gpio chip: %d\n", ret); 2336 + return ret; 2337 + } 2338 + 2339 + return 0; 2340 + } 2341 + 2342 + static void gpmc_gpio_exit(struct gpmc_device *gpmc) 2343 + { 2344 + gpiochip_remove(&gpmc->gpio_chip); 2345 + } 2220 2346 2221 2347 static int gpmc_probe(struct platform_device *pdev) 2222 2348 { ··· 2434 2436 { 2435 2437 return platform_driver_register(&gpmc_driver); 2436 2438 } 2437 - 2438 - static __exit void gpmc_exit(void) 2439 - { 2440 - platform_driver_unregister(&gpmc_driver); 2441 - 2442 - } 2443 - 2444 2439 postcore_initcall(gpmc_init); 2445 - module_exit(gpmc_exit); 2446 2440 2447 2441 static struct omap3_gpmc_regs gpmc_context; 2448 2442
+13 -28
drivers/memory/samsung/exynos-srom.c
··· 11 11 */ 12 12 13 13 #include <linux/io.h> 14 - #include <linux/module.h> 14 + #include <linux/init.h> 15 15 #include <linux/of.h> 16 16 #include <linux/of_address.h> 17 17 #include <linux/of_platform.h> ··· 91 91 if (width == 2) 92 92 cs |= 1 << EXYNOS_SROM_BW__DATAWIDTH__SHIFT; 93 93 94 - bw = __raw_readl(srom->reg_base + EXYNOS_SROM_BW); 94 + bw = readl_relaxed(srom->reg_base + EXYNOS_SROM_BW); 95 95 bw = (bw & ~(EXYNOS_SROM_BW__CS_MASK << bank)) | (cs << bank); 96 - __raw_writel(bw, srom->reg_base + EXYNOS_SROM_BW); 96 + writel_relaxed(bw, srom->reg_base + EXYNOS_SROM_BW); 97 97 98 - __raw_writel(pmc | (timing[0] << EXYNOS_SROM_BCX__TACP__SHIFT) | 99 - (timing[1] << EXYNOS_SROM_BCX__TCAH__SHIFT) | 100 - (timing[2] << EXYNOS_SROM_BCX__TCOH__SHIFT) | 101 - (timing[3] << EXYNOS_SROM_BCX__TACC__SHIFT) | 102 - (timing[4] << EXYNOS_SROM_BCX__TCOS__SHIFT) | 103 - (timing[5] << EXYNOS_SROM_BCX__TACS__SHIFT), 104 - srom->reg_base + EXYNOS_SROM_BC0 + bank); 98 + writel_relaxed(pmc | (timing[0] << EXYNOS_SROM_BCX__TACP__SHIFT) | 99 + (timing[1] << EXYNOS_SROM_BCX__TCAH__SHIFT) | 100 + (timing[2] << EXYNOS_SROM_BCX__TCOH__SHIFT) | 101 + (timing[3] << EXYNOS_SROM_BCX__TACC__SHIFT) | 102 + (timing[4] << EXYNOS_SROM_BCX__TCOS__SHIFT) | 103 + (timing[5] << EXYNOS_SROM_BCX__TACS__SHIFT), 104 + srom->reg_base + EXYNOS_SROM_BC0 + bank); 105 105 106 106 return 0; 107 107 } ··· 134 134 platform_set_drvdata(pdev, srom); 135 135 136 136 srom->reg_offset = exynos_srom_alloc_reg_dump(exynos_srom_offsets, 137 - sizeof(exynos_srom_offsets)); 137 + ARRAY_SIZE(exynos_srom_offsets)); 138 138 if (!srom->reg_offset) { 139 139 iounmap(srom->reg_base); 140 140 return -ENOMEM; ··· 157 157 return 0; 158 158 159 159 return of_platform_populate(np, NULL, NULL, dev); 160 - } 161 - 162 - static int exynos_srom_remove(struct platform_device *pdev) 163 - { 164 - struct exynos_srom *srom = platform_get_drvdata(pdev); 165 - 166 - kfree(srom->reg_offset); 167 - iounmap(srom->reg_base); 168 - 169 - return 0; 170 160 } 171 161 172 162 #ifdef CONFIG_PM_SLEEP ··· 201 211 }, 202 212 {}, 203 213 }; 204 - MODULE_DEVICE_TABLE(of, of_exynos_srom_ids); 205 214 206 215 static SIMPLE_DEV_PM_OPS(exynos_srom_pm_ops, exynos_srom_suspend, exynos_srom_resume); 207 216 208 217 static struct platform_driver exynos_srom_driver = { 209 218 .probe = exynos_srom_probe, 210 - .remove = exynos_srom_remove, 211 219 .driver = { 212 220 .name = "exynos-srom", 213 221 .of_match_table = of_exynos_srom_ids, 214 222 .pm = &exynos_srom_pm_ops, 223 + .suppress_bind_attrs = true, 215 224 }, 216 225 }; 217 - module_platform_driver(exynos_srom_driver); 218 - 219 - MODULE_AUTHOR("Pankaj Dubey <pankaj.dubey@samsung.com>"); 220 - MODULE_DESCRIPTION("Exynos SROM Controller Driver"); 221 - MODULE_LICENSE("GPL"); 226 + builtin_platform_driver(exynos_srom_driver);
+5 -5
drivers/memory/tegra/mc.c
··· 186 186 timing = &mc->timings[i++]; 187 187 188 188 err = load_one_timing(mc, timing, child); 189 - if (err) 189 + if (err) { 190 + of_node_put(child); 190 191 return err; 192 + } 191 193 } 192 194 193 195 return 0; ··· 208 206 for_each_child_of_node(mc->dev->of_node, node) { 209 207 err = of_property_read_u32(node, "nvidia,ram-code", 210 208 &node_ram_code); 211 - if (err || (node_ram_code != ram_code)) { 212 - of_node_put(node); 209 + if (err || (node_ram_code != ram_code)) 213 210 continue; 214 - } 215 211 216 212 err = load_timings(mc, node); 213 + of_node_put(node); 217 214 if (err) 218 215 return err; 219 - of_node_put(node); 220 216 break; 221 217 } 222 218
+4 -4
drivers/memory/tegra/tegra124-emc.c
··· 970 970 timing = &emc->timings[i++]; 971 971 972 972 err = load_one_timing_from_dt(emc, timing, child); 973 - if (err) 973 + if (err) { 974 + of_node_put(child); 974 975 return err; 976 + } 975 977 } 976 978 977 979 sort(emc->timings, emc->num_timings, sizeof(*timing), cmp_timings, ··· 997 995 u32 value; 998 996 999 997 err = of_property_read_u32(np, "nvidia,ram-code", &value); 1000 - if (err || (value != ram_code)) { 1001 - of_node_put(np); 998 + if (err || (value != ram_code)) 1002 999 continue; 1003 - } 1004 1000 1005 1001 return np; 1006 1002 }
-4
drivers/mfd/ab8500-core.c
··· 1087 1087 "Vbus Detect (USB)", 1088 1088 "USB ID Detect", 1089 1089 "UART Factory Mode Detect"}; 1090 - struct ab8500_platform_data *plat = dev_get_platdata(&pdev->dev); 1091 1090 const struct platform_device_id *platid = platform_get_device_id(pdev); 1092 1091 enum ab8500_version version = AB8500_VERSION_UNDEFINED; 1093 1092 struct device_node *np = pdev->dev.of_node; ··· 1217 1218 } else { 1218 1219 pr_cont("None\n"); 1219 1220 } 1220 - 1221 - if (plat && plat->init) 1222 - plat->init(ab8500); 1223 1221 1224 1222 if (is_ab9540(ab8500)) { 1225 1223 ret = get_register_interruptible(ab8500, AB8500_CHARGER,
-34
drivers/mfd/ab8500-sysctrl.c
··· 127 127 128 128 static int ab8500_sysctrl_probe(struct platform_device *pdev) 129 129 { 130 - struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); 131 - struct ab8500_platform_data *plat; 132 - struct ab8500_sysctrl_platform_data *pdata; 133 - 134 - plat = dev_get_platdata(pdev->dev.parent); 135 - 136 - if (!plat) 137 - return -EINVAL; 138 - 139 130 sysctrl_dev = &pdev->dev; 140 131 141 132 if (!pm_power_off) 142 133 pm_power_off = ab8500_power_off; 143 - 144 - pdata = plat->sysctrl; 145 - if (pdata) { 146 - int last, ret, i, j; 147 - 148 - if (is_ab8505(ab8500)) 149 - last = AB8500_SYSCLKREQ4RFCLKBUF; 150 - else 151 - last = AB8500_SYSCLKREQ8RFCLKBUF; 152 - 153 - for (i = AB8500_SYSCLKREQ1RFCLKBUF; i <= last; i++) { 154 - j = i - AB8500_SYSCLKREQ1RFCLKBUF; 155 - ret = ab8500_sysctrl_write(i, 0xff, 156 - pdata->initial_req_buf_config[j]); 157 - dev_dbg(&pdev->dev, 158 - "Setting SysClkReq%dRfClkBuf 0x%X\n", 159 - j + 1, 160 - pdata->initial_req_buf_config[j]); 161 - if (ret < 0) { 162 - dev_err(&pdev->dev, 163 - "Can't set sysClkReq%dRfClkBuf: %d\n", 164 - j + 1, ret); 165 - } 166 - } 167 - } 168 134 169 135 return 0; 170 136 }
+3 -7
drivers/mfd/db8500-prcmu.c
··· 3094 3094 } 3095 3095 } 3096 3096 3097 - static int db8500_prcmu_register_ab8500(struct device *parent, 3098 - struct ab8500_platform_data *pdata) 3097 + static int db8500_prcmu_register_ab8500(struct device *parent) 3099 3098 { 3100 3099 struct device_node *np; 3101 3100 struct resource ab8500_resource; ··· 3102 3103 .name = "ab8500-core", 3103 3104 .of_compatible = "stericsson,ab8500", 3104 3105 .id = AB8500_VERSION_AB8500, 3105 - .platform_data = pdata, 3106 - .pdata_size = sizeof(struct ab8500_platform_data), 3107 3106 .resources = &ab8500_resource, 3108 3107 .num_resources = 1, 3109 3108 }; ··· 3130 3133 static int db8500_prcmu_probe(struct platform_device *pdev) 3131 3134 { 3132 3135 struct device_node *np = pdev->dev.of_node; 3133 - struct prcmu_pdata *pdata = dev_get_platdata(&pdev->dev); 3134 3136 int irq = 0, err = 0; 3135 3137 struct resource *res; 3136 3138 ··· 3145 3149 return -ENOMEM; 3146 3150 } 3147 3151 init_prcm_registers(); 3148 - dbx500_fw_version_init(pdev, pdata->version_offset); 3152 + dbx500_fw_version_init(pdev, DB8500_PRCMU_FW_VERSION_OFFSET); 3149 3153 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "prcmu-tcdm"); 3150 3154 if (!res) { 3151 3155 dev_err(&pdev->dev, "no prcmu tcdm region provided\n"); ··· 3200 3204 } 3201 3205 } 3202 3206 3203 - err = db8500_prcmu_register_ab8500(&pdev->dev, pdata->ab_platdata); 3207 + err = db8500_prcmu_register_ab8500(&pdev->dev); 3204 3208 if (err) { 3205 3209 mfd_remove_devices(&pdev->dev); 3206 3210 pr_err("prcmu: Failed to add ab8500 subdevice\n");
+10
drivers/power/reset/Kconfig
··· 46 46 47 47 Say Y if you have an Axxia family SoC. 48 48 49 + config POWER_RESET_BRCMKONA 50 + bool "Broadcom Kona reset driver" 51 + depends on ARM || COMPILE_TEST 52 + default ARCH_BCM_MOBILE 53 + help 54 + This driver provides restart support for Broadcom Kona chips. 55 + 56 + Say Y here if you have a Broadcom Kona-based board and you wish 57 + to have restart support. 58 + 49 59 config POWER_RESET_BRCMSTB 50 60 bool "Broadcom STB reset driver" 51 61 depends on ARM || MIPS || COMPILE_TEST
+1
drivers/power/reset/Makefile
··· 3 3 obj-$(CONFIG_POWER_RESET_AT91_RESET) += at91-reset.o 4 4 obj-$(CONFIG_POWER_RESET_AT91_SAMA5D2_SHDWC) += at91-sama5d2_shdwc.o 5 5 obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o 6 + obj-$(CONFIG_POWER_RESET_BRCMKONA) += brcm-kona-reset.o 6 7 obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o 7 8 obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o 8 9 obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o
+73
drivers/power/reset/brcm-kona-reset.c
··· 1 + /* 2 + * Copyright (C) 2016 Broadcom 3 + * 4 + * This program is free software; you can redistribute it and/or 5 + * modify it under the terms of the GNU General Public License as 6 + * published by the Free Software Foundation version 2. 7 + * 8 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 9 + * kind, whether express or implied; without even the implied warranty 10 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <linux/io.h> 15 + #include <linux/of_address.h> 16 + #include <linux/of_platform.h> 17 + #include <linux/reboot.h> 18 + 19 + #define RSTMGR_REG_WR_ACCESS_OFFSET 0 20 + #define RSTMGR_REG_CHIP_SOFT_RST_OFFSET 4 21 + 22 + #define RSTMGR_WR_PASSWORD 0xa5a5 23 + #define RSTMGR_WR_PASSWORD_SHIFT 8 24 + #define RSTMGR_WR_ACCESS_ENABLE 1 25 + 26 + static void __iomem *kona_reset_base; 27 + 28 + static int kona_reset_handler(struct notifier_block *this, 29 + unsigned long mode, void *cmd) 30 + { 31 + /* 32 + * A soft reset is triggered by writing a 0 to bit 0 of the soft reset 33 + * register. To write to that register we must first write the password 34 + * and the enable bit in the write access enable register. 35 + */ 36 + writel((RSTMGR_WR_PASSWORD << RSTMGR_WR_PASSWORD_SHIFT) | 37 + RSTMGR_WR_ACCESS_ENABLE, 38 + kona_reset_base + RSTMGR_REG_WR_ACCESS_OFFSET); 39 + writel(0, kona_reset_base + RSTMGR_REG_CHIP_SOFT_RST_OFFSET); 40 + 41 + return NOTIFY_DONE; 42 + } 43 + 44 + static struct notifier_block kona_reset_nb = { 45 + .notifier_call = kona_reset_handler, 46 + .priority = 128, 47 + }; 48 + 49 + static int kona_reset_probe(struct platform_device *pdev) 50 + { 51 + struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 52 + 53 + kona_reset_base = devm_ioremap_resource(&pdev->dev, res); 54 + if (IS_ERR(kona_reset_base)) 55 + return PTR_ERR(kona_reset_base); 56 + 57 + return register_restart_handler(&kona_reset_nb); 58 + } 59 + 60 + static const struct of_device_id of_match[] = { 61 + { .compatible = "brcm,bcm21664-resetmgr" }, 62 + {}, 63 + }; 64 + 65 + static struct platform_driver bcm_kona_reset_driver = { 66 + .probe = kona_reset_probe, 67 + .driver = { 68 + .name = "brcm-kona-reset", 69 + .of_match_table = of_match, 70 + }, 71 + }; 72 + 73 + builtin_platform_driver(bcm_kona_reset_driver);
+1 -1
drivers/pwm/pwm-clps711x.c
··· 155 155 } 156 156 157 157 static const struct of_device_id __maybe_unused clps711x_pwm_dt_ids[] = { 158 - { .compatible = "cirrus,clps711x-pwm", }, 158 + { .compatible = "cirrus,ep7209-pwm", }, 159 159 { } 160 160 }; 161 161 MODULE_DEVICE_TABLE(of, clps711x_pwm_dt_ids);
+7 -5
drivers/pwm/pwm-omap-dmtimer.c
··· 245 245 struct pwm_omap_dmtimer_chip *omap; 246 246 struct pwm_omap_dmtimer_pdata *pdata; 247 247 pwm_omap_dmtimer *dm_timer; 248 - u32 prescaler; 248 + u32 v; 249 249 int status; 250 250 251 251 pdata = dev_get_platdata(&pdev->dev); ··· 306 306 if (pm_runtime_active(&omap->dm_timer_pdev->dev)) 307 307 omap->pdata->stop(omap->dm_timer); 308 308 309 - /* setup dmtimer prescaler */ 310 - if (!of_property_read_u32(pdev->dev.of_node, "ti,prescaler", 311 - &prescaler)) 312 - omap->pdata->set_prescaler(omap->dm_timer, prescaler); 309 + if (!of_property_read_u32(pdev->dev.of_node, "ti,prescaler", &v)) 310 + omap->pdata->set_prescaler(omap->dm_timer, v); 311 + 312 + /* setup dmtimer clock source */ 313 + if (!of_property_read_u32(pdev->dev.of_node, "ti,clock-source", &v)) 314 + omap->pdata->set_source(omap->dm_timer, v); 313 315 314 316 omap->chip.dev = &pdev->dev; 315 317 omap->chip.ops = &pwm_omap_dmtimer_ops;
+451 -14
drivers/regulator/ab8500-ext.c
··· 25 25 #include <linux/mfd/abx500/ab8500.h> 26 26 #include <linux/regulator/ab8500.h> 27 27 28 + static struct regulator_consumer_supply ab8500_vaux1_consumers[] = { 29 + /* Main display, u8500 R3 uib */ 30 + REGULATOR_SUPPLY("vddi", "mcde_disp_sony_acx424akp.0"), 31 + /* Main display, u8500 uib and ST uib */ 32 + REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.0"), 33 + /* Secondary display, ST uib */ 34 + REGULATOR_SUPPLY("vdd1", "samsung_s6d16d0.1"), 35 + /* SFH7741 proximity sensor */ 36 + REGULATOR_SUPPLY("vcc", "gpio-keys.0"), 37 + /* BH1780GLS ambient light sensor */ 38 + REGULATOR_SUPPLY("vcc", "2-0029"), 39 + /* lsm303dlh accelerometer */ 40 + REGULATOR_SUPPLY("vdd", "2-0018"), 41 + /* lsm303dlhc accelerometer */ 42 + REGULATOR_SUPPLY("vdd", "2-0019"), 43 + /* lsm303dlh magnetometer */ 44 + REGULATOR_SUPPLY("vdd", "2-001e"), 45 + /* Rohm BU21013 Touchscreen devices */ 46 + REGULATOR_SUPPLY("avdd", "3-005c"), 47 + REGULATOR_SUPPLY("avdd", "3-005d"), 48 + /* Synaptics RMI4 Touchscreen device */ 49 + REGULATOR_SUPPLY("vdd", "3-004b"), 50 + /* L3G4200D Gyroscope device */ 51 + REGULATOR_SUPPLY("vdd", "2-0068"), 52 + /* Ambient light sensor device */ 53 + REGULATOR_SUPPLY("vdd", "3-0029"), 54 + /* Pressure sensor device */ 55 + REGULATOR_SUPPLY("vdd", "2-005c"), 56 + /* Cypress TrueTouch Touchscreen device */ 57 + REGULATOR_SUPPLY("vcpin", "spi8.0"), 58 + /* Camera device */ 59 + REGULATOR_SUPPLY("vaux12v5", "mmio_camera"), 60 + }; 61 + 62 + static struct regulator_consumer_supply ab8500_vaux2_consumers[] = { 63 + /* On-board eMMC power */ 64 + REGULATOR_SUPPLY("vmmc", "sdi4"), 65 + /* AB8500 audio codec */ 66 + REGULATOR_SUPPLY("vcc-N2158", "ab8500-codec.0"), 67 + /* AB8500 accessory detect 1 */ 68 + REGULATOR_SUPPLY("vcc-N2158", "ab8500-acc-det.0"), 69 + /* AB8500 Tv-out device */ 70 + REGULATOR_SUPPLY("vcc-N2158", "mcde_tv_ab8500.4"), 71 + /* AV8100 HDMI device */ 72 + REGULATOR_SUPPLY("vcc-N2158", "av8100_hdmi.3"), 73 + }; 74 + 75 + static struct regulator_consumer_supply ab8500_vaux3_consumers[] = { 76 + REGULATOR_SUPPLY("v-SD-STM", "stm"), 77 + /* External MMC slot power */ 78 + REGULATOR_SUPPLY("vmmc", "sdi0"), 79 + }; 80 + 81 + static struct regulator_consumer_supply ab8500_vtvout_consumers[] = { 82 + /* TV-out DENC supply */ 83 + REGULATOR_SUPPLY("vtvout", "ab8500-denc.0"), 84 + /* Internal general-purpose ADC */ 85 + REGULATOR_SUPPLY("vddadc", "ab8500-gpadc.0"), 86 + /* ADC for charger */ 87 + REGULATOR_SUPPLY("vddadc", "ab8500-charger.0"), 88 + /* AB8500 Tv-out device */ 89 + REGULATOR_SUPPLY("vtvout", "mcde_tv_ab8500.4"), 90 + }; 91 + 92 + static struct regulator_consumer_supply ab8500_vaud_consumers[] = { 93 + /* AB8500 audio-codec main supply */ 94 + REGULATOR_SUPPLY("vaud", "ab8500-codec.0"), 95 + }; 96 + 97 + static struct regulator_consumer_supply ab8500_vamic1_consumers[] = { 98 + /* AB8500 audio-codec Mic1 supply */ 99 + REGULATOR_SUPPLY("vamic1", "ab8500-codec.0"), 100 + }; 101 + 102 + static struct regulator_consumer_supply ab8500_vamic2_consumers[] = { 103 + /* AB8500 audio-codec Mic2 supply */ 104 + REGULATOR_SUPPLY("vamic2", "ab8500-codec.0"), 105 + }; 106 + 107 + static struct regulator_consumer_supply ab8500_vdmic_consumers[] = { 108 + /* AB8500 audio-codec DMic supply */ 109 + REGULATOR_SUPPLY("vdmic", "ab8500-codec.0"), 110 + }; 111 + 112 + static struct regulator_consumer_supply ab8500_vintcore_consumers[] = { 113 + /* SoC core supply, no device */ 114 + REGULATOR_SUPPLY("v-intcore", NULL), 115 + /* USB Transceiver */ 116 + REGULATOR_SUPPLY("vddulpivio18", "ab8500-usb.0"), 117 + /* Handled by abx500 clk driver */ 118 + REGULATOR_SUPPLY("v-intcore", "abx500-clk.0"), 119 + }; 120 + 121 + static struct regulator_consumer_supply ab8500_vana_consumers[] = { 122 + /* DB8500 DSI */ 123 + REGULATOR_SUPPLY("vdddsi1v2", "mcde"), 124 + REGULATOR_SUPPLY("vdddsi1v2", "b2r2_core"), 125 + REGULATOR_SUPPLY("vdddsi1v2", "b2r2_1_core"), 126 + REGULATOR_SUPPLY("vdddsi1v2", "dsilink.0"), 127 + REGULATOR_SUPPLY("vdddsi1v2", "dsilink.1"), 128 + REGULATOR_SUPPLY("vdddsi1v2", "dsilink.2"), 129 + /* DB8500 CSI */ 130 + REGULATOR_SUPPLY("vddcsi1v2", "mmio_camera"), 131 + }; 132 + 133 + /* ab8500 regulator register initialization */ 134 + static struct ab8500_regulator_reg_init ab8500_reg_init[] = { 135 + /* 136 + * VanaRequestCtrl = HP/LP depending on VxRequest 137 + * VextSupply1RequestCtrl = HP/LP depending on VxRequest 138 + */ 139 + INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL2, 0xf0, 0x00), 140 + /* 141 + * VextSupply2RequestCtrl = HP/LP depending on VxRequest 142 + * VextSupply3RequestCtrl = HP/LP depending on VxRequest 143 + * Vaux1RequestCtrl = HP/LP depending on VxRequest 144 + * Vaux2RequestCtrl = HP/LP depending on VxRequest 145 + */ 146 + INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL3, 0xff, 0x00), 147 + /* 148 + * Vaux3RequestCtrl = HP/LP depending on VxRequest 149 + * SwHPReq = Control through SWValid disabled 150 + */ 151 + INIT_REGULATOR_REGISTER(AB8500_REGUREQUESTCTRL4, 0x07, 0x00), 152 + /* 153 + * VanaSysClkReq1HPValid = disabled 154 + * Vaux1SysClkReq1HPValid = disabled 155 + * Vaux2SysClkReq1HPValid = disabled 156 + * Vaux3SysClkReq1HPValid = disabled 157 + */ 158 + INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID1, 0xe8, 0x00), 159 + /* 160 + * VextSupply1SysClkReq1HPValid = disabled 161 + * VextSupply2SysClkReq1HPValid = disabled 162 + * VextSupply3SysClkReq1HPValid = SysClkReq1 controlled 163 + */ 164 + INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQ1HPVALID2, 0x70, 0x40), 165 + /* 166 + * VanaHwHPReq1Valid = disabled 167 + * Vaux1HwHPreq1Valid = disabled 168 + * Vaux2HwHPReq1Valid = disabled 169 + * Vaux3HwHPReqValid = disabled 170 + */ 171 + INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID1, 0xe8, 0x00), 172 + /* 173 + * VextSupply1HwHPReq1Valid = disabled 174 + * VextSupply2HwHPReq1Valid = disabled 175 + * VextSupply3HwHPReq1Valid = disabled 176 + */ 177 + INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ1VALID2, 0x07, 0x00), 178 + /* 179 + * VanaHwHPReq2Valid = disabled 180 + * Vaux1HwHPReq2Valid = disabled 181 + * Vaux2HwHPReq2Valid = disabled 182 + * Vaux3HwHPReq2Valid = disabled 183 + */ 184 + INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID1, 0xe8, 0x00), 185 + /* 186 + * VextSupply1HwHPReq2Valid = disabled 187 + * VextSupply2HwHPReq2Valid = disabled 188 + * VextSupply3HwHPReq2Valid = HWReq2 controlled 189 + */ 190 + INIT_REGULATOR_REGISTER(AB8500_REGUHWHPREQ2VALID2, 0x07, 0x04), 191 + /* 192 + * VanaSwHPReqValid = disabled 193 + * Vaux1SwHPReqValid = disabled 194 + */ 195 + INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID1, 0xa0, 0x00), 196 + /* 197 + * Vaux2SwHPReqValid = disabled 198 + * Vaux3SwHPReqValid = disabled 199 + * VextSupply1SwHPReqValid = disabled 200 + * VextSupply2SwHPReqValid = disabled 201 + * VextSupply3SwHPReqValid = disabled 202 + */ 203 + INIT_REGULATOR_REGISTER(AB8500_REGUSWHPREQVALID2, 0x1f, 0x00), 204 + /* 205 + * SysClkReq2Valid1 = SysClkReq2 controlled 206 + * SysClkReq3Valid1 = disabled 207 + * SysClkReq4Valid1 = SysClkReq4 controlled 208 + * SysClkReq5Valid1 = disabled 209 + * SysClkReq6Valid1 = SysClkReq6 controlled 210 + * SysClkReq7Valid1 = disabled 211 + * SysClkReq8Valid1 = disabled 212 + */ 213 + INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID1, 0xfe, 0x2a), 214 + /* 215 + * SysClkReq2Valid2 = disabled 216 + * SysClkReq3Valid2 = disabled 217 + * SysClkReq4Valid2 = disabled 218 + * SysClkReq5Valid2 = disabled 219 + * SysClkReq6Valid2 = SysClkReq6 controlled 220 + * SysClkReq7Valid2 = disabled 221 + * SysClkReq8Valid2 = disabled 222 + */ 223 + INIT_REGULATOR_REGISTER(AB8500_REGUSYSCLKREQVALID2, 0xfe, 0x20), 224 + /* 225 + * VTVoutEna = disabled 226 + * Vintcore12Ena = disabled 227 + * Vintcore12Sel = 1.25 V 228 + * Vintcore12LP = inactive (HP) 229 + * VTVoutLP = inactive (HP) 230 + */ 231 + INIT_REGULATOR_REGISTER(AB8500_REGUMISC1, 0xfe, 0x10), 232 + /* 233 + * VaudioEna = disabled 234 + * VdmicEna = disabled 235 + * Vamic1Ena = disabled 236 + * Vamic2Ena = disabled 237 + */ 238 + INIT_REGULATOR_REGISTER(AB8500_VAUDIOSUPPLY, 0x1e, 0x00), 239 + /* 240 + * Vamic1_dzout = high-Z when Vamic1 is disabled 241 + * Vamic2_dzout = high-Z when Vamic2 is disabled 242 + */ 243 + INIT_REGULATOR_REGISTER(AB8500_REGUCTRL1VAMIC, 0x03, 0x00), 244 + /* 245 + * VPll = Hw controlled (NOTE! PRCMU bits) 246 + * VanaRegu = force off 247 + */ 248 + INIT_REGULATOR_REGISTER(AB8500_VPLLVANAREGU, 0x0f, 0x02), 249 + /* 250 + * VrefDDREna = disabled 251 + * VrefDDRSleepMode = inactive (no pulldown) 252 + */ 253 + INIT_REGULATOR_REGISTER(AB8500_VREFDDR, 0x03, 0x00), 254 + /* 255 + * VextSupply1Regu = force LP 256 + * VextSupply2Regu = force OFF 257 + * VextSupply3Regu = force HP (-> STBB2=LP and TPS=LP) 258 + * ExtSupply2Bypass = ExtSupply12LPn ball is 0 when Ena is 0 259 + * ExtSupply3Bypass = ExtSupply3LPn ball is 0 when Ena is 0 260 + */ 261 + INIT_REGULATOR_REGISTER(AB8500_EXTSUPPLYREGU, 0xff, 0x13), 262 + /* 263 + * Vaux1Regu = force HP 264 + * Vaux2Regu = force off 265 + */ 266 + INIT_REGULATOR_REGISTER(AB8500_VAUX12REGU, 0x0f, 0x01), 267 + /* 268 + * Vaux3Regu = force off 269 + */ 270 + INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3REGU, 0x03, 0x00), 271 + /* 272 + * Vaux1Sel = 2.8 V 273 + */ 274 + INIT_REGULATOR_REGISTER(AB8500_VAUX1SEL, 0x0f, 0x0C), 275 + /* 276 + * Vaux2Sel = 2.9 V 277 + */ 278 + INIT_REGULATOR_REGISTER(AB8500_VAUX2SEL, 0x0f, 0x0d), 279 + /* 280 + * Vaux3Sel = 2.91 V 281 + */ 282 + INIT_REGULATOR_REGISTER(AB8500_VRF1VAUX3SEL, 0x07, 0x07), 283 + /* 284 + * VextSupply12LP = disabled (no LP) 285 + */ 286 + INIT_REGULATOR_REGISTER(AB8500_REGUCTRL2SPARE, 0x01, 0x00), 287 + /* 288 + * Vaux1Disch = short discharge time 289 + * Vaux2Disch = short discharge time 290 + * Vaux3Disch = short discharge time 291 + * Vintcore12Disch = short discharge time 292 + * VTVoutDisch = short discharge time 293 + * VaudioDisch = short discharge time 294 + */ 295 + INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH, 0xfc, 0x00), 296 + /* 297 + * VanaDisch = short discharge time 298 + * VdmicPullDownEna = pulldown disabled when Vdmic is disabled 299 + * VdmicDisch = short discharge time 300 + */ 301 + INIT_REGULATOR_REGISTER(AB8500_REGUCTRLDISCH2, 0x16, 0x00), 302 + }; 303 + 304 + /* AB8500 regulators */ 305 + static struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS] = { 306 + /* supplies to the display/camera */ 307 + [AB8500_LDO_AUX1] = { 308 + .supply_regulator = "ab8500-ext-supply3", 309 + .constraints = { 310 + .name = "V-DISPLAY", 311 + .min_uV = 2800000, 312 + .max_uV = 3300000, 313 + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 314 + REGULATOR_CHANGE_STATUS, 315 + .boot_on = 1, /* display is on at boot */ 316 + }, 317 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux1_consumers), 318 + .consumer_supplies = ab8500_vaux1_consumers, 319 + }, 320 + /* supplies to the on-board eMMC */ 321 + [AB8500_LDO_AUX2] = { 322 + .supply_regulator = "ab8500-ext-supply3", 323 + .constraints = { 324 + .name = "V-eMMC1", 325 + .min_uV = 1100000, 326 + .max_uV = 3300000, 327 + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 328 + REGULATOR_CHANGE_STATUS | 329 + REGULATOR_CHANGE_MODE, 330 + .valid_modes_mask = REGULATOR_MODE_NORMAL | 331 + REGULATOR_MODE_IDLE, 332 + }, 333 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux2_consumers), 334 + .consumer_supplies = ab8500_vaux2_consumers, 335 + }, 336 + /* supply for VAUX3, supplies to SDcard slots */ 337 + [AB8500_LDO_AUX3] = { 338 + .supply_regulator = "ab8500-ext-supply3", 339 + .constraints = { 340 + .name = "V-MMC-SD", 341 + .min_uV = 1100000, 342 + .max_uV = 3300000, 343 + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 344 + REGULATOR_CHANGE_STATUS | 345 + REGULATOR_CHANGE_MODE, 346 + .valid_modes_mask = REGULATOR_MODE_NORMAL | 347 + REGULATOR_MODE_IDLE, 348 + }, 349 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vaux3_consumers), 350 + .consumer_supplies = ab8500_vaux3_consumers, 351 + }, 352 + /* supply for tvout, gpadc, TVOUT LDO */ 353 + [AB8500_LDO_TVOUT] = { 354 + .constraints = { 355 + .name = "V-TVOUT", 356 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 357 + }, 358 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vtvout_consumers), 359 + .consumer_supplies = ab8500_vtvout_consumers, 360 + }, 361 + /* supply for ab8500-vaudio, VAUDIO LDO */ 362 + [AB8500_LDO_AUDIO] = { 363 + .constraints = { 364 + .name = "V-AUD", 365 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 366 + }, 367 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vaud_consumers), 368 + .consumer_supplies = ab8500_vaud_consumers, 369 + }, 370 + /* supply for v-anamic1 VAMic1-LDO */ 371 + [AB8500_LDO_ANAMIC1] = { 372 + .constraints = { 373 + .name = "V-AMIC1", 374 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 375 + }, 376 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic1_consumers), 377 + .consumer_supplies = ab8500_vamic1_consumers, 378 + }, 379 + /* supply for v-amic2, VAMIC2 LDO, reuse constants for AMIC1 */ 380 + [AB8500_LDO_ANAMIC2] = { 381 + .constraints = { 382 + .name = "V-AMIC2", 383 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 384 + }, 385 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vamic2_consumers), 386 + .consumer_supplies = ab8500_vamic2_consumers, 387 + }, 388 + /* supply for v-dmic, VDMIC LDO */ 389 + [AB8500_LDO_DMIC] = { 390 + .constraints = { 391 + .name = "V-DMIC", 392 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 393 + }, 394 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vdmic_consumers), 395 + .consumer_supplies = ab8500_vdmic_consumers, 396 + }, 397 + /* supply for v-intcore12, VINTCORE12 LDO */ 398 + [AB8500_LDO_INTCORE] = { 399 + .constraints = { 400 + .name = "V-INTCORE", 401 + .min_uV = 1250000, 402 + .max_uV = 1350000, 403 + .input_uV = 1800000, 404 + .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | 405 + REGULATOR_CHANGE_STATUS | 406 + REGULATOR_CHANGE_MODE | 407 + REGULATOR_CHANGE_DRMS, 408 + .valid_modes_mask = REGULATOR_MODE_NORMAL | 409 + REGULATOR_MODE_IDLE, 410 + }, 411 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vintcore_consumers), 412 + .consumer_supplies = ab8500_vintcore_consumers, 413 + }, 414 + /* supply for U8500 CSI-DSI, VANA LDO */ 415 + [AB8500_LDO_ANA] = { 416 + .constraints = { 417 + .name = "V-CSI-DSI", 418 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 419 + }, 420 + .num_consumer_supplies = ARRAY_SIZE(ab8500_vana_consumers), 421 + .consumer_supplies = ab8500_vana_consumers, 422 + }, 423 + }; 424 + 425 + /* supply for VextSupply3 */ 426 + static struct regulator_consumer_supply ab8500_ext_supply3_consumers[] = { 427 + /* SIM supply for 3 V SIM cards */ 428 + REGULATOR_SUPPLY("vinvsim", "sim-detect.0"), 429 + }; 430 + 431 + /* 432 + * AB8500 external regulators 433 + */ 434 + static struct regulator_init_data ab8500_ext_regulators[] = { 435 + /* fixed Vbat supplies VSMPS1_EXT_1V8 */ 436 + [AB8500_EXT_SUPPLY1] = { 437 + .constraints = { 438 + .name = "ab8500-ext-supply1", 439 + .min_uV = 1800000, 440 + .max_uV = 1800000, 441 + .initial_mode = REGULATOR_MODE_IDLE, 442 + .boot_on = 1, 443 + .always_on = 1, 444 + }, 445 + }, 446 + /* fixed Vbat supplies VSMPS2_EXT_1V36 and VSMPS5_EXT_1V15 */ 447 + [AB8500_EXT_SUPPLY2] = { 448 + .constraints = { 449 + .name = "ab8500-ext-supply2", 450 + .min_uV = 1360000, 451 + .max_uV = 1360000, 452 + }, 453 + }, 454 + /* fixed Vbat supplies VSMPS3_EXT_3V4 and VSMPS4_EXT_3V4 */ 455 + [AB8500_EXT_SUPPLY3] = { 456 + .constraints = { 457 + .name = "ab8500-ext-supply3", 458 + .min_uV = 3400000, 459 + .max_uV = 3400000, 460 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 461 + .boot_on = 1, 462 + }, 463 + .num_consumer_supplies = 464 + ARRAY_SIZE(ab8500_ext_supply3_consumers), 465 + .consumer_supplies = ab8500_ext_supply3_consumers, 466 + }, 467 + }; 468 + 469 + static struct ab8500_regulator_platform_data ab8500_regulator_plat_data = { 470 + .reg_init = ab8500_reg_init, 471 + .num_reg_init = ARRAY_SIZE(ab8500_reg_init), 472 + .regulator = ab8500_regulators, 473 + .num_regulator = ARRAY_SIZE(ab8500_regulators), 474 + .ext_regulator = ab8500_ext_regulators, 475 + .num_ext_regulator = ARRAY_SIZE(ab8500_ext_regulators), 476 + }; 477 + 28 478 /** 29 479 * struct ab8500_ext_regulator_info - ab8500 regulator information 30 480 * @dev: device pointer ··· 794 344 static int ab8500_ext_regulator_probe(struct platform_device *pdev) 795 345 { 796 346 struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); 797 - struct ab8500_platform_data *ppdata; 798 - struct ab8500_regulator_platform_data *pdata; 347 + struct ab8500_regulator_platform_data *pdata = &ab8500_regulator_plat_data; 799 348 struct device_node *np = pdev->dev.of_node; 800 349 struct regulator_config config = { }; 801 350 int i, err; ··· 812 363 813 364 if (!ab8500) { 814 365 dev_err(&pdev->dev, "null mfd parent\n"); 815 - return -EINVAL; 816 - } 817 - 818 - ppdata = dev_get_platdata(ab8500->dev); 819 - if (!ppdata) { 820 - dev_err(&pdev->dev, "null parent pdata\n"); 821 - return -EINVAL; 822 - } 823 - 824 - pdata = ppdata->regulator; 825 - if (!pdata) { 826 - dev_err(&pdev->dev, "null pdata\n"); 827 366 return -EINVAL; 828 367 } 829 368
+14
drivers/reset/Kconfig
··· 12 12 13 13 If unsure, say no. 14 14 15 + if RESET_CONTROLLER 16 + 15 17 config RESET_OXNAS 16 18 bool 17 19 20 + config TI_SYSCON_RESET 21 + tristate "TI SYSCON Reset Driver" 22 + depends on HAS_IOMEM 23 + select MFD_SYSCON 24 + help 25 + This enables the reset driver support for TI devices with 26 + memory-mapped reset registers as part of a syscon device node. If 27 + you wish to use the reset framework for such memory-mapped devices, 28 + say Y here. Otherwise, say N. 29 + 18 30 source "drivers/reset/sti/Kconfig" 19 31 source "drivers/reset/hisilicon/Kconfig" 32 + 33 + endif
+2
drivers/reset/Makefile
··· 3 3 obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o 4 4 obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o 5 5 obj-$(CONFIG_MACH_PISTACHIO) += reset-pistachio.o 6 + obj-$(CONFIG_ARCH_MESON) += reset-meson.o 6 7 obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o 7 8 obj-$(CONFIG_ARCH_STI) += sti/ 8 9 obj-$(CONFIG_ARCH_HISI) += hisilicon/ 9 10 obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o 10 11 obj-$(CONFIG_ATH79) += reset-ath79.o 11 12 obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o 13 + obj-$(CONFIG_TI_SYSCON_RESET) += reset-ti-syscon.o
+37
drivers/reset/core.c
··· 93 93 } 94 94 EXPORT_SYMBOL_GPL(reset_controller_unregister); 95 95 96 + static void devm_reset_controller_release(struct device *dev, void *res) 97 + { 98 + reset_controller_unregister(*(struct reset_controller_dev **)res); 99 + } 100 + 101 + /** 102 + * devm_reset_controller_register - resource managed reset_controller_register() 103 + * @dev: device that is registering this reset controller 104 + * @rcdev: a pointer to the initialized reset controller device 105 + * 106 + * Managed reset_controller_register(). For reset controllers registered by 107 + * this function, reset_controller_unregister() is automatically called on 108 + * driver detach. See reset_controller_register() for more information. 109 + */ 110 + int devm_reset_controller_register(struct device *dev, 111 + struct reset_controller_dev *rcdev) 112 + { 113 + struct reset_controller_dev **rcdevp; 114 + int ret; 115 + 116 + rcdevp = devres_alloc(devm_reset_controller_release, sizeof(*rcdevp), 117 + GFP_KERNEL); 118 + if (!rcdevp) 119 + return -ENOMEM; 120 + 121 + ret = reset_controller_register(rcdev); 122 + if (!ret) { 123 + *rcdevp = rcdev; 124 + devres_add(dev, rcdevp); 125 + } else { 126 + devres_free(rcdevp); 127 + } 128 + 129 + return ret; 130 + } 131 + EXPORT_SYMBOL_GPL(devm_reset_controller_register); 132 + 96 133 /** 97 134 * reset_control_reset - reset the controlled device 98 135 * @rstc: reset controller
+89 -39
drivers/reset/hisilicon/hi6220_reset.c
··· 1 1 /* 2 2 * Hisilicon Hi6220 reset controller driver 3 3 * 4 - * Copyright (c) 2015 Hisilicon Limited. 4 + * Copyright (c) 2016 Linaro Limited. 5 + * Copyright (c) 2015-2016 Hisilicon Limited. 5 6 * 6 7 * Author: Feng Chen <puck.chen@hisilicon.com> 7 8 * ··· 16 15 #include <linux/module.h> 17 16 #include <linux/bitops.h> 18 17 #include <linux/of.h> 18 + #include <linux/of_device.h> 19 + #include <linux/regmap.h> 20 + #include <linux/mfd/syscon.h> 19 21 #include <linux/reset-controller.h> 20 22 #include <linux/reset.h> 21 23 #include <linux/platform_device.h> 22 24 23 - #define ASSERT_OFFSET 0x300 24 - #define DEASSERT_OFFSET 0x304 25 - #define MAX_INDEX 0x509 25 + #define PERIPH_ASSERT_OFFSET 0x300 26 + #define PERIPH_DEASSERT_OFFSET 0x304 27 + #define PERIPH_MAX_INDEX 0x509 28 + 29 + #define SC_MEDIA_RSTEN 0x052C 30 + #define SC_MEDIA_RSTDIS 0x0530 31 + #define MEDIA_MAX_INDEX 8 26 32 27 33 #define to_reset_data(x) container_of(x, struct hi6220_reset_data, rc_dev) 28 34 29 - struct hi6220_reset_data { 30 - void __iomem *assert_base; 31 - void __iomem *deassert_base; 32 - struct reset_controller_dev rc_dev; 35 + enum hi6220_reset_ctrl_type { 36 + PERIPHERAL, 37 + MEDIA, 33 38 }; 34 39 35 - static int hi6220_reset_assert(struct reset_controller_dev *rc_dev, 40 + struct hi6220_reset_data { 41 + struct reset_controller_dev rc_dev; 42 + struct regmap *regmap; 43 + }; 44 + 45 + static int hi6220_peripheral_assert(struct reset_controller_dev *rc_dev, 46 + unsigned long idx) 47 + { 48 + struct hi6220_reset_data *data = to_reset_data(rc_dev); 49 + struct regmap *regmap = data->regmap; 50 + u32 bank = idx >> 8; 51 + u32 offset = idx & 0xff; 52 + u32 reg = PERIPH_ASSERT_OFFSET + bank * 0x10; 53 + 54 + return regmap_write(regmap, reg, BIT(offset)); 55 + } 56 + 57 + static int hi6220_peripheral_deassert(struct reset_controller_dev *rc_dev, 58 + unsigned long idx) 59 + { 60 + struct hi6220_reset_data *data = to_reset_data(rc_dev); 61 + struct regmap *regmap = data->regmap; 62 + u32 bank = idx >> 8; 63 + u32 offset = idx & 0xff; 64 + u32 reg = PERIPH_DEASSERT_OFFSET + bank * 0x10; 65 + 66 + return regmap_write(regmap, reg, BIT(offset)); 67 + } 68 + 69 + static const struct reset_control_ops hi6220_peripheral_reset_ops = { 70 + .assert = hi6220_peripheral_assert, 71 + .deassert = hi6220_peripheral_deassert, 72 + }; 73 + 74 + static int hi6220_media_assert(struct reset_controller_dev *rc_dev, 36 75 unsigned long idx) 37 76 { 38 77 struct hi6220_reset_data *data = to_reset_data(rc_dev); 78 + struct regmap *regmap = data->regmap; 39 79 40 - int bank = idx >> 8; 41 - int offset = idx & 0xff; 42 - 43 - writel(BIT(offset), data->assert_base + (bank * 0x10)); 44 - 45 - return 0; 80 + return regmap_write(regmap, SC_MEDIA_RSTEN, BIT(idx)); 46 81 } 47 82 48 - static int hi6220_reset_deassert(struct reset_controller_dev *rc_dev, 83 + static int hi6220_media_deassert(struct reset_controller_dev *rc_dev, 49 84 unsigned long idx) 50 85 { 51 86 struct hi6220_reset_data *data = to_reset_data(rc_dev); 87 + struct regmap *regmap = data->regmap; 52 88 53 - int bank = idx >> 8; 54 - int offset = idx & 0xff; 55 - 56 - writel(BIT(offset), data->deassert_base + (bank * 0x10)); 57 - 58 - return 0; 89 + return regmap_write(regmap, SC_MEDIA_RSTDIS, BIT(idx)); 59 90 } 60 91 61 - static const struct reset_control_ops hi6220_reset_ops = { 62 - .assert = hi6220_reset_assert, 63 - .deassert = hi6220_reset_deassert, 92 + static const struct reset_control_ops hi6220_media_reset_ops = { 93 + .assert = hi6220_media_assert, 94 + .deassert = hi6220_media_deassert, 64 95 }; 65 96 66 97 static int hi6220_reset_probe(struct platform_device *pdev) 67 98 { 99 + struct device_node *np = pdev->dev.of_node; 100 + struct device *dev = &pdev->dev; 101 + enum hi6220_reset_ctrl_type type; 68 102 struct hi6220_reset_data *data; 69 - struct resource *res; 70 - void __iomem *src_base; 103 + struct regmap *regmap; 71 104 72 - data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 105 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 73 106 if (!data) 74 107 return -ENOMEM; 75 108 76 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 77 - src_base = devm_ioremap_resource(&pdev->dev, res); 78 - if (IS_ERR(src_base)) 79 - return PTR_ERR(src_base); 109 + type = (enum hi6220_reset_ctrl_type)of_device_get_match_data(dev); 80 110 81 - data->assert_base = src_base + ASSERT_OFFSET; 82 - data->deassert_base = src_base + DEASSERT_OFFSET; 83 - data->rc_dev.nr_resets = MAX_INDEX; 84 - data->rc_dev.ops = &hi6220_reset_ops; 85 - data->rc_dev.of_node = pdev->dev.of_node; 111 + regmap = syscon_node_to_regmap(np); 112 + if (IS_ERR(regmap)) { 113 + dev_err(dev, "failed to get reset controller regmap\n"); 114 + return PTR_ERR(regmap); 115 + } 116 + 117 + data->regmap = regmap; 118 + data->rc_dev.of_node = np; 119 + if (type == MEDIA) { 120 + data->rc_dev.ops = &hi6220_media_reset_ops; 121 + data->rc_dev.nr_resets = MEDIA_MAX_INDEX; 122 + } else { 123 + data->rc_dev.ops = &hi6220_peripheral_reset_ops; 124 + data->rc_dev.nr_resets = PERIPH_MAX_INDEX; 125 + } 86 126 87 127 return reset_controller_register(&data->rc_dev); 88 128 } 89 129 90 130 static const struct of_device_id hi6220_reset_match[] = { 91 - { .compatible = "hisilicon,hi6220-sysctrl" }, 92 - { }, 131 + { 132 + .compatible = "hisilicon,hi6220-sysctrl", 133 + .data = (void *)PERIPHERAL, 134 + }, 135 + { 136 + .compatible = "hisilicon,hi6220-mediactrl", 137 + .data = (void *)MEDIA, 138 + }, 139 + { /* sentinel */ }, 93 140 }; 141 + MODULE_DEVICE_TABLE(of, hi6220_reset_match); 94 142 95 143 static struct platform_driver hi6220_reset_driver = { 96 144 .probe = hi6220_reset_probe,
+1 -2
drivers/reset/reset-ath79.c
··· 112 112 ath79_reset->rcdev.of_reset_n_cells = 1; 113 113 ath79_reset->rcdev.nr_resets = 32; 114 114 115 - err = reset_controller_register(&ath79_reset->rcdev); 115 + err = devm_reset_controller_register(&pdev->dev, &ath79_reset->rcdev); 116 116 if (err) 117 117 return err; 118 118 ··· 131 131 struct ath79_reset *ath79_reset = platform_get_drvdata(pdev); 132 132 133 133 unregister_restart_handler(&ath79_reset->restart_nb); 134 - reset_controller_unregister(&ath79_reset->rcdev); 135 134 136 135 return 0; 137 136 }
+136
drivers/reset/reset-meson.c
··· 1 + /* 2 + * This file is provided under a dual BSD/GPLv2 license. When using or 3 + * redistributing this file, you may do so under either license. 4 + * 5 + * GPL LICENSE SUMMARY 6 + * 7 + * Copyright (c) 2016 BayLibre, SAS. 8 + * Author: Neil Armstrong <narmstrong@baylibre.com> 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of version 2 of the GNU General Public License as 12 + * published by the Free Software Foundation. 13 + * 14 + * This program is distributed in the hope that it will be useful, but 15 + * WITHOUT ANY WARRANTY; without even the implied warranty of 16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 + * General Public License for more details. 18 + * 19 + * You should have received a copy of the GNU General Public License 20 + * along with this program; if not, see <http://www.gnu.org/licenses/>. 21 + * The full GNU General Public License is included in this distribution 22 + * in the file called COPYING. 23 + * 24 + * BSD LICENSE 25 + * 26 + * Copyright (c) 2016 BayLibre, SAS. 27 + * Author: Neil Armstrong <narmstrong@baylibre.com> 28 + * 29 + * Redistribution and use in source and binary forms, with or without 30 + * modification, are permitted provided that the following conditions 31 + * are met: 32 + * 33 + * * Redistributions of source code must retain the above copyright 34 + * notice, this list of conditions and the following disclaimer. 35 + * * Redistributions in binary form must reproduce the above copyright 36 + * notice, this list of conditions and the following disclaimer in 37 + * the documentation and/or other materials provided with the 38 + * distribution. 39 + * * Neither the name of Intel Corporation nor the names of its 40 + * contributors may be used to endorse or promote products derived 41 + * from this software without specific prior written permission. 42 + * 43 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 44 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 45 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 46 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 47 + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 48 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 49 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 50 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 52 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 53 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 + */ 55 + #include <linux/err.h> 56 + #include <linux/module.h> 57 + #include <linux/io.h> 58 + #include <linux/of.h> 59 + #include <linux/platform_device.h> 60 + #include <linux/reset-controller.h> 61 + #include <linux/slab.h> 62 + #include <linux/types.h> 63 + 64 + #define REG_COUNT 8 65 + #define BITS_PER_REG 32 66 + 67 + struct meson_reset { 68 + void __iomem *reg_base; 69 + struct reset_controller_dev rcdev; 70 + }; 71 + 72 + static int meson_reset_reset(struct reset_controller_dev *rcdev, 73 + unsigned long id) 74 + { 75 + struct meson_reset *data = 76 + container_of(rcdev, struct meson_reset, rcdev); 77 + unsigned int bank = id / BITS_PER_REG; 78 + unsigned int offset = id % BITS_PER_REG; 79 + void __iomem *reg_addr = data->reg_base + (bank << 2); 80 + 81 + if (bank >= REG_COUNT) 82 + return -EINVAL; 83 + 84 + writel(BIT(offset), reg_addr); 85 + 86 + return 0; 87 + } 88 + 89 + static const struct reset_control_ops meson_reset_ops = { 90 + .reset = meson_reset_reset, 91 + }; 92 + 93 + static const struct of_device_id meson_reset_dt_ids[] = { 94 + { .compatible = "amlogic,meson8b-reset", }, 95 + { .compatible = "amlogic,meson-gxbb-reset", }, 96 + { /* sentinel */ }, 97 + }; 98 + MODULE_DEVICE_TABLE(of, meson_reset_dt_ids); 99 + 100 + static int meson_reset_probe(struct platform_device *pdev) 101 + { 102 + struct meson_reset *data; 103 + struct resource *res; 104 + 105 + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); 106 + if (!data) 107 + return -ENOMEM; 108 + 109 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 110 + data->reg_base = devm_ioremap_resource(&pdev->dev, res); 111 + if (IS_ERR(data->reg_base)) 112 + return PTR_ERR(data->reg_base); 113 + 114 + platform_set_drvdata(pdev, data); 115 + 116 + data->rcdev.owner = THIS_MODULE; 117 + data->rcdev.nr_resets = REG_COUNT * BITS_PER_REG; 118 + data->rcdev.ops = &meson_reset_ops; 119 + data->rcdev.of_node = pdev->dev.of_node; 120 + 121 + return devm_reset_controller_register(&pdev->dev, &data->rcdev); 122 + } 123 + 124 + static struct platform_driver meson_reset_driver = { 125 + .probe = meson_reset_probe, 126 + .driver = { 127 + .name = "meson_reset", 128 + .of_match_table = meson_reset_dt_ids, 129 + }, 130 + }; 131 + 132 + module_platform_driver(meson_reset_driver); 133 + 134 + MODULE_AUTHOR("Neil Armstrong <narmstrong@baylibre.com>"); 135 + MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver"); 136 + MODULE_LICENSE("Dual BSD/GPL");
+1 -11
drivers/reset/reset-oxnas.c
··· 112 112 data->rcdev.ops = &oxnas_reset_ops; 113 113 data->rcdev.of_node = pdev->dev.of_node; 114 114 115 - return reset_controller_register(&data->rcdev); 116 - } 117 - 118 - static int oxnas_reset_remove(struct platform_device *pdev) 119 - { 120 - struct oxnas_reset *data = platform_get_drvdata(pdev); 121 - 122 - reset_controller_unregister(&data->rcdev); 123 - 124 - return 0; 115 + return devm_reset_controller_register(&pdev->dev, &data->rcdev); 125 116 } 126 117 127 118 static struct platform_driver oxnas_reset_driver = { 128 119 .probe = oxnas_reset_probe, 129 - .remove = oxnas_reset_remove, 130 120 .driver = { 131 121 .name = "oxnas-reset", 132 122 .of_match_table = oxnas_reset_dt_ids,
+1 -11
drivers/reset/reset-pistachio.c
··· 121 121 rd->rcdev.ops = &pistachio_reset_ops; 122 122 rd->rcdev.of_node = np; 123 123 124 - return reset_controller_register(&rd->rcdev); 125 - } 126 - 127 - static int pistachio_reset_remove(struct platform_device *pdev) 128 - { 129 - struct pistachio_reset_data *data = platform_get_drvdata(pdev); 130 - 131 - reset_controller_unregister(&data->rcdev); 132 - 133 - return 0; 124 + return devm_reset_controller_register(dev, &rd->rcdev); 134 125 } 135 126 136 127 static const struct of_device_id pistachio_reset_dt_ids[] = { ··· 132 141 133 142 static struct platform_driver pistachio_reset_driver = { 134 143 .probe = pistachio_reset_probe, 135 - .remove = pistachio_reset_remove, 136 144 .driver = { 137 145 .name = "pistachio-reset", 138 146 .of_match_table = pistachio_reset_dt_ids,
+1 -11
drivers/reset/reset-socfpga.c
··· 134 134 data->rcdev.ops = &socfpga_reset_ops; 135 135 data->rcdev.of_node = pdev->dev.of_node; 136 136 137 - return reset_controller_register(&data->rcdev); 138 - } 139 - 140 - static int socfpga_reset_remove(struct platform_device *pdev) 141 - { 142 - struct socfpga_reset_data *data = platform_get_drvdata(pdev); 143 - 144 - reset_controller_unregister(&data->rcdev); 145 - 146 - return 0; 137 + return devm_reset_controller_register(dev, &data->rcdev); 147 138 } 148 139 149 140 static const struct of_device_id socfpga_reset_dt_ids[] = { ··· 144 153 145 154 static struct platform_driver socfpga_reset_driver = { 146 155 .probe = socfpga_reset_probe, 147 - .remove = socfpga_reset_remove, 148 156 .driver = { 149 157 .name = "socfpga-reset", 150 158 .of_match_table = socfpga_reset_dt_ids,
+1 -11
drivers/reset/reset-sunxi.c
··· 165 165 data->rcdev.ops = &sunxi_reset_ops; 166 166 data->rcdev.of_node = pdev->dev.of_node; 167 167 168 - return reset_controller_register(&data->rcdev); 169 - } 170 - 171 - static int sunxi_reset_remove(struct platform_device *pdev) 172 - { 173 - struct sunxi_reset_data *data = platform_get_drvdata(pdev); 174 - 175 - reset_controller_unregister(&data->rcdev); 176 - 177 - return 0; 168 + return devm_reset_controller_register(&pdev->dev, &data->rcdev); 178 169 } 179 170 180 171 static struct platform_driver sunxi_reset_driver = { 181 172 .probe = sunxi_reset_probe, 182 - .remove = sunxi_reset_remove, 183 173 .driver = { 184 174 .name = "sunxi-reset", 185 175 .of_match_table = sunxi_reset_dt_ids,
+237
drivers/reset/reset-ti-syscon.c
··· 1 + /* 2 + * TI SYSCON regmap reset driver 3 + * 4 + * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ 5 + * Andrew F. Davis <afd@ti.com> 6 + * Suman Anna <afd@ti.com> 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License version 2 as 10 + * published by the Free Software Foundation. 11 + * 12 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 13 + * kind, whether express or implied; without even the implied warranty 14 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 + * GNU General Public License for more details. 16 + */ 17 + 18 + #include <linux/mfd/syscon.h> 19 + #include <linux/module.h> 20 + #include <linux/of.h> 21 + #include <linux/platform_device.h> 22 + #include <linux/regmap.h> 23 + #include <linux/reset-controller.h> 24 + 25 + #include <dt-bindings/reset/ti-syscon.h> 26 + 27 + /** 28 + * struct ti_syscon_reset_control - reset control structure 29 + * @assert_offset: reset assert control register offset from syscon base 30 + * @assert_bit: reset assert bit in the reset assert control register 31 + * @deassert_offset: reset deassert control register offset from syscon base 32 + * @deassert_bit: reset deassert bit in the reset deassert control register 33 + * @status_offset: reset status register offset from syscon base 34 + * @status_bit: reset status bit in the reset status register 35 + * @flags: reset flag indicating how the (de)assert and status are handled 36 + */ 37 + struct ti_syscon_reset_control { 38 + unsigned int assert_offset; 39 + unsigned int assert_bit; 40 + unsigned int deassert_offset; 41 + unsigned int deassert_bit; 42 + unsigned int status_offset; 43 + unsigned int status_bit; 44 + u32 flags; 45 + }; 46 + 47 + /** 48 + * struct ti_syscon_reset_data - reset controller information structure 49 + * @rcdev: reset controller entity 50 + * @regmap: regmap handle containing the memory-mapped reset registers 51 + * @controls: array of reset controls 52 + * @nr_controls: number of controls in control array 53 + */ 54 + struct ti_syscon_reset_data { 55 + struct reset_controller_dev rcdev; 56 + struct regmap *regmap; 57 + struct ti_syscon_reset_control *controls; 58 + unsigned int nr_controls; 59 + }; 60 + 61 + #define to_ti_syscon_reset_data(rcdev) \ 62 + container_of(rcdev, struct ti_syscon_reset_data, rcdev) 63 + 64 + /** 65 + * ti_syscon_reset_assert() - assert device reset 66 + * @rcdev: reset controller entity 67 + * @id: ID of the reset to be asserted 68 + * 69 + * This function implements the reset driver op to assert a device's reset. 70 + * This asserts the reset in a manner prescribed by the reset flags. 71 + * 72 + * Return: 0 for successful request, else a corresponding error value 73 + */ 74 + static int ti_syscon_reset_assert(struct reset_controller_dev *rcdev, 75 + unsigned long id) 76 + { 77 + struct ti_syscon_reset_data *data = to_ti_syscon_reset_data(rcdev); 78 + struct ti_syscon_reset_control *control; 79 + unsigned int mask, value; 80 + 81 + if (id >= data->nr_controls) 82 + return -EINVAL; 83 + 84 + control = &data->controls[id]; 85 + 86 + if (control->flags & ASSERT_NONE) 87 + return -ENOTSUPP; /* assert not supported for this reset */ 88 + 89 + mask = BIT(control->assert_bit); 90 + value = (control->flags & ASSERT_SET) ? mask : 0x0; 91 + 92 + return regmap_update_bits(data->regmap, control->assert_offset, mask, value); 93 + } 94 + 95 + /** 96 + * ti_syscon_reset_deassert() - deassert device reset 97 + * @rcdev: reset controller entity 98 + * @id: ID of reset to be deasserted 99 + * 100 + * This function implements the reset driver op to deassert a device's reset. 101 + * This deasserts the reset in a manner prescribed by the reset flags. 102 + * 103 + * Return: 0 for successful request, else a corresponding error value 104 + */ 105 + static int ti_syscon_reset_deassert(struct reset_controller_dev *rcdev, 106 + unsigned long id) 107 + { 108 + struct ti_syscon_reset_data *data = to_ti_syscon_reset_data(rcdev); 109 + struct ti_syscon_reset_control *control; 110 + unsigned int mask, value; 111 + 112 + if (id >= data->nr_controls) 113 + return -EINVAL; 114 + 115 + control = &data->controls[id]; 116 + 117 + if (control->flags & DEASSERT_NONE) 118 + return -ENOTSUPP; /* deassert not supported for this reset */ 119 + 120 + mask = BIT(control->deassert_bit); 121 + value = (control->flags & DEASSERT_SET) ? mask : 0x0; 122 + 123 + return regmap_update_bits(data->regmap, control->deassert_offset, mask, value); 124 + } 125 + 126 + /** 127 + * ti_syscon_reset_status() - check device reset status 128 + * @rcdev: reset controller entity 129 + * @id: ID of the reset for which the status is being requested 130 + * 131 + * This function implements the reset driver op to return the status of a 132 + * device's reset. 133 + * 134 + * Return: 0 if reset is deasserted, true if reset is asserted, else a 135 + * corresponding error value 136 + */ 137 + static int ti_syscon_reset_status(struct reset_controller_dev *rcdev, 138 + unsigned long id) 139 + { 140 + struct ti_syscon_reset_data *data = to_ti_syscon_reset_data(rcdev); 141 + struct ti_syscon_reset_control *control; 142 + unsigned int reset_state; 143 + int ret; 144 + 145 + if (id >= data->nr_controls) 146 + return -EINVAL; 147 + 148 + control = &data->controls[id]; 149 + 150 + if (control->flags & STATUS_NONE) 151 + return -ENOTSUPP; /* status not supported for this reset */ 152 + 153 + ret = regmap_read(data->regmap, control->status_offset, &reset_state); 154 + if (ret) 155 + return ret; 156 + 157 + return (reset_state & BIT(control->status_bit)) && 158 + (control->flags & STATUS_SET); 159 + } 160 + 161 + static struct reset_control_ops ti_syscon_reset_ops = { 162 + .assert = ti_syscon_reset_assert, 163 + .deassert = ti_syscon_reset_deassert, 164 + .status = ti_syscon_reset_status, 165 + }; 166 + 167 + static int ti_syscon_reset_probe(struct platform_device *pdev) 168 + { 169 + struct device *dev = &pdev->dev; 170 + struct device_node *np = dev->of_node; 171 + struct ti_syscon_reset_data *data; 172 + struct regmap *regmap; 173 + const __be32 *list; 174 + struct ti_syscon_reset_control *controls; 175 + int size, nr_controls, i; 176 + 177 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 178 + if (!data) 179 + return -ENOMEM; 180 + 181 + regmap = syscon_node_to_regmap(np->parent); 182 + if (IS_ERR(regmap)) 183 + return PTR_ERR(regmap); 184 + 185 + list = of_get_property(np, "ti,reset-bits", &size); 186 + if (!list || (size / sizeof(*list)) % 7 != 0) { 187 + dev_err(dev, "invalid DT reset description\n"); 188 + return -EINVAL; 189 + } 190 + 191 + nr_controls = (size / sizeof(*list)) / 7; 192 + controls = devm_kzalloc(dev, nr_controls * sizeof(*controls), GFP_KERNEL); 193 + if (!controls) 194 + return -ENOMEM; 195 + 196 + for (i = 0; i < nr_controls; i++) { 197 + controls[i].assert_offset = be32_to_cpup(list++); 198 + controls[i].assert_bit = be32_to_cpup(list++); 199 + controls[i].deassert_offset = be32_to_cpup(list++); 200 + controls[i].deassert_bit = be32_to_cpup(list++); 201 + controls[i].status_offset = be32_to_cpup(list++); 202 + controls[i].status_bit = be32_to_cpup(list++); 203 + controls[i].flags = be32_to_cpup(list++); 204 + } 205 + 206 + data->rcdev.ops = &ti_syscon_reset_ops; 207 + data->rcdev.owner = THIS_MODULE; 208 + data->rcdev.of_node = np; 209 + data->rcdev.nr_resets = nr_controls; 210 + data->regmap = regmap; 211 + data->controls = controls; 212 + data->nr_controls = nr_controls; 213 + 214 + platform_set_drvdata(pdev, data); 215 + 216 + return devm_reset_controller_register(dev, &data->rcdev); 217 + } 218 + 219 + static const struct of_device_id ti_syscon_reset_of_match[] = { 220 + { .compatible = "ti,syscon-reset", }, 221 + { /* sentinel */ }, 222 + }; 223 + MODULE_DEVICE_TABLE(of, ti_syscon_reset_of_match); 224 + 225 + static struct platform_driver ti_syscon_reset_driver = { 226 + .probe = ti_syscon_reset_probe, 227 + .driver = { 228 + .name = "ti-syscon-reset", 229 + .of_match_table = ti_syscon_reset_of_match, 230 + }, 231 + }; 232 + module_platform_driver(ti_syscon_reset_driver); 233 + 234 + MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>"); 235 + MODULE_AUTHOR("Suman Anna <s-anna@ti.com>"); 236 + MODULE_DESCRIPTION("TI SYSCON Regmap Reset Driver"); 237 + MODULE_LICENSE("GPL v2");
+1 -11
drivers/reset/reset-zynq.c
··· 122 122 priv->rcdev.ops = &zynq_reset_ops; 123 123 priv->rcdev.of_node = pdev->dev.of_node; 124 124 125 - return reset_controller_register(&priv->rcdev); 126 - } 127 - 128 - static int zynq_reset_remove(struct platform_device *pdev) 129 - { 130 - struct zynq_reset_data *priv = platform_get_drvdata(pdev); 131 - 132 - reset_controller_unregister(&priv->rcdev); 133 - 134 - return 0; 125 + return devm_reset_controller_register(&pdev->dev, &priv->rcdev); 135 126 } 136 127 137 128 static const struct of_device_id zynq_reset_dt_ids[] = { ··· 132 141 133 142 static struct platform_driver zynq_reset_driver = { 134 143 .probe = zynq_reset_probe, 135 - .remove = zynq_reset_remove, 136 144 .driver = { 137 145 .name = KBUILD_MODNAME, 138 146 .of_match_table = zynq_reset_dt_ids,
-1
drivers/reset/sti/Kconfig
··· 2 2 3 3 config STI_RESET_SYSCFG 4 4 bool 5 - select RESET_CONTROLLER 6 5 7 6 config STIH415_RESET 8 7 bool
+1 -1
drivers/soc/Kconfig
··· 1 1 menu "SOC (System On Chip) specific Drivers" 2 2 3 3 source "drivers/soc/bcm/Kconfig" 4 - source "drivers/soc/brcmstb/Kconfig" 5 4 source "drivers/soc/fsl/qe/Kconfig" 6 5 source "drivers/soc/mediatek/Kconfig" 7 6 source "drivers/soc/qcom/Kconfig" ··· 9 10 source "drivers/soc/sunxi/Kconfig" 10 11 source "drivers/soc/tegra/Kconfig" 11 12 source "drivers/soc/ti/Kconfig" 13 + source "drivers/soc/ux500/Kconfig" 12 14 source "drivers/soc/versatile/Kconfig" 13 15 14 16 endmenu
+1 -1
drivers/soc/Makefile
··· 3 3 # 4 4 5 5 obj-y += bcm/ 6 - obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/ 7 6 obj-$(CONFIG_ARCH_DOVE) += dove/ 8 7 obj-$(CONFIG_MACH_DOVE) += dove/ 9 8 obj-y += fsl/ ··· 14 15 obj-$(CONFIG_ARCH_SUNXI) += sunxi/ 15 16 obj-$(CONFIG_ARCH_TEGRA) += tegra/ 16 17 obj-$(CONFIG_SOC_TI) += ti/ 18 + obj-$(CONFIG_ARCH_U8500) += ux500/ 17 19 obj-$(CONFIG_PLAT_VERSATILE) += versatile/
+16 -2
drivers/soc/bcm/Kconfig
··· 1 + menu "Broadcom SoC drivers" 2 + 1 3 config RASPBERRYPI_POWER 2 4 bool "Raspberry Pi power domain driver" 3 - depends on ARCH_BCM2835 || COMPILE_TEST 5 + depends on ARCH_BCM2835 || (COMPILE_TEST && OF) 4 6 depends on RASPBERRYPI_FIRMWARE=y 5 7 select PM_GENERIC_DOMAINS if PM 6 - select PM_GENERIC_DOMAINS_OF if PM 7 8 help 8 9 This enables support for the RPi power domains which can be enabled 9 10 or disabled via the RPi firmware. 11 + 12 + config SOC_BRCMSTB 13 + bool "Broadcom STB SoC drivers" 14 + depends on ARM 15 + select SOC_BUS 16 + help 17 + Enables drivers for the Broadcom Set-Top Box (STB) series of chips. 18 + This option alone enables only some support code, while the drivers 19 + can be enabled individually within this menu. 20 + 21 + If unsure, say N. 22 + 23 + endmenu
+1
drivers/soc/bcm/Makefile
··· 1 1 obj-$(CONFIG_RASPBERRYPI_POWER) += raspberrypi-power.o 2 + obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/
-10
drivers/soc/brcmstb/Kconfig
··· 1 - menuconfig SOC_BRCMSTB 2 - bool "Broadcom STB SoC drivers" 3 - depends on ARM 4 - select SOC_BUS 5 - help 6 - Enables drivers for the Broadcom Set-Top Box (STB) series of chips. 7 - This option alone enables only some support code, while the drivers 8 - can be enabled individually within this menu. 9 - 10 - If unsure, say N.
drivers/soc/brcmstb/Makefile drivers/soc/bcm/brcmstb/Makefile
+1
drivers/soc/brcmstb/biuctrl.c drivers/soc/bcm/brcmstb/biuctrl.c
··· 19 19 #include <linux/io.h> 20 20 #include <linux/of_address.h> 21 21 #include <linux/syscore_ops.h> 22 + #include <linux/soc/brcmstb/brcmstb.h> 22 23 23 24 #define CPU_CREDIT_REG_OFFSET 0x184 24 25 #define CPU_CREDIT_REG_MCPx_WR_PAIRING_EN_MASK 0x70000000
drivers/soc/brcmstb/common.c drivers/soc/bcm/brcmstb/common.c
+6 -6
drivers/soc/qcom/smem_state.c
··· 104 104 105 105 if (con_id) { 106 106 index = of_property_match_string(dev->of_node, 107 - "qcom,state-names", 107 + "qcom,smem-state-names", 108 108 con_id); 109 109 if (index < 0) { 110 - dev_err(dev, "missing qcom,state-names\n"); 110 + dev_err(dev, "missing qcom,smem-state-names\n"); 111 111 return ERR_PTR(index); 112 112 } 113 113 } 114 114 115 115 ret = of_parse_phandle_with_args(dev->of_node, 116 - "qcom,state", 117 - "#qcom,state-cells", 116 + "qcom,smem-states", 117 + "#qcom,smem-state-cells", 118 118 index, 119 119 &args); 120 120 if (ret) { 121 - dev_err(dev, "failed to parse qcom,state property\n"); 121 + dev_err(dev, "failed to parse qcom,smem-states property\n"); 122 122 return ERR_PTR(ret); 123 123 } 124 124 125 125 if (args.args_count != 1) { 126 - dev_err(dev, "invalid #qcom,state-cells\n"); 126 + dev_err(dev, "invalid #qcom,smem-state-cells\n"); 127 127 return ERR_PTR(-EINVAL); 128 128 } 129 129
+4 -3
drivers/soc/qcom/smp2p.c
··· 196 196 /* Match newly created entries */ 197 197 for (i = smp2p->valid_entries; i < in->valid_entries; i++) { 198 198 list_for_each_entry(entry, &smp2p->inbound, node) { 199 - memcpy_fromio(buf, in->entries[i].name, sizeof(buf)); 199 + memcpy(buf, in->entries[i].name, sizeof(buf)); 200 200 if (!strcmp(buf, entry->name)) { 201 201 entry->value = &in->entries[i].value; 202 202 break; ··· 343 343 344 344 /* Allocate an entry from the smem item */ 345 345 strlcpy(buf, entry->name, SMP2P_MAX_ENTRY_NAME); 346 - memcpy_toio(out->entries[out->valid_entries].name, buf, SMP2P_MAX_ENTRY_NAME); 347 - out->valid_entries++; 346 + memcpy(out->entries[out->valid_entries].name, buf, SMP2P_MAX_ENTRY_NAME); 348 347 349 348 /* Make the logical entry reference the physical value */ 350 349 entry->value = &out->entries[out->valid_entries].value; 350 + 351 + out->valid_entries++; 351 352 352 353 entry->state = qcom_smem_state_register(node, &smp2p_state_ops, entry); 353 354 if (IS_ERR(entry->state)) {
+1 -1
drivers/soc/qcom/smsm.c
··· 495 495 if (!smsm->hosts) 496 496 return -ENOMEM; 497 497 498 - local_node = of_find_node_with_property(pdev->dev.of_node, "#qcom,state-cells"); 498 + local_node = of_find_node_with_property(pdev->dev.of_node, "#qcom,smem-state-cells"); 499 499 if (!local_node) { 500 500 dev_err(&pdev->dev, "no state entry\n"); 501 501 return -EINVAL;
+106 -19
drivers/soc/qcom/wcnss_ctrl.c
··· 1 1 /* 2 + * Copyright (c) 2016, Linaro Ltd. 2 3 * Copyright (c) 2015, Sony Mobile Communications Inc. 3 4 * 4 5 * This program is free software; you can redistribute it and/or modify ··· 15 14 #include <linux/module.h> 16 15 #include <linux/slab.h> 17 16 #include <linux/soc/qcom/smd.h> 17 + #include <linux/io.h> 18 + #include <linux/of_platform.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/soc/qcom/wcnss_ctrl.h> 18 21 19 22 #define WCNSS_REQUEST_TIMEOUT (5 * HZ) 23 + #define WCNSS_CBC_TIMEOUT (10 * HZ) 24 + 25 + #define WCNSS_ACK_DONE_BOOTING 1 26 + #define WCNSS_ACK_COLD_BOOTING 2 20 27 21 28 #define NV_FRAGMENT_SIZE 3072 22 29 #define NVBIN_FILE "wlan/prima/WCNSS_qcom_wlan_nv.bin" ··· 34 25 * @dev: device handle 35 26 * @channel: SMD channel handle 36 27 * @ack: completion for outstanding requests 28 + * @cbc: completion for cbc complete indication 37 29 * @ack_status: status of the outstanding request 38 - * @download_nv_work: worker for uploading nv binary 30 + * @probe_work: worker for uploading nv binary 39 31 */ 40 32 struct wcnss_ctrl { 41 33 struct device *dev; 42 34 struct qcom_smd_channel *channel; 43 35 44 36 struct completion ack; 37 + struct completion cbc; 45 38 int ack_status; 46 39 47 - struct work_struct download_nv_work; 40 + struct work_struct probe_work; 48 41 }; 49 42 50 43 /* message types */ ··· 59 48 WCNSS_UPLOAD_CAL_RESP, 60 49 WCNSS_DOWNLOAD_CAL_REQ, 61 50 WCNSS_DOWNLOAD_CAL_RESP, 51 + WCNSS_VBAT_LEVEL_IND, 52 + WCNSS_BUILD_VERSION_REQ, 53 + WCNSS_BUILD_VERSION_RESP, 54 + WCNSS_PM_CONFIG_REQ, 55 + WCNSS_CBC_COMPLETE_IND, 62 56 }; 63 57 64 58 /** ··· 144 128 version->major, version->minor, 145 129 version->version, version->revision); 146 130 147 - schedule_work(&wcnss->download_nv_work); 131 + complete(&wcnss->ack); 148 132 break; 149 133 case WCNSS_DOWNLOAD_NV_RESP: 150 134 if (count != sizeof(*nvresp)) { ··· 156 140 nvresp = data; 157 141 wcnss->ack_status = nvresp->status; 158 142 complete(&wcnss->ack); 143 + break; 144 + case WCNSS_CBC_COMPLETE_IND: 145 + dev_dbg(wcnss->dev, "cold boot complete\n"); 146 + complete(&wcnss->cbc); 159 147 break; 160 148 default: 161 149 dev_info(wcnss->dev, "unknown message type %d\n", hdr->type); ··· 176 156 static int wcnss_request_version(struct wcnss_ctrl *wcnss) 177 157 { 178 158 struct wcnss_msg_hdr msg; 159 + int ret; 179 160 180 161 msg.type = WCNSS_VERSION_REQ; 181 162 msg.len = sizeof(msg); 163 + ret = qcom_smd_send(wcnss->channel, &msg, sizeof(msg)); 164 + if (ret < 0) 165 + return ret; 182 166 183 - return qcom_smd_send(wcnss->channel, &msg, sizeof(msg)); 167 + ret = wait_for_completion_timeout(&wcnss->ack, WCNSS_CBC_TIMEOUT); 168 + if (!ret) { 169 + dev_err(wcnss->dev, "timeout waiting for version response\n"); 170 + return -ETIMEDOUT; 171 + } 172 + 173 + return 0; 184 174 } 185 175 186 176 /** 187 177 * wcnss_download_nv() - send nv binary to WCNSS 188 - * @work: work struct to acquire wcnss context 178 + * @wcnss: wcnss_ctrl state handle 179 + * @expect_cbc: indicator to caller that an cbc event is expected 180 + * 181 + * Returns 0 on success. Negative errno on failure. 189 182 */ 190 - static void wcnss_download_nv(struct work_struct *work) 183 + static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc) 191 184 { 192 - struct wcnss_ctrl *wcnss = container_of(work, struct wcnss_ctrl, download_nv_work); 193 185 struct wcnss_download_nv_req *req; 194 186 const struct firmware *fw; 195 187 const void *data; ··· 210 178 211 179 req = kzalloc(sizeof(*req) + NV_FRAGMENT_SIZE, GFP_KERNEL); 212 180 if (!req) 213 - return; 181 + return -ENOMEM; 214 182 215 183 ret = request_firmware(&fw, NVBIN_FILE, wcnss->dev); 216 - if (ret) { 184 + if (ret < 0) { 217 185 dev_err(wcnss->dev, "Failed to load nv file %s: %d\n", 218 186 NVBIN_FILE, ret); 219 187 goto free_req; ··· 239 207 memcpy(req->fragment, data, req->frag_size); 240 208 241 209 ret = qcom_smd_send(wcnss->channel, req, req->hdr.len); 242 - if (ret) { 210 + if (ret < 0) { 243 211 dev_err(wcnss->dev, "failed to send smd packet\n"); 244 212 goto release_fw; 245 213 } ··· 252 220 } while (left > 0); 253 221 254 222 ret = wait_for_completion_timeout(&wcnss->ack, WCNSS_REQUEST_TIMEOUT); 255 - if (!ret) 223 + if (!ret) { 256 224 dev_err(wcnss->dev, "timeout waiting for nv upload ack\n"); 257 - else if (wcnss->ack_status != 1) 258 - dev_err(wcnss->dev, "nv upload response failed err: %d\n", 259 - wcnss->ack_status); 225 + ret = -ETIMEDOUT; 226 + } else { 227 + *expect_cbc = wcnss->ack_status == WCNSS_ACK_COLD_BOOTING; 228 + ret = 0; 229 + } 260 230 261 231 release_fw: 262 232 release_firmware(fw); 263 233 free_req: 264 234 kfree(req); 235 + 236 + return ret; 237 + } 238 + 239 + /** 240 + * qcom_wcnss_open_channel() - open additional SMD channel to WCNSS 241 + * @wcnss: wcnss handle, retrieved from drvdata 242 + * @name: SMD channel name 243 + * @cb: callback to handle incoming data on the channel 244 + */ 245 + struct qcom_smd_channel *qcom_wcnss_open_channel(void *wcnss, const char *name, qcom_smd_cb_t cb) 246 + { 247 + struct wcnss_ctrl *_wcnss = wcnss; 248 + 249 + return qcom_smd_open_channel(_wcnss->channel, name, cb); 250 + } 251 + EXPORT_SYMBOL(qcom_wcnss_open_channel); 252 + 253 + static void wcnss_async_probe(struct work_struct *work) 254 + { 255 + struct wcnss_ctrl *wcnss = container_of(work, struct wcnss_ctrl, probe_work); 256 + bool expect_cbc; 257 + int ret; 258 + 259 + ret = wcnss_request_version(wcnss); 260 + if (ret < 0) 261 + return; 262 + 263 + ret = wcnss_download_nv(wcnss, &expect_cbc); 264 + if (ret < 0) 265 + return; 266 + 267 + /* Wait for pending cold boot completion if indicated by the nv downloader */ 268 + if (expect_cbc) { 269 + ret = wait_for_completion_timeout(&wcnss->cbc, WCNSS_REQUEST_TIMEOUT); 270 + if (!ret) 271 + dev_err(wcnss->dev, "expected cold boot completion\n"); 272 + } 273 + 274 + of_platform_populate(wcnss->dev->of_node, NULL, NULL, wcnss->dev); 265 275 } 266 276 267 277 static int wcnss_ctrl_probe(struct qcom_smd_device *sdev) ··· 318 244 wcnss->channel = sdev->channel; 319 245 320 246 init_completion(&wcnss->ack); 321 - INIT_WORK(&wcnss->download_nv_work, wcnss_download_nv); 247 + init_completion(&wcnss->cbc); 248 + INIT_WORK(&wcnss->probe_work, wcnss_async_probe); 322 249 323 250 qcom_smd_set_drvdata(sdev->channel, wcnss); 251 + dev_set_drvdata(&sdev->dev, wcnss); 324 252 325 - return wcnss_request_version(wcnss); 253 + schedule_work(&wcnss->probe_work); 254 + 255 + return 0; 326 256 } 327 257 328 - static const struct qcom_smd_id wcnss_ctrl_smd_match[] = { 329 - { .name = "WCNSS_CTRL" }, 258 + static void wcnss_ctrl_remove(struct qcom_smd_device *sdev) 259 + { 260 + struct wcnss_ctrl *wcnss = qcom_smd_get_drvdata(sdev->channel); 261 + 262 + cancel_work_sync(&wcnss->probe_work); 263 + of_platform_depopulate(&sdev->dev); 264 + } 265 + 266 + static const struct of_device_id wcnss_ctrl_of_match[] = { 267 + { .compatible = "qcom,wcnss", }, 330 268 {} 331 269 }; 332 270 333 271 static struct qcom_smd_driver wcnss_ctrl_driver = { 334 272 .probe = wcnss_ctrl_probe, 273 + .remove = wcnss_ctrl_remove, 335 274 .callback = wcnss_ctrl_smd_callback, 336 - .smd_match_table = wcnss_ctrl_smd_match, 337 275 .driver = { 338 276 .name = "qcom_wcnss_ctrl", 339 277 .owner = THIS_MODULE, 278 + .of_match_table = wcnss_ctrl_of_match, 340 279 }, 341 280 }; 342 281
+4
drivers/soc/samsung/Kconfig
··· 10 10 bool "Exynos PMU controller driver" if COMPILE_TEST 11 11 depends on (ARM && ARCH_EXYNOS) || ((ARM || ARM64) && COMPILE_TEST) 12 12 13 + config EXYNOS_PM_DOMAINS 14 + bool "Exynos PM domains" if COMPILE_TEST 15 + depends on PM_GENERIC_DOMAINS || COMPILE_TEST 16 + 13 17 endif
+1
drivers/soc/samsung/Makefile
··· 1 1 obj-$(CONFIG_EXYNOS_PMU) += exynos-pmu.o exynos3250-pmu.o exynos4-pmu.o \ 2 2 exynos5250-pmu.o exynos5420-pmu.o 3 + obj-$(CONFIG_EXYNOS_PM_DOMAINS) += pm_domains.o
+1 -1
drivers/soc/samsung/exynos3250-pmu.c
··· 14 14 15 15 #include "exynos-pmu.h" 16 16 17 - static struct exynos_pmu_conf exynos3250_pmu_config[] = { 17 + static const struct exynos_pmu_conf exynos3250_pmu_config[] = { 18 18 /* { .offset = offset, .val = { AFTR, W-AFTR, SLEEP } */ 19 19 { EXYNOS3_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x2} }, 20 20 { EXYNOS3_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
+1 -1
drivers/soc/samsung/exynos5420-pmu.c
··· 17 17 18 18 #include "exynos-pmu.h" 19 19 20 - static struct exynos_pmu_conf exynos5420_pmu_config[] = { 20 + static const struct exynos_pmu_conf exynos5420_pmu_config[] = { 21 21 /* { .offset = offset, .val = { AFTR, LPA, SLEEP } */ 22 22 { EXYNOS5_ARM_CORE0_SYS_PWR_REG, { 0x0, 0x0, 0x0} }, 23 23 { EXYNOS5_DIS_IRQ_ARM_CORE0_LOCAL_SYS_PWR_REG, { 0x0, 0x0, 0x0} },
+115 -40
drivers/soc/tegra/pmc.c
··· 51 51 #define PMC_CNTRL_CPU_PWRREQ_POLARITY (1 << 15) /* CPU pwr req polarity */ 52 52 #define PMC_CNTRL_CPU_PWRREQ_OE (1 << 16) /* CPU pwr req enable */ 53 53 #define PMC_CNTRL_INTR_POLARITY (1 << 17) /* inverts INTR polarity */ 54 + #define PMC_CNTRL_MAIN_RST (1 << 4) 54 55 55 56 #define DPD_SAMPLE 0x020 56 57 #define DPD_SAMPLE_ENABLE (1 << 0) ··· 80 79 #define PMC_SENSOR_CTRL 0x1b0 81 80 #define PMC_SENSOR_CTRL_SCRATCH_WRITE (1 << 2) 82 81 #define PMC_SENSOR_CTRL_ENABLE_RST (1 << 1) 82 + 83 + #define PMC_RST_STATUS 0x1b4 84 + #define PMC_RST_STATUS_POR 0 85 + #define PMC_RST_STATUS_WATCHDOG 1 86 + #define PMC_RST_STATUS_SENSOR 2 87 + #define PMC_RST_STATUS_SW_MAIN 3 88 + #define PMC_RST_STATUS_LP0 4 89 + #define PMC_RST_STATUS_AOTAG 5 83 90 84 91 #define IO_DPD_REQ 0x1b8 85 92 #define IO_DPD_REQ_CODE_IDLE (0 << 30) ··· 408 399 disable_clks: 409 400 tegra_powergate_disable_clocks(pg); 410 401 usleep_range(10, 20); 402 + 411 403 powergate_off: 412 404 tegra_powergate_set(pg->id, false); 413 405 ··· 446 436 usleep_range(10, 20); 447 437 tegra_powergate_reset_deassert(pg); 448 438 usleep_range(10, 20); 439 + 449 440 disable_clks: 450 441 tegra_powergate_disable_clocks(pg); 451 442 ··· 551 540 struct tegra_powergate pg; 552 541 int err; 553 542 543 + if (!tegra_powergate_is_available(id)) 544 + return -EINVAL; 545 + 554 546 pg.id = id; 555 547 pg.clks = &clk; 556 548 pg.num_clks = 1; ··· 652 638 653 639 tegra_pmc_writel(value, PMC_SCRATCH0); 654 640 655 - value = tegra_pmc_readl(0); 656 - value |= 0x10; 657 - tegra_pmc_writel(value, 0); 641 + /* reset everything but PMC_SCRATCH0 and PMC_RST_STATUS */ 642 + value = tegra_pmc_readl(PMC_CNTRL); 643 + value |= PMC_CNTRL_MAIN_RST; 644 + tegra_pmc_writel(value, PMC_CNTRL); 658 645 659 646 return NOTIFY_DONE; 660 647 } ··· 737 722 err: 738 723 while (i--) 739 724 clk_put(pg->clks[i]); 725 + 740 726 kfree(pg->clks); 741 727 742 728 return err; 743 729 } 744 730 745 731 static int tegra_powergate_of_get_resets(struct tegra_powergate *pg, 746 - struct device_node *np) 732 + struct device_node *np, bool off) 747 733 { 748 734 struct reset_control *rst; 749 735 unsigned int i, count; ··· 764 748 err = PTR_ERR(pg->resets[i]); 765 749 goto error; 766 750 } 751 + 752 + if (off) 753 + err = reset_control_assert(pg->resets[i]); 754 + else 755 + err = reset_control_deassert(pg->resets[i]); 756 + 757 + if (err) { 758 + reset_control_put(pg->resets[i]); 759 + goto error; 760 + } 767 761 } 768 762 769 763 pg->num_resets = count; ··· 783 757 error: 784 758 while (i--) 785 759 reset_control_put(pg->resets[i]); 760 + 786 761 kfree(pg->resets); 787 762 788 763 return err; ··· 792 765 static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np) 793 766 { 794 767 struct tegra_powergate *pg; 768 + int id, err; 795 769 bool off; 796 - int id; 797 770 798 771 pg = kzalloc(sizeof(*pg), GFP_KERNEL); 799 772 if (!pg) 800 - goto error; 773 + return; 801 774 802 775 id = tegra_powergate_lookup(pmc, np->name); 803 - if (id < 0) 776 + if (id < 0) { 777 + dev_err(pmc->dev, "powergate lookup failed for %s: %d\n", 778 + np->name, id); 804 779 goto free_mem; 780 + } 805 781 806 782 /* 807 783 * Clear the bit for this powergate so it cannot be managed ··· 818 788 pg->genpd.power_on = tegra_genpd_power_on; 819 789 pg->pmc = pmc; 820 790 821 - if (tegra_powergate_of_get_clks(pg, np)) 822 - goto set_available; 823 - 824 - if (tegra_powergate_of_get_resets(pg, np)) 825 - goto remove_clks; 826 - 827 791 off = !tegra_powergate_is_powered(pg->id); 792 + 793 + err = tegra_powergate_of_get_clks(pg, np); 794 + if (err < 0) { 795 + dev_err(pmc->dev, "failed to get clocks for %s: %d\n", 796 + np->name, err); 797 + goto set_available; 798 + } 799 + 800 + err = tegra_powergate_of_get_resets(pg, np, off); 801 + if (err < 0) { 802 + dev_err(pmc->dev, "failed to get resets for %s: %d\n", 803 + np->name, err); 804 + goto remove_clks; 805 + } 806 + 807 + if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) 808 + goto power_on_cleanup; 809 + 810 + /* 811 + * FIXME: If XHCI is enabled for Tegra, then power-up the XUSB 812 + * host and super-speed partitions. Once the XHCI driver 813 + * manages the partitions itself this code can be removed. Note 814 + * that we don't register these partitions with the genpd core 815 + * to avoid it from powering down the partitions as they appear 816 + * to be unused. 817 + */ 818 + if (IS_ENABLED(CONFIG_USB_XHCI_TEGRA) && 819 + (id == TEGRA_POWERGATE_XUSBA || id == TEGRA_POWERGATE_XUSBC)) 820 + goto power_on_cleanup; 828 821 829 822 pm_genpd_init(&pg->genpd, NULL, off); 830 823 831 - if (of_genpd_add_provider_simple(np, &pg->genpd)) 824 + err = of_genpd_add_provider_simple(np, &pg->genpd); 825 + if (err < 0) { 826 + dev_err(pmc->dev, "failed to add genpd provider for %s: %d\n", 827 + np->name, err); 832 828 goto remove_resets; 829 + } 833 830 834 831 dev_dbg(pmc->dev, "added power domain %s\n", pg->genpd.name); 835 832 836 833 return; 837 834 835 + power_on_cleanup: 836 + if (off) 837 + WARN_ON(tegra_powergate_power_up(pg, true)); 838 + 838 839 remove_resets: 839 840 while (pg->num_resets--) 840 841 reset_control_put(pg->resets[pg->num_resets]); 842 + 841 843 kfree(pg->resets); 842 844 843 845 remove_clks: 844 846 while (pg->num_clks--) 845 847 clk_put(pg->clks[pg->num_clks]); 848 + 846 849 kfree(pg->clks); 847 850 848 851 set_available: ··· 883 820 884 821 free_mem: 885 822 kfree(pg); 886 - 887 - error: 888 - dev_err(pmc->dev, "failed to create power domain for %s\n", np->name); 889 823 } 890 824 891 - static void tegra_powergate_init(struct tegra_pmc *pmc) 825 + static void tegra_powergate_init(struct tegra_pmc *pmc, 826 + struct device_node *parent) 892 827 { 893 828 struct device_node *np, *child; 829 + unsigned int i; 894 830 895 - np = of_get_child_by_name(pmc->dev->of_node, "powergates"); 831 + /* Create a bitmap of the available and valid partitions */ 832 + for (i = 0; i < pmc->soc->num_powergates; i++) 833 + if (pmc->soc->powergates[i]) 834 + set_bit(i, pmc->powergates_available); 835 + 836 + np = of_get_child_by_name(parent, "powergates"); 896 837 if (!np) 897 838 return; 898 839 ··· 1272 1205 struct resource *res; 1273 1206 int err; 1274 1207 1208 + /* 1209 + * Early initialisation should have configured an initial 1210 + * register mapping and setup the soc data pointer. If these 1211 + * are not valid then something went badly wrong! 1212 + */ 1213 + if (WARN_ON(!pmc->base || !pmc->soc)) 1214 + return -ENODEV; 1215 + 1275 1216 err = tegra_pmc_parse_dt(pmc, pdev->dev.of_node); 1276 1217 if (err < 0) 1277 1218 return err; ··· 1316 1241 err); 1317 1242 return err; 1318 1243 } 1319 - 1320 - tegra_powergate_init(pmc); 1321 1244 1322 1245 mutex_lock(&pmc->powergates_lock); 1323 1246 iounmap(pmc->base); ··· 1550 1477 const struct of_device_id *match; 1551 1478 struct device_node *np; 1552 1479 struct resource regs; 1553 - unsigned int i; 1554 1480 bool invert; 1555 1481 u32 value; 1482 + 1483 + mutex_init(&pmc->powergates_lock); 1556 1484 1557 1485 np = of_find_matching_node_and_match(NULL, tegra_pmc_match, &match); 1558 1486 if (!np) { ··· 1589 1515 */ 1590 1516 if (of_address_to_resource(np, 0, &regs) < 0) { 1591 1517 pr_err("failed to get PMC registers\n"); 1518 + of_node_put(np); 1592 1519 return -ENXIO; 1593 1520 } 1594 - 1595 - pmc->soc = match->data; 1596 1521 } 1597 1522 1598 1523 pmc->base = ioremap_nocache(regs.start, resource_size(&regs)); 1599 1524 if (!pmc->base) { 1600 1525 pr_err("failed to map PMC registers\n"); 1526 + of_node_put(np); 1601 1527 return -ENXIO; 1602 1528 } 1603 1529 1604 - /* Create a bit-map of the available and valid partitions */ 1605 - for (i = 0; i < pmc->soc->num_powergates; i++) 1606 - if (pmc->soc->powergates[i]) 1607 - set_bit(i, pmc->powergates_available); 1530 + if (np) { 1531 + pmc->soc = match->data; 1608 1532 1609 - mutex_init(&pmc->powergates_lock); 1533 + tegra_powergate_init(pmc, np); 1610 1534 1611 - /* 1612 - * Invert the interrupt polarity if a PMC device tree node exists and 1613 - * contains the nvidia,invert-interrupt property. 1614 - */ 1615 - invert = of_property_read_bool(np, "nvidia,invert-interrupt"); 1535 + /* 1536 + * Invert the interrupt polarity if a PMC device tree node 1537 + * exists and contains the nvidia,invert-interrupt property. 1538 + */ 1539 + invert = of_property_read_bool(np, "nvidia,invert-interrupt"); 1616 1540 1617 - value = tegra_pmc_readl(PMC_CNTRL); 1541 + value = tegra_pmc_readl(PMC_CNTRL); 1618 1542 1619 - if (invert) 1620 - value |= PMC_CNTRL_INTR_POLARITY; 1621 - else 1622 - value &= ~PMC_CNTRL_INTR_POLARITY; 1543 + if (invert) 1544 + value |= PMC_CNTRL_INTR_POLARITY; 1545 + else 1546 + value &= ~PMC_CNTRL_INTR_POLARITY; 1623 1547 1624 - tegra_pmc_writel(value, PMC_CNTRL); 1548 + tegra_pmc_writel(value, PMC_CNTRL); 1549 + 1550 + of_node_put(np); 1551 + } 1625 1552 1626 1553 return 0; 1627 1554 }
+7
drivers/soc/ux500/Kconfig
··· 1 + config UX500_SOC_ID 2 + bool "SoC bus for ST-Ericsson ux500" 3 + depends on ARCH_U8500 || COMPILE_TEST 4 + default ARCH_U8500 5 + help 6 + Include support for the SoC bus on the ARM RealView platforms 7 + providing some sysfs information about the ASIC variant.
+1
drivers/soc/ux500/Makefile
··· 1 + obj-$(CONFIG_UX500_SOC_ID) += ux500-soc-id.o
+222
drivers/soc/ux500/ux500-soc-id.c
··· 1 + /* 2 + * Copyright (C) ST-Ericsson SA 2010 3 + * 4 + * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 5 + * License terms: GNU General Public License (GPL) version 2 6 + */ 7 + 8 + #include <linux/kernel.h> 9 + #include <linux/init.h> 10 + #include <linux/io.h> 11 + #include <linux/module.h> 12 + #include <linux/random.h> 13 + #include <linux/slab.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/sys_soc.h> 17 + 18 + #include <asm/cputype.h> 19 + #include <asm/tlbflush.h> 20 + #include <asm/cacheflush.h> 21 + #include <asm/mach/map.h> 22 + 23 + /** 24 + * struct dbx500_asic_id - fields of the ASIC ID 25 + * @process: the manufacturing process, 0x40 is 40 nm 0x00 is "standard" 26 + * @partnumber: hithereto 0x8500 for DB8500 27 + * @revision: version code in the series 28 + */ 29 + struct dbx500_asic_id { 30 + u16 partnumber; 31 + u8 revision; 32 + u8 process; 33 + }; 34 + 35 + static struct dbx500_asic_id dbx500_id; 36 + 37 + static unsigned int __init ux500_read_asicid(phys_addr_t addr) 38 + { 39 + void __iomem *virt = ioremap(addr, 4); 40 + unsigned int asicid; 41 + 42 + if (!virt) 43 + return 0; 44 + 45 + asicid = readl(virt); 46 + iounmap(virt); 47 + 48 + return asicid; 49 + } 50 + 51 + static void ux500_print_soc_info(unsigned int asicid) 52 + { 53 + unsigned int rev = dbx500_id.revision; 54 + 55 + pr_info("DB%4x ", dbx500_id.partnumber); 56 + 57 + if (rev == 0x01) 58 + pr_cont("Early Drop"); 59 + else if (rev >= 0xA0) 60 + pr_cont("v%d.%d" , (rev >> 4) - 0xA + 1, rev & 0xf); 61 + else 62 + pr_cont("Unknown"); 63 + 64 + pr_cont(" [%#010x]\n", asicid); 65 + } 66 + 67 + static unsigned int partnumber(unsigned int asicid) 68 + { 69 + return (asicid >> 8) & 0xffff; 70 + } 71 + 72 + /* 73 + * SOC MIDR ASICID ADDRESS ASICID VALUE 74 + * DB8500ed 0x410fc090 0x9001FFF4 0x00850001 75 + * DB8500v1 0x411fc091 0x9001FFF4 0x008500A0 76 + * DB8500v1.1 0x411fc091 0x9001FFF4 0x008500A1 77 + * DB8500v2 0x412fc091 0x9001DBF4 0x008500B0 78 + * DB8520v2.2 0x412fc091 0x9001DBF4 0x008500B2 79 + * DB5500v1 0x412fc091 0x9001FFF4 0x005500A0 80 + * DB9540 0x413fc090 0xFFFFDBF4 0x009540xx 81 + */ 82 + 83 + static void __init ux500_setup_id(void) 84 + { 85 + unsigned int cpuid = read_cpuid_id(); 86 + unsigned int asicid = 0; 87 + phys_addr_t addr = 0; 88 + 89 + switch (cpuid) { 90 + case 0x410fc090: /* DB8500ed */ 91 + case 0x411fc091: /* DB8500v1 */ 92 + addr = 0x9001FFF4; 93 + break; 94 + 95 + case 0x412fc091: /* DB8520 / DB8500v2 / DB5500v1 */ 96 + asicid = ux500_read_asicid(0x9001DBF4); 97 + if (partnumber(asicid) == 0x8500 || 98 + partnumber(asicid) == 0x8520) 99 + /* DB8500v2 */ 100 + break; 101 + 102 + /* DB5500v1 */ 103 + addr = 0x9001FFF4; 104 + break; 105 + 106 + case 0x413fc090: /* DB9540 */ 107 + addr = 0xFFFFDBF4; 108 + break; 109 + } 110 + 111 + if (addr) 112 + asicid = ux500_read_asicid(addr); 113 + 114 + if (!asicid) { 115 + pr_err("Unable to identify SoC\n"); 116 + BUG(); 117 + } 118 + 119 + dbx500_id.process = asicid >> 24; 120 + dbx500_id.partnumber = partnumber(asicid); 121 + dbx500_id.revision = asicid & 0xff; 122 + 123 + ux500_print_soc_info(asicid); 124 + } 125 + 126 + static const char * __init ux500_get_machine(void) 127 + { 128 + return kasprintf(GFP_KERNEL, "DB%4x", dbx500_id.partnumber); 129 + } 130 + 131 + static const char * __init ux500_get_family(void) 132 + { 133 + return kasprintf(GFP_KERNEL, "ux500"); 134 + } 135 + 136 + static const char * __init ux500_get_revision(void) 137 + { 138 + unsigned int rev = dbx500_id.revision; 139 + 140 + if (rev == 0x01) 141 + return kasprintf(GFP_KERNEL, "%s", "ED"); 142 + else if (rev >= 0xA0) 143 + return kasprintf(GFP_KERNEL, "%d.%d", 144 + (rev >> 4) - 0xA + 1, rev & 0xf); 145 + 146 + return kasprintf(GFP_KERNEL, "%s", "Unknown"); 147 + } 148 + 149 + static ssize_t ux500_get_process(struct device *dev, 150 + struct device_attribute *attr, 151 + char *buf) 152 + { 153 + if (dbx500_id.process == 0x00) 154 + return sprintf(buf, "Standard\n"); 155 + 156 + return sprintf(buf, "%02xnm\n", dbx500_id.process); 157 + } 158 + 159 + static const char *db8500_read_soc_id(struct device_node *backupram) 160 + { 161 + void __iomem *base; 162 + void __iomem *uid; 163 + const char *retstr; 164 + 165 + base = of_iomap(backupram, 0); 166 + if (!base) 167 + return NULL; 168 + uid = base + 0x1fc0; 169 + 170 + /* Throw these device-specific numbers into the entropy pool */ 171 + add_device_randomness(uid, 0x14); 172 + retstr = kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x", 173 + readl((u32 *)uid+0), 174 + readl((u32 *)uid+1), readl((u32 *)uid+2), 175 + readl((u32 *)uid+3), readl((u32 *)uid+4)); 176 + iounmap(base); 177 + return retstr; 178 + } 179 + 180 + static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr, 181 + struct device_node *backupram) 182 + { 183 + soc_dev_attr->soc_id = db8500_read_soc_id(backupram); 184 + soc_dev_attr->machine = ux500_get_machine(); 185 + soc_dev_attr->family = ux500_get_family(); 186 + soc_dev_attr->revision = ux500_get_revision(); 187 + } 188 + 189 + static const struct device_attribute ux500_soc_attr = 190 + __ATTR(process, S_IRUGO, ux500_get_process, NULL); 191 + 192 + static int __init ux500_soc_device_init(void) 193 + { 194 + struct device *parent; 195 + struct soc_device *soc_dev; 196 + struct soc_device_attribute *soc_dev_attr; 197 + struct device_node *backupram; 198 + 199 + backupram = of_find_compatible_node(NULL, NULL, "ste,dbx500-backupram"); 200 + if (!backupram) 201 + return 0; 202 + 203 + ux500_setup_id(); 204 + 205 + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); 206 + if (!soc_dev_attr) 207 + return -ENOMEM; 208 + 209 + soc_info_populate(soc_dev_attr, backupram); 210 + 211 + soc_dev = soc_device_register(soc_dev_attr); 212 + if (IS_ERR(soc_dev)) { 213 + kfree(soc_dev_attr); 214 + return PTR_ERR(soc_dev); 215 + } 216 + 217 + parent = soc_device_to_device(soc_dev); 218 + device_create_file(parent, &ux500_soc_attr); 219 + 220 + return 0; 221 + } 222 + subsys_initcall(ux500_soc_device_init);
+1 -1
drivers/tty/serial/clps711x.c
··· 539 539 } 540 540 541 541 static const struct of_device_id __maybe_unused clps711x_uart_dt_ids[] = { 542 - { .compatible = "cirrus,clps711x-uart", }, 542 + { .compatible = "cirrus,ep7209-uart", }, 543 543 { } 544 544 }; 545 545 MODULE_DEVICE_TABLE(of, clps711x_uart_dt_ids);
+2 -2
drivers/video/fbdev/clps711x-fb.c
··· 273 273 } 274 274 275 275 cfb->syscon = 276 - syscon_regmap_lookup_by_compatible("cirrus,clps711x-syscon1"); 276 + syscon_regmap_lookup_by_compatible("cirrus,ep7209-syscon1"); 277 277 if (IS_ERR(cfb->syscon)) { 278 278 ret = PTR_ERR(cfb->syscon); 279 279 goto out_fb_release; ··· 376 376 } 377 377 378 378 static const struct of_device_id clps711x_fb_dt_ids[] = { 379 - { .compatible = "cirrus,clps711x-fb", }, 379 + { .compatible = "cirrus,ep7209-fb", }, 380 380 { } 381 381 }; 382 382 MODULE_DEVICE_TABLE(of, clps711x_fb_dt_ids);
+210
include/dt-bindings/reset/amlogic,meson-gxbb-reset.h
··· 1 + /* 2 + * This file is provided under a dual BSD/GPLv2 license. When using or 3 + * redistributing this file, you may do so under either license. 4 + * 5 + * GPL LICENSE SUMMARY 6 + * 7 + * Copyright (c) 2016 BayLibre, SAS. 8 + * Author: Neil Armstrong <narmstrong@baylibre.com> 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of version 2 of the GNU General Public License as 12 + * published by the Free Software Foundation. 13 + * 14 + * This program is distributed in the hope that it will be useful, but 15 + * WITHOUT ANY WARRANTY; without even the implied warranty of 16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 + * General Public License for more details. 18 + * 19 + * You should have received a copy of the GNU General Public License 20 + * along with this program; if not, see <http://www.gnu.org/licenses/>. 21 + * The full GNU General Public License is included in this distribution 22 + * in the file called COPYING. 23 + * 24 + * BSD LICENSE 25 + * 26 + * Copyright (c) 2016 BayLibre, SAS. 27 + * Author: Neil Armstrong <narmstrong@baylibre.com> 28 + * 29 + * Redistribution and use in source and binary forms, with or without 30 + * modification, are permitted provided that the following conditions 31 + * are met: 32 + * 33 + * * Redistributions of source code must retain the above copyright 34 + * notice, this list of conditions and the following disclaimer. 35 + * * Redistributions in binary form must reproduce the above copyright 36 + * notice, this list of conditions and the following disclaimer in 37 + * the documentation and/or other materials provided with the 38 + * distribution. 39 + * * Neither the name of Intel Corporation nor the names of its 40 + * contributors may be used to endorse or promote products derived 41 + * from this software without specific prior written permission. 42 + * 43 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 44 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 45 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 46 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 47 + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 48 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 49 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 50 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 52 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 53 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 + */ 55 + #ifndef _DT_BINDINGS_AMLOGIC_MESON_GXBB_RESET_H 56 + #define _DT_BINDINGS_AMLOGIC_MESON_GXBB_RESET_H 57 + 58 + /* RESET0 */ 59 + #define RESET_HIU 0 60 + /* 1 */ 61 + #define RESET_DOS_RESET 2 62 + #define RESET_DDR_TOP 3 63 + #define RESET_DCU_RESET 4 64 + #define RESET_VIU 5 65 + #define RESET_AIU 6 66 + #define RESET_VID_PLL_DIV 7 67 + /* 8 */ 68 + #define RESET_PMUX 9 69 + #define RESET_VENC 10 70 + #define RESET_ASSIST 11 71 + #define RESET_AFIFO2 12 72 + #define RESET_VCBUS 13 73 + /* 14 */ 74 + /* 15 */ 75 + #define RESET_GIC 16 76 + #define RESET_CAPB3_DECODE 17 77 + #define RESET_NAND_CAPB3 18 78 + #define RESET_HDMITX_CAPB3 19 79 + #define RESET_MALI_CAPB3 20 80 + #define RESET_DOS_CAPB3 21 81 + #define RESET_SYS_CPU_CAPB3 22 82 + #define RESET_CBUS_CAPB3 23 83 + #define RESET_AHB_CNTL 24 84 + #define RESET_AHB_DATA 25 85 + #define RESET_VCBUS_CLK81 26 86 + #define RESET_MMC 27 87 + #define RESET_MIPI_0 28 88 + #define RESET_MIPI_1 29 89 + #define RESET_MIPI_2 30 90 + #define RESET_MIPI_3 31 91 + /* RESET1 */ 92 + #define RESET_CPPM 32 93 + #define RESET_DEMUX 33 94 + #define RESET_USB_OTG 34 95 + #define RESET_DDR 35 96 + #define RESET_AO_RESET 36 97 + #define RESET_BT656 37 98 + #define RESET_AHB_SRAM 38 99 + /* 39 */ 100 + #define RESET_PARSER 40 101 + #define RESET_BLKMV 41 102 + #define RESET_ISA 42 103 + #define RESET_ETHERNET 43 104 + #define RESET_SD_EMMC_A 44 105 + #define RESET_SD_EMMC_B 45 106 + #define RESET_SD_EMMC_C 46 107 + #define RESET_ROM_BOOT 47 108 + #define RESET_SYS_CPU_0 48 109 + #define RESET_SYS_CPU_1 49 110 + #define RESET_SYS_CPU_2 50 111 + #define RESET_SYS_CPU_3 51 112 + #define RESET_SYS_CPU_CORE_0 52 113 + #define RESET_SYS_CPU_CORE_1 53 114 + #define RESET_SYS_CPU_CORE_2 54 115 + #define RESET_SYS_CPU_CORE_3 55 116 + #define RESET_SYS_PLL_DIV 56 117 + #define RESET_SYS_CPU_AXI 57 118 + #define RESET_SYS_CPU_L2 58 119 + #define RESET_SYS_CPU_P 59 120 + #define RESET_SYS_CPU_MBIST 60 121 + /* 61 */ 122 + /* 62 */ 123 + /* 63 */ 124 + /* RESET2 */ 125 + #define RESET_VD_RMEM 64 126 + #define RESET_AUDIN 65 127 + #define RESET_HDMI_TX 66 128 + /* 67 */ 129 + /* 68 */ 130 + /* 69 */ 131 + #define RESET_GE2D 70 132 + #define RESET_PARSER_REG 71 133 + #define RESET_PARSER_FETCH 72 134 + #define RESET_PARSER_CTL 73 135 + #define RESET_PARSER_TOP 74 136 + /* 75 */ 137 + /* 76 */ 138 + #define RESET_AO_CPU_RESET 77 139 + #define RESET_MALI 78 140 + #define RESET_HDMI_SYSTEM_RESET 79 141 + /* 80-95 */ 142 + /* RESET3 */ 143 + #define RESET_RING_OSCILLATOR 96 144 + #define RESET_SYS_CPU 97 145 + #define RESET_EFUSE 98 146 + #define RESET_SYS_CPU_BVCI 99 147 + #define RESET_AIFIFO 100 148 + #define RESET_TVFE 101 149 + #define RESET_AHB_BRIDGE_CNTL 102 150 + /* 103 */ 151 + #define RESET_AUDIO_DAC 104 152 + #define RESET_DEMUX_TOP 105 153 + #define RESET_DEMUX_DES 106 154 + #define RESET_DEMUX_S2P_0 107 155 + #define RESET_DEMUX_S2P_1 108 156 + #define RESET_DEMUX_RESET_0 109 157 + #define RESET_DEMUX_RESET_1 110 158 + #define RESET_DEMUX_RESET_2 111 159 + /* 112-127 */ 160 + /* RESET4 */ 161 + /* 128 */ 162 + /* 129 */ 163 + /* 130 */ 164 + /* 131 */ 165 + #define RESET_DVIN_RESET 132 166 + #define RESET_RDMA 133 167 + #define RESET_VENCI 134 168 + #define RESET_VENCP 135 169 + /* 136 */ 170 + #define RESET_VDAC 137 171 + #define RESET_RTC 138 172 + /* 139 */ 173 + #define RESET_VDI6 140 174 + #define RESET_VENCL 141 175 + #define RESET_I2C_MASTER_2 142 176 + #define RESET_I2C_MASTER_1 143 177 + /* 144-159 */ 178 + /* RESET5 */ 179 + /* 160-191 */ 180 + /* RESET6 */ 181 + #define RESET_PERIPHS_GENERAL 192 182 + #define RESET_PERIPHS_SPICC 193 183 + #define RESET_PERIPHS_SMART_CARD 194 184 + #define RESET_PERIPHS_SAR_ADC 195 185 + #define RESET_PERIPHS_I2C_MASTER_0 196 186 + #define RESET_SANA 197 187 + /* 198 */ 188 + #define RESET_PERIPHS_STREAM_INTERFACE 199 189 + #define RESET_PERIPHS_SDIO 200 190 + #define RESET_PERIPHS_UART_0 201 191 + #define RESET_PERIPHS_UART_1_2 202 192 + #define RESET_PERIPHS_ASYNC_0 203 193 + #define RESET_PERIPHS_ASYNC_1 204 194 + #define RESET_PERIPHS_SPI_0 205 195 + #define RESET_PERIPHS_SDHC 206 196 + #define RESET_UART_SLIP 207 197 + /* 208-223 */ 198 + /* RESET7 */ 199 + #define RESET_USB_DDR_0 224 200 + #define RESET_USB_DDR_1 225 201 + #define RESET_USB_DDR_2 226 202 + #define RESET_USB_DDR_3 227 203 + /* 228 */ 204 + #define RESET_DEVICE_MMC_ARB 229 205 + /* 230 */ 206 + #define RESET_VID_LOCK 231 207 + #define RESET_A9_DMC_PIPEL 232 208 + /* 233-255 */ 209 + 210 + #endif
+175
include/dt-bindings/reset/amlogic,meson8b-reset.h
··· 1 + /* 2 + * This file is provided under a dual BSD/GPLv2 license. When using or 3 + * redistributing this file, you may do so under either license. 4 + * 5 + * GPL LICENSE SUMMARY 6 + * 7 + * Copyright (c) 2016 BayLibre, SAS. 8 + * Author: Neil Armstrong <narmstrong@baylibre.com> 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of version 2 of the GNU General Public License as 12 + * published by the Free Software Foundation. 13 + * 14 + * This program is distributed in the hope that it will be useful, but 15 + * WITHOUT ANY WARRANTY; without even the implied warranty of 16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 + * General Public License for more details. 18 + * 19 + * You should have received a copy of the GNU General Public License 20 + * along with this program; if not, see <http://www.gnu.org/licenses/>. 21 + * The full GNU General Public License is included in this distribution 22 + * in the file called COPYING. 23 + * 24 + * BSD LICENSE 25 + * 26 + * Copyright (c) 2016 BayLibre, SAS. 27 + * Author: Neil Armstrong <narmstrong@baylibre.com> 28 + * 29 + * Redistribution and use in source and binary forms, with or without 30 + * modification, are permitted provided that the following conditions 31 + * are met: 32 + * 33 + * * Redistributions of source code must retain the above copyright 34 + * notice, this list of conditions and the following disclaimer. 35 + * * Redistributions in binary form must reproduce the above copyright 36 + * notice, this list of conditions and the following disclaimer in 37 + * the documentation and/or other materials provided with the 38 + * distribution. 39 + * * Neither the name of Intel Corporation nor the names of its 40 + * contributors may be used to endorse or promote products derived 41 + * from this software without specific prior written permission. 42 + * 43 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 44 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 45 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 46 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 47 + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 48 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 49 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 50 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 51 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 52 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 53 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 + */ 55 + #ifndef _DT_BINDINGS_AMLOGIC_MESON8B_RESET_H 56 + #define _DT_BINDINGS_AMLOGIC_MESON8B_RESET_H 57 + 58 + /* RESET0 */ 59 + #define RESET_HIU 0 60 + #define RESET_VLD 1 61 + #define RESET_IQIDCT 2 62 + #define RESET_MC 3 63 + /* 8 */ 64 + #define RESET_VIU 5 65 + #define RESET_AIU 6 66 + #define RESET_MCPU 7 67 + #define RESET_CCPU 8 68 + #define RESET_PMUX 9 69 + #define RESET_VENC 10 70 + #define RESET_ASSIST 11 71 + #define RESET_AFIFO2 12 72 + #define RESET_MDEC 13 73 + #define RESET_VLD_PART 14 74 + #define RESET_VIFIFO 15 75 + /* 16-31 */ 76 + /* RESET1 */ 77 + /* 32 */ 78 + #define RESET_DEMUX 33 79 + #define RESET_USB_OTG 34 80 + #define RESET_DDR 35 81 + #define RESET_VDAC_1 36 82 + #define RESET_BT656 37 83 + #define RESET_AHB_SRAM 38 84 + #define RESET_AHB_BRIDGE 39 85 + #define RESET_PARSER 40 86 + #define RESET_BLKMV 41 87 + #define RESET_ISA 42 88 + #define RESET_ETHERNET 43 89 + #define RESET_ABUF 44 90 + #define RESET_AHB_DATA 45 91 + #define RESET_AHB_CNTL 46 92 + #define RESET_ROM_BOOT 47 93 + /* 48-63 */ 94 + /* RESET2 */ 95 + #define RESET_VD_RMEM 64 96 + #define RESET_AUDIN 65 97 + #define RESET_DBLK 66 98 + #define RESET_PIC_DC 66 99 + #define RESET_PSC 66 100 + #define RESET_NAND 66 101 + #define RESET_GE2D 70 102 + #define RESET_PARSER_REG 71 103 + #define RESET_PARSER_FETCH 72 104 + #define RESET_PARSER_CTL 73 105 + #define RESET_PARSER_TOP 74 106 + #define RESET_HDMI_APB 75 107 + #define RESET_AUDIO_APB 76 108 + #define RESET_MEDIA_CPU 77 109 + #define RESET_MALI 78 110 + #define RESET_HDMI_SYSTEM_RESET 79 111 + /* 80-95 */ 112 + /* RESET3 */ 113 + #define RESET_RING_OSCILLATOR 96 114 + #define RESET_SYS_CPU_0 97 115 + #define RESET_EFUSE 98 116 + #define RESET_SYS_CPU_BVCI 99 117 + #define RESET_AIFIFO 100 118 + #define RESET_AUDIO_PLL_MODULATOR 101 119 + #define RESET_AHB_BRIDGE_CNTL 102 120 + #define RESET_SYS_CPU_1 103 121 + #define RESET_AUDIO_DAC 104 122 + #define RESET_DEMUX_TOP 105 123 + #define RESET_DEMUX_DES 106 124 + #define RESET_DEMUX_S2P_0 107 125 + #define RESET_DEMUX_S2P_1 108 126 + #define RESET_DEMUX_RESET_0 109 127 + #define RESET_DEMUX_RESET_1 110 128 + #define RESET_DEMUX_RESET_2 111 129 + /* 112-127 */ 130 + /* RESET4 */ 131 + #define RESET_PL310 128 132 + #define RESET_A5_APB 129 133 + #define RESET_A5_AXI 130 134 + #define RESET_A5 131 135 + #define RESET_DVIN 132 136 + #define RESET_RDMA 133 137 + #define RESET_VENCI 134 138 + #define RESET_VENCP 135 139 + #define RESET_VENCT 136 140 + #define RESET_VDAC_4 137 141 + #define RESET_RTC 138 142 + #define RESET_A5_DEBUG 139 143 + #define RESET_VDI6 140 144 + #define RESET_VENCL 141 145 + /* 142-159 */ 146 + /* RESET5 */ 147 + #define RESET_DDR_PLL 160 148 + #define RESET_MISC_PLL 161 149 + #define RESET_SYS_PLL 162 150 + #define RESET_HPLL_PLL 163 151 + #define RESET_AUDIO_PLL 164 152 + #define RESET_VID2_PLL 165 153 + /* 166-191 */ 154 + /* RESET6 */ 155 + #define RESET_PERIPHS_GENERAL 192 156 + #define RESET_PERIPHS_IR_REMOTE 193 157 + #define RESET_PERIPHS_SMART_CARD 194 158 + #define RESET_PERIPHS_SAR_ADC 195 159 + #define RESET_PERIPHS_I2C_MASTER_0 196 160 + #define RESET_PERIPHS_I2C_MASTER_1 197 161 + #define RESET_PERIPHS_I2C_SLAVE 198 162 + #define RESET_PERIPHS_STREAM_INTERFACE 199 163 + #define RESET_PERIPHS_SDIO 200 164 + #define RESET_PERIPHS_UART_0 201 165 + #define RESET_PERIPHS_UART_1 202 166 + #define RESET_PERIPHS_ASYNC_0 203 167 + #define RESET_PERIPHS_ASYNC_1 204 168 + #define RESET_PERIPHS_SPI_0 205 169 + #define RESET_PERIPHS_SPI_1 206 170 + #define RESET_PERIPHS_LED_PWM 207 171 + /* 208-223 */ 172 + /* RESET7 */ 173 + /* 224-255 */ 174 + 175 + #endif
+8
include/dt-bindings/reset/hisi,hi6220-resets.h
··· 64 64 #define PERIPH_RSDIST9_CARM_SOCDBG 0x507 65 65 #define PERIPH_RSDIST9_CARM_ETM 0x508 66 66 67 + #define MEDIA_G3D 0 68 + #define MEDIA_CODEC_VPU 2 69 + #define MEDIA_CODEC_JPEG 3 70 + #define MEDIA_ISP 4 71 + #define MEDIA_ADE 5 72 + #define MEDIA_MMU 6 73 + #define MEDIA_XG2RAM1 7 74 + 67 75 #endif /*_DT_BINDINGS_RESET_CONTROLLER_HI6220*/
+38
include/dt-bindings/reset/ti-syscon.h
··· 1 + /* 2 + * TI Syscon Reset definitions 3 + * 4 + * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + */ 16 + 17 + #ifndef __DT_BINDINGS_RESET_TI_SYSCON_H__ 18 + #define __DT_BINDINGS_RESET_TI_SYSCON_H__ 19 + 20 + /* 21 + * The reset does not support the feature and corresponding 22 + * values are not valid 23 + */ 24 + #define ASSERT_NONE (1 << 0) 25 + #define DEASSERT_NONE (1 << 1) 26 + #define STATUS_NONE (1 << 2) 27 + 28 + /* When set this function is activated by setting(vs clearing) this bit */ 29 + #define ASSERT_SET (1 << 3) 30 + #define DEASSERT_SET (1 << 4) 31 + #define STATUS_SET (1 << 5) 32 + 33 + /* The following are the inverse of the above and are added for consistency */ 34 + #define ASSERT_CLEAR (0 << 3) 35 + #define DEASSERT_CLEAR (0 << 4) 36 + #define STATUS_CLEAR (0 << 5) 37 + 38 + #endif
-6
include/linux/mfd/abx500/ab8500-sysctrl.h
··· 37 37 return ab8500_sysctrl_write(reg, bits, 0); 38 38 } 39 39 40 - /* Configuration data for SysClkReq1RfClkBuf - SysClkReq8RfClkBuf */ 41 - struct ab8500_sysctrl_platform_data { 42 - u8 initial_req_buf_config[8]; 43 - u16 (*reboot_reason_code)(const char *cmd); 44 - }; 45 - 46 40 /* Registers */ 47 41 #define AB8500_TURNONSTATUS 0x100 48 42 #define AB8500_RESETSTATUS 0x101
-10
include/linux/mfd/dbx500-prcmu.h
··· 178 178 179 179 #define DB8500_PRCMU_LEGACY_OFFSET 0xDD4 180 180 181 - struct prcmu_pdata 182 - { 183 - bool enable_set_ddr_opp; 184 - bool enable_ape_opp_100_voltage; 185 - struct ab8500_platform_data *ab_platdata; 186 - u32 version_offset; 187 - u32 legacy_offset; 188 - u32 adt_offset; 189 - }; 190 - 191 181 #define PRCMU_FW_PROJECT_U8500 2 192 182 #define PRCMU_FW_PROJECT_U8400 3 193 183 #define PRCMU_FW_PROJECT_U9500 4 /* Customer specific */
-17
include/linux/platform_data/clk-ux500.h
··· 1 - /* 2 - * Clock definitions for ux500 platforms 3 - * 4 - * Copyright (C) 2012 ST-Ericsson SA 5 - * Author: Ulf Hansson <ulf.hansson@linaro.org> 6 - * 7 - * License terms: GNU General Public License (GPL) version 2 8 - */ 9 - 10 - #ifndef __CLK_UX500_H 11 - #define __CLK_UX500_H 12 - 13 - void u8500_clk_init(void); 14 - void u9540_clk_init(void); 15 - void u8540_clk_init(void); 16 - 17 - #endif /* __CLK_UX500_H */
-3
include/linux/platform_data/media/ir-rx51.h
··· 2 2 #define _LIRC_RX51_H 3 3 4 4 struct lirc_rx51_platform_data { 5 - int pwm_timer; 6 - 7 5 int(*set_max_mpu_wakeup_lat)(struct device *dev, long t); 8 - struct pwm_omap_dmtimer_pdata *dmtimer; 9 6 }; 10 7 11 8 #endif
+8
include/linux/qcom_scm.h
··· 29 29 extern int qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, 30 30 u32 *resp); 31 31 32 + extern bool qcom_scm_pas_supported(u32 peripheral); 33 + extern int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, 34 + size_t size); 35 + extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, 36 + phys_addr_t size); 37 + extern int qcom_scm_pas_auth_and_reset(u32 peripheral); 38 + extern int qcom_scm_pas_shutdown(u32 peripheral); 39 + 32 40 #define QCOM_SCM_CPU_PWR_DOWN_L2_ON 0x0 33 41 #define QCOM_SCM_CPU_PWR_DOWN_L2_OFF 0x1 34 42
+4
include/linux/reset-controller.h
··· 53 53 int reset_controller_register(struct reset_controller_dev *rcdev); 54 54 void reset_controller_unregister(struct reset_controller_dev *rcdev); 55 55 56 + struct device; 57 + int devm_reset_controller_register(struct device *dev, 58 + struct reset_controller_dev *rcdev); 59 + 56 60 #endif
+2 -2
include/linux/reset.h
··· 71 71 struct device_node *node, 72 72 const char *id, int index, int shared) 73 73 { 74 - return ERR_PTR(-EINVAL); 74 + return ERR_PTR(-ENOTSUPP); 75 75 } 76 76 77 77 static inline struct reset_control *__devm_reset_control_get( 78 78 struct device *dev, 79 79 const char *id, int index, int shared) 80 80 { 81 - return ERR_PTR(-EINVAL); 81 + return ERR_PTR(-ENOTSUPP); 82 82 } 83 83 84 84 #endif /* CONFIG_RESET_CONTROLLER */
+2
include/linux/scpi_protocol.h
··· 70 70 int (*sensor_get_capability)(u16 *sensors); 71 71 int (*sensor_get_info)(u16 sensor_id, struct scpi_sensor_info *); 72 72 int (*sensor_get_value)(u16, u64 *); 73 + int (*device_get_power_state)(u16); 74 + int (*device_set_power_state)(u16, u8); 73 75 }; 74 76 75 77 #if IS_REACHABLE(CONFIG_ARM_SCPI_PROTOCOL)
+8
include/linux/soc/qcom/wcnss_ctrl.h
··· 1 + #ifndef __WCNSS_CTRL_H__ 2 + #define __WCNSS_CTRL_H__ 3 + 4 + #include <linux/soc/qcom/smd.h> 5 + 6 + struct qcom_smd_channel *qcom_wcnss_open_channel(void *wcnss, const char *name, qcom_smd_cb_t cb); 7 + 8 + #endif
+1 -1
include/soc/tegra/cpuidle.h
··· 14 14 #ifndef __SOC_TEGRA_CPUIDLE_H__ 15 15 #define __SOC_TEGRA_CPUIDLE_H__ 16 16 17 - #ifdef CONFIG_CPU_IDLE 17 + #if defined(CONFIG_ARM) && defined(CONFIG_CPU_IDLE) 18 18 void tegra_cpuidle_pcie_irqs_in_use(void); 19 19 #else 20 20 static inline void tegra_cpuidle_pcie_irqs_in_use(void)
+4 -29
sound/soc/codecs/ab8500-codec.c
··· 2464 2464 struct device *dev = codec->dev; 2465 2465 struct device_node *np = dev->of_node; 2466 2466 struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(dev); 2467 - struct ab8500_platform_data *pdata; 2467 + struct ab8500_codec_platform_data codec_pdata; 2468 2468 struct filter_control *fc; 2469 2469 int status; 2470 2470 2471 2471 dev_dbg(dev, "%s: Enter.\n", __func__); 2472 2472 2473 - /* Setup AB8500 according to board-settings */ 2474 - pdata = dev_get_platdata(dev->parent); 2473 + ab8500_codec_of_probe(dev, np, &codec_pdata); 2475 2474 2476 - if (np) { 2477 - if (!pdata) 2478 - pdata = devm_kzalloc(dev, 2479 - sizeof(struct ab8500_platform_data), 2480 - GFP_KERNEL); 2481 - 2482 - if (pdata && !pdata->codec) 2483 - pdata->codec 2484 - = devm_kzalloc(dev, 2485 - sizeof(struct ab8500_codec_platform_data), 2486 - GFP_KERNEL); 2487 - 2488 - if (!(pdata && pdata->codec)) 2489 - return -ENOMEM; 2490 - 2491 - ab8500_codec_of_probe(dev, np, pdata->codec); 2492 - 2493 - } else { 2494 - if (!(pdata && pdata->codec)) { 2495 - dev_err(dev, "No codec platform data or DT found\n"); 2496 - return -EINVAL; 2497 - } 2498 - } 2499 - 2500 - status = ab8500_audio_setup_mics(codec, &pdata->codec->amics); 2475 + status = ab8500_audio_setup_mics(codec, &codec_pdata.amics); 2501 2476 if (status < 0) { 2502 2477 pr_err("%s: Failed to setup mics (%d)!\n", __func__, status); 2503 2478 return status; 2504 2479 } 2505 - status = ab8500_audio_set_ear_cmv(codec, pdata->codec->ear_cmv); 2480 + status = ab8500_audio_set_ear_cmv(codec, codec_pdata.ear_cmv); 2506 2481 if (status < 0) { 2507 2482 pr_err("%s: Failed to set earpiece CM-voltage (%d)!\n", 2508 2483 __func__, status);