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

Merge branch 'next/cleanup' into next/dt

+4905 -654
+339
Documentation/devicetree/bindings/clock/at91-clock.txt
··· 1 + Device Tree Clock bindings for arch-at91 2 + 3 + This binding uses the common clock binding[1]. 4 + 5 + [1] Documentation/devicetree/bindings/clock/clock-bindings.txt 6 + 7 + Required properties: 8 + - compatible : shall be one of the following: 9 + "atmel,at91rm9200-pmc" or 10 + "atmel,at91sam9g45-pmc" or 11 + "atmel,at91sam9n12-pmc" or 12 + "atmel,at91sam9x5-pmc" or 13 + "atmel,sama5d3-pmc": 14 + at91 PMC (Power Management Controller) 15 + All at91 specific clocks (clocks defined below) must be child 16 + node of the PMC node. 17 + 18 + "atmel,at91rm9200-clk-main": 19 + at91 main oscillator 20 + 21 + "atmel,at91rm9200-clk-master" or 22 + "atmel,at91sam9x5-clk-master": 23 + at91 master clock 24 + 25 + "atmel,at91sam9x5-clk-peripheral" or 26 + "atmel,at91rm9200-clk-peripheral": 27 + at91 peripheral clocks 28 + 29 + "atmel,at91rm9200-clk-pll" or 30 + "atmel,at91sam9g45-clk-pll" or 31 + "atmel,at91sam9g20-clk-pllb" or 32 + "atmel,sama5d3-clk-pll": 33 + at91 pll clocks 34 + 35 + "atmel,at91sam9x5-clk-plldiv": 36 + at91 plla divisor 37 + 38 + "atmel,at91rm9200-clk-programmable" or 39 + "atmel,at91sam9g45-clk-programmable" or 40 + "atmel,at91sam9x5-clk-programmable": 41 + at91 programmable clocks 42 + 43 + "atmel,at91sam9x5-clk-smd": 44 + at91 SMD (Soft Modem) clock 45 + 46 + "atmel,at91rm9200-clk-system": 47 + at91 system clocks 48 + 49 + "atmel,at91rm9200-clk-usb" or 50 + "atmel,at91sam9x5-clk-usb" or 51 + "atmel,at91sam9n12-clk-usb": 52 + at91 usb clock 53 + 54 + "atmel,at91sam9x5-clk-utmi": 55 + at91 utmi clock 56 + 57 + Required properties for PMC node: 58 + - reg : defines the IO memory reserved for the PMC. 59 + - #size-cells : shall be 0 (reg is used to encode clk id). 60 + - #address-cells : shall be 1 (reg is used to encode clk id). 61 + - interrupts : shall be set to PMC interrupt line. 62 + - interrupt-controller : tell that the PMC is an interrupt controller. 63 + - #interrupt-cells : must be set to 1. The first cell encodes the interrupt id, 64 + and reflect the bit position in the PMC_ER/DR/SR registers. 65 + You can use the dt macros defined in dt-bindings/clk/at91.h. 66 + 0 (AT91_PMC_MOSCS) -> main oscillator ready 67 + 1 (AT91_PMC_LOCKA) -> PLL A ready 68 + 2 (AT91_PMC_LOCKB) -> PLL B ready 69 + 3 (AT91_PMC_MCKRDY) -> master clock ready 70 + 6 (AT91_PMC_LOCKU) -> UTMI PLL clock ready 71 + 8 .. 15 (AT91_PMC_PCKRDY(id)) -> programmable clock ready 72 + 16 (AT91_PMC_MOSCSELS) -> main oscillator selected 73 + 17 (AT91_PMC_MOSCRCS) -> RC main oscillator stabilized 74 + 18 (AT91_PMC_CFDEV) -> clock failure detected 75 + 76 + For example: 77 + pmc: pmc@fffffc00 { 78 + compatible = "atmel,sama5d3-pmc"; 79 + interrupts = <1 4 7>; 80 + interrupt-controller; 81 + #interrupt-cells = <2>; 82 + #size-cells = <0>; 83 + #address-cells = <1>; 84 + 85 + /* put at91 clocks here */ 86 + }; 87 + 88 + Required properties for main clock: 89 + - interrupt-parent : must reference the PMC node. 90 + - interrupts : shall be set to "<0>". 91 + - #clock-cells : from common clock binding; shall be set to 0. 92 + - clocks (optional if clock-frequency is provided) : shall be the slow clock 93 + phandle. This clock is used to calculate the main clock rate if 94 + "clock-frequency" is not provided. 95 + - clock-frequency : the main oscillator frequency.Prefer the use of 96 + "clock-frequency" over automatic clock rate calculation. 97 + 98 + For example: 99 + main: mainck { 100 + compatible = "atmel,at91rm9200-clk-main"; 101 + interrupt-parent = <&pmc>; 102 + interrupts = <0>; 103 + #clock-cells = <0>; 104 + clocks = <&ck32k>; 105 + clock-frequency = <18432000>; 106 + }; 107 + 108 + Required properties for master clock: 109 + - interrupt-parent : must reference the PMC node. 110 + - interrupts : shall be set to "<3>". 111 + - #clock-cells : from common clock binding; shall be set to 0. 112 + - clocks : shall be the master clock sources (see atmel datasheet) phandles. 113 + e.g. "<&ck32k>, <&main>, <&plla>, <&pllb>". 114 + - atmel,clk-output-range : minimum and maximum clock frequency (two u32 115 + fields). 116 + e.g. output = <0 133000000>; <=> 0 to 133MHz. 117 + - atmel,clk-divisors : master clock divisors table (four u32 fields). 118 + 0 <=> reserved value. 119 + e.g. divisors = <1 2 4 6>; 120 + - atmel,master-clk-have-div3-pres : some SoC use the reserved value 7 in the 121 + PRES field as CLOCK_DIV3 (e.g sam9x5). 122 + 123 + For example: 124 + mck: mck { 125 + compatible = "atmel,at91rm9200-clk-master"; 126 + interrupt-parent = <&pmc>; 127 + interrupts = <3>; 128 + #clock-cells = <0>; 129 + atmel,clk-output-range = <0 133000000>; 130 + atmel,clk-divisors = <1 2 4 0>; 131 + }; 132 + 133 + Required properties for peripheral clocks: 134 + - #size-cells : shall be 0 (reg is used to encode clk id). 135 + - #address-cells : shall be 1 (reg is used to encode clk id). 136 + - clocks : shall be the master clock phandle. 137 + e.g. clocks = <&mck>; 138 + - name: device tree node describing a specific system clock. 139 + * #clock-cells : from common clock binding; shall be set to 0. 140 + * reg: peripheral id. See Atmel's datasheets to get a full 141 + list of peripheral ids. 142 + * atmel,clk-output-range : minimum and maximum clock frequency 143 + (two u32 fields). Only valid on at91sam9x5-clk-peripheral 144 + compatible IPs. 145 + 146 + For example: 147 + periph: periphck { 148 + compatible = "atmel,at91sam9x5-clk-peripheral"; 149 + #size-cells = <0>; 150 + #address-cells = <1>; 151 + clocks = <&mck>; 152 + 153 + ssc0_clk { 154 + #clock-cells = <0>; 155 + reg = <2>; 156 + atmel,clk-output-range = <0 133000000>; 157 + }; 158 + 159 + usart0_clk { 160 + #clock-cells = <0>; 161 + reg = <3>; 162 + atmel,clk-output-range = <0 66000000>; 163 + }; 164 + }; 165 + 166 + 167 + Required properties for pll clocks: 168 + - interrupt-parent : must reference the PMC node. 169 + - interrupts : shall be set to "<1>". 170 + - #clock-cells : from common clock binding; shall be set to 0. 171 + - clocks : shall be the main clock phandle. 172 + - reg : pll id. 173 + 0 -> PLL A 174 + 1 -> PLL B 175 + - atmel,clk-input-range : minimum and maximum source clock frequency (two u32 176 + fields). 177 + e.g. input = <1 32000000>; <=> 1 to 32MHz. 178 + - #atmel,pll-clk-output-range-cells : number of cells reserved for pll output 179 + range description. Sould be set to 2, 3 180 + or 4. 181 + * 1st and 2nd cells represent the frequency range (min-max). 182 + * 3rd cell is optional and represents the OUT field value for the given 183 + range. 184 + * 4th cell is optional and represents the ICPLL field (PLLICPR 185 + register) 186 + - atmel,pll-clk-output-ranges : pll output frequency ranges + optional parameter 187 + depending on #atmel,pll-output-range-cells 188 + property value. 189 + 190 + For example: 191 + plla: pllack { 192 + compatible = "atmel,at91sam9g45-clk-pll"; 193 + interrupt-parent = <&pmc>; 194 + interrupts = <1>; 195 + #clock-cells = <0>; 196 + clocks = <&main>; 197 + reg = <0>; 198 + atmel,clk-input-range = <2000000 32000000>; 199 + #atmel,pll-clk-output-range-cells = <4>; 200 + atmel,pll-clk-output-ranges = <74500000 800000000 0 0 201 + 69500000 750000000 1 0 202 + 64500000 700000000 2 0 203 + 59500000 650000000 3 0 204 + 54500000 600000000 0 1 205 + 49500000 550000000 1 1 206 + 44500000 500000000 2 1 207 + 40000000 450000000 3 1>; 208 + }; 209 + 210 + Required properties for plldiv clocks (plldiv = pll / 2): 211 + - #clock-cells : from common clock binding; shall be set to 0. 212 + - clocks : shall be the plla clock phandle. 213 + 214 + The pll divisor is equal to 2 and cannot be changed. 215 + 216 + For example: 217 + plladiv: plladivck { 218 + compatible = "atmel,at91sam9x5-clk-plldiv"; 219 + #clock-cells = <0>; 220 + clocks = <&plla>; 221 + }; 222 + 223 + Required properties for programmable clocks: 224 + - interrupt-parent : must reference the PMC node. 225 + - #size-cells : shall be 0 (reg is used to encode clk id). 226 + - #address-cells : shall be 1 (reg is used to encode clk id). 227 + - clocks : shall be the programmable clock source phandles. 228 + e.g. clocks = <&clk32k>, <&main>, <&plla>, <&pllb>; 229 + - name: device tree node describing a specific prog clock. 230 + * #clock-cells : from common clock binding; shall be set to 0. 231 + * reg : programmable clock id (register offset from PCKx 232 + register). 233 + * interrupts : shall be set to "<(8 + id)>". 234 + 235 + For example: 236 + prog: progck { 237 + compatible = "atmel,at91sam9g45-clk-programmable"; 238 + #size-cells = <0>; 239 + #address-cells = <1>; 240 + interrupt-parent = <&pmc>; 241 + clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>; 242 + 243 + prog0 { 244 + #clock-cells = <0>; 245 + reg = <0>; 246 + interrupts = <8>; 247 + }; 248 + 249 + prog1 { 250 + #clock-cells = <0>; 251 + reg = <1>; 252 + interrupts = <9>; 253 + }; 254 + }; 255 + 256 + 257 + Required properties for smd clock: 258 + - #clock-cells : from common clock binding; shall be set to 0. 259 + - clocks : shall be the smd clock source phandles. 260 + e.g. clocks = <&plladiv>, <&utmi>; 261 + 262 + For example: 263 + smd: smdck { 264 + compatible = "atmel,at91sam9x5-clk-smd"; 265 + #clock-cells = <0>; 266 + clocks = <&plladiv>, <&utmi>; 267 + }; 268 + 269 + Required properties for system clocks: 270 + - #size-cells : shall be 0 (reg is used to encode clk id). 271 + - #address-cells : shall be 1 (reg is used to encode clk id). 272 + - name: device tree node describing a specific system clock. 273 + * #clock-cells : from common clock binding; shall be set to 0. 274 + * reg: system clock id (bit position in SCER/SCDR/SCSR registers). 275 + See Atmel's datasheet to get a full list of system clock ids. 276 + 277 + For example: 278 + system: systemck { 279 + compatible = "atmel,at91rm9200-clk-system"; 280 + #address-cells = <1>; 281 + #size-cells = <0>; 282 + 283 + ddrck { 284 + #clock-cells = <0>; 285 + reg = <2>; 286 + clocks = <&mck>; 287 + }; 288 + 289 + uhpck { 290 + #clock-cells = <0>; 291 + reg = <6>; 292 + clocks = <&usb>; 293 + }; 294 + 295 + udpck { 296 + #clock-cells = <0>; 297 + reg = <7>; 298 + clocks = <&usb>; 299 + }; 300 + }; 301 + 302 + 303 + Required properties for usb clock: 304 + - #clock-cells : from common clock binding; shall be set to 0. 305 + - clocks : shall be the smd clock source phandles. 306 + e.g. clocks = <&pllb>; 307 + - atmel,clk-divisors (only available for "atmel,at91rm9200-clk-usb"): 308 + usb clock divisor table. 309 + e.g. divisors = <1 2 4 0>; 310 + 311 + For example: 312 + usb: usbck { 313 + compatible = "atmel,at91sam9x5-clk-usb"; 314 + #clock-cells = <0>; 315 + clocks = <&plladiv>, <&utmi>; 316 + }; 317 + 318 + usb: usbck { 319 + compatible = "atmel,at91rm9200-clk-usb"; 320 + #clock-cells = <0>; 321 + clocks = <&pllb>; 322 + atmel,clk-divisors = <1 2 4 0>; 323 + }; 324 + 325 + 326 + Required properties for utmi clock: 327 + - interrupt-parent : must reference the PMC node. 328 + - interrupts : shall be set to "<AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>". 329 + - #clock-cells : from common clock binding; shall be set to 0. 330 + - clocks : shall be the main clock source phandle. 331 + 332 + For example: 333 + utmi: utmick { 334 + compatible = "atmel,at91sam9x5-clk-utmi"; 335 + interrupt-parent = <&pmc>; 336 + interrupts = <AT91_PMC_LOCKU IRQ_TYPE_LEVEL_HIGH>; 337 + #clock-cells = <0>; 338 + clocks = <&main>; 339 + };
+54
Documentation/devicetree/bindings/mmc/ti-omap.txt
··· 1 + * TI MMC host controller for OMAP1 and 2420 2 + 3 + The MMC Host Controller on TI OMAP1 and 2420 family provides 4 + an interface for MMC, SD, and SDIO types of memory cards. 5 + 6 + This file documents differences between the core properties described 7 + by mmc.txt and the properties used by the omap mmc driver. 8 + 9 + Note that this driver will not work with omap2430 or later omaps, 10 + please see the omap hsmmc driver for the current omaps. 11 + 12 + Required properties: 13 + - compatible: Must be "ti,omap2420-mmc", for OMAP2420 controllers 14 + - ti,hwmods: For 2420, must be "msdi<n>", where n is controller 15 + instance starting 1 16 + 17 + Examples: 18 + 19 + msdi1: mmc@4809c000 { 20 + compatible = "ti,omap2420-mmc"; 21 + ti,hwmods = "msdi1"; 22 + reg = <0x4809c000 0x80>; 23 + interrupts = <83>; 24 + dmas = <&sdma 61 &sdma 62>; 25 + dma-names = "tx", "rx"; 26 + }; 27 + 28 + * TI MMC host controller for OMAP1 and 2420 29 + 30 + The MMC Host Controller on TI OMAP1 and 2420 family provides 31 + an interface for MMC, SD, and SDIO types of memory cards. 32 + 33 + This file documents differences between the core properties described 34 + by mmc.txt and the properties used by the omap mmc driver. 35 + 36 + Note that this driver will not work with omap2430 or later omaps, 37 + please see the omap hsmmc driver for the current omaps. 38 + 39 + Required properties: 40 + - compatible: Must be "ti,omap2420-mmc", for OMAP2420 controllers 41 + - ti,hwmods: For 2420, must be "msdi<n>", where n is controller 42 + instance starting 1 43 + 44 + Examples: 45 + 46 + msdi1: mmc@4809c000 { 47 + compatible = "ti,omap2420-mmc"; 48 + ti,hwmods = "msdi1"; 49 + reg = <0x4809c000 0x80>; 50 + interrupts = <83>; 51 + dmas = <&sdma 61 &sdma 62>; 52 + dma-names = "tx", "rx"; 53 + }; 54 +
+79
arch/arm/boot/dts/am335x-base0033.dts
··· 13 13 / { 14 14 model = "IGEP COM AM335x on AQUILA Expansion"; 15 15 compatible = "isee,am335x-base0033", "isee,am335x-igep0033", "ti,am33xx"; 16 + 17 + hdmi { 18 + compatible = "ti,tilcdc,slave"; 19 + i2c = <&i2c0>; 20 + pinctrl-names = "default", "off"; 21 + pinctrl-0 = <&nxp_hdmi_pins>; 22 + pinctrl-1 = <&nxp_hdmi_off_pins>; 23 + status = "okay"; 24 + }; 25 + 26 + leds_base { 27 + pinctrl-names = "default"; 28 + pinctrl-0 = <&leds_base_pins>; 29 + 30 + compatible = "gpio-leds"; 31 + 32 + led@0 { 33 + label = "base:red:user"; 34 + gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>; /* gpio1_21 */ 35 + default-state = "off"; 36 + }; 37 + 38 + led@1 { 39 + label = "base:green:user"; 40 + gpios = <&gpio2 0 GPIO_ACTIVE_HIGH>; /* gpio2_0 */ 41 + default-state = "off"; 42 + }; 43 + }; 44 + }; 45 + 46 + &am33xx_pinmux { 47 + nxp_hdmi_pins: pinmux_nxp_hdmi_pins { 48 + pinctrl-single,pins = < 49 + 0x1b0 (PIN_OUTPUT | MUX_MODE3) /* xdma_event_intr0.clkout1 */ 50 + 0xa0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data0 */ 51 + 0xa4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data1 */ 52 + 0xa8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data2 */ 53 + 0xac (PIN_OUTPUT | MUX_MODE0) /* lcd_data3 */ 54 + 0xb0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data4 */ 55 + 0xb4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data5 */ 56 + 0xb8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data6 */ 57 + 0xbc (PIN_OUTPUT | MUX_MODE0) /* lcd_data7 */ 58 + 0xc0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data8 */ 59 + 0xc4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data9 */ 60 + 0xc8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data10 */ 61 + 0xcc (PIN_OUTPUT | MUX_MODE0) /* lcd_data11 */ 62 + 0xd0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data12 */ 63 + 0xd4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data13 */ 64 + 0xd8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data14 */ 65 + 0xdc (PIN_OUTPUT | MUX_MODE0) /* lcd_data15 */ 66 + 0xe0 (PIN_OUTPUT | MUX_MODE0) /* lcd_vsync */ 67 + 0xe4 (PIN_OUTPUT | MUX_MODE0) /* lcd_hsync */ 68 + 0xe8 (PIN_OUTPUT | MUX_MODE0) /* lcd_pclk */ 69 + 0xec (PIN_OUTPUT | MUX_MODE0) /* lcd_ac_bias_en */ 70 + >; 71 + }; 72 + nxp_hdmi_off_pins: pinmux_nxp_hdmi_off_pins { 73 + pinctrl-single,pins = < 74 + 0x1b0 (PIN_OUTPUT | MUX_MODE3) /* xdma_event_intr0.clkout1 */ 75 + >; 76 + }; 77 + 78 + leds_base_pins: pinmux_leds_base_pins { 79 + pinctrl-single,pins = < 80 + 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */ 81 + 0x88 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_csn3.gpio2_0 */ 82 + >; 83 + }; 84 + }; 85 + 86 + &lcdc { 87 + status = "okay"; 88 + }; 89 + 90 + &i2c0 { 91 + eeprom: eeprom@50 { 92 + compatible = "at,24c256"; 93 + reg = <0x50>; 94 + }; 16 95 };
+29
arch/arm/boot/dts/am335x-igep0033.dtsi
··· 199 199 pinctrl-0 = <&uart0_pins>; 200 200 }; 201 201 202 + &usb { 203 + status = "okay"; 204 + 205 + control@44e10000 { 206 + status = "okay"; 207 + }; 208 + 209 + usb-phy@47401300 { 210 + status = "okay"; 211 + }; 212 + 213 + usb-phy@47401b00 { 214 + status = "okay"; 215 + }; 216 + 217 + usb@47401000 { 218 + status = "okay"; 219 + }; 220 + 221 + usb@47401800 { 222 + status = "okay"; 223 + dr_mode = "host"; 224 + }; 225 + 226 + dma-controller@07402000 { 227 + status = "okay"; 228 + }; 229 + }; 230 + 202 231 #include "tps65910.dtsi" 203 232 204 233 &tps {
+14 -14
arch/arm/boot/dts/armada-370-db.dts
··· 99 99 spi-max-frequency = <50000000>; 100 100 }; 101 101 }; 102 + }; 102 103 103 - pcie-controller { 104 + pcie-controller { 105 + status = "okay"; 106 + /* 107 + * The two PCIe units are accessible through 108 + * both standard PCIe slots and mini-PCIe 109 + * slots on the board. 110 + */ 111 + pcie@1,0 { 112 + /* Port 0, Lane 0 */ 104 113 status = "okay"; 105 - /* 106 - * The two PCIe units are accessible through 107 - * both standard PCIe slots and mini-PCIe 108 - * slots on the board. 109 - */ 110 - pcie@1,0 { 111 - /* Port 0, Lane 0 */ 112 - status = "okay"; 113 - }; 114 - pcie@2,0 { 115 - /* Port 1, Lane 0 */ 116 - status = "okay"; 117 - }; 114 + }; 115 + pcie@2,0 { 116 + /* Port 1, Lane 0 */ 117 + status = "okay"; 118 118 }; 119 119 }; 120 120 };
+1 -1
arch/arm/boot/dts/armada-370-xp.dtsi
··· 118 118 119 119 coherency-fabric@20200 { 120 120 compatible = "marvell,coherency-fabric"; 121 - reg = <0x20200 0xb0>, <0x21810 0x1c>; 121 + reg = <0x20200 0xb0>, <0x21010 0x1c>; 122 122 }; 123 123 124 124 serial@12000 {
+12 -12
arch/arm/boot/dts/armada-xp-mv78230.dtsi
··· 47 47 /* 48 48 * MV78230 has 2 PCIe units Gen2.0: One unit can be 49 49 * configured as x4 or quad x1 lanes. One unit is 50 - * x4/x1. 50 + * x1 only. 51 51 */ 52 52 pcie-controller { 53 53 compatible = "marvell,armada-xp-pcie"; ··· 62 62 63 63 ranges = 64 64 <0x82000000 0 0x40000 MBUS_ID(0xf0, 0x01) 0x40000 0 0x00002000 /* Port 0.0 registers */ 65 - 0x82000000 0 0x42000 MBUS_ID(0xf0, 0x01) 0x42000 0 0x00002000 /* Port 2.0 registers */ 66 65 0x82000000 0 0x44000 MBUS_ID(0xf0, 0x01) 0x44000 0 0x00002000 /* Port 0.1 registers */ 67 66 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ 68 67 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ 68 + 0x82000000 0 0x80000 MBUS_ID(0xf0, 0x01) 0x80000 0 0x00002000 /* Port 1.0 registers */ 69 69 0x82000000 0x1 0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 MEM */ 70 70 0x81000000 0x1 0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 IO */ 71 71 0x82000000 0x2 0 MBUS_ID(0x04, 0xd8) 0 1 0 /* Port 0.1 MEM */ ··· 74 74 0x81000000 0x3 0 MBUS_ID(0x04, 0xb0) 0 1 0 /* Port 0.2 IO */ 75 75 0x82000000 0x4 0 MBUS_ID(0x04, 0x78) 0 1 0 /* Port 0.3 MEM */ 76 76 0x81000000 0x4 0 MBUS_ID(0x04, 0x70) 0 1 0 /* Port 0.3 IO */ 77 - 0x82000000 0x9 0 MBUS_ID(0x04, 0xf8) 0 1 0 /* Port 2.0 MEM */ 78 - 0x81000000 0x9 0 MBUS_ID(0x04, 0xf0) 0 1 0 /* Port 2.0 IO */>; 77 + 0x82000000 0x5 0 MBUS_ID(0x08, 0xe8) 0 1 0 /* Port 1.0 MEM */ 78 + 0x81000000 0x5 0 MBUS_ID(0x08, 0xe0) 0 1 0 /* Port 1.0 IO */>; 79 79 80 80 pcie@1,0 { 81 81 device_type = "pci"; ··· 145 145 status = "disabled"; 146 146 }; 147 147 148 - pcie@9,0 { 148 + pcie@5,0 { 149 149 device_type = "pci"; 150 - assigned-addresses = <0x82000800 0 0x42000 0 0x2000>; 151 - reg = <0x4800 0 0 0 0>; 150 + assigned-addresses = <0x82000800 0 0x80000 0 0x2000>; 151 + reg = <0x2800 0 0 0 0>; 152 152 #address-cells = <3>; 153 153 #size-cells = <2>; 154 154 #interrupt-cells = <1>; 155 - ranges = <0x82000000 0 0 0x82000000 0x9 0 1 0 156 - 0x81000000 0 0 0x81000000 0x9 0 1 0>; 155 + ranges = <0x82000000 0 0 0x82000000 0x5 0 1 0 156 + 0x81000000 0 0 0x81000000 0x5 0 1 0>; 157 157 interrupt-map-mask = <0 0 0 0>; 158 - interrupt-map = <0 0 0 0 &mpic 99>; 159 - marvell,pcie-port = <2>; 158 + interrupt-map = <0 0 0 0 &mpic 62>; 159 + marvell,pcie-port = <1>; 160 160 marvell,pcie-lane = <0>; 161 - clocks = <&gateclk 26>; 161 + clocks = <&gateclk 9>; 162 162 status = "disabled"; 163 163 }; 164 164 };
+86 -25
arch/arm/boot/dts/armada-xp-mv78260.dtsi
··· 48 48 /* 49 49 * MV78260 has 3 PCIe units Gen2.0: Two units can be 50 50 * configured as x4 or quad x1 lanes. One unit is 51 - * x4/x1. 51 + * x4 only. 52 52 */ 53 53 pcie-controller { 54 54 compatible = "marvell,armada-xp-pcie"; ··· 68 68 0x82000000 0 0x48000 MBUS_ID(0xf0, 0x01) 0x48000 0 0x00002000 /* Port 0.2 registers */ 69 69 0x82000000 0 0x4c000 MBUS_ID(0xf0, 0x01) 0x4c000 0 0x00002000 /* Port 0.3 registers */ 70 70 0x82000000 0 0x80000 MBUS_ID(0xf0, 0x01) 0x80000 0 0x00002000 /* Port 1.0 registers */ 71 - 0x82000000 0 0x82000 MBUS_ID(0xf0, 0x01) 0x82000 0 0x00002000 /* Port 3.0 registers */ 71 + 0x82000000 0 0x84000 MBUS_ID(0xf0, 0x01) 0x84000 0 0x00002000 /* Port 1.1 registers */ 72 + 0x82000000 0 0x88000 MBUS_ID(0xf0, 0x01) 0x88000 0 0x00002000 /* Port 1.2 registers */ 73 + 0x82000000 0 0x8c000 MBUS_ID(0xf0, 0x01) 0x8c000 0 0x00002000 /* Port 1.3 registers */ 72 74 0x82000000 0x1 0 MBUS_ID(0x04, 0xe8) 0 1 0 /* Port 0.0 MEM */ 73 75 0x81000000 0x1 0 MBUS_ID(0x04, 0xe0) 0 1 0 /* Port 0.0 IO */ 74 76 0x82000000 0x2 0 MBUS_ID(0x04, 0xd8) 0 1 0 /* Port 0.1 MEM */ ··· 79 77 0x81000000 0x3 0 MBUS_ID(0x04, 0xb0) 0 1 0 /* Port 0.2 IO */ 80 78 0x82000000 0x4 0 MBUS_ID(0x04, 0x78) 0 1 0 /* Port 0.3 MEM */ 81 79 0x81000000 0x4 0 MBUS_ID(0x04, 0x70) 0 1 0 /* Port 0.3 IO */ 82 - 0x82000000 0x9 0 MBUS_ID(0x08, 0xe8) 0 1 0 /* Port 1.0 MEM */ 83 - 0x81000000 0x9 0 MBUS_ID(0x08, 0xe0) 0 1 0 /* Port 1.0 IO */ 84 - 0x82000000 0xa 0 MBUS_ID(0x08, 0xf8) 0 1 0 /* Port 3.0 MEM */ 85 - 0x81000000 0xa 0 MBUS_ID(0x08, 0xf0) 0 1 0 /* Port 3.0 IO */>; 80 + 81 + 0x82000000 0x5 0 MBUS_ID(0x08, 0xe8) 0 1 0 /* Port 1.0 MEM */ 82 + 0x81000000 0x5 0 MBUS_ID(0x08, 0xe0) 0 1 0 /* Port 1.0 IO */ 83 + 0x82000000 0x6 0 MBUS_ID(0x08, 0xd8) 0 1 0 /* Port 1.1 MEM */ 84 + 0x81000000 0x6 0 MBUS_ID(0x08, 0xd0) 0 1 0 /* Port 1.1 IO */ 85 + 0x82000000 0x7 0 MBUS_ID(0x08, 0xb8) 0 1 0 /* Port 1.2 MEM */ 86 + 0x81000000 0x7 0 MBUS_ID(0x08, 0xb0) 0 1 0 /* Port 1.2 IO */ 87 + 0x82000000 0x8 0 MBUS_ID(0x08, 0x78) 0 1 0 /* Port 1.3 MEM */ 88 + 0x81000000 0x8 0 MBUS_ID(0x08, 0x70) 0 1 0 /* Port 1.3 IO */ 89 + 90 + 0x82000000 0x9 0 MBUS_ID(0x04, 0xf8) 0 1 0 /* Port 2.0 MEM */ 91 + 0x81000000 0x9 0 MBUS_ID(0x04, 0xf0) 0 1 0 /* Port 2.0 IO */>; 86 92 87 93 pcie@1,0 { 88 94 device_type = "pci"; ··· 116 106 #address-cells = <3>; 117 107 #size-cells = <2>; 118 108 #interrupt-cells = <1>; 119 - ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0 120 - 0x81000000 0 0 0x81000000 0x2 0 1 0>; 109 + ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0 110 + 0x81000000 0 0 0x81000000 0x2 0 1 0>; 121 111 interrupt-map-mask = <0 0 0 0>; 122 112 interrupt-map = <0 0 0 0 &mpic 59>; 123 113 marvell,pcie-port = <0>; ··· 160 150 status = "disabled"; 161 151 }; 162 152 153 + pcie@5,0 { 154 + device_type = "pci"; 155 + assigned-addresses = <0x82000800 0 0x80000 0 0x2000>; 156 + reg = <0x2800 0 0 0 0>; 157 + #address-cells = <3>; 158 + #size-cells = <2>; 159 + #interrupt-cells = <1>; 160 + ranges = <0x82000000 0 0 0x82000000 0x5 0 1 0 161 + 0x81000000 0 0 0x81000000 0x5 0 1 0>; 162 + interrupt-map-mask = <0 0 0 0>; 163 + interrupt-map = <0 0 0 0 &mpic 62>; 164 + marvell,pcie-port = <1>; 165 + marvell,pcie-lane = <0>; 166 + clocks = <&gateclk 9>; 167 + status = "disabled"; 168 + }; 169 + 170 + pcie@6,0 { 171 + device_type = "pci"; 172 + assigned-addresses = <0x82000800 0 0x84000 0 0x2000>; 173 + reg = <0x3000 0 0 0 0>; 174 + #address-cells = <3>; 175 + #size-cells = <2>; 176 + #interrupt-cells = <1>; 177 + ranges = <0x82000000 0 0 0x82000000 0x6 0 1 0 178 + 0x81000000 0 0 0x81000000 0x6 0 1 0>; 179 + interrupt-map-mask = <0 0 0 0>; 180 + interrupt-map = <0 0 0 0 &mpic 63>; 181 + marvell,pcie-port = <1>; 182 + marvell,pcie-lane = <1>; 183 + clocks = <&gateclk 10>; 184 + status = "disabled"; 185 + }; 186 + 187 + pcie@7,0 { 188 + device_type = "pci"; 189 + assigned-addresses = <0x82000800 0 0x88000 0 0x2000>; 190 + reg = <0x3800 0 0 0 0>; 191 + #address-cells = <3>; 192 + #size-cells = <2>; 193 + #interrupt-cells = <1>; 194 + ranges = <0x82000000 0 0 0x82000000 0x7 0 1 0 195 + 0x81000000 0 0 0x81000000 0x7 0 1 0>; 196 + interrupt-map-mask = <0 0 0 0>; 197 + interrupt-map = <0 0 0 0 &mpic 64>; 198 + marvell,pcie-port = <1>; 199 + marvell,pcie-lane = <2>; 200 + clocks = <&gateclk 11>; 201 + status = "disabled"; 202 + }; 203 + 204 + pcie@8,0 { 205 + device_type = "pci"; 206 + assigned-addresses = <0x82000800 0 0x8c000 0 0x2000>; 207 + reg = <0x4000 0 0 0 0>; 208 + #address-cells = <3>; 209 + #size-cells = <2>; 210 + #interrupt-cells = <1>; 211 + ranges = <0x82000000 0 0 0x82000000 0x8 0 1 0 212 + 0x81000000 0 0 0x81000000 0x8 0 1 0>; 213 + interrupt-map-mask = <0 0 0 0>; 214 + interrupt-map = <0 0 0 0 &mpic 65>; 215 + marvell,pcie-port = <1>; 216 + marvell,pcie-lane = <3>; 217 + clocks = <&gateclk 12>; 218 + status = "disabled"; 219 + }; 220 + 163 221 pcie@9,0 { 164 222 device_type = "pci"; 165 223 assigned-addresses = <0x82000800 0 0x42000 0 0x2000>; ··· 242 164 marvell,pcie-port = <2>; 243 165 marvell,pcie-lane = <0>; 244 166 clocks = <&gateclk 26>; 245 - status = "disabled"; 246 - }; 247 - 248 - pcie@10,0 { 249 - device_type = "pci"; 250 - assigned-addresses = <0x82000800 0 0x82000 0 0x2000>; 251 - reg = <0x5000 0 0 0 0>; 252 - #address-cells = <3>; 253 - #size-cells = <2>; 254 - #interrupt-cells = <1>; 255 - ranges = <0x82000000 0 0 0x82000000 0xa 0 1 0 256 - 0x81000000 0 0 0x81000000 0xa 0 1 0>; 257 - interrupt-map-mask = <0 0 0 0>; 258 - interrupt-map = <0 0 0 0 &mpic 103>; 259 - marvell,pcie-port = <3>; 260 - marvell,pcie-lane = <0>; 261 - clocks = <&gateclk 27>; 262 167 status = "disabled"; 263 168 }; 264 169 };
+4
arch/arm/boot/dts/at91sam9x5_usart3.dtsi
··· 11 11 #include <dt-bindings/interrupt-controller/irq.h> 12 12 13 13 / { 14 + aliases { 15 + serial4 = &usart3; 16 + }; 17 + 14 18 ahb { 15 19 apb { 16 20 pinctrl@fffff400 {
+2 -2
arch/arm/boot/dts/omap-gpmc-smsc911x.dtsi
··· 44 44 gpmc,wr-access-ns = <186>; 45 45 gpmc,cycle2cycle-samecsen; 46 46 gpmc,cycle2cycle-diffcsen; 47 - vmmc-supply = <&vddvario>; 48 - vmmc_aux-supply = <&vdd33a>; 47 + vddvario-supply = <&vddvario>; 48 + vdd33a-supply = <&vdd33a>; 49 49 reg-io-width = <4>; 50 50 smsc,save-mac-address; 51 51 };
+7
arch/arm/boot/dts/omap3-beagle-xm.dts
··· 215 215 &usbhsehci { 216 216 phys = <0 &hsusb2_phy>; 217 217 }; 218 + 219 + &vaux2 { 220 + regulator-name = "usb_1v8"; 221 + regulator-min-microvolt = <1800000>; 222 + regulator-max-microvolt = <1800000>; 223 + regulator-always-on; 224 + };
+21
arch/arm/boot/dts/omap3-beagle.dts
··· 61 61 vcc-supply = <&hsusb2_power>; 62 62 }; 63 63 64 + sound { 65 + compatible = "ti,omap-twl4030"; 66 + ti,model = "omap3beagle"; 67 + 68 + ti,mcbsp = <&mcbsp2>; 69 + ti,codec = <&twl_audio>; 70 + }; 71 + 64 72 gpio_keys { 65 73 compatible = "gpio-keys"; 66 74 ··· 128 120 reg = <0x48>; 129 121 interrupts = <7>; /* SYS_NIRQ cascaded to intc */ 130 122 interrupt-parent = <&intc>; 123 + 124 + twl_audio: audio { 125 + compatible = "ti,twl4030-audio"; 126 + codec { 127 + }; 128 + }; 131 129 }; 132 130 }; 133 131 ··· 191 177 phy-names = "usb2-phy"; 192 178 mode = <3>; 193 179 power = <50>; 180 + }; 181 + 182 + &vaux2 { 183 + regulator-name = "vdd_ehci"; 184 + regulator-min-microvolt = <1800000>; 185 + regulator-max-microvolt = <1800000>; 186 + regulator-always-on; 194 187 };
+77 -8
arch/arm/boot/dts/omap3-igep.dtsi
··· 1 1 /* 2 - * Device Tree Source for IGEP Technology devices 2 + * Common device tree for IGEP boards based on AM/DM37x 3 3 * 4 4 * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> 5 5 * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> ··· 10 10 */ 11 11 /dts-v1/; 12 12 13 - #include "omap34xx.dtsi" 13 + #include "omap36xx.dtsi" 14 14 15 15 / { 16 16 memory { ··· 23 23 ti,model = "igep2"; 24 24 ti,mcbsp = <&mcbsp2>; 25 25 ti,codec = <&twl_audio>; 26 + }; 27 + 28 + vdd33: regulator-vdd33 { 29 + compatible = "regulator-fixed"; 30 + regulator-name = "vdd33"; 31 + regulator-always-on; 32 + }; 33 + 34 + lbee1usjyc_vmmc: lbee1usjyc_vmmc { 35 + pinctrl-names = "default"; 36 + pinctrl-0 = <&lbee1usjyc_pins>; 37 + compatible = "regulator-fixed"; 38 + regulator-name = "regulator-lbee1usjyc"; 39 + regulator-min-microvolt = <3300000>; 40 + regulator-max-microvolt = <3300000>; 41 + gpio = <&gpio5 10 GPIO_ACTIVE_HIGH>; /* gpio_138 WIFI_PDN */ 42 + startup-delay-us = <10000>; 43 + enable-active-high; 44 + vin-supply = <&vdd33>; 26 45 }; 27 46 }; 28 47 ··· 67 48 >; 68 49 }; 69 50 51 + /* WiFi/BT combo */ 52 + lbee1usjyc_pins: pinmux_lbee1usjyc_pins { 53 + pinctrl-single,pins = < 54 + 0x136 (PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat5.gpio_137 */ 55 + 0x138 (PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat6.gpio_138 */ 56 + 0x13a (PIN_OUTPUT | MUX_MODE4) /* sdmmc2_dat7.gpio_139 */ 57 + >; 58 + }; 59 + 70 60 mcbsp2_pins: pinmux_mcbsp2_pins { 71 61 pinctrl-single,pins = < 72 62 0x10c (PIN_INPUT | MUX_MODE0) /* mcbsp2_fsx.mcbsp2_fsx */ ··· 93 65 0x11a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat1.sdmmc1_dat1 */ 94 66 0x11c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat2.sdmmc1_dat2 */ 95 67 0x11e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc1_dat3.sdmmc1_dat3 */ 96 - 0x120 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat4.sdmmc1_dat4 */ 97 - 0x122 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat5.sdmmc1_dat5 */ 98 - 0x124 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat6.sdmmc1_dat6 */ 99 - 0x126 (PIN_INPUT | MUX_MODE0) /* sdmmc1_dat7.sdmmc1_dat7 */ 68 + >; 69 + }; 70 + 71 + mmc2_pins: pinmux_mmc2_pins { 72 + pinctrl-single,pins = < 73 + 0x128 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk.sdmmc2_clk */ 74 + 0x12a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd.sdmmc2_cmd */ 75 + 0x12c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat0.sdmmc2_dat0 */ 76 + 0x12e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1.sdmmc2_dat1 */ 77 + 0x130 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat2.sdmmc2_dat2 */ 78 + 0x132 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat3.sdmmc2_dat3 */ 100 79 >; 101 80 }; 102 81 ··· 113 78 >; 114 79 }; 115 80 81 + i2c1_pins: pinmux_i2c1_pins { 82 + pinctrl-single,pins = < 83 + 0x18a (PIN_INPUT | MUX_MODE0) /* i2c1_scl.i2c1_scl */ 84 + 0x18c (PIN_INPUT | MUX_MODE0) /* i2c1_sda.i2c1_sda */ 85 + >; 86 + }; 87 + 88 + i2c2_pins: pinmux_i2c2_pins { 89 + pinctrl-single,pins = < 90 + 0x18e (PIN_INPUT | MUX_MODE0) /* i2c2_scl.i2c2_scl */ 91 + 0x190 (PIN_INPUT | MUX_MODE0) /* i2c2_sda.i2c2_sda */ 92 + >; 93 + }; 94 + 95 + i2c3_pins: pinmux_i2c3_pins { 96 + pinctrl-single,pins = < 97 + 0x192 (PIN_INPUT | MUX_MODE0) /* i2c3_scl.i2c3_scl */ 98 + 0x194 (PIN_INPUT | MUX_MODE0) /* i2c3_sda.i2c3_sda */ 99 + >; 100 + }; 101 + 116 102 leds_pins: pinmux_leds_pins { }; 117 103 }; 118 104 119 105 &i2c1 { 106 + pinctrl-names = "default"; 107 + pinctrl-0 = <&i2c1_pins>; 120 108 clock-frequency = <2600000>; 121 109 122 110 twl: twl@48 { ··· 159 101 #include "twl4030_omap3.dtsi" 160 102 161 103 &i2c2 { 104 + pinctrl-names = "default"; 105 + pinctrl-0 = <&i2c2_pins>; 162 106 clock-frequency = <400000>; 107 + }; 108 + 109 + &i2c3 { 110 + pinctrl-names = "default"; 111 + pinctrl-0 = <&i2c3_pins>; 163 112 }; 164 113 165 114 &mcbsp2 { ··· 179 114 pinctrl-0 = <&mmc1_pins>; 180 115 vmmc-supply = <&vmmc1>; 181 116 vmmc_aux-supply = <&vsim>; 182 - bus-width = <8>; 117 + bus-width = <4>; 183 118 }; 184 119 185 120 &mmc2 { 186 - status = "disabled"; 121 + pinctrl-names = "default"; 122 + pinctrl-0 = <&mmc2_pins>; 123 + vmmc-supply = <&lbee1usjyc_vmmc>; 124 + bus-width = <4>; 125 + non-removable; 187 126 }; 188 127 189 128 &mmc3 {
+48 -2
arch/arm/boot/dts/omap3-igep0020.dts
··· 1 1 /* 2 - * Device Tree Source for IGEPv2 board 2 + * Device Tree Source for IGEPv2 Rev. (TI OMAP AM/DM37x) 3 3 * 4 4 * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> 5 5 * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> ··· 13 13 #include "omap-gpmc-smsc911x.dtsi" 14 14 15 15 / { 16 - model = "IGEPv2"; 16 + model = "IGEPv2 (TI OMAP AM/DM37x)"; 17 17 compatible = "isee,omap3-igep0020", "ti,omap3"; 18 18 19 19 leds { ··· 67 67 pinctrl-names = "default"; 68 68 pinctrl-0 = < 69 69 &hsusbb1_pins 70 + &tfp410_pins 71 + &dss_pins 70 72 >; 71 73 72 74 hsusbb1_pins: pinmux_hsusbb1_pins { ··· 85 83 0x5b6 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d5.hsusb1_data5 */ 86 84 0x5b8 (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d6.hsusb1_data6 */ 87 85 0x5ba (PIN_INPUT_PULLDOWN | MUX_MODE3) /* etk_d7.hsusb1_data3 */ 86 + >; 87 + }; 88 + 89 + tfp410_pins: tfp410_dvi_pins { 90 + pinctrl-single,pins = < 91 + 0x196 (PIN_OUTPUT | MUX_MODE4) /* hdq_sio.gpio_170 */ 92 + >; 93 + }; 94 + 95 + dss_pins: pinmux_dss_dvi_pins { 96 + pinctrl-single,pins = < 97 + 0x0a4 (PIN_OUTPUT | MUX_MODE0) /* dss_pclk.dss_pclk */ 98 + 0x0a6 (PIN_OUTPUT | MUX_MODE0) /* dss_hsync.dss_hsync */ 99 + 0x0a8 (PIN_OUTPUT | MUX_MODE0) /* dss_vsync.dss_vsync */ 100 + 0x0aa (PIN_OUTPUT | MUX_MODE0) /* dss_acbias.dss_acbias */ 101 + 0x0ac (PIN_OUTPUT | MUX_MODE0) /* dss_data0.dss_data0 */ 102 + 0x0ae (PIN_OUTPUT | MUX_MODE0) /* dss_data1.dss_data1 */ 103 + 0x0b0 (PIN_OUTPUT | MUX_MODE0) /* dss_data2.dss_data2 */ 104 + 0x0b2 (PIN_OUTPUT | MUX_MODE0) /* dss_data3.dss_data3 */ 105 + 0x0b4 (PIN_OUTPUT | MUX_MODE0) /* dss_data4.dss_data4 */ 106 + 0x0b6 (PIN_OUTPUT | MUX_MODE0) /* dss_data5.dss_data5 */ 107 + 0x0b8 (PIN_OUTPUT | MUX_MODE0) /* dss_data6.dss_data6 */ 108 + 0x0ba (PIN_OUTPUT | MUX_MODE0) /* dss_data7.dss_data7 */ 109 + 0x0bc (PIN_OUTPUT | MUX_MODE0) /* dss_data8.dss_data8 */ 110 + 0x0be (PIN_OUTPUT | MUX_MODE0) /* dss_data9.dss_data9 */ 111 + 0x0c0 (PIN_OUTPUT | MUX_MODE0) /* dss_data10.dss_data10 */ 112 + 0x0c2 (PIN_OUTPUT | MUX_MODE0) /* dss_data11.dss_data11 */ 113 + 0x0c4 (PIN_OUTPUT | MUX_MODE0) /* dss_data12.dss_data12 */ 114 + 0x0c6 (PIN_OUTPUT | MUX_MODE0) /* dss_data13.dss_data13 */ 115 + 0x0c8 (PIN_OUTPUT | MUX_MODE0) /* dss_data14.dss_data14 */ 116 + 0x0ca (PIN_OUTPUT | MUX_MODE0) /* dss_data15.dss_data15 */ 117 + 0x0cc (PIN_OUTPUT | MUX_MODE0) /* dss_data16.dss_data16 */ 118 + 0x0ce (PIN_OUTPUT | MUX_MODE0) /* dss_data17.dss_data17 */ 119 + 0x0d0 (PIN_OUTPUT | MUX_MODE0) /* dss_data18.dss_data18 */ 120 + 0x0d2 (PIN_OUTPUT | MUX_MODE0) /* dss_data19.dss_data19 */ 121 + 0x0d4 (PIN_OUTPUT | MUX_MODE0) /* dss_data20.dss_data20 */ 122 + 0x0d6 (PIN_OUTPUT | MUX_MODE0) /* dss_data21.dss_data21 */ 123 + 0x0d8 (PIN_OUTPUT | MUX_MODE0) /* dss_data22.dss_data22 */ 124 + 0x0da (PIN_OUTPUT | MUX_MODE0) /* dss_data23.dss_data23 */ 88 125 >; 89 126 }; 90 127 }; ··· 214 173 215 174 &usbhsehci { 216 175 phys = <&hsusb1_phy>; 176 + }; 177 + 178 + &vpll2 { 179 + /* Needed for DSS */ 180 + regulator-name = "vdds_dsi"; 217 181 };
+2 -2
arch/arm/boot/dts/omap3-igep0030.dts
··· 1 1 /* 2 - * Device Tree Source for IGEP COM Module 2 + * Device Tree Source for IGEP COM MODULE (TI OMAP AM/DM37x) 3 3 * 4 4 * Copyright (C) 2012 Javier Martinez Canillas <javier@collabora.co.uk> 5 5 * Copyright (C) 2012 Enric Balletbo i Serra <eballetbo@gmail.com> ··· 12 12 #include "omap3-igep.dtsi" 13 13 14 14 / { 15 - model = "IGEP COM Module"; 15 + model = "IGEP COM MODULE (TI OMAP AM/DM37x)"; 16 16 compatible = "isee,omap3-igep0030", "ti,omap3"; 17 17 18 18 leds {
+22 -1
arch/arm/boot/dts/omap3-n900.dts
··· 125 125 >; 126 126 }; 127 127 128 + mmc2_pins: pinmux_mmc2_pins { 129 + pinctrl-single,pins = < 130 + 0x128 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_clk */ 131 + 0x12a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_cmd */ 132 + 0x12c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat0 */ 133 + 0x12e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat1 */ 134 + 0x130 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat2 */ 135 + 0x132 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat3 */ 136 + 0x134 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat4 */ 137 + 0x136 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat5 */ 138 + 0x138 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat6 */ 139 + 0x13a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc2_dat7 */ 140 + >; 141 + }; 142 + 128 143 display_pins: pinmux_display_pins { 129 144 pinctrl-single,pins = < 130 145 0x0d4 (PIN_OUTPUT | MUX_MODE4) /* RX51_LCD_RESET_GPIO */ ··· 373 358 cd-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>; /* 160 */ 374 359 }; 375 360 361 + /* most boards use vaux3, only some old versions use vmmc2 instead */ 376 362 &mmc2 { 377 - status = "disabled"; 363 + pinctrl-names = "default"; 364 + pinctrl-0 = <&mmc2_pins>; 365 + vmmc-supply = <&vaux3>; 366 + vmmc_aux-supply = <&vsim>; 367 + bus-width = <8>; 368 + non-removable; 378 369 }; 379 370 380 371 &mmc3 {
+42
arch/arm/boot/dts/omap3.dtsi
··· 82 82 ranges; 83 83 ti,hwmods = "l3_main"; 84 84 85 + aes: aes@480c5000 { 86 + compatible = "ti,omap3-aes"; 87 + ti,hwmods = "aes"; 88 + reg = <0x480c5000 0x50>; 89 + interrupts = <0>; 90 + }; 91 + 85 92 counter32k: counter@48320000 { 86 93 compatible = "ti,omap-counter32k"; 87 94 reg = <0x48320000 0x20>; ··· 267 260 ti,hwmods = "i2c3"; 268 261 }; 269 262 263 + mailbox: mailbox@48094000 { 264 + compatible = "ti,omap3-mailbox"; 265 + ti,hwmods = "mailbox"; 266 + reg = <0x48094000 0x200>; 267 + interrupts = <26>; 268 + }; 269 + 270 270 mcspi1: spi@48098000 { 271 271 compatible = "ti,omap2-mcspi"; 272 272 reg = <0x48098000 0x100>; ··· 371 357 dma-names = "tx", "rx"; 372 358 }; 373 359 360 + mmu_isp: mmu@480bd400 { 361 + compatible = "ti,omap3-mmu-isp"; 362 + ti,hwmods = "mmu_isp"; 363 + reg = <0x480bd400 0x80>; 364 + interrupts = <8>; 365 + }; 366 + 374 367 wdt2: wdt@48314000 { 375 368 compatible = "ti,omap3-wdt"; 376 369 reg = <0x48314000 0x80>; ··· 461 440 dmas = <&sdma 21>, 462 441 <&sdma 22>; 463 442 dma-names = "tx", "rx"; 443 + }; 444 + 445 + sham: sham@480c3000 { 446 + compatible = "ti,omap3-sham"; 447 + ti,hwmods = "sham"; 448 + reg = <0x480c3000 0x64>; 449 + interrupts = <49>; 450 + }; 451 + 452 + smartreflex_core: smartreflex@480cb000 { 453 + compatible = "ti,omap3-smartreflex-core"; 454 + ti,hwmods = "smartreflex_core"; 455 + reg = <0x480cb000 0x400>; 456 + interrupts = <19>; 457 + }; 458 + 459 + smartreflex_mpu_iva: smartreflex@480c9000 { 460 + compatible = "ti,omap3-smartreflex-iva"; 461 + ti,hwmods = "smartreflex_mpu_iva"; 462 + reg = <0x480c9000 0x400>; 463 + interrupts = <18>; 464 464 }; 465 465 466 466 timer1: timer@48318000 {
+10 -10
arch/arm/boot/dts/omap4-panda-common.dtsi
··· 246 246 0xf0 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c4_sda */ 247 247 >; 248 248 }; 249 - }; 250 - 251 - &omap4_pmx_wkup { 252 - led_wkgpio_pins: pinmux_leds_wkpins { 253 - pinctrl-single,pins = < 254 - 0x1a (PIN_OUTPUT | MUX_MODE3) /* gpio_wk7 */ 255 - 0x1c (PIN_OUTPUT | MUX_MODE3) /* gpio_wk8 */ 256 - >; 257 - }; 258 249 259 250 /* 260 251 * wl12xx GPIO outputs for WLAN_EN, BT_EN, FM_EN, BT_WAKEUP ··· 265 274 pinctrl-single,pins = < 266 275 0x38 (PIN_INPUT | MUX_MODE3) /* gpmc_ncs2.gpio_52 */ 267 276 0x3a (PIN_INPUT | MUX_MODE3) /* gpmc_ncs3.gpio_53 */ 268 - 0x108 (PIN_OUTPUT | MUX_MODE0) /* sdmmc5_clk.sdmmc5_clk */ 277 + 0x108 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_clk.sdmmc5_clk */ 269 278 0x10a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_cmd.sdmmc5_cmd */ 270 279 0x10c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat0.sdmmc5_dat0 */ 271 280 0x10e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat1.sdmmc5_dat1 */ 272 281 0x110 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat2.sdmmc5_dat2 */ 273 282 0x112 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat3.sdmmc5_dat3 */ 283 + >; 284 + }; 285 + }; 286 + 287 + &omap4_pmx_wkup { 288 + led_wkgpio_pins: pinmux_leds_wkpins { 289 + pinctrl-single,pins = < 290 + 0x1a (PIN_OUTPUT | MUX_MODE3) /* gpio_wk7 */ 291 + 0x1c (PIN_OUTPUT | MUX_MODE3) /* gpio_wk8 */ 274 292 >; 275 293 }; 276 294 };
+6 -6
arch/arm/boot/dts/omap4-sdp.dts
··· 300 300 wl12xx_pins: pinmux_wl12xx_pins { 301 301 pinctrl-single,pins = < 302 302 0x3a (PIN_INPUT | MUX_MODE3) /* gpmc_ncs3.gpio_53 */ 303 - 0x108 (PIN_OUTPUT | MUX_MODE3) /* sdmmc5_clk.sdmmc5_clk */ 304 - 0x10a (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_cmd.sdmmc5_cmd */ 305 - 0x10c (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat0.sdmmc5_dat0 */ 306 - 0x10e (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat1.sdmmc5_dat1 */ 307 - 0x110 (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat2.sdmmc5_dat2 */ 308 - 0x112 (PIN_INPUT_PULLUP | MUX_MODE3) /* sdmmc5_dat3.sdmmc5_dat3 */ 303 + 0x108 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_clk.sdmmc5_clk */ 304 + 0x10a (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_cmd.sdmmc5_cmd */ 305 + 0x10c (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat0.sdmmc5_dat0 */ 306 + 0x10e (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat1.sdmmc5_dat1 */ 307 + 0x110 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat2.sdmmc5_dat2 */ 308 + 0x112 (PIN_INPUT_PULLUP | MUX_MODE0) /* sdmmc5_dat3.sdmmc5_dat3 */ 309 309 >; 310 310 }; 311 311 };
+378 -1
arch/arm/boot/dts/sama5d3.dtsi
··· 13 13 #include <dt-bindings/pinctrl/at91.h> 14 14 #include <dt-bindings/interrupt-controller/irq.h> 15 15 #include <dt-bindings/gpio/gpio.h> 16 + #include <dt-bindings/clk/at91.h> 16 17 17 18 / { 18 19 model = "Atmel SAMA5D3 family SoC"; ··· 57 56 reg = <0x20000000 0x8000000>; 58 57 }; 59 58 59 + clocks { 60 + adc_op_clk: adc_op_clk{ 61 + compatible = "fixed-clock"; 62 + #clock-cells = <0>; 63 + clock-frequency = <20000000>; 64 + }; 65 + }; 66 + 60 67 ahb { 61 68 compatible = "simple-bus"; 62 69 #address-cells = <1>; ··· 88 79 status = "disabled"; 89 80 #address-cells = <1>; 90 81 #size-cells = <0>; 82 + clocks = <&mci0_clk>; 83 + clock-names = "mci_clk"; 91 84 }; 92 85 93 86 spi0: spi@f0004000 { ··· 103 92 dma-names = "tx", "rx"; 104 93 pinctrl-names = "default"; 105 94 pinctrl-0 = <&pinctrl_spi0>; 95 + clocks = <&spi0_clk>; 96 + clock-names = "spi_clk"; 106 97 status = "disabled"; 107 98 }; 108 99 ··· 114 101 interrupts = <38 IRQ_TYPE_LEVEL_HIGH 4>; 115 102 pinctrl-names = "default"; 116 103 pinctrl-0 = <&pinctrl_ssc0_tx &pinctrl_ssc0_rx>; 104 + clocks = <&ssc0_clk>; 105 + clock-names = "pclk"; 117 106 status = "disabled"; 118 107 }; 119 108 ··· 123 108 compatible = "atmel,at91sam9x5-tcb"; 124 109 reg = <0xf0010000 0x100>; 125 110 interrupts = <26 IRQ_TYPE_LEVEL_HIGH 0>; 111 + clocks = <&tcb0_clk>; 112 + clock-names = "t0_clk"; 126 113 }; 127 114 128 115 i2c0: i2c@f0014000 { ··· 138 121 pinctrl-0 = <&pinctrl_i2c0>; 139 122 #address-cells = <1>; 140 123 #size-cells = <0>; 124 + clocks = <&twi0_clk>; 141 125 status = "disabled"; 142 126 }; 143 127 ··· 153 135 pinctrl-0 = <&pinctrl_i2c1>; 154 136 #address-cells = <1>; 155 137 #size-cells = <0>; 138 + clocks = <&twi1_clk>; 156 139 status = "disabled"; 157 140 }; 158 141 ··· 163 144 interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>; 164 145 pinctrl-names = "default"; 165 146 pinctrl-0 = <&pinctrl_usart0>; 147 + clocks = <&usart0_clk>; 148 + clock-names = "usart"; 166 149 status = "disabled"; 167 150 }; 168 151 ··· 174 153 interrupts = <13 IRQ_TYPE_LEVEL_HIGH 5>; 175 154 pinctrl-names = "default"; 176 155 pinctrl-0 = <&pinctrl_usart1>; 156 + clocks = <&usart1_clk>; 157 + clock-names = "usart"; 177 158 status = "disabled"; 178 159 }; 179 160 ··· 197 174 status = "disabled"; 198 175 #address-cells = <1>; 199 176 #size-cells = <0>; 177 + clocks = <&mci1_clk>; 178 + clock-names = "mci_clk"; 200 179 }; 201 180 202 181 spi1: spi@f8008000 { ··· 212 187 dma-names = "tx", "rx"; 213 188 pinctrl-names = "default"; 214 189 pinctrl-0 = <&pinctrl_spi1>; 190 + clocks = <&spi1_clk>; 191 + clock-names = "spi_clk"; 215 192 status = "disabled"; 216 193 }; 217 194 ··· 223 196 interrupts = <39 IRQ_TYPE_LEVEL_HIGH 4>; 224 197 pinctrl-names = "default"; 225 198 pinctrl-0 = <&pinctrl_ssc1_tx &pinctrl_ssc1_rx>; 199 + clocks = <&ssc1_clk>; 200 + clock-names = "pclk"; 226 201 status = "disabled"; 227 202 }; 228 203 ··· 248 219 &pinctrl_adc0_ad10 249 220 &pinctrl_adc0_ad11 250 221 >; 222 + clocks = <&adc_clk>, 223 + <&adc_op_clk>; 224 + clock-names = "adc_clk", "adc_op_clk"; 251 225 atmel,adc-channel-base = <0x50>; 252 226 atmel,adc-channels-used = <0xfff>; 253 227 atmel,adc-drdy-mask = <0x1000000>; ··· 306 274 dma-names = "tx", "rx"; 307 275 #address-cells = <1>; 308 276 #size-cells = <0>; 277 + clocks = <&twi2_clk>; 309 278 status = "disabled"; 310 279 }; 311 280 ··· 316 283 interrupts = <14 IRQ_TYPE_LEVEL_HIGH 5>; 317 284 pinctrl-names = "default"; 318 285 pinctrl-0 = <&pinctrl_usart2>; 286 + clocks = <&usart2_clk>; 287 + clock-names = "usart"; 319 288 status = "disabled"; 320 289 }; 321 290 ··· 327 292 interrupts = <15 IRQ_TYPE_LEVEL_HIGH 5>; 328 293 pinctrl-names = "default"; 329 294 pinctrl-0 = <&pinctrl_usart3>; 295 + clocks = <&usart3_clk>; 296 + clock-names = "usart"; 330 297 status = "disabled"; 331 298 }; 332 299 ··· 355 318 reg = <0xffffe600 0x200>; 356 319 interrupts = <30 IRQ_TYPE_LEVEL_HIGH 0>; 357 320 #dma-cells = <2>; 321 + clocks = <&dma0_clk>; 322 + clock-names = "dma_clk"; 358 323 }; 359 324 360 325 dma1: dma-controller@ffffe800 { ··· 364 325 reg = <0xffffe800 0x200>; 365 326 interrupts = <31 IRQ_TYPE_LEVEL_HIGH 0>; 366 327 #dma-cells = <2>; 328 + clocks = <&dma1_clk>; 329 + clock-names = "dma_clk"; 367 330 }; 368 331 369 332 ramc0: ramc@ffffea00 { ··· 379 338 interrupts = <2 IRQ_TYPE_LEVEL_HIGH 7>; 380 339 pinctrl-names = "default"; 381 340 pinctrl-0 = <&pinctrl_dbgu>; 341 + clocks = <&dbgu_clk>; 342 + clock-names = "usart"; 382 343 status = "disabled"; 383 344 }; 384 345 ··· 669 626 gpio-controller; 670 627 interrupt-controller; 671 628 #interrupt-cells = <2>; 629 + clocks = <&pioA_clk>; 672 630 }; 673 631 674 632 pioB: gpio@fffff400 { ··· 680 636 gpio-controller; 681 637 interrupt-controller; 682 638 #interrupt-cells = <2>; 639 + clocks = <&pioB_clk>; 683 640 }; 684 641 685 642 pioC: gpio@fffff600 { ··· 691 646 gpio-controller; 692 647 interrupt-controller; 693 648 #interrupt-cells = <2>; 649 + clocks = <&pioC_clk>; 694 650 }; 695 651 696 652 pioD: gpio@fffff800 { ··· 702 656 gpio-controller; 703 657 interrupt-controller; 704 658 #interrupt-cells = <2>; 659 + clocks = <&pioD_clk>; 705 660 }; 706 661 707 662 pioE: gpio@fffffa00 { ··· 713 666 gpio-controller; 714 667 interrupt-controller; 715 668 #interrupt-cells = <2>; 669 + clocks = <&pioE_clk>; 716 670 }; 717 671 }; 718 672 719 673 pmc: pmc@fffffc00 { 720 - compatible = "atmel,at91rm9200-pmc"; 674 + compatible = "atmel,sama5d3-pmc"; 721 675 reg = <0xfffffc00 0x120>; 676 + interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; 677 + interrupt-controller; 678 + #address-cells = <1>; 679 + #size-cells = <0>; 680 + #interrupt-cells = <1>; 681 + 682 + clk32k: slck { 683 + compatible = "fixed-clock"; 684 + #clock-cells = <0>; 685 + clock-frequency = <32768>; 686 + }; 687 + 688 + main: mainck { 689 + compatible = "atmel,at91rm9200-clk-main"; 690 + #clock-cells = <0>; 691 + interrupt-parent = <&pmc>; 692 + interrupts = <AT91_PMC_MOSCS>; 693 + clocks = <&clk32k>; 694 + }; 695 + 696 + plla: pllack { 697 + compatible = "atmel,sama5d3-clk-pll"; 698 + #clock-cells = <0>; 699 + interrupt-parent = <&pmc>; 700 + interrupts = <AT91_PMC_LOCKA>; 701 + clocks = <&main>; 702 + reg = <0>; 703 + atmel,clk-input-range = <8000000 50000000>; 704 + #atmel,pll-clk-output-range-cells = <4>; 705 + atmel,pll-clk-output-ranges = <400000000 1000000000 0 0>; 706 + }; 707 + 708 + plladiv: plladivck { 709 + compatible = "atmel,at91sam9x5-clk-plldiv"; 710 + #clock-cells = <0>; 711 + clocks = <&plla>; 712 + }; 713 + 714 + utmi: utmick { 715 + compatible = "atmel,at91sam9x5-clk-utmi"; 716 + #clock-cells = <0>; 717 + interrupt-parent = <&pmc>; 718 + interrupts = <AT91_PMC_LOCKU>; 719 + clocks = <&main>; 720 + }; 721 + 722 + mck: masterck { 723 + compatible = "atmel,at91sam9x5-clk-master"; 724 + #clock-cells = <0>; 725 + interrupt-parent = <&pmc>; 726 + interrupts = <AT91_PMC_MCKRDY>; 727 + clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>; 728 + atmel,clk-output-range = <0 166000000>; 729 + atmel,clk-divisors = <1 2 4 3>; 730 + }; 731 + 732 + usb: usbck { 733 + compatible = "atmel,at91sam9x5-clk-usb"; 734 + #clock-cells = <0>; 735 + clocks = <&plladiv>, <&utmi>; 736 + }; 737 + 738 + prog: progck { 739 + compatible = "atmel,at91sam9x5-clk-programmable"; 740 + #address-cells = <1>; 741 + #size-cells = <0>; 742 + interrupt-parent = <&pmc>; 743 + clocks = <&clk32k>, <&main>, <&plladiv>, <&utmi>, <&mck>; 744 + 745 + prog0: prog0 { 746 + #clock-cells = <0>; 747 + reg = <0>; 748 + interrupts = <AT91_PMC_PCKRDY(0)>; 749 + }; 750 + 751 + prog1: prog1 { 752 + #clock-cells = <0>; 753 + reg = <1>; 754 + interrupts = <AT91_PMC_PCKRDY(1)>; 755 + }; 756 + 757 + prog2: prog2 { 758 + #clock-cells = <0>; 759 + reg = <2>; 760 + interrupts = <AT91_PMC_PCKRDY(2)>; 761 + }; 762 + }; 763 + 764 + smd: smdclk { 765 + compatible = "atmel,at91sam9x5-clk-smd"; 766 + #clock-cells = <0>; 767 + clocks = <&plladiv>, <&utmi>; 768 + }; 769 + 770 + systemck { 771 + compatible = "atmel,at91rm9200-clk-system"; 772 + #address-cells = <1>; 773 + #size-cells = <0>; 774 + 775 + ddrck: ddrck { 776 + #clock-cells = <0>; 777 + reg = <2>; 778 + clocks = <&mck>; 779 + }; 780 + 781 + smdck: smdck { 782 + #clock-cells = <0>; 783 + reg = <4>; 784 + clocks = <&smd>; 785 + }; 786 + 787 + uhpck: uhpck { 788 + #clock-cells = <0>; 789 + reg = <6>; 790 + clocks = <&usb>; 791 + }; 792 + 793 + udpck: udpck { 794 + #clock-cells = <0>; 795 + reg = <7>; 796 + clocks = <&usb>; 797 + }; 798 + 799 + pck0: pck0 { 800 + #clock-cells = <0>; 801 + reg = <8>; 802 + clocks = <&prog0>; 803 + }; 804 + 805 + pck1: pck1 { 806 + #clock-cells = <0>; 807 + reg = <9>; 808 + clocks = <&prog1>; 809 + }; 810 + 811 + pck2: pck2 { 812 + #clock-cells = <0>; 813 + reg = <10>; 814 + clocks = <&prog2>; 815 + }; 816 + }; 817 + 818 + periphck { 819 + compatible = "atmel,at91sam9x5-clk-peripheral"; 820 + #address-cells = <1>; 821 + #size-cells = <0>; 822 + clocks = <&mck>; 823 + 824 + dbgu_clk: dbgu_clk { 825 + #clock-cells = <0>; 826 + reg = <2>; 827 + }; 828 + 829 + pioA_clk: pioA_clk { 830 + #clock-cells = <0>; 831 + reg = <6>; 832 + }; 833 + 834 + pioB_clk: pioB_clk { 835 + #clock-cells = <0>; 836 + reg = <7>; 837 + }; 838 + 839 + pioC_clk: pioC_clk { 840 + #clock-cells = <0>; 841 + reg = <8>; 842 + }; 843 + 844 + pioD_clk: pioD_clk { 845 + #clock-cells = <0>; 846 + reg = <9>; 847 + }; 848 + 849 + pioE_clk: pioE_clk { 850 + #clock-cells = <0>; 851 + reg = <10>; 852 + }; 853 + 854 + usart0_clk: usart0_clk { 855 + #clock-cells = <0>; 856 + reg = <12>; 857 + atmel,clk-output-range = <0 66000000>; 858 + }; 859 + 860 + usart1_clk: usart1_clk { 861 + #clock-cells = <0>; 862 + reg = <13>; 863 + atmel,clk-output-range = <0 66000000>; 864 + }; 865 + 866 + usart2_clk: usart2_clk { 867 + #clock-cells = <0>; 868 + reg = <14>; 869 + atmel,clk-output-range = <0 66000000>; 870 + }; 871 + 872 + usart3_clk: usart3_clk { 873 + #clock-cells = <0>; 874 + reg = <15>; 875 + atmel,clk-output-range = <0 66000000>; 876 + }; 877 + 878 + twi0_clk: twi0_clk { 879 + reg = <18>; 880 + #clock-cells = <0>; 881 + atmel,clk-output-range = <0 16625000>; 882 + }; 883 + 884 + twi1_clk: twi1_clk { 885 + #clock-cells = <0>; 886 + reg = <19>; 887 + atmel,clk-output-range = <0 16625000>; 888 + }; 889 + 890 + twi2_clk: twi2_clk { 891 + #clock-cells = <0>; 892 + reg = <20>; 893 + atmel,clk-output-range = <0 16625000>; 894 + }; 895 + 896 + mci0_clk: mci0_clk { 897 + #clock-cells = <0>; 898 + reg = <21>; 899 + }; 900 + 901 + mci1_clk: mci1_clk { 902 + #clock-cells = <0>; 903 + reg = <22>; 904 + }; 905 + 906 + spi0_clk: spi0_clk { 907 + #clock-cells = <0>; 908 + reg = <24>; 909 + atmel,clk-output-range = <0 133000000>; 910 + }; 911 + 912 + spi1_clk: spi1_clk { 913 + #clock-cells = <0>; 914 + reg = <25>; 915 + atmel,clk-output-range = <0 133000000>; 916 + }; 917 + 918 + tcb0_clk: tcb0_clk { 919 + #clock-cells = <0>; 920 + reg = <26>; 921 + atmel,clk-output-range = <0 133000000>; 922 + }; 923 + 924 + pwm_clk: pwm_clk { 925 + #clock-cells = <0>; 926 + reg = <28>; 927 + }; 928 + 929 + adc_clk: adc_clk { 930 + #clock-cells = <0>; 931 + reg = <29>; 932 + atmel,clk-output-range = <0 66000000>; 933 + }; 934 + 935 + dma0_clk: dma0_clk { 936 + #clock-cells = <0>; 937 + reg = <30>; 938 + }; 939 + 940 + dma1_clk: dma1_clk { 941 + #clock-cells = <0>; 942 + reg = <31>; 943 + }; 944 + 945 + uhphs_clk: uhphs_clk { 946 + #clock-cells = <0>; 947 + reg = <32>; 948 + }; 949 + 950 + udphs_clk: udphs_clk { 951 + #clock-cells = <0>; 952 + reg = <33>; 953 + }; 954 + 955 + isi_clk: isi_clk { 956 + #clock-cells = <0>; 957 + reg = <37>; 958 + }; 959 + 960 + ssc0_clk: ssc0_clk { 961 + #clock-cells = <0>; 962 + reg = <38>; 963 + atmel,clk-output-range = <0 66000000>; 964 + }; 965 + 966 + ssc1_clk: ssc1_clk { 967 + #clock-cells = <0>; 968 + reg = <39>; 969 + atmel,clk-output-range = <0 66000000>; 970 + }; 971 + 972 + sha_clk: sha_clk { 973 + #clock-cells = <0>; 974 + reg = <42>; 975 + }; 976 + 977 + aes_clk: aes_clk { 978 + #clock-cells = <0>; 979 + reg = <43>; 980 + }; 981 + 982 + tdes_clk: tdes_clk { 983 + #clock-cells = <0>; 984 + reg = <44>; 985 + }; 986 + 987 + trng_clk: trng_clk { 988 + #clock-cells = <0>; 989 + reg = <45>; 990 + }; 991 + 992 + fuse_clk: fuse_clk { 993 + #clock-cells = <0>; 994 + reg = <48>; 995 + }; 996 + }; 722 997 }; 723 998 724 999 rstc@fffffe00 { ··· 1052 683 compatible = "atmel,at91sam9260-pit"; 1053 684 reg = <0xfffffe30 0xf>; 1054 685 interrupts = <3 IRQ_TYPE_LEVEL_HIGH 5>; 686 + clocks = <&mck>; 1055 687 }; 1056 688 1057 689 watchdog@fffffe40 { ··· 1075 705 reg = <0x00500000 0x100000 1076 706 0xf8030000 0x4000>; 1077 707 interrupts = <33 IRQ_TYPE_LEVEL_HIGH 2>; 708 + clocks = <&udphs_clk>, <&utmi>; 709 + clock-names = "pclk", "hclk"; 1078 710 status = "disabled"; 1079 711 1080 712 ep0 { ··· 1189 817 compatible = "atmel,at91rm9200-ohci", "usb-ohci"; 1190 818 reg = <0x00600000 0x100000>; 1191 819 interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; 820 + clocks = <&usb>, <&uhphs_clk>, <&udphs_clk>, 821 + <&uhpck>; 822 + clock-names = "usb_clk", "ohci_clk", "hclk", "uhpck"; 1192 823 status = "disabled"; 1193 824 }; 1194 825 ··· 1199 824 compatible = "atmel,at91sam9g45-ehci", "usb-ehci"; 1200 825 reg = <0x00700000 0x100000>; 1201 826 interrupts = <32 IRQ_TYPE_LEVEL_HIGH 2>; 827 + clocks = <&usb>, <&uhphs_clk>, <&uhpck>; 828 + clock-names = "usb_clk", "ehci_clk", "uhpck"; 1202 829 status = "disabled"; 1203 830 }; 1204 831
+20
arch/arm/boot/dts/sama5d3_can.dtsi
··· 32 32 33 33 }; 34 34 35 + pmc: pmc@fffffc00 { 36 + periphck { 37 + can0_clk: can0_clk { 38 + #clock-cells = <0>; 39 + reg = <40>; 40 + atmel,clk-output-range = <0 66000000>; 41 + }; 42 + 43 + can1_clk: can0_clk { 44 + #clock-cells = <0>; 45 + reg = <41>; 46 + atmel,clk-output-range = <0 66000000>; 47 + }; 48 + }; 49 + }; 50 + 35 51 can0: can@f000c000 { 36 52 compatible = "atmel,at91sam9x5-can"; 37 53 reg = <0xf000c000 0x300>; 38 54 interrupts = <40 IRQ_TYPE_LEVEL_HIGH 3>; 39 55 pinctrl-names = "default"; 40 56 pinctrl-0 = <&pinctrl_can0_rx_tx>; 57 + clocks = <&can0_clk>; 58 + clock-names = "can_clk"; 41 59 status = "disabled"; 42 60 }; 43 61 ··· 65 47 interrupts = <41 IRQ_TYPE_LEVEL_HIGH 3>; 66 48 pinctrl-names = "default"; 67 49 pinctrl-0 = <&pinctrl_can1_rx_tx>; 50 + clocks = <&can1_clk>; 51 + clock-names = "can_clk"; 68 52 status = "disabled"; 69 53 }; 70 54 };
+11
arch/arm/boot/dts/sama5d3_emac.dtsi
··· 31 31 }; 32 32 }; 33 33 34 + pmc: pmc@fffffc00 { 35 + periphck { 36 + macb1_clk: macb1_clk { 37 + #clock-cells = <0>; 38 + reg = <35>; 39 + }; 40 + }; 41 + }; 42 + 34 43 macb1: ethernet@f802c000 { 35 44 compatible = "cdns,at32ap7000-macb", "cdns,macb"; 36 45 reg = <0xf802c000 0x100>; 37 46 interrupts = <35 IRQ_TYPE_LEVEL_HIGH 3>; 38 47 pinctrl-names = "default"; 39 48 pinctrl-0 = <&pinctrl_macb1_rmii>; 49 + clocks = <&macb1_clk>, <&macb1_clk>; 50 + clock-names = "hclk", "pclk"; 40 51 status = "disabled"; 41 52 }; 42 53 };
+11
arch/arm/boot/dts/sama5d3_gmac.dtsi
··· 64 64 }; 65 65 }; 66 66 67 + pmc: pmc@fffffc00 { 68 + periphck { 69 + macb0_clk: macb0_clk { 70 + #clock-cells = <0>; 71 + reg = <34>; 72 + }; 73 + }; 74 + }; 75 + 67 76 macb0: ethernet@f0028000 { 68 77 compatible = "cdns,pc302-gem", "cdns,gem"; 69 78 reg = <0xf0028000 0x100>; 70 79 interrupts = <34 IRQ_TYPE_LEVEL_HIGH 3>; 71 80 pinctrl-names = "default"; 72 81 pinctrl-0 = <&pinctrl_macb0_data_rgmii &pinctrl_macb0_signal_rgmii>; 82 + clocks = <&macb0_clk>, <&macb0_clk>; 83 + clock-names = "hclk", "pclk"; 73 84 status = "disabled"; 74 85 }; 75 86 };
+17
arch/arm/boot/dts/sama5d3_lcd.dtsi
··· 50 50 }; 51 51 }; 52 52 }; 53 + 54 + pmc: pmc@fffffc00 { 55 + periphck { 56 + lcdc_clk: lcdc_clk { 57 + #clock-cells = <0>; 58 + reg = <36>; 59 + }; 60 + }; 61 + 62 + systemck { 63 + lcdck: lcdck { 64 + #clock-cells = <0>; 65 + reg = <3>; 66 + clocks = <&mck>; 67 + }; 68 + }; 69 + }; 53 70 }; 54 71 }; 55 72 };
+12
arch/arm/boot/dts/sama5d3_mci2.dtsi
··· 9 9 10 10 #include <dt-bindings/pinctrl/at91.h> 11 11 #include <dt-bindings/interrupt-controller/irq.h> 12 + #include <dt-bindings/clk/at91.h> 12 13 13 14 / { 14 15 ahb { ··· 31 30 }; 32 31 }; 33 32 33 + pmc: pmc@fffffc00 { 34 + periphck { 35 + mci2_clk: mci2_clk { 36 + #clock-cells = <0>; 37 + reg = <23>; 38 + }; 39 + }; 40 + }; 41 + 34 42 mmc2: mmc@f8004000 { 35 43 compatible = "atmel,hsmci"; 36 44 reg = <0xf8004000 0x600>; ··· 48 38 dma-names = "rxtx"; 49 39 pinctrl-names = "default"; 50 40 pinctrl-0 = <&pinctrl_mmc2_clk_cmd_dat0 &pinctrl_mmc2_dat1_3>; 41 + clocks = <&mci2_clk>; 42 + clock-names = "mci_clk"; 51 43 status = "disabled"; 52 44 #address-cells = <1>; 53 45 #size-cells = <0>;
+12
arch/arm/boot/dts/sama5d3_tcb1.dtsi
··· 9 9 10 10 #include <dt-bindings/pinctrl/at91.h> 11 11 #include <dt-bindings/interrupt-controller/irq.h> 12 + #include <dt-bindings/clk/at91.h> 12 13 13 14 / { 14 15 aliases { ··· 18 17 19 18 ahb { 20 19 apb { 20 + pmc: pmc@fffffc00 { 21 + periphck { 22 + tcb1_clk: tcb1_clk { 23 + #clock-cells = <0>; 24 + reg = <27>; 25 + }; 26 + }; 27 + }; 28 + 21 29 tcb1: timer@f8014000 { 22 30 compatible = "atmel,at91sam9x5-tcb"; 23 31 reg = <0xf8014000 0x100>; 24 32 interrupts = <27 IRQ_TYPE_LEVEL_HIGH 0>; 33 + clocks = <&tcb1_clk>; 34 + clock-names = "t0_clk"; 25 35 }; 26 36 }; 27 37 };
+21
arch/arm/boot/dts/sama5d3_uart.dtsi
··· 9 9 10 10 #include <dt-bindings/pinctrl/at91.h> 11 11 #include <dt-bindings/interrupt-controller/irq.h> 12 + #include <dt-bindings/clk/at91.h> 12 13 13 14 / { 14 15 ahb { ··· 32 31 }; 33 32 }; 34 33 34 + pmc: pmc@fffffc00 { 35 + periphck { 36 + uart0_clk: uart0_clk { 37 + #clock-cells = <0>; 38 + reg = <16>; 39 + atmel,clk-output-range = <0 66000000>; 40 + }; 41 + 42 + uart1_clk: uart1_clk { 43 + #clock-cells = <0>; 44 + reg = <17>; 45 + atmel,clk-output-range = <0 66000000>; 46 + }; 47 + }; 48 + }; 49 + 35 50 uart0: serial@f0024000 { 36 51 compatible = "atmel,at91sam9260-usart"; 37 52 reg = <0xf0024000 0x200>; 38 53 interrupts = <16 IRQ_TYPE_LEVEL_HIGH 5>; 39 54 pinctrl-names = "default"; 40 55 pinctrl-0 = <&pinctrl_uart0>; 56 + clocks = <&uart0_clk>; 57 + clock-names = "usart"; 41 58 status = "disabled"; 42 59 }; 43 60 ··· 65 46 interrupts = <17 IRQ_TYPE_LEVEL_HIGH 5>; 66 47 pinctrl-names = "default"; 67 48 pinctrl-0 = <&pinctrl_uart1>; 49 + clocks = <&uart1_clk>; 50 + clock-names = "usart"; 68 51 status = "disabled"; 69 52 }; 70 53 };
+6 -11
arch/arm/boot/dts/sama5d3xcm.dtsi
··· 18 18 reg = <0x20000000 0x20000000>; 19 19 }; 20 20 21 - clocks { 22 - #address-cells = <1>; 23 - #size-cells = <1>; 24 - ranges; 25 - 26 - main_clock: clock@0 { 27 - compatible = "atmel,osc", "fixed-clock"; 28 - clock-frequency = <12000000>; 29 - }; 30 - }; 31 - 32 21 ahb { 33 22 apb { 34 23 spi0: spi@f0004000 { ··· 26 37 27 38 macb0: ethernet@f0028000 { 28 39 phy-mode = "rgmii"; 40 + }; 41 + 42 + pmc: pmc@fffffc00 { 43 + main: mainck { 44 + clock-frequency = <12000000>; 45 + }; 29 46 }; 30 47 }; 31 48
+4 -3
arch/arm/boot/dts/socfpga.dtsi
··· 245 245 246 246 mpu_periph_clk: mpu_periph_clk { 247 247 #clock-cells = <0>; 248 - compatible = "altr,socfpga-gate-clk"; 248 + compatible = "altr,socfpga-perip-clk"; 249 249 clocks = <&mpuclk>; 250 250 fixed-divider = <4>; 251 251 }; 252 252 253 253 mpu_l2_ram_clk: mpu_l2_ram_clk { 254 254 #clock-cells = <0>; 255 - compatible = "altr,socfpga-gate-clk"; 255 + compatible = "altr,socfpga-perip-clk"; 256 256 clocks = <&mpuclk>; 257 257 fixed-divider = <2>; 258 258 }; ··· 266 266 267 267 l3_main_clk: l3_main_clk { 268 268 #clock-cells = <0>; 269 - compatible = "altr,socfpga-gate-clk"; 269 + compatible = "altr,socfpga-perip-clk"; 270 270 clocks = <&mainclk>; 271 + fixed-divider = <1>; 271 272 }; 272 273 273 274 l3_mp_clk: l3_mp_clk {
+3
arch/arm/configs/multi_v7_defconfig
··· 69 69 CONFIG_SMSC911X=y 70 70 CONFIG_STMMAC_ETH=y 71 71 CONFIG_MDIO_SUN4I=y 72 + CONFIG_TI_CPSW=y 72 73 CONFIG_KEYBOARD_SPEAR=y 73 74 CONFIG_SERIO_AMBAKMI=y 74 75 CONFIG_SERIAL_8250=y ··· 134 133 CONFIG_USB_ISP1301=y 135 134 CONFIG_USB_MXS_PHY=y 136 135 CONFIG_MMC=y 136 + CONFIG_MMC_BLOCK_MINORS=16 137 137 CONFIG_MMC_ARMMMCI=y 138 138 CONFIG_MMC_SDHCI=y 139 139 CONFIG_MMC_SDHCI_PLTFM=y 140 140 CONFIG_MMC_SDHCI_ESDHC_IMX=y 141 141 CONFIG_MMC_SDHCI_TEGRA=y 142 142 CONFIG_MMC_SDHCI_SPEAR=y 143 + CONFIG_MMC_SDHCI_BCM_KONA=y 143 144 CONFIG_MMC_OMAP=y 144 145 CONFIG_MMC_OMAP_HS=y 145 146 CONFIG_EDAC=y
+1
arch/arm/configs/omap2plus_defconfig
··· 173 173 CONFIG_MFD_TPS65217=y 174 174 CONFIG_MFD_TPS65910=y 175 175 CONFIG_TWL6040_CORE=y 176 + CONFIG_REGULATOR_FIXED_VOLTAGE=y 176 177 CONFIG_REGULATOR_PALMAS=y 177 178 CONFIG_REGULATOR_TPS65023=y 178 179 CONFIG_REGULATOR_TPS6507X=y
+7
arch/arm/configs/sunxi_defconfig
··· 12 12 CONFIG_PACKET=y 13 13 CONFIG_UNIX=y 14 14 CONFIG_INET=y 15 + CONFIG_IP_PNP=y 16 + CONFIG_IP_PNP_DHCP=y 17 + CONFIG_IP_PNP_BOOTP=y 15 18 # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 16 19 # CONFIG_INET_XFRM_MODE_TUNNEL is not set 17 20 # CONFIG_INET_XFRM_MODE_BEET is not set ··· 61 58 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y 62 59 CONFIG_COMMON_CLK_DEBUG=y 63 60 # CONFIG_IOMMU_SUPPORT is not set 61 + CONFIG_TMPFS=y 62 + CONFIG_NFS_FS=y 63 + CONFIG_ROOT_NFS=y 64 64 CONFIG_NLS=y 65 + CONFIG_PRINTK_TIME=y
+3
arch/arm/configs/u8500_defconfig
··· 22 22 CONFIG_CPU_FREQ=y 23 23 CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y 24 24 CONFIG_CPU_IDLE=y 25 + CONFIG_ARM_U8500_CPUIDLE=y 25 26 CONFIG_VFP=y 26 27 CONFIG_NEON=y 27 28 CONFIG_PM_RUNTIME=y ··· 110 109 CONFIG_EXT3_FS=y 111 110 CONFIG_EXT4_FS=y 112 111 CONFIG_VFAT_FS=y 112 + CONFIG_DEVTMPFS=y 113 + CONFIG_DEVTMPFS_MOUNT=y 113 114 CONFIG_TMPFS=y 114 115 CONFIG_TMPFS_POSIX_ACL=y 115 116 # CONFIG_MISC_FILESYSTEMS is not set
+43
arch/arm/mach-at91/Kconfig
··· 1 1 if ARCH_AT91 2 2 3 + config HAVE_AT91_UTMI 4 + bool 5 + 6 + config HAVE_AT91_USB_CLK 7 + bool 8 + 3 9 config HAVE_AT91_DBGU0 4 10 bool 5 11 6 12 config HAVE_AT91_DBGU1 7 13 bool 8 14 15 + config AT91_USE_OLD_CLK 16 + bool 17 + 9 18 config AT91_PMC_UNIT 10 19 bool 11 20 default !ARCH_AT91X40 21 + 22 + config COMMON_CLK_AT91 23 + bool 24 + default AT91_PMC_UNIT && USE_OF && !AT91_USE_OLD_CLK 25 + select COMMON_CLK 26 + 27 + config OLD_CLK_AT91 28 + bool 29 + default AT91_PMC_UNIT && AT91_USE_OLD_CLK 12 30 13 31 config AT91_SAM9_ALT_RESET 14 32 bool ··· 37 19 default !ARCH_AT91X40 38 20 39 21 config AT91_SAM9_TIME 22 + bool 23 + 24 + config HAVE_AT91_SMD 40 25 bool 41 26 42 27 config SOC_AT91SAM9 ··· 86 65 select SOC_SAMA5 87 66 select HAVE_FB_ATMEL 88 67 select HAVE_AT91_DBGU1 68 + select HAVE_AT91_UTMI 69 + select HAVE_AT91_SMD 70 + select HAVE_AT91_USB_CLK 89 71 help 90 72 Select this if you are using one of Atmel's SAMA5D3 family SoC. 91 73 This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35. ··· 102 78 select HAVE_AT91_DBGU0 103 79 select MULTI_IRQ_HANDLER 104 80 select SPARSE_IRQ 81 + select AT91_USE_OLD_CLK 82 + select HAVE_AT91_USB_CLK 105 83 106 84 config SOC_AT91SAM9260 107 85 bool "AT91SAM9260, AT91SAM9XE or AT91SAM9G20" 108 86 select HAVE_AT91_DBGU0 109 87 select SOC_AT91SAM9 88 + select AT91_USE_OLD_CLK 89 + select HAVE_AT91_USB_CLK 110 90 help 111 91 Select this if you are using one of Atmel's AT91SAM9260, AT91SAM9XE 112 92 or AT91SAM9G20 SoC. ··· 120 92 select HAVE_AT91_DBGU0 121 93 select HAVE_FB_ATMEL 122 94 select SOC_AT91SAM9 95 + select AT91_USE_OLD_CLK 96 + select HAVE_AT91_USB_CLK 123 97 help 124 98 Select this if you are using one of Atmel's AT91SAM9261 or AT91SAM9G10 SoC. 125 99 ··· 130 100 select HAVE_AT91_DBGU1 131 101 select HAVE_FB_ATMEL 132 102 select SOC_AT91SAM9 103 + select AT91_USE_OLD_CLK 104 + select HAVE_AT91_USB_CLK 133 105 134 106 config SOC_AT91SAM9RL 135 107 bool "AT91SAM9RL" 136 108 select HAVE_AT91_DBGU0 137 109 select HAVE_FB_ATMEL 138 110 select SOC_AT91SAM9 111 + select AT91_USE_OLD_CLK 112 + select HAVE_AT91_UTMI 139 113 140 114 config SOC_AT91SAM9G45 141 115 bool "AT91SAM9G45 or AT91SAM9M10 families" 142 116 select HAVE_AT91_DBGU1 143 117 select HAVE_FB_ATMEL 144 118 select SOC_AT91SAM9 119 + select AT91_USE_OLD_CLK 120 + select HAVE_AT91_UTMI 121 + select HAVE_AT91_USB_CLK 145 122 help 146 123 Select this if you are using one of Atmel's AT91SAM9G45 family SoC. 147 124 This support covers AT91SAM9G45, AT91SAM9G46, AT91SAM9M10 and AT91SAM9M11. ··· 158 121 select HAVE_AT91_DBGU0 159 122 select HAVE_FB_ATMEL 160 123 select SOC_AT91SAM9 124 + select AT91_USE_OLD_CLK 125 + select HAVE_AT91_UTMI 126 + select HAVE_AT91_SMD 127 + select HAVE_AT91_USB_CLK 161 128 help 162 129 Select this if you are using one of Atmel's AT91SAM9x5 family SoC. 163 130 This means that your SAM9 name finishes with a '5' (except if it is ··· 174 133 select HAVE_AT91_DBGU0 175 134 select HAVE_FB_ATMEL 176 135 select SOC_AT91SAM9 136 + select AT91_USE_OLD_CLK 137 + select HAVE_AT91_USB_CLK 177 138 help 178 139 Select this if you are using Atmel's AT91SAM9N12 SoC. 179 140
+6
arch/arm/mach-at91/Kconfig.non_dt
··· 12 12 config ARCH_AT91RM9200 13 13 bool "AT91RM9200" 14 14 select SOC_AT91RM9200 15 + select AT91_USE_OLD_CLK 15 16 16 17 config ARCH_AT91SAM9260 17 18 bool "AT91SAM9260 or AT91SAM9XE or AT91SAM9G20" 18 19 select SOC_AT91SAM9260 20 + select AT91_USE_OLD_CLK 19 21 20 22 config ARCH_AT91SAM9261 21 23 bool "AT91SAM9261 or AT91SAM9G10" 22 24 select SOC_AT91SAM9261 25 + select AT91_USE_OLD_CLK 23 26 24 27 config ARCH_AT91SAM9263 25 28 bool "AT91SAM9263" 26 29 select SOC_AT91SAM9263 30 + select AT91_USE_OLD_CLK 27 31 28 32 config ARCH_AT91SAM9RL 29 33 bool "AT91SAM9RL" 30 34 select SOC_AT91SAM9RL 35 + select AT91_USE_OLD_CLK 31 36 32 37 config ARCH_AT91SAM9G45 33 38 bool "AT91SAM9G45" 34 39 select SOC_AT91SAM9G45 40 + select AT91_USE_OLD_CLK 35 41 36 42 config ARCH_AT91X40 37 43 bool "AT91x40"
+1 -1
arch/arm/mach-at91/Makefile
··· 7 7 obj-n := 8 8 obj- := 9 9 10 - obj-$(CONFIG_AT91_PMC_UNIT) += clock.o 10 + obj-$(CONFIG_OLD_CLK_AT91) += clock.o 11 11 obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o 12 12 obj-$(CONFIG_AT91_SAM9G45_RESET) += at91sam9g45_reset.o 13 13 obj-$(CONFIG_AT91_SAM9_TIME) += at91sam926x_time.o
+1 -1
arch/arm/mach-at91/at91rm9200.c
··· 12 12 13 13 #include <linux/module.h> 14 14 #include <linux/reboot.h> 15 + #include <linux/clk/at91_pmc.h> 15 16 16 17 #include <asm/irq.h> 17 18 #include <asm/mach/arch.h> 18 19 #include <asm/mach/map.h> 19 20 #include <asm/system_misc.h> 20 21 #include <mach/at91rm9200.h> 21 - #include <mach/at91_pmc.h> 22 22 #include <mach/at91_st.h> 23 23 #include <mach/cpu.h> 24 24
+1 -1
arch/arm/mach-at91/at91sam9260.c
··· 11 11 */ 12 12 13 13 #include <linux/module.h> 14 + #include <linux/clk/at91_pmc.h> 14 15 15 16 #include <asm/proc-fns.h> 16 17 #include <asm/irq.h> ··· 21 20 #include <mach/cpu.h> 22 21 #include <mach/at91_dbgu.h> 23 22 #include <mach/at91sam9260.h> 24 - #include <mach/at91_pmc.h> 25 23 26 24 #include "at91_aic.h" 27 25 #include "at91_rstc.h"
+1 -1
arch/arm/mach-at91/at91sam9261.c
··· 11 11 */ 12 12 13 13 #include <linux/module.h> 14 + #include <linux/clk/at91_pmc.h> 14 15 15 16 #include <asm/proc-fns.h> 16 17 #include <asm/irq.h> ··· 20 19 #include <asm/system_misc.h> 21 20 #include <mach/cpu.h> 22 21 #include <mach/at91sam9261.h> 23 - #include <mach/at91_pmc.h> 24 22 25 23 #include "at91_aic.h" 26 24 #include "at91_rstc.h"
+1 -1
arch/arm/mach-at91/at91sam9263.c
··· 11 11 */ 12 12 13 13 #include <linux/module.h> 14 + #include <linux/clk/at91_pmc.h> 14 15 15 16 #include <asm/proc-fns.h> 16 17 #include <asm/irq.h> ··· 19 18 #include <asm/mach/map.h> 20 19 #include <asm/system_misc.h> 21 20 #include <mach/at91sam9263.h> 22 - #include <mach/at91_pmc.h> 23 21 24 22 #include "at91_aic.h" 25 23 #include "at91_rstc.h"
+13 -1
arch/arm/mach-at91/at91sam926x_time.c
··· 39 39 static u32 pit_cycle; /* write-once */ 40 40 static u32 pit_cnt; /* access only w/system irq blocked */ 41 41 static void __iomem *pit_base_addr __read_mostly; 42 + static struct clk *mck; 42 43 43 44 static inline unsigned int pit_read(unsigned int reg_offset) 44 45 { ··· 196 195 if (!pit_base_addr) 197 196 goto node_err; 198 197 198 + mck = of_clk_get(np, 0); 199 + 199 200 /* Get the interrupts property */ 200 201 ret = irq_of_parse_and_map(np, 0); 201 202 if (!ret) { 202 203 pr_crit("AT91: PIT: Unable to get IRQ from DT\n"); 204 + if (!IS_ERR(mck)) 205 + clk_put(mck); 203 206 goto ioremap_err; 204 207 } 205 208 at91sam926x_pit_irq.irq = ret; ··· 235 230 unsigned bits; 236 231 int ret; 237 232 233 + mck = ERR_PTR(-ENOENT); 234 + 238 235 /* For device tree enabled device: initialize here */ 239 236 of_at91sam926x_pit_init(); 240 237 ··· 244 237 * Use our actual MCK to figure out how many MCK/16 ticks per 245 238 * 1/HZ period (instead of a compile-time constant LATCH). 246 239 */ 247 - pit_rate = clk_get_rate(clk_get(NULL, "mck")) / 16; 240 + if (IS_ERR(mck)) 241 + mck = clk_get(NULL, "mck"); 242 + 243 + if (IS_ERR(mck)) 244 + panic("AT91: PIT: Unable to get mck clk\n"); 245 + pit_rate = clk_get_rate(mck) / 16; 248 246 pit_cycle = (pit_rate + HZ/2) / HZ; 249 247 WARN_ON(((pit_cycle - 1) & ~AT91_PIT_PIV) != 0); 250 248
+1 -1
arch/arm/mach-at91/at91sam9g45.c
··· 12 12 13 13 #include <linux/module.h> 14 14 #include <linux/dma-mapping.h> 15 + #include <linux/clk/at91_pmc.h> 15 16 16 17 #include <asm/irq.h> 17 18 #include <asm/mach/arch.h> 18 19 #include <asm/mach/map.h> 19 20 #include <asm/system_misc.h> 20 21 #include <mach/at91sam9g45.h> 21 - #include <mach/at91_pmc.h> 22 22 #include <mach/cpu.h> 23 23 24 24 #include "at91_aic.h"
+1 -1
arch/arm/mach-at91/at91sam9n12.c
··· 8 8 9 9 #include <linux/module.h> 10 10 #include <linux/dma-mapping.h> 11 + #include <linux/clk/at91_pmc.h> 11 12 12 13 #include <asm/irq.h> 13 14 #include <asm/mach/arch.h> 14 15 #include <asm/mach/map.h> 15 16 #include <mach/at91sam9n12.h> 16 - #include <mach/at91_pmc.h> 17 17 #include <mach/cpu.h> 18 18 19 19 #include "board.h"
+1 -1
arch/arm/mach-at91/at91sam9rl.c
··· 10 10 */ 11 11 12 12 #include <linux/module.h> 13 + #include <linux/clk/at91_pmc.h> 13 14 14 15 #include <asm/proc-fns.h> 15 16 #include <asm/irq.h> ··· 20 19 #include <mach/cpu.h> 21 20 #include <mach/at91_dbgu.h> 22 21 #include <mach/at91sam9rl.h> 23 - #include <mach/at91_pmc.h> 24 22 25 23 #include "at91_aic.h" 26 24 #include "at91_rstc.h"
+1 -1
arch/arm/mach-at91/at91sam9x5.c
··· 8 8 9 9 #include <linux/module.h> 10 10 #include <linux/dma-mapping.h> 11 + #include <linux/clk/at91_pmc.h> 11 12 12 13 #include <asm/irq.h> 13 14 #include <asm/mach/arch.h> 14 15 #include <asm/mach/map.h> 15 16 #include <mach/at91sam9x5.h> 16 - #include <mach/at91_pmc.h> 17 17 #include <mach/cpu.h> 18 18 19 19 #include "board.h"
+9 -1
arch/arm/mach-at91/board-dt-sama5.c
··· 16 16 #include <linux/of_irq.h> 17 17 #include <linux/of_platform.h> 18 18 #include <linux/phy.h> 19 + #include <linux/clk-provider.h> 19 20 20 21 #include <asm/setup.h> 21 22 #include <asm/irq.h> ··· 27 26 #include "at91_aic.h" 28 27 #include "generic.h" 29 28 29 + static void __init sama5_dt_timer_init(void) 30 + { 31 + #if defined(CONFIG_COMMON_CLK) 32 + of_clk_init(NULL); 33 + #endif 34 + at91sam926x_pit_init(); 35 + } 30 36 31 37 static const struct of_device_id irq_of_match[] __initconst = { 32 38 ··· 80 72 81 73 DT_MACHINE_START(sama5_dt, "Atmel SAMA5 (Device Tree)") 82 74 /* Maintainer: Atmel */ 83 - .init_time = at91sam926x_pit_init, 75 + .init_time = sama5_dt_timer_init, 84 76 .map_io = at91_map_io, 85 77 .handle_irq = at91_aic5_handle_irq, 86 78 .init_early = at91_dt_initialize,
+6 -1
arch/arm/mach-at91/clock.c
··· 24 24 #include <linux/clk.h> 25 25 #include <linux/io.h> 26 26 #include <linux/of_address.h> 27 + #include <linux/clk/at91_pmc.h> 27 28 28 29 #include <mach/hardware.h> 29 - #include <mach/at91_pmc.h> 30 30 #include <mach/cpu.h> 31 31 32 32 #include <asm/proc-fns.h> ··· 884 884 #if defined(CONFIG_OF) 885 885 static struct of_device_id pmc_ids[] = { 886 886 { .compatible = "atmel,at91rm9200-pmc" }, 887 + { .compatible = "atmel,at91sam9260-pmc" }, 888 + { .compatible = "atmel,at91sam9g45-pmc" }, 889 + { .compatible = "atmel,at91sam9n12-pmc" }, 890 + { .compatible = "atmel,at91sam9x5-pmc" }, 891 + { .compatible = "atmel,sama5d3-pmc" }, 887 892 { /*sentinel*/ } 888 893 }; 889 894
+2 -1
arch/arm/mach-at91/generic.h
··· 46 46 extern void at91x40_timer_init(void); 47 47 48 48 /* Clocks */ 49 - #ifdef CONFIG_AT91_PMC_UNIT 49 + #ifdef CONFIG_OLD_CLK_AT91 50 50 extern int __init at91_clock_init(unsigned long main_clock); 51 51 extern int __init at91_dt_clock_init(void); 52 52 #else 53 53 static int inline at91_clock_init(unsigned long main_clock) { return 0; } 54 + static int inline at91_dt_clock_init(void) { return 0; } 54 55 #endif 55 56 struct device; 56 57
+3 -1
arch/arm/mach-at91/include/mach/at91_pmc.h include/linux/clk/at91_pmc.h
··· 1 1 /* 2 - * arch/arm/mach-at91/include/mach/at91_pmc.h 2 + * include/linux/clk/at91_pmc.h 3 3 * 4 4 * Copyright (C) 2005 Ivan Kokshaysky 5 5 * Copyright (C) SAN People ··· 163 163 #define AT91_PMC_MOSCRCS (1 << 17) /* Main On-Chip RC [some SAM9] */ 164 164 #define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */ 165 165 #define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */ 166 + 167 + #define AT91_PMC_PLLICPR 0x80 /* PLL Charge Pump Current Register */ 166 168 167 169 #define AT91_PMC_PROT 0xe4 /* Write Protect Mode Register [some SAM9] */ 168 170 #define AT91_PMC_WPEN (0x1 << 0) /* Write Protect Enable */
+1 -1
arch/arm/mach-at91/pm.c
··· 19 19 #include <linux/module.h> 20 20 #include <linux/platform_device.h> 21 21 #include <linux/io.h> 22 + #include <linux/clk/at91_pmc.h> 22 23 23 24 #include <asm/irq.h> 24 25 #include <linux/atomic.h> 25 26 #include <asm/mach/time.h> 26 27 #include <asm/mach/irq.h> 27 28 28 - #include <mach/at91_pmc.h> 29 29 #include <mach/cpu.h> 30 30 31 31 #include "at91_aic.h"
+4
arch/arm/mach-at91/pm.h
··· 16 16 #include <mach/at91_ramc.h> 17 17 #include <mach/at91rm9200_sdramc.h> 18 18 19 + #ifdef CONFIG_PM 19 20 extern void at91_pm_set_standby(void (*at91_standby)(void)); 21 + #else 22 + static inline void at91_pm_set_standby(void (*at91_standby)(void)) { } 23 + #endif 20 24 21 25 /* 22 26 * The AT91RM9200 goes into self-refresh mode with this command, and will
+1 -1
arch/arm/mach-at91/pm_slowclock.S
··· 13 13 */ 14 14 15 15 #include <linux/linkage.h> 16 + #include <linux/clk/at91_pmc.h> 16 17 #include <mach/hardware.h> 17 - #include <mach/at91_pmc.h> 18 18 #include <mach/at91_ramc.h> 19 19 20 20
+1 -343
arch/arm/mach-at91/sama5d3.c
··· 9 9 10 10 #include <linux/module.h> 11 11 #include <linux/dma-mapping.h> 12 + #include <linux/clk/at91_pmc.h> 12 13 13 14 #include <asm/irq.h> 14 15 #include <asm/mach/arch.h> 15 16 #include <asm/mach/map.h> 16 17 #include <mach/sama5d3.h> 17 - #include <mach/at91_pmc.h> 18 18 #include <mach/cpu.h> 19 19 20 20 #include "soc.h" 21 21 #include "generic.h" 22 - #include "clock.h" 23 22 #include "sam9_smc.h" 24 - 25 - /* -------------------------------------------------------------------- 26 - * Clocks 27 - * -------------------------------------------------------------------- */ 28 - 29 - /* 30 - * The peripheral clocks. 31 - */ 32 - 33 - static struct clk pioA_clk = { 34 - .name = "pioA_clk", 35 - .pid = SAMA5D3_ID_PIOA, 36 - .type = CLK_TYPE_PERIPHERAL, 37 - }; 38 - static struct clk pioB_clk = { 39 - .name = "pioB_clk", 40 - .pid = SAMA5D3_ID_PIOB, 41 - .type = CLK_TYPE_PERIPHERAL, 42 - }; 43 - static struct clk pioC_clk = { 44 - .name = "pioC_clk", 45 - .pid = SAMA5D3_ID_PIOC, 46 - .type = CLK_TYPE_PERIPHERAL, 47 - }; 48 - static struct clk pioD_clk = { 49 - .name = "pioD_clk", 50 - .pid = SAMA5D3_ID_PIOD, 51 - .type = CLK_TYPE_PERIPHERAL, 52 - }; 53 - static struct clk pioE_clk = { 54 - .name = "pioE_clk", 55 - .pid = SAMA5D3_ID_PIOE, 56 - .type = CLK_TYPE_PERIPHERAL, 57 - }; 58 - static struct clk usart0_clk = { 59 - .name = "usart0_clk", 60 - .pid = SAMA5D3_ID_USART0, 61 - .type = CLK_TYPE_PERIPHERAL, 62 - .div = AT91_PMC_PCR_DIV2, 63 - }; 64 - static struct clk usart1_clk = { 65 - .name = "usart1_clk", 66 - .pid = SAMA5D3_ID_USART1, 67 - .type = CLK_TYPE_PERIPHERAL, 68 - .div = AT91_PMC_PCR_DIV2, 69 - }; 70 - static struct clk usart2_clk = { 71 - .name = "usart2_clk", 72 - .pid = SAMA5D3_ID_USART2, 73 - .type = CLK_TYPE_PERIPHERAL, 74 - .div = AT91_PMC_PCR_DIV2, 75 - }; 76 - static struct clk usart3_clk = { 77 - .name = "usart3_clk", 78 - .pid = SAMA5D3_ID_USART3, 79 - .type = CLK_TYPE_PERIPHERAL, 80 - .div = AT91_PMC_PCR_DIV2, 81 - }; 82 - static struct clk uart0_clk = { 83 - .name = "uart0_clk", 84 - .pid = SAMA5D3_ID_UART0, 85 - .type = CLK_TYPE_PERIPHERAL, 86 - .div = AT91_PMC_PCR_DIV2, 87 - }; 88 - static struct clk uart1_clk = { 89 - .name = "uart1_clk", 90 - .pid = SAMA5D3_ID_UART1, 91 - .type = CLK_TYPE_PERIPHERAL, 92 - .div = AT91_PMC_PCR_DIV2, 93 - }; 94 - static struct clk twi0_clk = { 95 - .name = "twi0_clk", 96 - .pid = SAMA5D3_ID_TWI0, 97 - .type = CLK_TYPE_PERIPHERAL, 98 - .div = AT91_PMC_PCR_DIV2, 99 - }; 100 - static struct clk twi1_clk = { 101 - .name = "twi1_clk", 102 - .pid = SAMA5D3_ID_TWI1, 103 - .type = CLK_TYPE_PERIPHERAL, 104 - .div = AT91_PMC_PCR_DIV2, 105 - }; 106 - static struct clk twi2_clk = { 107 - .name = "twi2_clk", 108 - .pid = SAMA5D3_ID_TWI2, 109 - .type = CLK_TYPE_PERIPHERAL, 110 - .div = AT91_PMC_PCR_DIV2, 111 - }; 112 - static struct clk mmc0_clk = { 113 - .name = "mci0_clk", 114 - .pid = SAMA5D3_ID_HSMCI0, 115 - .type = CLK_TYPE_PERIPHERAL, 116 - }; 117 - static struct clk mmc1_clk = { 118 - .name = "mci1_clk", 119 - .pid = SAMA5D3_ID_HSMCI1, 120 - .type = CLK_TYPE_PERIPHERAL, 121 - }; 122 - static struct clk mmc2_clk = { 123 - .name = "mci2_clk", 124 - .pid = SAMA5D3_ID_HSMCI2, 125 - .type = CLK_TYPE_PERIPHERAL, 126 - }; 127 - static struct clk spi0_clk = { 128 - .name = "spi0_clk", 129 - .pid = SAMA5D3_ID_SPI0, 130 - .type = CLK_TYPE_PERIPHERAL, 131 - }; 132 - static struct clk spi1_clk = { 133 - .name = "spi1_clk", 134 - .pid = SAMA5D3_ID_SPI1, 135 - .type = CLK_TYPE_PERIPHERAL, 136 - }; 137 - static struct clk tcb0_clk = { 138 - .name = "tcb0_clk", 139 - .pid = SAMA5D3_ID_TC0, 140 - .type = CLK_TYPE_PERIPHERAL, 141 - .div = AT91_PMC_PCR_DIV2, 142 - }; 143 - static struct clk tcb1_clk = { 144 - .name = "tcb1_clk", 145 - .pid = SAMA5D3_ID_TC1, 146 - .type = CLK_TYPE_PERIPHERAL, 147 - .div = AT91_PMC_PCR_DIV2, 148 - }; 149 - static struct clk adc_clk = { 150 - .name = "adc_clk", 151 - .pid = SAMA5D3_ID_ADC, 152 - .type = CLK_TYPE_PERIPHERAL, 153 - .div = AT91_PMC_PCR_DIV2, 154 - }; 155 - static struct clk adc_op_clk = { 156 - .name = "adc_op_clk", 157 - .type = CLK_TYPE_PERIPHERAL, 158 - .rate_hz = 5000000, 159 - }; 160 - static struct clk dma0_clk = { 161 - .name = "dma0_clk", 162 - .pid = SAMA5D3_ID_DMA0, 163 - .type = CLK_TYPE_PERIPHERAL, 164 - }; 165 - static struct clk dma1_clk = { 166 - .name = "dma1_clk", 167 - .pid = SAMA5D3_ID_DMA1, 168 - .type = CLK_TYPE_PERIPHERAL, 169 - }; 170 - static struct clk uhphs_clk = { 171 - .name = "uhphs", 172 - .pid = SAMA5D3_ID_UHPHS, 173 - .type = CLK_TYPE_PERIPHERAL, 174 - }; 175 - static struct clk udphs_clk = { 176 - .name = "udphs_clk", 177 - .pid = SAMA5D3_ID_UDPHS, 178 - .type = CLK_TYPE_PERIPHERAL, 179 - }; 180 - /* gmac only for sama5d33, sama5d34, sama5d35 */ 181 - static struct clk macb0_clk = { 182 - .name = "macb0_clk", 183 - .pid = SAMA5D3_ID_GMAC, 184 - .type = CLK_TYPE_PERIPHERAL, 185 - }; 186 - /* emac only for sama5d31, sama5d35 */ 187 - static struct clk macb1_clk = { 188 - .name = "macb1_clk", 189 - .pid = SAMA5D3_ID_EMAC, 190 - .type = CLK_TYPE_PERIPHERAL, 191 - }; 192 - /* lcd only for sama5d31, sama5d33, sama5d34 */ 193 - static struct clk lcdc_clk = { 194 - .name = "lcdc_clk", 195 - .pid = SAMA5D3_ID_LCDC, 196 - .type = CLK_TYPE_PERIPHERAL, 197 - }; 198 - /* isi only for sama5d33, sama5d35 */ 199 - static struct clk isi_clk = { 200 - .name = "isi_clk", 201 - .pid = SAMA5D3_ID_ISI, 202 - .type = CLK_TYPE_PERIPHERAL, 203 - }; 204 - static struct clk can0_clk = { 205 - .name = "can0_clk", 206 - .pid = SAMA5D3_ID_CAN0, 207 - .type = CLK_TYPE_PERIPHERAL, 208 - .div = AT91_PMC_PCR_DIV2, 209 - }; 210 - static struct clk can1_clk = { 211 - .name = "can1_clk", 212 - .pid = SAMA5D3_ID_CAN1, 213 - .type = CLK_TYPE_PERIPHERAL, 214 - .div = AT91_PMC_PCR_DIV2, 215 - }; 216 - static struct clk ssc0_clk = { 217 - .name = "ssc0_clk", 218 - .pid = SAMA5D3_ID_SSC0, 219 - .type = CLK_TYPE_PERIPHERAL, 220 - .div = AT91_PMC_PCR_DIV2, 221 - }; 222 - static struct clk ssc1_clk = { 223 - .name = "ssc1_clk", 224 - .pid = SAMA5D3_ID_SSC1, 225 - .type = CLK_TYPE_PERIPHERAL, 226 - .div = AT91_PMC_PCR_DIV2, 227 - }; 228 - static struct clk sha_clk = { 229 - .name = "sha_clk", 230 - .pid = SAMA5D3_ID_SHA, 231 - .type = CLK_TYPE_PERIPHERAL, 232 - .div = AT91_PMC_PCR_DIV8, 233 - }; 234 - static struct clk aes_clk = { 235 - .name = "aes_clk", 236 - .pid = SAMA5D3_ID_AES, 237 - .type = CLK_TYPE_PERIPHERAL, 238 - }; 239 - static struct clk tdes_clk = { 240 - .name = "tdes_clk", 241 - .pid = SAMA5D3_ID_TDES, 242 - .type = CLK_TYPE_PERIPHERAL, 243 - }; 244 - 245 - static struct clk *periph_clocks[] __initdata = { 246 - &pioA_clk, 247 - &pioB_clk, 248 - &pioC_clk, 249 - &pioD_clk, 250 - &pioE_clk, 251 - &usart0_clk, 252 - &usart1_clk, 253 - &usart2_clk, 254 - &usart3_clk, 255 - &uart0_clk, 256 - &uart1_clk, 257 - &twi0_clk, 258 - &twi1_clk, 259 - &twi2_clk, 260 - &mmc0_clk, 261 - &mmc1_clk, 262 - &mmc2_clk, 263 - &spi0_clk, 264 - &spi1_clk, 265 - &tcb0_clk, 266 - &tcb1_clk, 267 - &adc_clk, 268 - &adc_op_clk, 269 - &dma0_clk, 270 - &dma1_clk, 271 - &uhphs_clk, 272 - &udphs_clk, 273 - &macb0_clk, 274 - &macb1_clk, 275 - &lcdc_clk, 276 - &isi_clk, 277 - &can0_clk, 278 - &can1_clk, 279 - &ssc0_clk, 280 - &ssc1_clk, 281 - &sha_clk, 282 - &aes_clk, 283 - &tdes_clk, 284 - }; 285 - 286 - static struct clk pck0 = { 287 - .name = "pck0", 288 - .pmc_mask = AT91_PMC_PCK0, 289 - .type = CLK_TYPE_PROGRAMMABLE, 290 - .id = 0, 291 - }; 292 - 293 - static struct clk pck1 = { 294 - .name = "pck1", 295 - .pmc_mask = AT91_PMC_PCK1, 296 - .type = CLK_TYPE_PROGRAMMABLE, 297 - .id = 1, 298 - }; 299 - 300 - static struct clk pck2 = { 301 - .name = "pck2", 302 - .pmc_mask = AT91_PMC_PCK2, 303 - .type = CLK_TYPE_PROGRAMMABLE, 304 - .id = 2, 305 - }; 306 - 307 - static struct clk_lookup periph_clocks_lookups[] = { 308 - /* lookup table for DT entries */ 309 - CLKDEV_CON_DEV_ID("usart", "ffffee00.serial", &mck), 310 - CLKDEV_CON_DEV_ID(NULL, "fffff200.gpio", &pioA_clk), 311 - CLKDEV_CON_DEV_ID(NULL, "fffff400.gpio", &pioB_clk), 312 - CLKDEV_CON_DEV_ID(NULL, "fffff600.gpio", &pioC_clk), 313 - CLKDEV_CON_DEV_ID(NULL, "fffff800.gpio", &pioD_clk), 314 - CLKDEV_CON_DEV_ID(NULL, "fffffa00.gpio", &pioE_clk), 315 - CLKDEV_CON_DEV_ID("usart", "f001c000.serial", &usart0_clk), 316 - CLKDEV_CON_DEV_ID("usart", "f0020000.serial", &usart1_clk), 317 - CLKDEV_CON_DEV_ID("usart", "f8020000.serial", &usart2_clk), 318 - CLKDEV_CON_DEV_ID("usart", "f8024000.serial", &usart3_clk), 319 - CLKDEV_CON_DEV_ID(NULL, "f0014000.i2c", &twi0_clk), 320 - CLKDEV_CON_DEV_ID(NULL, "f0018000.i2c", &twi1_clk), 321 - CLKDEV_CON_DEV_ID(NULL, "f801c000.i2c", &twi2_clk), 322 - CLKDEV_CON_DEV_ID("mci_clk", "f0000000.mmc", &mmc0_clk), 323 - CLKDEV_CON_DEV_ID("mci_clk", "f8000000.mmc", &mmc1_clk), 324 - CLKDEV_CON_DEV_ID("mci_clk", "f8004000.mmc", &mmc2_clk), 325 - CLKDEV_CON_DEV_ID("spi_clk", "f0004000.spi", &spi0_clk), 326 - CLKDEV_CON_DEV_ID("spi_clk", "f8008000.spi", &spi1_clk), 327 - CLKDEV_CON_DEV_ID("t0_clk", "f0010000.timer", &tcb0_clk), 328 - CLKDEV_CON_DEV_ID("t0_clk", "f8014000.timer", &tcb1_clk), 329 - CLKDEV_CON_DEV_ID("tsc_clk", "f8018000.tsadcc", &adc_clk), 330 - CLKDEV_CON_DEV_ID("dma_clk", "ffffe600.dma-controller", &dma0_clk), 331 - CLKDEV_CON_DEV_ID("dma_clk", "ffffe800.dma-controller", &dma1_clk), 332 - CLKDEV_CON_DEV_ID("hclk", "600000.ohci", &uhphs_clk), 333 - CLKDEV_CON_DEV_ID("ohci_clk", "600000.ohci", &uhphs_clk), 334 - CLKDEV_CON_DEV_ID("ehci_clk", "700000.ehci", &uhphs_clk), 335 - CLKDEV_CON_DEV_ID("pclk", "500000.gadget", &udphs_clk), 336 - CLKDEV_CON_DEV_ID("hclk", "500000.gadget", &utmi_clk), 337 - CLKDEV_CON_DEV_ID("hclk", "f0028000.ethernet", &macb0_clk), 338 - CLKDEV_CON_DEV_ID("pclk", "f0028000.ethernet", &macb0_clk), 339 - CLKDEV_CON_DEV_ID("hclk", "f802c000.ethernet", &macb1_clk), 340 - CLKDEV_CON_DEV_ID("pclk", "f802c000.ethernet", &macb1_clk), 341 - CLKDEV_CON_DEV_ID("pclk", "f0008000.ssc", &ssc0_clk), 342 - CLKDEV_CON_DEV_ID("pclk", "f000c000.ssc", &ssc1_clk), 343 - CLKDEV_CON_DEV_ID("can_clk", "f000c000.can", &can0_clk), 344 - CLKDEV_CON_DEV_ID("can_clk", "f8010000.can", &can1_clk), 345 - CLKDEV_CON_DEV_ID("sha_clk", "f8034000.sha", &sha_clk), 346 - CLKDEV_CON_DEV_ID("aes_clk", "f8038000.aes", &aes_clk), 347 - CLKDEV_CON_DEV_ID("tdes_clk", "f803c000.tdes", &tdes_clk), 348 - }; 349 - 350 - static void __init sama5d3_register_clocks(void) 351 - { 352 - int i; 353 - 354 - for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) 355 - clk_register(periph_clocks[i]); 356 - 357 - clkdev_add_table(periph_clocks_lookups, 358 - ARRAY_SIZE(periph_clocks_lookups)); 359 - 360 - clk_register(&pck0); 361 - clk_register(&pck1); 362 - clk_register(&pck2); 363 - } 364 23 365 24 /* -------------------------------------------------------------------- 366 25 * AT91SAM9x5 processor initialization ··· 37 378 38 379 AT91_SOC_START(sama5d3) 39 380 .map_io = sama5d3_map_io, 40 - .register_clocks = sama5d3_register_clocks, 41 381 .init = sama5d3_initialize, 42 382 AT91_SOC_END
+5 -3
arch/arm/mach-at91/setup.c
··· 11 11 #include <linux/pm.h> 12 12 #include <linux/of_address.h> 13 13 #include <linux/pinctrl/machine.h> 14 + #include <linux/clk/at91_pmc.h> 14 15 15 16 #include <asm/system_misc.h> 16 17 #include <asm/mach/map.h> ··· 19 18 #include <mach/hardware.h> 20 19 #include <mach/cpu.h> 21 20 #include <mach/at91_dbgu.h> 22 - #include <mach/at91_pmc.h> 23 21 24 22 #include "at91_shdwc.h" 25 23 #include "soc.h" ··· 491 491 at91_dt_clock_init(); 492 492 493 493 /* Register the processor-specific clocks */ 494 - at91_boot_soc.register_clocks(); 494 + if (at91_boot_soc.register_clocks) 495 + at91_boot_soc.register_clocks(); 495 496 496 497 at91_boot_soc.init(); 497 498 } ··· 507 506 at91_dt_clock_init(); 508 507 509 508 /* Register the processor-specific clocks */ 510 - at91_boot_soc.register_clocks(); 509 + if (at91_boot_soc.register_clocks) 510 + at91_boot_soc.register_clocks(); 511 511 512 512 if (at91_boot_soc.init) 513 513 at91_boot_soc.init();
+3 -12
arch/arm/mach-dove/common.c
··· 162 162 /***************************************************************************** 163 163 * SoC RTC 164 164 ****************************************************************************/ 165 - void __init dove_rtc_init(void) 165 + static void __init dove_rtc_init(void) 166 166 { 167 167 orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC); 168 168 } ··· 257 257 } 258 258 259 259 /***************************************************************************** 260 - * Cryptographic Engines and Security Accelerator (CESA) 261 - ****************************************************************************/ 262 - void __init dove_crypto_init(void) 263 - { 264 - orion_crypto_init(DOVE_CRYPT_PHYS_BASE, DOVE_CESA_PHYS_BASE, 265 - DOVE_CESA_SIZE, IRQ_DOVE_CRYPTO); 266 - } 267 - 268 - /***************************************************************************** 269 260 * XOR 0 270 261 ****************************************************************************/ 271 - void __init dove_xor0_init(void) 262 + static void __init dove_xor0_init(void) 272 263 { 273 264 orion_xor0_init(DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE, 274 265 IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01); ··· 268 277 /***************************************************************************** 269 278 * XOR 1 270 279 ****************************************************************************/ 271 - void __init dove_xor1_init(void) 280 + static void __init dove_xor1_init(void) 272 281 { 273 282 orion_xor1_init(DOVE_XOR1_PHYS_BASE, DOVE_XOR1_HIGH_PHYS_BASE, 274 283 IRQ_DOVE_XOR_10, IRQ_DOVE_XOR_11);
+2 -38
arch/arm/mach-kirkwood/board-dt.c
··· 10 10 * warranty of any kind, whether express or implied. 11 11 */ 12 12 13 + #include <linux/clk.h> 13 14 #include <linux/kernel.h> 14 15 #include <linux/init.h> 15 16 #include <linux/of.h> 16 17 #include <linux/of_address.h> 17 18 #include <linux/of_net.h> 18 19 #include <linux/of_platform.h> 19 - #include <linux/clk-provider.h> 20 20 #include <linux/dma-mapping.h> 21 21 #include <linux/irqchip.h> 22 22 #include <linux/kexec.h> 23 23 #include <asm/mach/arch.h> 24 - #include <asm/mach/map.h> 25 24 #include <mach/bridge-regs.h> 26 - #include <linux/platform_data/usb-ehci-orion.h> 27 - #include <plat/irq.h> 28 25 #include <plat/common.h> 29 26 #include "common.h" 30 - 31 - /* 32 - * There are still devices that doesn't know about DT yet. Get clock 33 - * gates here and add a clock lookup alias, so that old platform 34 - * devices still work. 35 - */ 36 - 37 - static void __init kirkwood_legacy_clk_init(void) 38 - { 39 - 40 - struct device_node *np = of_find_compatible_node( 41 - NULL, NULL, "marvell,kirkwood-gating-clock"); 42 - struct of_phandle_args clkspec; 43 - struct clk *clk; 44 - 45 - clkspec.np = np; 46 - clkspec.args_count = 1; 47 - 48 - /* 49 - * The ethernet interfaces forget the MAC address assigned by 50 - * u-boot if the clocks are turned off. Until proper DT support 51 - * is available we always enable them for now. 52 - */ 53 - clkspec.args[0] = CGC_BIT_GE0; 54 - clk = of_clk_get_from_provider(&clkspec); 55 - clk_prepare_enable(clk); 56 - 57 - clkspec.args[0] = CGC_BIT_GE1; 58 - clk = of_clk_get_from_provider(&clkspec); 59 - clk_prepare_enable(clk); 60 - } 61 27 62 28 #define MV643XX_ETH_MAC_ADDR_LOW 0x0414 63 29 #define MV643XX_ETH_MAC_ADDR_HIGH 0x0418 ··· 106 140 107 141 static void __init kirkwood_dt_init(void) 108 142 { 109 - pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); 143 + pr_info("Kirkwood: %s.\n", kirkwood_id()); 110 144 111 145 /* 112 146 * Disable propagation of mbus errors to the CPU local bus, ··· 122 156 123 157 kirkwood_cpufreq_init(); 124 158 kirkwood_cpuidle_init(); 125 - /* Setup clocks for legacy devices */ 126 - kirkwood_legacy_clk_init(); 127 159 128 160 kirkwood_pm_init(); 129 161 kirkwood_dt_eth_fixup();
+1
arch/arm/mach-mvebu/coherency.c
··· 27 27 #include <asm/smp_plat.h> 28 28 #include <asm/cacheflush.h> 29 29 #include "armada-370-xp.h" 30 + #include "coherency.h" 30 31 31 32 unsigned long coherency_phys_base; 32 33 static void __iomem *coherency_base;
+3 -1
arch/arm/mach-mvebu/coherency.h
··· 14 14 #ifndef __MACH_370_XP_COHERENCY_H 15 15 #define __MACH_370_XP_COHERENCY_H 16 16 17 - int set_cpu_coherent(int cpu_id, int smp_group_id); 17 + extern unsigned long coherency_phys_base; 18 + 19 + int set_cpu_coherent(unsigned int cpu_id, int smp_group_id); 18 20 int coherency_init(void); 19 21 20 22 #endif /* __MACH_370_XP_COHERENCY_H */
-1
arch/arm/mach-mvebu/common.h
··· 26 26 27 27 void armada_xp_cpu_die(unsigned int cpu); 28 28 int armada_370_xp_coherency_init(void); 29 - int armada_370_xp_pmsu_init(void); 30 29 void armada_xp_secondary_startup(void); 31 30 extern struct smp_operations armada_xp_smp_ops; 32 31 #endif
+1
arch/arm/mach-mvebu/hotplug.c
··· 15 15 #include <linux/errno.h> 16 16 #include <linux/smp.h> 17 17 #include <asm/proc-fns.h> 18 + #include "common.h" 18 19 19 20 /* 20 21 * platform-specific code to shutdown a CPU
+2 -2
arch/arm/mach-mvebu/platsmp.c
··· 46 46 return cpu_clk; 47 47 } 48 48 49 - void __init set_secondary_cpus_clock(void) 49 + static void __init set_secondary_cpus_clock(void) 50 50 { 51 51 int thiscpu, cpu; 52 52 unsigned long rate; ··· 94 94 set_smp_cross_call(armada_mpic_send_doorbell); 95 95 } 96 96 97 - void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus) 97 + static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus) 98 98 { 99 99 struct device_node *node; 100 100 struct resource res;
+2 -1
arch/arm/mach-mvebu/pmsu.c
··· 22 22 #include <linux/io.h> 23 23 #include <linux/smp.h> 24 24 #include <asm/smp_plat.h> 25 + #include "pmsu.h" 25 26 26 27 static void __iomem *pmsu_mp_base; 27 28 static void __iomem *pmsu_reset_base; ··· 59 58 } 60 59 #endif 61 60 62 - int __init armada_370_xp_pmsu_init(void) 61 + static int __init armada_370_xp_pmsu_init(void) 63 62 { 64 63 struct device_node *np; 65 64
+3 -2
arch/arm/mach-mvebu/system-controller.c
··· 27 27 #include <linux/of_address.h> 28 28 #include <linux/io.h> 29 29 #include <linux/reboot.h> 30 + #include "common.h" 30 31 31 32 static void __iomem *system_controller_base; 32 33 ··· 40 39 }; 41 40 static struct mvebu_system_controller *mvebu_sc; 42 41 43 - const struct mvebu_system_controller armada_370_xp_system_controller = { 42 + static const struct mvebu_system_controller armada_370_xp_system_controller = { 44 43 .rstoutn_mask_offset = 0x60, 45 44 .system_soft_reset_offset = 0x64, 46 45 .rstoutn_mask_reset_out_en = 0x1, 47 46 .system_soft_reset = 0x1, 48 47 }; 49 48 50 - const struct mvebu_system_controller orion_system_controller = { 49 + static const struct mvebu_system_controller orion_system_controller = { 51 50 .rstoutn_mask_offset = 0x108, 52 51 .system_soft_reset_offset = 0x10c, 53 52 .rstoutn_mask_reset_out_en = 0x4,
+1 -1
arch/arm/mach-omap2/dss-common.c
··· 223 223 static struct connector_dvi_platform_data omap3_igep2_dvi_connector_pdata = { 224 224 .name = "dvi", 225 225 .source = "tfp410.0", 226 - .i2c_bus_num = 3, 226 + .i2c_bus_num = 2, 227 227 }; 228 228 229 229 static struct platform_device omap3_igep2_dvi_connector_device = {
+1
arch/arm/mach-omap2/pdata-quirks.c
··· 139 139 140 140 static struct pdata_init pdata_quirks[] __initdata = { 141 141 #ifdef CONFIG_ARCH_OMAP3 142 + { "nokia,omap3-n900", hsmmc2_internal_input_clk, }, 142 143 { "nokia,omap3-n9", hsmmc2_internal_input_clk, }, 143 144 { "nokia,omap3-n950", hsmmc2_internal_input_clk, }, 144 145 { "isee,omap3-igep0020", omap3_igep0020_legacy_init, },
+2 -1
arch/arm/mach-omap2/powerdomain.c
··· 128 128 for (i = 0; i < pwrdm->banks; i++) 129 129 pwrdm->ret_mem_off_counter[i] = 0; 130 130 131 - arch_pwrdm->pwrdm_wait_transition(pwrdm); 131 + if (arch_pwrdm && arch_pwrdm->pwrdm_wait_transition) 132 + arch_pwrdm->pwrdm_wait_transition(pwrdm); 132 133 pwrdm->state = pwrdm_read_pwrst(pwrdm); 133 134 pwrdm->state_counter[pwrdm->state] = 1; 134 135
+1 -1
arch/arm/mach-orion5x/board-dt.c
··· 21 21 #include <plat/irq.h> 22 22 #include "common.h" 23 23 24 - struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = { 24 + static struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = { 25 25 OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL), 26 26 OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0", 27 27 NULL),
+3 -4
arch/arm/mach-orion5x/common.c
··· 24 24 #include <asm/page.h> 25 25 #include <asm/setup.h> 26 26 #include <asm/system_misc.h> 27 - #include <asm/timex.h> 28 27 #include <asm/mach/arch.h> 29 28 #include <asm/mach/map.h> 30 29 #include <asm/mach/time.h> ··· 134 135 /***************************************************************************** 135 136 * SPI 136 137 ****************************************************************************/ 137 - void __init orion5x_spi_init() 138 + void __init orion5x_spi_init(void) 138 139 { 139 140 orion_spi_init(SPI_PHYS_BASE); 140 141 } ··· 184 185 /***************************************************************************** 185 186 * Watchdog 186 187 ****************************************************************************/ 187 - void __init orion5x_wdt_init(void) 188 + static void __init orion5x_wdt_init(void) 188 189 { 189 190 orion_wdt_init(); 190 191 } ··· 245 246 246 247 int orion5x_tclk; 247 248 248 - int __init orion5x_find_tclk(void) 249 + static int __init orion5x_find_tclk(void) 249 250 { 250 251 u32 dev, rev; 251 252
+1 -1
arch/arm/mach-orion5x/db88f5281-setup.c
··· 202 202 * PCI 203 203 ****************************************************************************/ 204 204 205 - void __init db88f5281_pci_preinit(void) 205 + static void __init db88f5281_pci_preinit(void) 206 206 { 207 207 int pin; 208 208
+1
arch/arm/mach-orion5x/irq.c
··· 16 16 #include <mach/bridge-regs.h> 17 17 #include <plat/orion-gpio.h> 18 18 #include <plat/irq.h> 19 + #include "common.h" 19 20 20 21 static int __initdata gpio0_irqs[4] = { 21 22 IRQ_ORION5X_GPIO_0_7,
+2 -2
arch/arm/mach-orion5x/pci.c
··· 240 240 #define PCI_BAR_SIZE_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc08) : \ 241 241 ((n) == 1) ? ORION5X_PCI_REG(0xd08) : \ 242 242 ((n) == 2) ? ORION5X_PCI_REG(0xc0c) : \ 243 - ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : 0) 243 + ((n) == 3) ? ORION5X_PCI_REG(0xd0c) : NULL) 244 244 #define PCI_BAR_REMAP_DDR_CS(n) (((n) == 0) ? ORION5X_PCI_REG(0xc48) : \ 245 245 ((n) == 1) ? ORION5X_PCI_REG(0xd48) : \ 246 246 ((n) == 2) ? ORION5X_PCI_REG(0xc4c) : \ 247 - ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : 0) 247 + ((n) == 3) ? ORION5X_PCI_REG(0xd4c) : NULL) 248 248 #define PCI_BAR_ENABLE ORION5X_PCI_REG(0xc3c) 249 249 #define PCI_ADDR_DECODE_CTRL ORION5X_PCI_REG(0xd3c) 250 250
+1 -1
arch/arm/mach-orion5x/rd88f5182-setup.c
··· 108 108 * PCI 109 109 ****************************************************************************/ 110 110 111 - void __init rd88f5182_pci_preinit(void) 111 + static void __init rd88f5182_pci_preinit(void) 112 112 { 113 113 int pin; 114 114
+1 -1
arch/arm/mach-orion5x/terastation_pro2-setup.c
··· 77 77 #define TSP2_PCI_SLOT0_OFFS 7 78 78 #define TSP2_PCI_SLOT0_IRQ_PIN 11 79 79 80 - void __init tsp2_pci_preinit(void) 80 + static void __init tsp2_pci_preinit(void) 81 81 { 82 82 int pin; 83 83
+1 -1
arch/arm/mach-orion5x/ts209-setup.c
··· 106 106 #define QNAP_TS209_PCI_SLOT0_IRQ_PIN 6 107 107 #define QNAP_TS209_PCI_SLOT1_IRQ_PIN 7 108 108 109 - void __init qnap_ts209_pci_preinit(void) 109 + static void __init qnap_ts209_pci_preinit(void) 110 110 { 111 111 int pin; 112 112
+1 -1
arch/arm/mach-orion5x/ts78xx-setup.c
··· 57 57 }, 58 58 }; 59 59 60 - void __init ts78xx_map_io(void) 60 + static void __init ts78xx_map_io(void) 61 61 { 62 62 orion5x_map_io(); 63 63 iotable_init(ts78xx_io_desc, ARRAY_SIZE(ts78xx_io_desc));
+3 -3
arch/arm/mach-shmobile/board-ape6evm.c
··· 168 168 }; 169 169 170 170 static const struct resource mmcif0_resources[] __initconst = { 171 - DEFINE_RES_MEM_NAMED(0xee200000, 0x100, "MMCIF0"), 171 + DEFINE_RES_MEM(0xee200000, 0x100), 172 172 DEFINE_RES_IRQ(gic_spi(169)), 173 173 }; 174 174 ··· 179 179 }; 180 180 181 181 static const struct resource sdhi0_resources[] __initconst = { 182 - DEFINE_RES_MEM_NAMED(0xee100000, 0x100, "SDHI0"), 182 + DEFINE_RES_MEM(0xee100000, 0x100), 183 183 DEFINE_RES_IRQ(gic_spi(165)), 184 184 }; 185 185 ··· 191 191 }; 192 192 193 193 static const struct resource sdhi1_resources[] __initconst = { 194 - DEFINE_RES_MEM_NAMED(0xee120000, 0x100, "SDHI1"), 194 + DEFINE_RES_MEM(0xee120000, 0x100), 195 195 DEFINE_RES_IRQ(gic_spi(166)), 196 196 }; 197 197
-1
arch/arm/mach-shmobile/board-bockw-reference.c
··· 19 19 */ 20 20 21 21 #include <linux/of_platform.h> 22 - #include <linux/pinctrl/machine.h> 23 22 #include <mach/common.h> 24 23 #include <mach/r8a7778.h> 25 24 #include <asm/mach/arch.h>
+2 -3
arch/arm/mach-shmobile/board-lager-reference.c
··· 20 20 21 21 #include <linux/init.h> 22 22 #include <linux/of_platform.h> 23 + #include <mach/rcar-gen2.h> 23 24 #include <mach/r8a7790.h> 24 25 #include <asm/mach/arch.h> 25 26 26 27 static void __init lager_add_standard_devices(void) 27 28 { 28 - /* clocks are setup late during boot in the case of DT */ 29 29 r8a7790_clock_init(); 30 - 31 30 r8a7790_add_dt_devices(); 32 - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 31 + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 33 32 } 34 33 35 34 static const char *lager_boards_compat_dt[] __initdata = {
+1 -1
arch/arm/mach-shmobile/board-lager.c
··· 148 148 }; 149 149 150 150 static const struct resource mmcif1_resources[] __initconst = { 151 - DEFINE_RES_MEM_NAMED(0xee220000, 0x80, "MMCIF1"), 151 + DEFINE_RES_MEM(0xee220000, 0x80), 152 152 DEFINE_RES_IRQ(gic_spi(170)), 153 153 }; 154 154
+23 -2
arch/arm/mach-shmobile/board-marzen.c
··· 29 29 #include <linux/leds.h> 30 30 #include <linux/dma-mapping.h> 31 31 #include <linux/pinctrl/machine.h> 32 + #include <linux/platform_data/camera-rcar.h> 32 33 #include <linux/platform_data/gpio-rcar.h> 33 34 #include <linux/platform_data/rcar-du.h> 34 35 #include <linux/platform_data/usb-rcar-phy.h> ··· 260 259 }, 261 260 }; 262 261 262 + /* VIN */ 263 263 static struct rcar_vin_platform_data vin_platform_data __initdata = { 264 264 .flags = RCAR_VIN_BT656, 265 265 }; 266 + 267 + #define MARZEN_VIN(idx) \ 268 + static struct resource vin##idx##_resources[] __initdata = { \ 269 + DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \ 270 + DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \ 271 + }; \ 272 + \ 273 + static struct platform_device_info vin##idx##_info __initdata = { \ 274 + .parent = &platform_bus, \ 275 + .name = "r8a7779-vin", \ 276 + .id = idx, \ 277 + .res = vin##idx##_resources, \ 278 + .num_res = ARRAY_SIZE(vin##idx##_resources), \ 279 + .dma_mask = DMA_BIT_MASK(32), \ 280 + .data = &vin_platform_data, \ 281 + .size_data = sizeof(vin_platform_data), \ 282 + } 283 + MARZEN_VIN(1); 284 + MARZEN_VIN(3); 266 285 267 286 #define MARZEN_CAMERA(idx) \ 268 287 static struct i2c_board_info camera##idx##_info = { \ ··· 388 367 r8a7779_init_irq_extpin(1); /* IRQ1 as individual interrupt */ 389 368 390 369 r8a7779_add_standard_devices(); 391 - r8a7779_add_vin_device(1, &vin_platform_data); 392 - r8a7779_add_vin_device(3, &vin_platform_data); 370 + platform_device_register_full(&vin1_info); 371 + platform_device_register_full(&vin3_info); 393 372 platform_add_devices(marzen_devices, ARRAY_SIZE(marzen_devices)); 394 373 marzen_add_du_device(); 395 374 }
+3
arch/arm/mach-shmobile/clock-r7s72100.c
··· 170 170 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), 171 171 172 172 /* MSTP clocks */ 173 + CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]), 174 + 175 + /* ICK */ 173 176 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]), 174 177 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP46]), 175 178 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]),
+1 -1
arch/arm/mach-shmobile/clock-r8a7790.c
··· 77 77 }; 78 78 79 79 static struct clk main_clk = { 80 - /* .parent will be set r8a73a4_clock_init */ 80 + /* .parent will be set r8a7790_clock_init */ 81 81 .ops = &followparent_clk_ops, 82 82 }; 83 83
+5 -4
arch/arm/mach-shmobile/clock-sh7372.c
··· 504 504 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]), 505 505 CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]), 506 506 CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]), 507 - CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), 508 - CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), 509 - CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), 510 - CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), 511 507 512 508 /* MSTP32 clocks */ 513 509 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */ ··· 570 574 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ 571 575 CLKDEV_DEV_ID("sh_cmt.2", &mstp_clks[MSTP400]), /* CMT2 */ 572 576 577 + /* ICK */ 578 + CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), 579 + CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), 580 + CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), 581 + CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), 573 582 CLKDEV_ICK_ID("hdmi", "sh_mobile_lcdc_fb.1", 574 583 &div6_reparent_clks[DIV6_HDMI]), 575 584 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]),
+8 -6
arch/arm/mach-shmobile/clock-sh73a0.c
··· 625 625 CLKDEV_CON_ID("sdhi0_clk", &div6_clks[DIV6_SDHI0]), 626 626 CLKDEV_CON_ID("sdhi1_clk", &div6_clks[DIV6_SDHI1]), 627 627 CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]), 628 - CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), 629 - CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), 630 - CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), 631 - CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), 632 - CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk), 633 - CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk), 634 628 635 629 /* MSTP32 clocks */ 636 630 CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ ··· 674 680 CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */ 675 681 CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */ 676 682 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ 683 + 684 + /* ICK */ 685 + CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), 686 + CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), 687 + CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), 688 + CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]), 689 + CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.0", &dsi0phy_clk), 690 + CLKDEV_ICK_ID("dsiphy_clk", "sh-mipi-dsi.1", &dsi1phy_clk), 677 691 }; 678 692 679 693 void __init sh73a0_clock_init(void)
-5
arch/arm/mach-shmobile/include/mach/r8a7779.h
··· 3 3 4 4 #include <linux/sh_clk.h> 5 5 #include <linux/pm_domain.h> 6 - #include <linux/sh_eth.h> 7 - #include <linux/platform_data/camera-rcar.h> 8 6 9 7 /* HPB-DMA slave IDs */ 10 8 enum { ··· 38 40 extern void r8a7779_add_early_devices(void); 39 41 extern void r8a7779_add_standard_devices(void); 40 42 extern void r8a7779_add_standard_devices_dt(void); 41 - extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata); 42 - extern void r8a7779_add_vin_device(int idx, 43 - struct rcar_vin_platform_data *pdata); 44 43 extern void r8a7779_init_late(void); 45 44 extern void r8a7779_clock_init(void); 46 45 extern void r8a7779_pinmux_init(void);
-57
arch/arm/mach-shmobile/setup-r8a7779.c
··· 598 598 .resource = ohci1_resources, 599 599 }; 600 600 601 - /* Ether */ 602 - static struct resource ether_resources[] __initdata = { 603 - { 604 - .start = 0xfde00000, 605 - .end = 0xfde003ff, 606 - .flags = IORESOURCE_MEM, 607 - }, { 608 - .start = gic_iid(0xb4), 609 - .flags = IORESOURCE_IRQ, 610 - }, 611 - }; 612 - 613 - #define R8A7779_VIN(idx) \ 614 - static struct resource vin##idx##_resources[] __initdata = { \ 615 - DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \ 616 - DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \ 617 - }; \ 618 - \ 619 - static struct platform_device_info vin##idx##_info __initdata = { \ 620 - .parent = &platform_bus, \ 621 - .name = "r8a7779-vin", \ 622 - .id = idx, \ 623 - .res = vin##idx##_resources, \ 624 - .num_res = ARRAY_SIZE(vin##idx##_resources), \ 625 - .dma_mask = DMA_BIT_MASK(32), \ 626 - } 627 - 628 - R8A7779_VIN(0); 629 - R8A7779_VIN(1); 630 - R8A7779_VIN(2); 631 - R8A7779_VIN(3); 632 - 633 - static struct platform_device_info *vin_info_table[] __initdata = { 634 - &vin0_info, 635 - &vin1_info, 636 - &vin2_info, 637 - &vin3_info, 638 - }; 639 - 640 601 /* HPB-DMA */ 641 602 642 603 /* Asynchronous mode register bits */ ··· 784 823 platform_add_devices(r8a7779_standard_devices, 785 824 ARRAY_SIZE(r8a7779_standard_devices)); 786 825 r8a7779_register_hpb_dmae(); 787 - } 788 - 789 - void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata) 790 - { 791 - platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1, 792 - ether_resources, 793 - ARRAY_SIZE(ether_resources), 794 - pdata, sizeof(*pdata)); 795 - } 796 - 797 - void __init r8a7779_add_vin_device(int id, struct rcar_vin_platform_data *pdata) 798 - { 799 - BUG_ON(id < 0 || id > 3); 800 - 801 - vin_info_table[id]->data = pdata; 802 - vin_info_table[id]->size_data = sizeof(*pdata); 803 - 804 - platform_device_register_full(vin_info_table[id]); 805 826 } 806 827 807 828 /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
+5 -2
arch/arm/mach-shmobile/setup-r8a7790.c
··· 34 34 DEFINE_RES_MEM(0xe6060000, 0x250), 35 35 }; 36 36 37 + #define r8a7790_register_pfc() \ 38 + platform_device_register_simple("pfc-r8a7790", -1, pfc_resources, \ 39 + ARRAY_SIZE(pfc_resources)) 40 + 37 41 #define R8A7790_GPIO(idx) \ 38 42 static const struct resource r8a7790_gpio##idx##_resources[] __initconst = { \ 39 43 DEFINE_RES_MEM(0xe6050000 + 0x1000 * (idx), 0x50), \ ··· 69 65 70 66 void __init r8a7790_pinmux_init(void) 71 67 { 72 - platform_device_register_simple("pfc-r8a7790", -1, pfc_resources, 73 - ARRAY_SIZE(pfc_resources)); 68 + r8a7790_register_pfc(); 74 69 r8a7790_register_gpio(0); 75 70 r8a7790_register_gpio(1); 76 71 r8a7790_register_gpio(2);
+8 -8
arch/arm/mach-shmobile/setup-sh73a0.c
··· 273 273 }; 274 274 275 275 static struct resource tmu00_resources[] = { 276 - [0] = DEFINE_RES_MEM_NAMED(0xfff60008, 0xc, "TMU00"), 276 + [0] = DEFINE_RES_MEM(0xfff60008, 0xc), 277 277 [1] = { 278 278 .start = intcs_evt2irq(0x0e80), /* TMU0_TUNI00 */ 279 279 .flags = IORESOURCE_IRQ, ··· 298 298 }; 299 299 300 300 static struct resource tmu01_resources[] = { 301 - [0] = DEFINE_RES_MEM_NAMED(0xfff60014, 0xc, "TMU00"), 301 + [0] = DEFINE_RES_MEM(0xfff60014, 0xc), 302 302 [1] = { 303 303 .start = intcs_evt2irq(0x0ea0), /* TMU0_TUNI01 */ 304 304 .flags = IORESOURCE_IRQ, ··· 316 316 }; 317 317 318 318 static struct resource i2c0_resources[] = { 319 - [0] = DEFINE_RES_MEM_NAMED(0xe6820000, 0x426, "IIC0"), 319 + [0] = DEFINE_RES_MEM(0xe6820000, 0x426), 320 320 [1] = { 321 321 .start = gic_spi(167), 322 322 .end = gic_spi(170), ··· 325 325 }; 326 326 327 327 static struct resource i2c1_resources[] = { 328 - [0] = DEFINE_RES_MEM_NAMED(0xe6822000, 0x426, "IIC1"), 328 + [0] = DEFINE_RES_MEM(0xe6822000, 0x426), 329 329 [1] = { 330 330 .start = gic_spi(51), 331 331 .end = gic_spi(54), ··· 334 334 }; 335 335 336 336 static struct resource i2c2_resources[] = { 337 - [0] = DEFINE_RES_MEM_NAMED(0xe6824000, 0x426, "IIC2"), 337 + [0] = DEFINE_RES_MEM(0xe6824000, 0x426), 338 338 [1] = { 339 339 .start = gic_spi(171), 340 340 .end = gic_spi(174), ··· 343 343 }; 344 344 345 345 static struct resource i2c3_resources[] = { 346 - [0] = DEFINE_RES_MEM_NAMED(0xe6826000, 0x426, "IIC3"), 346 + [0] = DEFINE_RES_MEM(0xe6826000, 0x426), 347 347 [1] = { 348 348 .start = gic_spi(183), 349 349 .end = gic_spi(186), ··· 352 352 }; 353 353 354 354 static struct resource i2c4_resources[] = { 355 - [0] = DEFINE_RES_MEM_NAMED(0xe6828000, 0x426, "IIC4"), 355 + [0] = DEFINE_RES_MEM(0xe6828000, 0x426), 356 356 [1] = { 357 357 .start = gic_spi(187), 358 358 .end = gic_spi(190), ··· 722 722 723 723 /* an IPMMU module for ICB */ 724 724 static struct resource ipmmu_resources[] = { 725 - DEFINE_RES_MEM_NAMED(0xfe951000, 0x100, "IPMMU"), 725 + DEFINE_RES_MEM(0xfe951000, 0x100), 726 726 }; 727 727 728 728 static const char * const ipmmu_dev_names[] = {
+1
arch/arm/mach-socfpga/Kconfig
··· 10 10 select GENERIC_CLOCKEVENTS 11 11 select GPIO_PL061 if GPIOLIB 12 12 select HAVE_ARM_SCU 13 + select HAVE_ARM_TWD if SMP 13 14 select HAVE_SMP 14 15 select MFD_SYSCON 15 16 select SPARSE_IRQ
+4
arch/arm/mach-ux500/cpu-db8500.c
··· 151 151 /* Requires call-back bindings. */ 152 152 OF_DEV_AUXDATA("arm,cortex-a9-pmu", 0, "arm-pmu", &db8500_pmu_platdata), 153 153 /* Requires DMA bindings. */ 154 + OF_DEV_AUXDATA("arm,pl18x", 0x80126000, "sdi0", &mop500_sdi0_data), 155 + OF_DEV_AUXDATA("arm,pl18x", 0x80118000, "sdi1", &mop500_sdi1_data), 156 + OF_DEV_AUXDATA("arm,pl18x", 0x80005000, "sdi2", &mop500_sdi2_data), 157 + OF_DEV_AUXDATA("arm,pl18x", 0x80114000, "sdi4", &mop500_sdi4_data), 154 158 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80123000, 155 159 "ux500-msp-i2s.0", &msp0_platform_data), 156 160 OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
+4 -1
arch/arm/plat-omap/include/plat/dmtimer.h
··· 336 336 if (timer->posted) 337 337 return; 338 338 339 - if (timer->errata & OMAP_TIMER_ERRATA_I103_I767) 339 + if (timer->errata & OMAP_TIMER_ERRATA_I103_I767) { 340 + timer->posted = OMAP_TIMER_NONPOSTED; 341 + __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, 0, 0); 340 342 return; 343 + } 341 344 342 345 __omap_dm_timer_write(timer, OMAP_TIMER_IF_CTRL_REG, 343 346 OMAP_TIMER_CTRL_POSTED, 0);
+5 -4
arch/arm/plat-orion/common.c
··· 22 22 #include <linux/platform_data/dma-mv_xor.h> 23 23 #include <linux/platform_data/usb-ehci-orion.h> 24 24 #include <mach/bridge-regs.h> 25 + #include <plat/common.h> 25 26 26 27 /* Create a clkdev entry for a given device/clk */ 27 28 void __init orion_clkdev_add(const char *con_id, const char *dev_id, ··· 257 256 /***************************************************************************** 258 257 * GE00 259 258 ****************************************************************************/ 260 - struct mv643xx_eth_shared_platform_data orion_ge00_shared_data; 259 + static struct mv643xx_eth_shared_platform_data orion_ge00_shared_data; 261 260 262 261 static struct resource orion_ge00_shared_resources[] = { 263 262 { ··· 323 322 /***************************************************************************** 324 323 * GE01 325 324 ****************************************************************************/ 326 - struct mv643xx_eth_shared_platform_data orion_ge01_shared_data; 325 + static struct mv643xx_eth_shared_platform_data orion_ge01_shared_data; 327 326 328 327 static struct resource orion_ge01_shared_resources[] = { 329 328 { ··· 374 373 /***************************************************************************** 375 374 * GE10 376 375 ****************************************************************************/ 377 - struct mv643xx_eth_shared_platform_data orion_ge10_shared_data; 376 + static struct mv643xx_eth_shared_platform_data orion_ge10_shared_data; 378 377 379 378 static struct resource orion_ge10_shared_resources[] = { 380 379 { ··· 423 422 /***************************************************************************** 424 423 * GE11 425 424 ****************************************************************************/ 426 - struct mv643xx_eth_shared_platform_data orion_ge11_shared_data; 425 + static struct mv643xx_eth_shared_platform_data orion_ge11_shared_data; 427 426 428 427 static struct resource orion_ge11_shared_resources[] = { 429 428 {
+2 -1
arch/arm/plat-orion/time.c
··· 17 17 #include <linux/interrupt.h> 18 18 #include <linux/irq.h> 19 19 #include <linux/sched_clock.h> 20 + #include <plat/time.h> 20 21 21 22 /* 22 23 * MBus bridge block registers. ··· 175 174 176 175 static struct irqaction orion_timer_irq = { 177 176 .name = "orion_tick", 178 - .flags = IRQF_DISABLED | IRQF_TIMER, 177 + .flags = IRQF_TIMER, 179 178 .handler = orion_timer_interrupt 180 179 }; 181 180
+1
drivers/clk/Makefile
··· 35 35 obj-$(CONFIG_PLAT_SAMSUNG) += samsung/ 36 36 obj-$(CONFIG_COMMON_CLK_XGENE) += clk-xgene.o 37 37 obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/ 38 + obj-$(CONFIG_COMMON_CLK_AT91) += at91/ 38 39 39 40 obj-$(CONFIG_X86) += x86/ 40 41
+12
drivers/clk/at91/Makefile
··· 1 + # 2 + # Makefile for at91 specific clk 3 + # 4 + 5 + obj-y += pmc.o 6 + obj-y += clk-main.o clk-pll.o clk-plldiv.o clk-master.o 7 + obj-y += clk-system.o clk-peripheral.o 8 + 9 + obj-$(CONFIG_AT91_PROGRAMMABLE_CLOCKS) += clk-programmable.o 10 + obj-$(CONFIG_HAVE_AT91_UTMI) += clk-utmi.o 11 + obj-$(CONFIG_HAVE_AT91_USB_CLK) += clk-usb.o 12 + obj-$(CONFIG_HAVE_AT91_SMD) += clk-smd.o
+187
drivers/clk/at91/clk-main.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/delay.h> 15 + #include <linux/of.h> 16 + #include <linux/of_address.h> 17 + #include <linux/of_irq.h> 18 + #include <linux/io.h> 19 + #include <linux/interrupt.h> 20 + #include <linux/irq.h> 21 + #include <linux/sched.h> 22 + #include <linux/wait.h> 23 + 24 + #include "pmc.h" 25 + 26 + #define SLOW_CLOCK_FREQ 32768 27 + #define MAINF_DIV 16 28 + #define MAINFRDY_TIMEOUT (((MAINF_DIV + 1) * USEC_PER_SEC) / \ 29 + SLOW_CLOCK_FREQ) 30 + #define MAINF_LOOP_MIN_WAIT (USEC_PER_SEC / SLOW_CLOCK_FREQ) 31 + #define MAINF_LOOP_MAX_WAIT MAINFRDY_TIMEOUT 32 + 33 + struct clk_main { 34 + struct clk_hw hw; 35 + struct at91_pmc *pmc; 36 + unsigned long rate; 37 + unsigned int irq; 38 + wait_queue_head_t wait; 39 + }; 40 + 41 + #define to_clk_main(hw) container_of(hw, struct clk_main, hw) 42 + 43 + static irqreturn_t clk_main_irq_handler(int irq, void *dev_id) 44 + { 45 + struct clk_main *clkmain = (struct clk_main *)dev_id; 46 + 47 + wake_up(&clkmain->wait); 48 + disable_irq_nosync(clkmain->irq); 49 + 50 + return IRQ_HANDLED; 51 + } 52 + 53 + static int clk_main_prepare(struct clk_hw *hw) 54 + { 55 + struct clk_main *clkmain = to_clk_main(hw); 56 + struct at91_pmc *pmc = clkmain->pmc; 57 + unsigned long halt_time, timeout; 58 + u32 tmp; 59 + 60 + while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS)) { 61 + enable_irq(clkmain->irq); 62 + wait_event(clkmain->wait, 63 + pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MOSCS); 64 + } 65 + 66 + if (clkmain->rate) 67 + return 0; 68 + 69 + timeout = jiffies + usecs_to_jiffies(MAINFRDY_TIMEOUT); 70 + do { 71 + halt_time = jiffies; 72 + tmp = pmc_read(pmc, AT91_CKGR_MCFR); 73 + if (tmp & AT91_PMC_MAINRDY) 74 + return 0; 75 + usleep_range(MAINF_LOOP_MIN_WAIT, MAINF_LOOP_MAX_WAIT); 76 + } while (time_before(halt_time, timeout)); 77 + 78 + return 0; 79 + } 80 + 81 + static int clk_main_is_prepared(struct clk_hw *hw) 82 + { 83 + struct clk_main *clkmain = to_clk_main(hw); 84 + 85 + return !!(pmc_read(clkmain->pmc, AT91_PMC_SR) & AT91_PMC_MOSCS); 86 + } 87 + 88 + static unsigned long clk_main_recalc_rate(struct clk_hw *hw, 89 + unsigned long parent_rate) 90 + { 91 + u32 tmp; 92 + struct clk_main *clkmain = to_clk_main(hw); 93 + struct at91_pmc *pmc = clkmain->pmc; 94 + 95 + if (clkmain->rate) 96 + return clkmain->rate; 97 + 98 + tmp = pmc_read(pmc, AT91_CKGR_MCFR) & AT91_PMC_MAINF; 99 + clkmain->rate = (tmp * parent_rate) / MAINF_DIV; 100 + 101 + return clkmain->rate; 102 + } 103 + 104 + static const struct clk_ops main_ops = { 105 + .prepare = clk_main_prepare, 106 + .is_prepared = clk_main_is_prepared, 107 + .recalc_rate = clk_main_recalc_rate, 108 + }; 109 + 110 + static struct clk * __init 111 + at91_clk_register_main(struct at91_pmc *pmc, 112 + unsigned int irq, 113 + const char *name, 114 + const char *parent_name, 115 + unsigned long rate) 116 + { 117 + int ret; 118 + struct clk_main *clkmain; 119 + struct clk *clk = NULL; 120 + struct clk_init_data init; 121 + 122 + if (!pmc || !irq || !name) 123 + return ERR_PTR(-EINVAL); 124 + 125 + if (!rate && !parent_name) 126 + return ERR_PTR(-EINVAL); 127 + 128 + clkmain = kzalloc(sizeof(*clkmain), GFP_KERNEL); 129 + if (!clkmain) 130 + return ERR_PTR(-ENOMEM); 131 + 132 + init.name = name; 133 + init.ops = &main_ops; 134 + init.parent_names = parent_name ? &parent_name : NULL; 135 + init.num_parents = parent_name ? 1 : 0; 136 + init.flags = parent_name ? 0 : CLK_IS_ROOT; 137 + 138 + clkmain->hw.init = &init; 139 + clkmain->rate = rate; 140 + clkmain->pmc = pmc; 141 + clkmain->irq = irq; 142 + init_waitqueue_head(&clkmain->wait); 143 + irq_set_status_flags(clkmain->irq, IRQ_NOAUTOEN); 144 + ret = request_irq(clkmain->irq, clk_main_irq_handler, 145 + IRQF_TRIGGER_HIGH, "clk-main", clkmain); 146 + if (ret) 147 + return ERR_PTR(ret); 148 + 149 + clk = clk_register(NULL, &clkmain->hw); 150 + if (IS_ERR(clk)) { 151 + free_irq(clkmain->irq, clkmain); 152 + kfree(clkmain); 153 + } 154 + 155 + return clk; 156 + } 157 + 158 + 159 + 160 + static void __init 161 + of_at91_clk_main_setup(struct device_node *np, struct at91_pmc *pmc) 162 + { 163 + struct clk *clk; 164 + unsigned int irq; 165 + const char *parent_name; 166 + const char *name = np->name; 167 + u32 rate = 0; 168 + 169 + parent_name = of_clk_get_parent_name(np, 0); 170 + of_property_read_string(np, "clock-output-names", &name); 171 + of_property_read_u32(np, "clock-frequency", &rate); 172 + irq = irq_of_parse_and_map(np, 0); 173 + if (!irq) 174 + return; 175 + 176 + clk = at91_clk_register_main(pmc, irq, name, parent_name, rate); 177 + if (IS_ERR(clk)) 178 + return; 179 + 180 + of_clk_add_provider(np, of_clk_src_simple_get, clk); 181 + } 182 + 183 + void __init of_at91rm9200_clk_main_setup(struct device_node *np, 184 + struct at91_pmc *pmc) 185 + { 186 + of_at91_clk_main_setup(np, pmc); 187 + }
+270
drivers/clk/at91/clk-master.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/of_irq.h> 17 + #include <linux/io.h> 18 + #include <linux/wait.h> 19 + #include <linux/sched.h> 20 + #include <linux/interrupt.h> 21 + #include <linux/irq.h> 22 + 23 + #include "pmc.h" 24 + 25 + #define MASTER_SOURCE_MAX 4 26 + 27 + #define MASTER_PRES_MASK 0x7 28 + #define MASTER_PRES_MAX MASTER_PRES_MASK 29 + #define MASTER_DIV_SHIFT 8 30 + #define MASTER_DIV_MASK 0x3 31 + 32 + struct clk_master_characteristics { 33 + struct clk_range output; 34 + u32 divisors[4]; 35 + u8 have_div3_pres; 36 + }; 37 + 38 + struct clk_master_layout { 39 + u32 mask; 40 + u8 pres_shift; 41 + }; 42 + 43 + #define to_clk_master(hw) container_of(hw, struct clk_master, hw) 44 + 45 + struct clk_master { 46 + struct clk_hw hw; 47 + struct at91_pmc *pmc; 48 + unsigned int irq; 49 + wait_queue_head_t wait; 50 + const struct clk_master_layout *layout; 51 + const struct clk_master_characteristics *characteristics; 52 + }; 53 + 54 + static irqreturn_t clk_master_irq_handler(int irq, void *dev_id) 55 + { 56 + struct clk_master *master = (struct clk_master *)dev_id; 57 + 58 + wake_up(&master->wait); 59 + disable_irq_nosync(master->irq); 60 + 61 + return IRQ_HANDLED; 62 + } 63 + static int clk_master_prepare(struct clk_hw *hw) 64 + { 65 + struct clk_master *master = to_clk_master(hw); 66 + struct at91_pmc *pmc = master->pmc; 67 + 68 + while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY)) { 69 + enable_irq(master->irq); 70 + wait_event(master->wait, 71 + pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY); 72 + } 73 + 74 + return 0; 75 + } 76 + 77 + static int clk_master_is_prepared(struct clk_hw *hw) 78 + { 79 + struct clk_master *master = to_clk_master(hw); 80 + 81 + return !!(pmc_read(master->pmc, AT91_PMC_SR) & AT91_PMC_MCKRDY); 82 + } 83 + 84 + static unsigned long clk_master_recalc_rate(struct clk_hw *hw, 85 + unsigned long parent_rate) 86 + { 87 + u8 pres; 88 + u8 div; 89 + unsigned long rate = parent_rate; 90 + struct clk_master *master = to_clk_master(hw); 91 + struct at91_pmc *pmc = master->pmc; 92 + const struct clk_master_layout *layout = master->layout; 93 + const struct clk_master_characteristics *characteristics = 94 + master->characteristics; 95 + u32 tmp; 96 + 97 + pmc_lock(pmc); 98 + tmp = pmc_read(pmc, AT91_PMC_MCKR) & layout->mask; 99 + pmc_unlock(pmc); 100 + 101 + pres = (tmp >> layout->pres_shift) & MASTER_PRES_MASK; 102 + div = (tmp >> MASTER_DIV_SHIFT) & MASTER_DIV_MASK; 103 + 104 + if (characteristics->have_div3_pres && pres == MASTER_PRES_MAX) 105 + rate /= 3; 106 + else 107 + rate >>= pres; 108 + 109 + rate /= characteristics->divisors[div]; 110 + 111 + if (rate < characteristics->output.min) 112 + pr_warn("master clk is underclocked"); 113 + else if (rate > characteristics->output.max) 114 + pr_warn("master clk is overclocked"); 115 + 116 + return rate; 117 + } 118 + 119 + static u8 clk_master_get_parent(struct clk_hw *hw) 120 + { 121 + struct clk_master *master = to_clk_master(hw); 122 + struct at91_pmc *pmc = master->pmc; 123 + 124 + return pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_CSS; 125 + } 126 + 127 + static const struct clk_ops master_ops = { 128 + .prepare = clk_master_prepare, 129 + .is_prepared = clk_master_is_prepared, 130 + .recalc_rate = clk_master_recalc_rate, 131 + .get_parent = clk_master_get_parent, 132 + }; 133 + 134 + static struct clk * __init 135 + at91_clk_register_master(struct at91_pmc *pmc, unsigned int irq, 136 + const char *name, int num_parents, 137 + const char **parent_names, 138 + const struct clk_master_layout *layout, 139 + const struct clk_master_characteristics *characteristics) 140 + { 141 + int ret; 142 + struct clk_master *master; 143 + struct clk *clk = NULL; 144 + struct clk_init_data init; 145 + 146 + if (!pmc || !irq || !name || !num_parents || !parent_names) 147 + return ERR_PTR(-EINVAL); 148 + 149 + master = kzalloc(sizeof(*master), GFP_KERNEL); 150 + if (!master) 151 + return ERR_PTR(-ENOMEM); 152 + 153 + init.name = name; 154 + init.ops = &master_ops; 155 + init.parent_names = parent_names; 156 + init.num_parents = num_parents; 157 + init.flags = 0; 158 + 159 + master->hw.init = &init; 160 + master->layout = layout; 161 + master->characteristics = characteristics; 162 + master->pmc = pmc; 163 + master->irq = irq; 164 + init_waitqueue_head(&master->wait); 165 + irq_set_status_flags(master->irq, IRQ_NOAUTOEN); 166 + ret = request_irq(master->irq, clk_master_irq_handler, 167 + IRQF_TRIGGER_HIGH, "clk-master", master); 168 + if (ret) 169 + return ERR_PTR(ret); 170 + 171 + clk = clk_register(NULL, &master->hw); 172 + if (IS_ERR(clk)) 173 + kfree(master); 174 + 175 + return clk; 176 + } 177 + 178 + 179 + static const struct clk_master_layout at91rm9200_master_layout = { 180 + .mask = 0x31F, 181 + .pres_shift = 2, 182 + }; 183 + 184 + static const struct clk_master_layout at91sam9x5_master_layout = { 185 + .mask = 0x373, 186 + .pres_shift = 4, 187 + }; 188 + 189 + 190 + static struct clk_master_characteristics * __init 191 + of_at91_clk_master_get_characteristics(struct device_node *np) 192 + { 193 + struct clk_master_characteristics *characteristics; 194 + 195 + characteristics = kzalloc(sizeof(*characteristics), GFP_KERNEL); 196 + if (!characteristics) 197 + return NULL; 198 + 199 + if (of_at91_get_clk_range(np, "atmel,clk-output-range", &characteristics->output)) 200 + goto out_free_characteristics; 201 + 202 + of_property_read_u32_array(np, "atmel,clk-divisors", 203 + characteristics->divisors, 4); 204 + 205 + characteristics->have_div3_pres = 206 + of_property_read_bool(np, "atmel,master-clk-have-div3-pres"); 207 + 208 + return characteristics; 209 + 210 + out_free_characteristics: 211 + kfree(characteristics); 212 + return NULL; 213 + } 214 + 215 + static void __init 216 + of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc, 217 + const struct clk_master_layout *layout) 218 + { 219 + struct clk *clk; 220 + int num_parents; 221 + int i; 222 + unsigned int irq; 223 + const char *parent_names[MASTER_SOURCE_MAX]; 224 + const char *name = np->name; 225 + struct clk_master_characteristics *characteristics; 226 + 227 + num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); 228 + if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX) 229 + return; 230 + 231 + for (i = 0; i < num_parents; ++i) { 232 + parent_names[i] = of_clk_get_parent_name(np, i); 233 + if (!parent_names[i]) 234 + return; 235 + } 236 + 237 + of_property_read_string(np, "clock-output-names", &name); 238 + 239 + characteristics = of_at91_clk_master_get_characteristics(np); 240 + if (!characteristics) 241 + return; 242 + 243 + irq = irq_of_parse_and_map(np, 0); 244 + if (!irq) 245 + return; 246 + 247 + clk = at91_clk_register_master(pmc, irq, name, num_parents, 248 + parent_names, layout, 249 + characteristics); 250 + if (IS_ERR(clk)) 251 + goto out_free_characteristics; 252 + 253 + of_clk_add_provider(np, of_clk_src_simple_get, clk); 254 + return; 255 + 256 + out_free_characteristics: 257 + kfree(characteristics); 258 + } 259 + 260 + void __init of_at91rm9200_clk_master_setup(struct device_node *np, 261 + struct at91_pmc *pmc) 262 + { 263 + of_at91_clk_master_setup(np, pmc, &at91rm9200_master_layout); 264 + } 265 + 266 + void __init of_at91sam9x5_clk_master_setup(struct device_node *np, 267 + struct at91_pmc *pmc) 268 + { 269 + of_at91_clk_master_setup(np, pmc, &at91sam9x5_master_layout); 270 + }
+410
drivers/clk/at91/clk-peripheral.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/io.h> 17 + 18 + #include "pmc.h" 19 + 20 + #define PERIPHERAL_MAX 64 21 + 22 + #define PERIPHERAL_AT91RM9200 0 23 + #define PERIPHERAL_AT91SAM9X5 1 24 + 25 + #define PERIPHERAL_ID_MIN 2 26 + #define PERIPHERAL_ID_MAX 31 27 + #define PERIPHERAL_MASK(id) (1 << ((id) & PERIPHERAL_ID_MAX)) 28 + 29 + #define PERIPHERAL_RSHIFT_MASK 0x3 30 + #define PERIPHERAL_RSHIFT(val) (((val) >> 16) & PERIPHERAL_RSHIFT_MASK) 31 + 32 + #define PERIPHERAL_MAX_SHIFT 4 33 + 34 + struct clk_peripheral { 35 + struct clk_hw hw; 36 + struct at91_pmc *pmc; 37 + u32 id; 38 + }; 39 + 40 + #define to_clk_peripheral(hw) container_of(hw, struct clk_peripheral, hw) 41 + 42 + struct clk_sam9x5_peripheral { 43 + struct clk_hw hw; 44 + struct at91_pmc *pmc; 45 + struct clk_range range; 46 + u32 id; 47 + u32 div; 48 + bool auto_div; 49 + }; 50 + 51 + #define to_clk_sam9x5_peripheral(hw) \ 52 + container_of(hw, struct clk_sam9x5_peripheral, hw) 53 + 54 + static int clk_peripheral_enable(struct clk_hw *hw) 55 + { 56 + struct clk_peripheral *periph = to_clk_peripheral(hw); 57 + struct at91_pmc *pmc = periph->pmc; 58 + int offset = AT91_PMC_PCER; 59 + u32 id = periph->id; 60 + 61 + if (id < PERIPHERAL_ID_MIN) 62 + return 0; 63 + if (id > PERIPHERAL_ID_MAX) 64 + offset = AT91_PMC_PCER1; 65 + pmc_write(pmc, offset, PERIPHERAL_MASK(id)); 66 + return 0; 67 + } 68 + 69 + static void clk_peripheral_disable(struct clk_hw *hw) 70 + { 71 + struct clk_peripheral *periph = to_clk_peripheral(hw); 72 + struct at91_pmc *pmc = periph->pmc; 73 + int offset = AT91_PMC_PCDR; 74 + u32 id = periph->id; 75 + 76 + if (id < PERIPHERAL_ID_MIN) 77 + return; 78 + if (id > PERIPHERAL_ID_MAX) 79 + offset = AT91_PMC_PCDR1; 80 + pmc_write(pmc, offset, PERIPHERAL_MASK(id)); 81 + } 82 + 83 + static int clk_peripheral_is_enabled(struct clk_hw *hw) 84 + { 85 + struct clk_peripheral *periph = to_clk_peripheral(hw); 86 + struct at91_pmc *pmc = periph->pmc; 87 + int offset = AT91_PMC_PCSR; 88 + u32 id = periph->id; 89 + 90 + if (id < PERIPHERAL_ID_MIN) 91 + return 1; 92 + if (id > PERIPHERAL_ID_MAX) 93 + offset = AT91_PMC_PCSR1; 94 + return !!(pmc_read(pmc, offset) & PERIPHERAL_MASK(id)); 95 + } 96 + 97 + static const struct clk_ops peripheral_ops = { 98 + .enable = clk_peripheral_enable, 99 + .disable = clk_peripheral_disable, 100 + .is_enabled = clk_peripheral_is_enabled, 101 + }; 102 + 103 + static struct clk * __init 104 + at91_clk_register_peripheral(struct at91_pmc *pmc, const char *name, 105 + const char *parent_name, u32 id) 106 + { 107 + struct clk_peripheral *periph; 108 + struct clk *clk = NULL; 109 + struct clk_init_data init; 110 + 111 + if (!pmc || !name || !parent_name || id > PERIPHERAL_ID_MAX) 112 + return ERR_PTR(-EINVAL); 113 + 114 + periph = kzalloc(sizeof(*periph), GFP_KERNEL); 115 + if (!periph) 116 + return ERR_PTR(-ENOMEM); 117 + 118 + init.name = name; 119 + init.ops = &peripheral_ops; 120 + init.parent_names = (parent_name ? &parent_name : NULL); 121 + init.num_parents = (parent_name ? 1 : 0); 122 + init.flags = 0; 123 + 124 + periph->id = id; 125 + periph->hw.init = &init; 126 + periph->pmc = pmc; 127 + 128 + clk = clk_register(NULL, &periph->hw); 129 + if (IS_ERR(clk)) 130 + kfree(periph); 131 + 132 + return clk; 133 + } 134 + 135 + static void clk_sam9x5_peripheral_autodiv(struct clk_sam9x5_peripheral *periph) 136 + { 137 + struct clk *parent; 138 + unsigned long parent_rate; 139 + int shift = 0; 140 + 141 + if (!periph->auto_div) 142 + return; 143 + 144 + if (periph->range.max) { 145 + parent = clk_get_parent_by_index(periph->hw.clk, 0); 146 + parent_rate = __clk_get_rate(parent); 147 + if (!parent_rate) 148 + return; 149 + 150 + for (; shift < PERIPHERAL_MAX_SHIFT; shift++) { 151 + if (parent_rate >> shift <= periph->range.max) 152 + break; 153 + } 154 + } 155 + 156 + periph->auto_div = false; 157 + periph->div = shift; 158 + } 159 + 160 + static int clk_sam9x5_peripheral_enable(struct clk_hw *hw) 161 + { 162 + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); 163 + struct at91_pmc *pmc = periph->pmc; 164 + 165 + if (periph->id < PERIPHERAL_ID_MIN) 166 + return 0; 167 + 168 + pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) | 169 + AT91_PMC_PCR_CMD | 170 + AT91_PMC_PCR_DIV(periph->div) | 171 + AT91_PMC_PCR_EN); 172 + return 0; 173 + } 174 + 175 + static void clk_sam9x5_peripheral_disable(struct clk_hw *hw) 176 + { 177 + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); 178 + struct at91_pmc *pmc = periph->pmc; 179 + 180 + if (periph->id < PERIPHERAL_ID_MIN) 181 + return; 182 + 183 + pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID) | 184 + AT91_PMC_PCR_CMD); 185 + } 186 + 187 + static int clk_sam9x5_peripheral_is_enabled(struct clk_hw *hw) 188 + { 189 + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); 190 + struct at91_pmc *pmc = periph->pmc; 191 + int ret; 192 + 193 + if (periph->id < PERIPHERAL_ID_MIN) 194 + return 1; 195 + 196 + pmc_lock(pmc); 197 + pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID)); 198 + ret = !!(pmc_read(pmc, AT91_PMC_PCR) & AT91_PMC_PCR_EN); 199 + pmc_unlock(pmc); 200 + 201 + return ret; 202 + } 203 + 204 + static unsigned long 205 + clk_sam9x5_peripheral_recalc_rate(struct clk_hw *hw, 206 + unsigned long parent_rate) 207 + { 208 + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); 209 + struct at91_pmc *pmc = periph->pmc; 210 + u32 tmp; 211 + 212 + if (periph->id < PERIPHERAL_ID_MIN) 213 + return parent_rate; 214 + 215 + pmc_lock(pmc); 216 + pmc_write(pmc, AT91_PMC_PCR, (periph->id & AT91_PMC_PCR_PID)); 217 + tmp = pmc_read(pmc, AT91_PMC_PCR); 218 + pmc_unlock(pmc); 219 + 220 + if (tmp & AT91_PMC_PCR_EN) { 221 + periph->div = PERIPHERAL_RSHIFT(tmp); 222 + periph->auto_div = false; 223 + } else { 224 + clk_sam9x5_peripheral_autodiv(periph); 225 + } 226 + 227 + return parent_rate >> periph->div; 228 + } 229 + 230 + static long clk_sam9x5_peripheral_round_rate(struct clk_hw *hw, 231 + unsigned long rate, 232 + unsigned long *parent_rate) 233 + { 234 + int shift = 0; 235 + unsigned long best_rate; 236 + unsigned long best_diff; 237 + unsigned long cur_rate = *parent_rate; 238 + unsigned long cur_diff; 239 + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); 240 + 241 + if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) 242 + return *parent_rate; 243 + 244 + if (periph->range.max) { 245 + for (; shift < PERIPHERAL_MAX_SHIFT; shift++) { 246 + cur_rate = *parent_rate >> shift; 247 + if (cur_rate <= periph->range.max) 248 + break; 249 + } 250 + } 251 + 252 + if (rate >= cur_rate) 253 + return cur_rate; 254 + 255 + best_diff = cur_rate - rate; 256 + best_rate = cur_rate; 257 + for (; shift < PERIPHERAL_MAX_SHIFT; shift++) { 258 + cur_rate = *parent_rate >> shift; 259 + if (cur_rate < rate) 260 + cur_diff = rate - cur_rate; 261 + else 262 + cur_diff = cur_rate - rate; 263 + 264 + if (cur_diff < best_diff) { 265 + best_diff = cur_diff; 266 + best_rate = cur_rate; 267 + } 268 + 269 + if (!best_diff || cur_rate < rate) 270 + break; 271 + } 272 + 273 + return best_rate; 274 + } 275 + 276 + static int clk_sam9x5_peripheral_set_rate(struct clk_hw *hw, 277 + unsigned long rate, 278 + unsigned long parent_rate) 279 + { 280 + int shift; 281 + struct clk_sam9x5_peripheral *periph = to_clk_sam9x5_peripheral(hw); 282 + if (periph->id < PERIPHERAL_ID_MIN || !periph->range.max) { 283 + if (parent_rate == rate) 284 + return 0; 285 + else 286 + return -EINVAL; 287 + } 288 + 289 + if (periph->range.max && rate > periph->range.max) 290 + return -EINVAL; 291 + 292 + for (shift = 0; shift < PERIPHERAL_MAX_SHIFT; shift++) { 293 + if (parent_rate >> shift == rate) { 294 + periph->auto_div = false; 295 + periph->div = shift; 296 + return 0; 297 + } 298 + } 299 + 300 + return -EINVAL; 301 + } 302 + 303 + static const struct clk_ops sam9x5_peripheral_ops = { 304 + .enable = clk_sam9x5_peripheral_enable, 305 + .disable = clk_sam9x5_peripheral_disable, 306 + .is_enabled = clk_sam9x5_peripheral_is_enabled, 307 + .recalc_rate = clk_sam9x5_peripheral_recalc_rate, 308 + .round_rate = clk_sam9x5_peripheral_round_rate, 309 + .set_rate = clk_sam9x5_peripheral_set_rate, 310 + }; 311 + 312 + static struct clk * __init 313 + at91_clk_register_sam9x5_peripheral(struct at91_pmc *pmc, const char *name, 314 + const char *parent_name, u32 id, 315 + const struct clk_range *range) 316 + { 317 + struct clk_sam9x5_peripheral *periph; 318 + struct clk *clk = NULL; 319 + struct clk_init_data init; 320 + 321 + if (!pmc || !name || !parent_name) 322 + return ERR_PTR(-EINVAL); 323 + 324 + periph = kzalloc(sizeof(*periph), GFP_KERNEL); 325 + if (!periph) 326 + return ERR_PTR(-ENOMEM); 327 + 328 + init.name = name; 329 + init.ops = &sam9x5_peripheral_ops; 330 + init.parent_names = (parent_name ? &parent_name : NULL); 331 + init.num_parents = (parent_name ? 1 : 0); 332 + init.flags = 0; 333 + 334 + periph->id = id; 335 + periph->hw.init = &init; 336 + periph->div = 0; 337 + periph->pmc = pmc; 338 + periph->auto_div = true; 339 + periph->range = *range; 340 + 341 + clk = clk_register(NULL, &periph->hw); 342 + if (IS_ERR(clk)) 343 + kfree(periph); 344 + else 345 + clk_sam9x5_peripheral_autodiv(periph); 346 + 347 + return clk; 348 + } 349 + 350 + static void __init 351 + of_at91_clk_periph_setup(struct device_node *np, struct at91_pmc *pmc, u8 type) 352 + { 353 + int num; 354 + u32 id; 355 + struct clk *clk; 356 + const char *parent_name; 357 + const char *name; 358 + struct device_node *periphclknp; 359 + 360 + parent_name = of_clk_get_parent_name(np, 0); 361 + if (!parent_name) 362 + return; 363 + 364 + num = of_get_child_count(np); 365 + if (!num || num > PERIPHERAL_MAX) 366 + return; 367 + 368 + for_each_child_of_node(np, periphclknp) { 369 + if (of_property_read_u32(periphclknp, "reg", &id)) 370 + continue; 371 + 372 + if (id >= PERIPHERAL_MAX) 373 + continue; 374 + 375 + if (of_property_read_string(np, "clock-output-names", &name)) 376 + name = periphclknp->name; 377 + 378 + if (type == PERIPHERAL_AT91RM9200) { 379 + clk = at91_clk_register_peripheral(pmc, name, 380 + parent_name, id); 381 + } else { 382 + struct clk_range range = CLK_RANGE(0, 0); 383 + 384 + of_at91_get_clk_range(periphclknp, 385 + "atmel,clk-output-range", 386 + &range); 387 + 388 + clk = at91_clk_register_sam9x5_peripheral(pmc, name, 389 + parent_name, 390 + id, &range); 391 + } 392 + 393 + if (IS_ERR(clk)) 394 + continue; 395 + 396 + of_clk_add_provider(periphclknp, of_clk_src_simple_get, clk); 397 + } 398 + } 399 + 400 + void __init of_at91rm9200_clk_periph_setup(struct device_node *np, 401 + struct at91_pmc *pmc) 402 + { 403 + of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91RM9200); 404 + } 405 + 406 + void __init of_at91sam9x5_clk_periph_setup(struct device_node *np, 407 + struct at91_pmc *pmc) 408 + { 409 + of_at91_clk_periph_setup(np, pmc, PERIPHERAL_AT91SAM9X5); 410 + }
+531
drivers/clk/at91/clk-pll.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/of_irq.h> 17 + #include <linux/io.h> 18 + #include <linux/wait.h> 19 + #include <linux/sched.h> 20 + #include <linux/interrupt.h> 21 + #include <linux/irq.h> 22 + 23 + #include "pmc.h" 24 + 25 + #define PLL_STATUS_MASK(id) (1 << (1 + (id))) 26 + #define PLL_REG(id) (AT91_CKGR_PLLAR + ((id) * 4)) 27 + #define PLL_DIV_MASK 0xff 28 + #define PLL_DIV_MAX PLL_DIV_MASK 29 + #define PLL_DIV(reg) ((reg) & PLL_DIV_MASK) 30 + #define PLL_MUL(reg, layout) (((reg) >> (layout)->mul_shift) & \ 31 + (layout)->mul_mask) 32 + #define PLL_ICPR_SHIFT(id) ((id) * 16) 33 + #define PLL_ICPR_MASK(id) (0xffff << PLL_ICPR_SHIFT(id)) 34 + #define PLL_MAX_COUNT 0x3ff 35 + #define PLL_COUNT_SHIFT 8 36 + #define PLL_OUT_SHIFT 14 37 + #define PLL_MAX_ID 1 38 + 39 + struct clk_pll_characteristics { 40 + struct clk_range input; 41 + int num_output; 42 + struct clk_range *output; 43 + u16 *icpll; 44 + u8 *out; 45 + }; 46 + 47 + struct clk_pll_layout { 48 + u32 pllr_mask; 49 + u16 mul_mask; 50 + u8 mul_shift; 51 + }; 52 + 53 + #define to_clk_pll(hw) container_of(hw, struct clk_pll, hw) 54 + 55 + struct clk_pll { 56 + struct clk_hw hw; 57 + struct at91_pmc *pmc; 58 + unsigned int irq; 59 + wait_queue_head_t wait; 60 + u8 id; 61 + u8 div; 62 + u8 range; 63 + u16 mul; 64 + const struct clk_pll_layout *layout; 65 + const struct clk_pll_characteristics *characteristics; 66 + }; 67 + 68 + static irqreturn_t clk_pll_irq_handler(int irq, void *dev_id) 69 + { 70 + struct clk_pll *pll = (struct clk_pll *)dev_id; 71 + 72 + wake_up(&pll->wait); 73 + disable_irq_nosync(pll->irq); 74 + 75 + return IRQ_HANDLED; 76 + } 77 + 78 + static int clk_pll_prepare(struct clk_hw *hw) 79 + { 80 + struct clk_pll *pll = to_clk_pll(hw); 81 + struct at91_pmc *pmc = pll->pmc; 82 + const struct clk_pll_layout *layout = pll->layout; 83 + const struct clk_pll_characteristics *characteristics = 84 + pll->characteristics; 85 + u8 id = pll->id; 86 + u32 mask = PLL_STATUS_MASK(id); 87 + int offset = PLL_REG(id); 88 + u8 out = 0; 89 + u32 pllr, icpr; 90 + u8 div; 91 + u16 mul; 92 + 93 + pllr = pmc_read(pmc, offset); 94 + div = PLL_DIV(pllr); 95 + mul = PLL_MUL(pllr, layout); 96 + 97 + if ((pmc_read(pmc, AT91_PMC_SR) & mask) && 98 + (div == pll->div && mul == pll->mul)) 99 + return 0; 100 + 101 + if (characteristics->out) 102 + out = characteristics->out[pll->range]; 103 + if (characteristics->icpll) { 104 + icpr = pmc_read(pmc, AT91_PMC_PLLICPR) & ~PLL_ICPR_MASK(id); 105 + icpr |= (characteristics->icpll[pll->range] << 106 + PLL_ICPR_SHIFT(id)); 107 + pmc_write(pmc, AT91_PMC_PLLICPR, icpr); 108 + } 109 + 110 + pllr &= ~layout->pllr_mask; 111 + pllr |= layout->pllr_mask & 112 + (pll->div | (PLL_MAX_COUNT << PLL_COUNT_SHIFT) | 113 + (out << PLL_OUT_SHIFT) | 114 + ((pll->mul & layout->mul_mask) << layout->mul_shift)); 115 + pmc_write(pmc, offset, pllr); 116 + 117 + while (!(pmc_read(pmc, AT91_PMC_SR) & mask)) { 118 + enable_irq(pll->irq); 119 + wait_event(pll->wait, 120 + pmc_read(pmc, AT91_PMC_SR) & mask); 121 + } 122 + 123 + return 0; 124 + } 125 + 126 + static int clk_pll_is_prepared(struct clk_hw *hw) 127 + { 128 + struct clk_pll *pll = to_clk_pll(hw); 129 + struct at91_pmc *pmc = pll->pmc; 130 + 131 + return !!(pmc_read(pmc, AT91_PMC_SR) & 132 + PLL_STATUS_MASK(pll->id)); 133 + } 134 + 135 + static void clk_pll_unprepare(struct clk_hw *hw) 136 + { 137 + struct clk_pll *pll = to_clk_pll(hw); 138 + struct at91_pmc *pmc = pll->pmc; 139 + const struct clk_pll_layout *layout = pll->layout; 140 + int offset = PLL_REG(pll->id); 141 + u32 tmp = pmc_read(pmc, offset) & ~(layout->pllr_mask); 142 + 143 + pmc_write(pmc, offset, tmp); 144 + } 145 + 146 + static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, 147 + unsigned long parent_rate) 148 + { 149 + struct clk_pll *pll = to_clk_pll(hw); 150 + const struct clk_pll_layout *layout = pll->layout; 151 + struct at91_pmc *pmc = pll->pmc; 152 + int offset = PLL_REG(pll->id); 153 + u32 tmp = pmc_read(pmc, offset) & layout->pllr_mask; 154 + u8 div = PLL_DIV(tmp); 155 + u16 mul = PLL_MUL(tmp, layout); 156 + if (!div || !mul) 157 + return 0; 158 + 159 + return (parent_rate * (mul + 1)) / div; 160 + } 161 + 162 + static long clk_pll_get_best_div_mul(struct clk_pll *pll, unsigned long rate, 163 + unsigned long parent_rate, 164 + u32 *div, u32 *mul, 165 + u32 *index) { 166 + unsigned long maxrate; 167 + unsigned long minrate; 168 + unsigned long divrate; 169 + unsigned long bestdiv = 1; 170 + unsigned long bestmul; 171 + unsigned long tmpdiv; 172 + unsigned long roundup; 173 + unsigned long rounddown; 174 + unsigned long remainder; 175 + unsigned long bestremainder; 176 + unsigned long maxmul; 177 + unsigned long maxdiv; 178 + unsigned long mindiv; 179 + int i = 0; 180 + const struct clk_pll_layout *layout = pll->layout; 181 + const struct clk_pll_characteristics *characteristics = 182 + pll->characteristics; 183 + 184 + /* Minimum divider = 1 */ 185 + /* Maximum multiplier = max_mul */ 186 + maxmul = layout->mul_mask + 1; 187 + maxrate = (parent_rate * maxmul) / 1; 188 + 189 + /* Maximum divider = max_div */ 190 + /* Minimum multiplier = 2 */ 191 + maxdiv = PLL_DIV_MAX; 192 + minrate = (parent_rate * 2) / maxdiv; 193 + 194 + if (parent_rate < characteristics->input.min || 195 + parent_rate < characteristics->input.max) 196 + return -ERANGE; 197 + 198 + if (parent_rate < minrate || parent_rate > maxrate) 199 + return -ERANGE; 200 + 201 + for (i = 0; i < characteristics->num_output; i++) { 202 + if (parent_rate >= characteristics->output[i].min && 203 + parent_rate <= characteristics->output[i].max) 204 + break; 205 + } 206 + 207 + if (i >= characteristics->num_output) 208 + return -ERANGE; 209 + 210 + bestmul = rate / parent_rate; 211 + rounddown = parent_rate % rate; 212 + roundup = rate - rounddown; 213 + bestremainder = roundup < rounddown ? roundup : rounddown; 214 + 215 + if (!bestremainder) { 216 + if (div) 217 + *div = bestdiv; 218 + if (mul) 219 + *mul = bestmul; 220 + if (index) 221 + *index = i; 222 + return rate; 223 + } 224 + 225 + maxdiv = 255 / (bestmul + 1); 226 + if (parent_rate / maxdiv < characteristics->input.min) 227 + maxdiv = parent_rate / characteristics->input.min; 228 + mindiv = parent_rate / characteristics->input.max; 229 + if (parent_rate % characteristics->input.max) 230 + mindiv++; 231 + 232 + for (tmpdiv = mindiv; tmpdiv < maxdiv; tmpdiv++) { 233 + divrate = parent_rate / tmpdiv; 234 + 235 + rounddown = rate % divrate; 236 + roundup = divrate - rounddown; 237 + remainder = roundup < rounddown ? roundup : rounddown; 238 + 239 + if (remainder < bestremainder) { 240 + bestremainder = remainder; 241 + bestmul = rate / divrate; 242 + bestdiv = tmpdiv; 243 + } 244 + 245 + if (!remainder) 246 + break; 247 + } 248 + 249 + rate = (parent_rate / bestdiv) * bestmul; 250 + 251 + if (div) 252 + *div = bestdiv; 253 + if (mul) 254 + *mul = bestmul; 255 + if (index) 256 + *index = i; 257 + 258 + return rate; 259 + } 260 + 261 + static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate, 262 + unsigned long *parent_rate) 263 + { 264 + struct clk_pll *pll = to_clk_pll(hw); 265 + 266 + return clk_pll_get_best_div_mul(pll, rate, *parent_rate, 267 + NULL, NULL, NULL); 268 + } 269 + 270 + static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, 271 + unsigned long parent_rate) 272 + { 273 + struct clk_pll *pll = to_clk_pll(hw); 274 + long ret; 275 + u32 div; 276 + u32 mul; 277 + u32 index; 278 + 279 + ret = clk_pll_get_best_div_mul(pll, rate, parent_rate, 280 + &div, &mul, &index); 281 + if (ret < 0) 282 + return ret; 283 + 284 + pll->range = index; 285 + pll->div = div; 286 + pll->mul = mul; 287 + 288 + return 0; 289 + } 290 + 291 + static const struct clk_ops pll_ops = { 292 + .prepare = clk_pll_prepare, 293 + .unprepare = clk_pll_unprepare, 294 + .is_prepared = clk_pll_is_prepared, 295 + .recalc_rate = clk_pll_recalc_rate, 296 + .round_rate = clk_pll_round_rate, 297 + .set_rate = clk_pll_set_rate, 298 + }; 299 + 300 + static struct clk * __init 301 + at91_clk_register_pll(struct at91_pmc *pmc, unsigned int irq, const char *name, 302 + const char *parent_name, u8 id, 303 + const struct clk_pll_layout *layout, 304 + const struct clk_pll_characteristics *characteristics) 305 + { 306 + struct clk_pll *pll; 307 + struct clk *clk = NULL; 308 + struct clk_init_data init; 309 + int ret; 310 + int offset = PLL_REG(id); 311 + u32 tmp; 312 + 313 + if (id > PLL_MAX_ID) 314 + return ERR_PTR(-EINVAL); 315 + 316 + pll = kzalloc(sizeof(*pll), GFP_KERNEL); 317 + if (!pll) 318 + return ERR_PTR(-ENOMEM); 319 + 320 + init.name = name; 321 + init.ops = &pll_ops; 322 + init.parent_names = &parent_name; 323 + init.num_parents = 1; 324 + init.flags = CLK_SET_RATE_GATE; 325 + 326 + pll->id = id; 327 + pll->hw.init = &init; 328 + pll->layout = layout; 329 + pll->characteristics = characteristics; 330 + pll->pmc = pmc; 331 + pll->irq = irq; 332 + tmp = pmc_read(pmc, offset) & layout->pllr_mask; 333 + pll->div = PLL_DIV(tmp); 334 + pll->mul = PLL_MUL(tmp, layout); 335 + init_waitqueue_head(&pll->wait); 336 + irq_set_status_flags(pll->irq, IRQ_NOAUTOEN); 337 + ret = request_irq(pll->irq, clk_pll_irq_handler, IRQF_TRIGGER_HIGH, 338 + id ? "clk-pllb" : "clk-plla", pll); 339 + if (ret) 340 + return ERR_PTR(ret); 341 + 342 + clk = clk_register(NULL, &pll->hw); 343 + if (IS_ERR(clk)) 344 + kfree(pll); 345 + 346 + return clk; 347 + } 348 + 349 + 350 + static const struct clk_pll_layout at91rm9200_pll_layout = { 351 + .pllr_mask = 0x7FFFFFF, 352 + .mul_shift = 16, 353 + .mul_mask = 0x7FF, 354 + }; 355 + 356 + static const struct clk_pll_layout at91sam9g45_pll_layout = { 357 + .pllr_mask = 0xFFFFFF, 358 + .mul_shift = 16, 359 + .mul_mask = 0xFF, 360 + }; 361 + 362 + static const struct clk_pll_layout at91sam9g20_pllb_layout = { 363 + .pllr_mask = 0x3FFFFF, 364 + .mul_shift = 16, 365 + .mul_mask = 0x3F, 366 + }; 367 + 368 + static const struct clk_pll_layout sama5d3_pll_layout = { 369 + .pllr_mask = 0x1FFFFFF, 370 + .mul_shift = 18, 371 + .mul_mask = 0x7F, 372 + }; 373 + 374 + 375 + static struct clk_pll_characteristics * __init 376 + of_at91_clk_pll_get_characteristics(struct device_node *np) 377 + { 378 + int i; 379 + int offset; 380 + u32 tmp; 381 + int num_output; 382 + u32 num_cells; 383 + struct clk_range input; 384 + struct clk_range *output; 385 + u8 *out = NULL; 386 + u16 *icpll = NULL; 387 + struct clk_pll_characteristics *characteristics; 388 + 389 + if (of_at91_get_clk_range(np, "atmel,clk-input-range", &input)) 390 + return NULL; 391 + 392 + if (of_property_read_u32(np, "#atmel,pll-clk-output-range-cells", 393 + &num_cells)) 394 + return NULL; 395 + 396 + if (num_cells < 2 || num_cells > 4) 397 + return NULL; 398 + 399 + if (!of_get_property(np, "atmel,pll-clk-output-ranges", &tmp)) 400 + return NULL; 401 + num_output = tmp / (sizeof(u32) * num_cells); 402 + 403 + characteristics = kzalloc(sizeof(*characteristics), GFP_KERNEL); 404 + if (!characteristics) 405 + return NULL; 406 + 407 + output = kzalloc(sizeof(*output) * num_output, GFP_KERNEL); 408 + if (!output) 409 + goto out_free_characteristics; 410 + 411 + if (num_cells > 2) { 412 + out = kzalloc(sizeof(*out) * num_output, GFP_KERNEL); 413 + if (!out) 414 + goto out_free_output; 415 + } 416 + 417 + if (num_cells > 3) { 418 + icpll = kzalloc(sizeof(*icpll) * num_output, GFP_KERNEL); 419 + if (!icpll) 420 + goto out_free_output; 421 + } 422 + 423 + for (i = 0; i < num_output; i++) { 424 + offset = i * num_cells; 425 + if (of_property_read_u32_index(np, 426 + "atmel,pll-clk-output-ranges", 427 + offset, &tmp)) 428 + goto out_free_output; 429 + output[i].min = tmp; 430 + if (of_property_read_u32_index(np, 431 + "atmel,pll-clk-output-ranges", 432 + offset + 1, &tmp)) 433 + goto out_free_output; 434 + output[i].max = tmp; 435 + 436 + if (num_cells == 2) 437 + continue; 438 + 439 + if (of_property_read_u32_index(np, 440 + "atmel,pll-clk-output-ranges", 441 + offset + 2, &tmp)) 442 + goto out_free_output; 443 + out[i] = tmp; 444 + 445 + if (num_cells == 3) 446 + continue; 447 + 448 + if (of_property_read_u32_index(np, 449 + "atmel,pll-clk-output-ranges", 450 + offset + 3, &tmp)) 451 + goto out_free_output; 452 + icpll[i] = tmp; 453 + } 454 + 455 + characteristics->input = input; 456 + characteristics->num_output = num_output; 457 + characteristics->output = output; 458 + characteristics->out = out; 459 + characteristics->icpll = icpll; 460 + return characteristics; 461 + 462 + out_free_output: 463 + kfree(icpll); 464 + kfree(out); 465 + kfree(output); 466 + out_free_characteristics: 467 + kfree(characteristics); 468 + return NULL; 469 + } 470 + 471 + static void __init 472 + of_at91_clk_pll_setup(struct device_node *np, struct at91_pmc *pmc, 473 + const struct clk_pll_layout *layout) 474 + { 475 + u32 id; 476 + unsigned int irq; 477 + struct clk *clk; 478 + const char *parent_name; 479 + const char *name = np->name; 480 + struct clk_pll_characteristics *characteristics; 481 + 482 + if (of_property_read_u32(np, "reg", &id)) 483 + return; 484 + 485 + parent_name = of_clk_get_parent_name(np, 0); 486 + 487 + of_property_read_string(np, "clock-output-names", &name); 488 + 489 + characteristics = of_at91_clk_pll_get_characteristics(np); 490 + if (!characteristics) 491 + return; 492 + 493 + irq = irq_of_parse_and_map(np, 0); 494 + if (!irq) 495 + return; 496 + 497 + clk = at91_clk_register_pll(pmc, irq, name, parent_name, id, layout, 498 + characteristics); 499 + if (IS_ERR(clk)) 500 + goto out_free_characteristics; 501 + 502 + of_clk_add_provider(np, of_clk_src_simple_get, clk); 503 + return; 504 + 505 + out_free_characteristics: 506 + kfree(characteristics); 507 + } 508 + 509 + void __init of_at91rm9200_clk_pll_setup(struct device_node *np, 510 + struct at91_pmc *pmc) 511 + { 512 + of_at91_clk_pll_setup(np, pmc, &at91rm9200_pll_layout); 513 + } 514 + 515 + void __init of_at91sam9g45_clk_pll_setup(struct device_node *np, 516 + struct at91_pmc *pmc) 517 + { 518 + of_at91_clk_pll_setup(np, pmc, &at91sam9g45_pll_layout); 519 + } 520 + 521 + void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np, 522 + struct at91_pmc *pmc) 523 + { 524 + of_at91_clk_pll_setup(np, pmc, &at91sam9g20_pllb_layout); 525 + } 526 + 527 + void __init of_sama5d3_clk_pll_setup(struct device_node *np, 528 + struct at91_pmc *pmc) 529 + { 530 + of_at91_clk_pll_setup(np, pmc, &sama5d3_pll_layout); 531 + }
+135
drivers/clk/at91/clk-plldiv.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/io.h> 17 + 18 + #include "pmc.h" 19 + 20 + #define to_clk_plldiv(hw) container_of(hw, struct clk_plldiv, hw) 21 + 22 + struct clk_plldiv { 23 + struct clk_hw hw; 24 + struct at91_pmc *pmc; 25 + }; 26 + 27 + static unsigned long clk_plldiv_recalc_rate(struct clk_hw *hw, 28 + unsigned long parent_rate) 29 + { 30 + struct clk_plldiv *plldiv = to_clk_plldiv(hw); 31 + struct at91_pmc *pmc = plldiv->pmc; 32 + 33 + if (pmc_read(pmc, AT91_PMC_MCKR) & AT91_PMC_PLLADIV2) 34 + return parent_rate / 2; 35 + 36 + return parent_rate; 37 + } 38 + 39 + static long clk_plldiv_round_rate(struct clk_hw *hw, unsigned long rate, 40 + unsigned long *parent_rate) 41 + { 42 + unsigned long div; 43 + 44 + if (rate > *parent_rate) 45 + return *parent_rate; 46 + div = *parent_rate / 2; 47 + if (rate < div) 48 + return div; 49 + 50 + if (rate - div < *parent_rate - rate) 51 + return div; 52 + 53 + return *parent_rate; 54 + } 55 + 56 + static int clk_plldiv_set_rate(struct clk_hw *hw, unsigned long rate, 57 + unsigned long parent_rate) 58 + { 59 + struct clk_plldiv *plldiv = to_clk_plldiv(hw); 60 + struct at91_pmc *pmc = plldiv->pmc; 61 + u32 tmp; 62 + 63 + if (parent_rate != rate && (parent_rate / 2) != rate) 64 + return -EINVAL; 65 + 66 + pmc_lock(pmc); 67 + tmp = pmc_read(pmc, AT91_PMC_MCKR) & ~AT91_PMC_PLLADIV2; 68 + if ((parent_rate / 2) == rate) 69 + tmp |= AT91_PMC_PLLADIV2; 70 + pmc_write(pmc, AT91_PMC_MCKR, tmp); 71 + pmc_unlock(pmc); 72 + 73 + return 0; 74 + } 75 + 76 + static const struct clk_ops plldiv_ops = { 77 + .recalc_rate = clk_plldiv_recalc_rate, 78 + .round_rate = clk_plldiv_round_rate, 79 + .set_rate = clk_plldiv_set_rate, 80 + }; 81 + 82 + static struct clk * __init 83 + at91_clk_register_plldiv(struct at91_pmc *pmc, const char *name, 84 + const char *parent_name) 85 + { 86 + struct clk_plldiv *plldiv; 87 + struct clk *clk = NULL; 88 + struct clk_init_data init; 89 + 90 + plldiv = kzalloc(sizeof(*plldiv), GFP_KERNEL); 91 + if (!plldiv) 92 + return ERR_PTR(-ENOMEM); 93 + 94 + init.name = name; 95 + init.ops = &plldiv_ops; 96 + init.parent_names = parent_name ? &parent_name : NULL; 97 + init.num_parents = parent_name ? 1 : 0; 98 + init.flags = CLK_SET_RATE_GATE; 99 + 100 + plldiv->hw.init = &init; 101 + plldiv->pmc = pmc; 102 + 103 + clk = clk_register(NULL, &plldiv->hw); 104 + 105 + if (IS_ERR(clk)) 106 + kfree(plldiv); 107 + 108 + return clk; 109 + } 110 + 111 + static void __init 112 + of_at91_clk_plldiv_setup(struct device_node *np, struct at91_pmc *pmc) 113 + { 114 + struct clk *clk; 115 + const char *parent_name; 116 + const char *name = np->name; 117 + 118 + parent_name = of_clk_get_parent_name(np, 0); 119 + 120 + of_property_read_string(np, "clock-output-names", &name); 121 + 122 + clk = at91_clk_register_plldiv(pmc, name, parent_name); 123 + 124 + if (IS_ERR(clk)) 125 + return; 126 + 127 + of_clk_add_provider(np, of_clk_src_simple_get, clk); 128 + return; 129 + } 130 + 131 + void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np, 132 + struct at91_pmc *pmc) 133 + { 134 + of_at91_clk_plldiv_setup(np, pmc); 135 + }
+366
drivers/clk/at91/clk-programmable.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/of_irq.h> 17 + #include <linux/io.h> 18 + #include <linux/wait.h> 19 + #include <linux/sched.h> 20 + #include <linux/interrupt.h> 21 + #include <linux/irq.h> 22 + 23 + #include "pmc.h" 24 + 25 + #define PROG_SOURCE_MAX 5 26 + #define PROG_ID_MAX 7 27 + 28 + #define PROG_STATUS_MASK(id) (1 << ((id) + 8)) 29 + #define PROG_PRES_MASK 0x7 30 + #define PROG_MAX_RM9200_CSS 3 31 + 32 + struct clk_programmable_layout { 33 + u8 pres_shift; 34 + u8 css_mask; 35 + u8 have_slck_mck; 36 + }; 37 + 38 + struct clk_programmable { 39 + struct clk_hw hw; 40 + struct at91_pmc *pmc; 41 + unsigned int irq; 42 + wait_queue_head_t wait; 43 + u8 id; 44 + u8 css; 45 + u8 pres; 46 + u8 slckmck; 47 + const struct clk_programmable_layout *layout; 48 + }; 49 + 50 + #define to_clk_programmable(hw) container_of(hw, struct clk_programmable, hw) 51 + 52 + 53 + static irqreturn_t clk_programmable_irq_handler(int irq, void *dev_id) 54 + { 55 + struct clk_programmable *prog = (struct clk_programmable *)dev_id; 56 + 57 + wake_up(&prog->wait); 58 + 59 + return IRQ_HANDLED; 60 + } 61 + 62 + static int clk_programmable_prepare(struct clk_hw *hw) 63 + { 64 + u32 tmp; 65 + struct clk_programmable *prog = to_clk_programmable(hw); 66 + struct at91_pmc *pmc = prog->pmc; 67 + const struct clk_programmable_layout *layout = prog->layout; 68 + u8 id = prog->id; 69 + u32 mask = PROG_STATUS_MASK(id); 70 + 71 + tmp = prog->css | (prog->pres << layout->pres_shift); 72 + if (layout->have_slck_mck && prog->slckmck) 73 + tmp |= AT91_PMC_CSSMCK_MCK; 74 + 75 + pmc_write(pmc, AT91_PMC_PCKR(id), tmp); 76 + 77 + while (!(pmc_read(pmc, AT91_PMC_SR) & mask)) 78 + wait_event(prog->wait, pmc_read(pmc, AT91_PMC_SR) & mask); 79 + 80 + return 0; 81 + } 82 + 83 + static int clk_programmable_is_ready(struct clk_hw *hw) 84 + { 85 + struct clk_programmable *prog = to_clk_programmable(hw); 86 + struct at91_pmc *pmc = prog->pmc; 87 + 88 + return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_PCKR(prog->id)); 89 + } 90 + 91 + static unsigned long clk_programmable_recalc_rate(struct clk_hw *hw, 92 + unsigned long parent_rate) 93 + { 94 + u32 tmp; 95 + struct clk_programmable *prog = to_clk_programmable(hw); 96 + struct at91_pmc *pmc = prog->pmc; 97 + const struct clk_programmable_layout *layout = prog->layout; 98 + 99 + tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)); 100 + prog->pres = (tmp >> layout->pres_shift) & PROG_PRES_MASK; 101 + 102 + return parent_rate >> prog->pres; 103 + } 104 + 105 + static long clk_programmable_round_rate(struct clk_hw *hw, unsigned long rate, 106 + unsigned long *parent_rate) 107 + { 108 + unsigned long best_rate = *parent_rate; 109 + unsigned long best_diff; 110 + unsigned long new_diff; 111 + unsigned long cur_rate; 112 + int shift = shift; 113 + 114 + if (rate > *parent_rate) 115 + return *parent_rate; 116 + else 117 + best_diff = *parent_rate - rate; 118 + 119 + if (!best_diff) 120 + return best_rate; 121 + 122 + for (shift = 1; shift < PROG_PRES_MASK; shift++) { 123 + cur_rate = *parent_rate >> shift; 124 + 125 + if (cur_rate > rate) 126 + new_diff = cur_rate - rate; 127 + else 128 + new_diff = rate - cur_rate; 129 + 130 + if (!new_diff) 131 + return cur_rate; 132 + 133 + if (new_diff < best_diff) { 134 + best_diff = new_diff; 135 + best_rate = cur_rate; 136 + } 137 + 138 + if (rate > cur_rate) 139 + break; 140 + } 141 + 142 + return best_rate; 143 + } 144 + 145 + static int clk_programmable_set_parent(struct clk_hw *hw, u8 index) 146 + { 147 + struct clk_programmable *prog = to_clk_programmable(hw); 148 + const struct clk_programmable_layout *layout = prog->layout; 149 + if (index > layout->css_mask) { 150 + if (index > PROG_MAX_RM9200_CSS && layout->have_slck_mck) { 151 + prog->css = 0; 152 + prog->slckmck = 1; 153 + return 0; 154 + } else { 155 + return -EINVAL; 156 + } 157 + } 158 + 159 + prog->css = index; 160 + return 0; 161 + } 162 + 163 + static u8 clk_programmable_get_parent(struct clk_hw *hw) 164 + { 165 + u32 tmp; 166 + u8 ret; 167 + struct clk_programmable *prog = to_clk_programmable(hw); 168 + struct at91_pmc *pmc = prog->pmc; 169 + const struct clk_programmable_layout *layout = prog->layout; 170 + 171 + tmp = pmc_read(pmc, AT91_PMC_PCKR(prog->id)); 172 + prog->css = tmp & layout->css_mask; 173 + ret = prog->css; 174 + if (layout->have_slck_mck) { 175 + prog->slckmck = !!(tmp & AT91_PMC_CSSMCK_MCK); 176 + if (prog->slckmck && !ret) 177 + ret = PROG_MAX_RM9200_CSS + 1; 178 + } 179 + 180 + return ret; 181 + } 182 + 183 + static int clk_programmable_set_rate(struct clk_hw *hw, unsigned long rate, 184 + unsigned long parent_rate) 185 + { 186 + struct clk_programmable *prog = to_clk_programmable(hw); 187 + unsigned long best_rate = parent_rate; 188 + unsigned long best_diff; 189 + unsigned long new_diff; 190 + unsigned long cur_rate; 191 + int shift = 0; 192 + 193 + if (rate > parent_rate) 194 + return parent_rate; 195 + else 196 + best_diff = parent_rate - rate; 197 + 198 + if (!best_diff) { 199 + prog->pres = shift; 200 + return 0; 201 + } 202 + 203 + for (shift = 1; shift < PROG_PRES_MASK; shift++) { 204 + cur_rate = parent_rate >> shift; 205 + 206 + if (cur_rate > rate) 207 + new_diff = cur_rate - rate; 208 + else 209 + new_diff = rate - cur_rate; 210 + 211 + if (!new_diff) 212 + break; 213 + 214 + if (new_diff < best_diff) { 215 + best_diff = new_diff; 216 + best_rate = cur_rate; 217 + } 218 + 219 + if (rate > cur_rate) 220 + break; 221 + } 222 + 223 + prog->pres = shift; 224 + return 0; 225 + } 226 + 227 + static const struct clk_ops programmable_ops = { 228 + .prepare = clk_programmable_prepare, 229 + .is_prepared = clk_programmable_is_ready, 230 + .recalc_rate = clk_programmable_recalc_rate, 231 + .round_rate = clk_programmable_round_rate, 232 + .get_parent = clk_programmable_get_parent, 233 + .set_parent = clk_programmable_set_parent, 234 + .set_rate = clk_programmable_set_rate, 235 + }; 236 + 237 + static struct clk * __init 238 + at91_clk_register_programmable(struct at91_pmc *pmc, unsigned int irq, 239 + const char *name, const char **parent_names, 240 + u8 num_parents, u8 id, 241 + const struct clk_programmable_layout *layout) 242 + { 243 + int ret; 244 + struct clk_programmable *prog; 245 + struct clk *clk = NULL; 246 + struct clk_init_data init; 247 + char irq_name[11]; 248 + 249 + if (id > PROG_ID_MAX) 250 + return ERR_PTR(-EINVAL); 251 + 252 + prog = kzalloc(sizeof(*prog), GFP_KERNEL); 253 + if (!prog) 254 + return ERR_PTR(-ENOMEM); 255 + 256 + init.name = name; 257 + init.ops = &programmable_ops; 258 + init.parent_names = parent_names; 259 + init.num_parents = num_parents; 260 + init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; 261 + 262 + prog->id = id; 263 + prog->layout = layout; 264 + prog->hw.init = &init; 265 + prog->pmc = pmc; 266 + prog->irq = irq; 267 + init_waitqueue_head(&prog->wait); 268 + irq_set_status_flags(prog->irq, IRQ_NOAUTOEN); 269 + snprintf(irq_name, sizeof(irq_name), "clk-prog%d", id); 270 + ret = request_irq(prog->irq, clk_programmable_irq_handler, 271 + IRQF_TRIGGER_HIGH, irq_name, prog); 272 + if (ret) 273 + return ERR_PTR(ret); 274 + 275 + clk = clk_register(NULL, &prog->hw); 276 + if (IS_ERR(clk)) 277 + kfree(prog); 278 + 279 + return clk; 280 + } 281 + 282 + static const struct clk_programmable_layout at91rm9200_programmable_layout = { 283 + .pres_shift = 2, 284 + .css_mask = 0x3, 285 + .have_slck_mck = 0, 286 + }; 287 + 288 + static const struct clk_programmable_layout at91sam9g45_programmable_layout = { 289 + .pres_shift = 2, 290 + .css_mask = 0x3, 291 + .have_slck_mck = 1, 292 + }; 293 + 294 + static const struct clk_programmable_layout at91sam9x5_programmable_layout = { 295 + .pres_shift = 4, 296 + .css_mask = 0x7, 297 + .have_slck_mck = 0, 298 + }; 299 + 300 + static void __init 301 + of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc, 302 + const struct clk_programmable_layout *layout) 303 + { 304 + int num; 305 + u32 id; 306 + int i; 307 + unsigned int irq; 308 + struct clk *clk; 309 + int num_parents; 310 + const char *parent_names[PROG_SOURCE_MAX]; 311 + const char *name; 312 + struct device_node *progclknp; 313 + 314 + num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); 315 + if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX) 316 + return; 317 + 318 + for (i = 0; i < num_parents; ++i) { 319 + parent_names[i] = of_clk_get_parent_name(np, i); 320 + if (!parent_names[i]) 321 + return; 322 + } 323 + 324 + num = of_get_child_count(np); 325 + if (!num || num > (PROG_ID_MAX + 1)) 326 + return; 327 + 328 + for_each_child_of_node(np, progclknp) { 329 + if (of_property_read_u32(progclknp, "reg", &id)) 330 + continue; 331 + 332 + if (of_property_read_string(np, "clock-output-names", &name)) 333 + name = progclknp->name; 334 + 335 + irq = irq_of_parse_and_map(progclknp, 0); 336 + if (!irq) 337 + continue; 338 + 339 + clk = at91_clk_register_programmable(pmc, irq, name, 340 + parent_names, num_parents, 341 + id, layout); 342 + if (IS_ERR(clk)) 343 + continue; 344 + 345 + of_clk_add_provider(progclknp, of_clk_src_simple_get, clk); 346 + } 347 + } 348 + 349 + 350 + void __init of_at91rm9200_clk_prog_setup(struct device_node *np, 351 + struct at91_pmc *pmc) 352 + { 353 + of_at91_clk_prog_setup(np, pmc, &at91rm9200_programmable_layout); 354 + } 355 + 356 + void __init of_at91sam9g45_clk_prog_setup(struct device_node *np, 357 + struct at91_pmc *pmc) 358 + { 359 + of_at91_clk_prog_setup(np, pmc, &at91sam9g45_programmable_layout); 360 + } 361 + 362 + void __init of_at91sam9x5_clk_prog_setup(struct device_node *np, 363 + struct at91_pmc *pmc) 364 + { 365 + of_at91_clk_prog_setup(np, pmc, &at91sam9x5_programmable_layout); 366 + }
+171
drivers/clk/at91/clk-smd.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/io.h> 17 + 18 + #include "pmc.h" 19 + 20 + #define SMD_SOURCE_MAX 2 21 + 22 + #define SMD_DIV_SHIFT 8 23 + #define SMD_MAX_DIV 0xf 24 + 25 + struct at91sam9x5_clk_smd { 26 + struct clk_hw hw; 27 + struct at91_pmc *pmc; 28 + }; 29 + 30 + #define to_at91sam9x5_clk_smd(hw) \ 31 + container_of(hw, struct at91sam9x5_clk_smd, hw) 32 + 33 + static unsigned long at91sam9x5_clk_smd_recalc_rate(struct clk_hw *hw, 34 + unsigned long parent_rate) 35 + { 36 + u32 tmp; 37 + u8 smddiv; 38 + struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); 39 + struct at91_pmc *pmc = smd->pmc; 40 + 41 + tmp = pmc_read(pmc, AT91_PMC_SMD); 42 + smddiv = (tmp & AT91_PMC_SMD_DIV) >> SMD_DIV_SHIFT; 43 + return parent_rate / (smddiv + 1); 44 + } 45 + 46 + static long at91sam9x5_clk_smd_round_rate(struct clk_hw *hw, unsigned long rate, 47 + unsigned long *parent_rate) 48 + { 49 + unsigned long div; 50 + unsigned long bestrate; 51 + unsigned long tmp; 52 + 53 + if (rate >= *parent_rate) 54 + return *parent_rate; 55 + 56 + div = *parent_rate / rate; 57 + if (div > SMD_MAX_DIV) 58 + return *parent_rate / (SMD_MAX_DIV + 1); 59 + 60 + bestrate = *parent_rate / div; 61 + tmp = *parent_rate / (div + 1); 62 + if (bestrate - rate > rate - tmp) 63 + bestrate = tmp; 64 + 65 + return bestrate; 66 + } 67 + 68 + static int at91sam9x5_clk_smd_set_parent(struct clk_hw *hw, u8 index) 69 + { 70 + u32 tmp; 71 + struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); 72 + struct at91_pmc *pmc = smd->pmc; 73 + 74 + if (index > 1) 75 + return -EINVAL; 76 + tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMDS; 77 + if (index) 78 + tmp |= AT91_PMC_SMDS; 79 + pmc_write(pmc, AT91_PMC_SMD, tmp); 80 + return 0; 81 + } 82 + 83 + static u8 at91sam9x5_clk_smd_get_parent(struct clk_hw *hw) 84 + { 85 + struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); 86 + struct at91_pmc *pmc = smd->pmc; 87 + 88 + return pmc_read(pmc, AT91_PMC_SMD) & AT91_PMC_SMDS; 89 + } 90 + 91 + static int at91sam9x5_clk_smd_set_rate(struct clk_hw *hw, unsigned long rate, 92 + unsigned long parent_rate) 93 + { 94 + u32 tmp; 95 + struct at91sam9x5_clk_smd *smd = to_at91sam9x5_clk_smd(hw); 96 + struct at91_pmc *pmc = smd->pmc; 97 + unsigned long div = parent_rate / rate; 98 + 99 + if (parent_rate % rate || div < 1 || div > (SMD_MAX_DIV + 1)) 100 + return -EINVAL; 101 + tmp = pmc_read(pmc, AT91_PMC_SMD) & ~AT91_PMC_SMD_DIV; 102 + tmp |= (div - 1) << SMD_DIV_SHIFT; 103 + pmc_write(pmc, AT91_PMC_SMD, tmp); 104 + 105 + return 0; 106 + } 107 + 108 + static const struct clk_ops at91sam9x5_smd_ops = { 109 + .recalc_rate = at91sam9x5_clk_smd_recalc_rate, 110 + .round_rate = at91sam9x5_clk_smd_round_rate, 111 + .get_parent = at91sam9x5_clk_smd_get_parent, 112 + .set_parent = at91sam9x5_clk_smd_set_parent, 113 + .set_rate = at91sam9x5_clk_smd_set_rate, 114 + }; 115 + 116 + static struct clk * __init 117 + at91sam9x5_clk_register_smd(struct at91_pmc *pmc, const char *name, 118 + const char **parent_names, u8 num_parents) 119 + { 120 + struct at91sam9x5_clk_smd *smd; 121 + struct clk *clk = NULL; 122 + struct clk_init_data init; 123 + 124 + smd = kzalloc(sizeof(*smd), GFP_KERNEL); 125 + if (!smd) 126 + return ERR_PTR(-ENOMEM); 127 + 128 + init.name = name; 129 + init.ops = &at91sam9x5_smd_ops; 130 + init.parent_names = parent_names; 131 + init.num_parents = num_parents; 132 + init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; 133 + 134 + smd->hw.init = &init; 135 + smd->pmc = pmc; 136 + 137 + clk = clk_register(NULL, &smd->hw); 138 + if (IS_ERR(clk)) 139 + kfree(smd); 140 + 141 + return clk; 142 + } 143 + 144 + void __init of_at91sam9x5_clk_smd_setup(struct device_node *np, 145 + struct at91_pmc *pmc) 146 + { 147 + struct clk *clk; 148 + int i; 149 + int num_parents; 150 + const char *parent_names[SMD_SOURCE_MAX]; 151 + const char *name = np->name; 152 + 153 + num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); 154 + if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX) 155 + return; 156 + 157 + for (i = 0; i < num_parents; i++) { 158 + parent_names[i] = of_clk_get_parent_name(np, i); 159 + if (!parent_names[i]) 160 + return; 161 + } 162 + 163 + of_property_read_string(np, "clock-output-names", &name); 164 + 165 + clk = at91sam9x5_clk_register_smd(pmc, name, parent_names, 166 + num_parents); 167 + if (IS_ERR(clk)) 168 + return; 169 + 170 + of_clk_add_provider(np, of_clk_src_simple_get, clk); 171 + }
+135
drivers/clk/at91/clk-system.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/io.h> 17 + 18 + #include "pmc.h" 19 + 20 + #define SYSTEM_MAX_ID 31 21 + 22 + #define SYSTEM_MAX_NAME_SZ 32 23 + 24 + #define to_clk_system(hw) container_of(hw, struct clk_system, hw) 25 + struct clk_system { 26 + struct clk_hw hw; 27 + struct at91_pmc *pmc; 28 + u8 id; 29 + }; 30 + 31 + static int clk_system_enable(struct clk_hw *hw) 32 + { 33 + struct clk_system *sys = to_clk_system(hw); 34 + struct at91_pmc *pmc = sys->pmc; 35 + 36 + pmc_write(pmc, AT91_PMC_SCER, 1 << sys->id); 37 + return 0; 38 + } 39 + 40 + static void clk_system_disable(struct clk_hw *hw) 41 + { 42 + struct clk_system *sys = to_clk_system(hw); 43 + struct at91_pmc *pmc = sys->pmc; 44 + 45 + pmc_write(pmc, AT91_PMC_SCDR, 1 << sys->id); 46 + } 47 + 48 + static int clk_system_is_enabled(struct clk_hw *hw) 49 + { 50 + struct clk_system *sys = to_clk_system(hw); 51 + struct at91_pmc *pmc = sys->pmc; 52 + 53 + return !!(pmc_read(pmc, AT91_PMC_SCSR) & (1 << sys->id)); 54 + } 55 + 56 + static const struct clk_ops system_ops = { 57 + .enable = clk_system_enable, 58 + .disable = clk_system_disable, 59 + .is_enabled = clk_system_is_enabled, 60 + }; 61 + 62 + static struct clk * __init 63 + at91_clk_register_system(struct at91_pmc *pmc, const char *name, 64 + const char *parent_name, u8 id) 65 + { 66 + struct clk_system *sys; 67 + struct clk *clk = NULL; 68 + struct clk_init_data init; 69 + 70 + if (!parent_name || id > SYSTEM_MAX_ID) 71 + return ERR_PTR(-EINVAL); 72 + 73 + sys = kzalloc(sizeof(*sys), GFP_KERNEL); 74 + if (!sys) 75 + return ERR_PTR(-ENOMEM); 76 + 77 + init.name = name; 78 + init.ops = &system_ops; 79 + init.parent_names = &parent_name; 80 + init.num_parents = 1; 81 + /* 82 + * CLK_IGNORE_UNUSED is used to avoid ddrck switch off. 83 + * TODO : we should implement a driver supporting at91 ddr controller 84 + * (see drivers/memory) which would request and enable the ddrck clock. 85 + * When this is done we will be able to remove CLK_IGNORE_UNUSED flag. 86 + */ 87 + init.flags = CLK_IGNORE_UNUSED; 88 + 89 + sys->id = id; 90 + sys->hw.init = &init; 91 + sys->pmc = pmc; 92 + 93 + clk = clk_register(NULL, &sys->hw); 94 + if (IS_ERR(clk)) 95 + kfree(sys); 96 + 97 + return clk; 98 + } 99 + 100 + static void __init 101 + of_at91_clk_sys_setup(struct device_node *np, struct at91_pmc *pmc) 102 + { 103 + int num; 104 + u32 id; 105 + struct clk *clk; 106 + const char *name; 107 + struct device_node *sysclknp; 108 + const char *parent_name; 109 + 110 + num = of_get_child_count(np); 111 + if (num > (SYSTEM_MAX_ID + 1)) 112 + return; 113 + 114 + for_each_child_of_node(np, sysclknp) { 115 + if (of_property_read_u32(sysclknp, "reg", &id)) 116 + continue; 117 + 118 + if (of_property_read_string(np, "clock-output-names", &name)) 119 + name = sysclknp->name; 120 + 121 + parent_name = of_clk_get_parent_name(sysclknp, 0); 122 + 123 + clk = at91_clk_register_system(pmc, name, parent_name, id); 124 + if (IS_ERR(clk)) 125 + continue; 126 + 127 + of_clk_add_provider(sysclknp, of_clk_src_simple_get, clk); 128 + } 129 + } 130 + 131 + void __init of_at91rm9200_clk_sys_setup(struct device_node *np, 132 + struct at91_pmc *pmc) 133 + { 134 + of_at91_clk_sys_setup(np, pmc); 135 + }
+398
drivers/clk/at91/clk-usb.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/io.h> 17 + 18 + #include "pmc.h" 19 + 20 + #define USB_SOURCE_MAX 2 21 + 22 + #define SAM9X5_USB_DIV_SHIFT 8 23 + #define SAM9X5_USB_MAX_DIV 0xf 24 + 25 + #define RM9200_USB_DIV_SHIFT 28 26 + #define RM9200_USB_DIV_TAB_SIZE 4 27 + 28 + struct at91sam9x5_clk_usb { 29 + struct clk_hw hw; 30 + struct at91_pmc *pmc; 31 + }; 32 + 33 + #define to_at91sam9x5_clk_usb(hw) \ 34 + container_of(hw, struct at91sam9x5_clk_usb, hw) 35 + 36 + struct at91rm9200_clk_usb { 37 + struct clk_hw hw; 38 + struct at91_pmc *pmc; 39 + u32 divisors[4]; 40 + }; 41 + 42 + #define to_at91rm9200_clk_usb(hw) \ 43 + container_of(hw, struct at91rm9200_clk_usb, hw) 44 + 45 + static unsigned long at91sam9x5_clk_usb_recalc_rate(struct clk_hw *hw, 46 + unsigned long parent_rate) 47 + { 48 + u32 tmp; 49 + u8 usbdiv; 50 + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); 51 + struct at91_pmc *pmc = usb->pmc; 52 + 53 + tmp = pmc_read(pmc, AT91_PMC_USB); 54 + usbdiv = (tmp & AT91_PMC_OHCIUSBDIV) >> SAM9X5_USB_DIV_SHIFT; 55 + return parent_rate / (usbdiv + 1); 56 + } 57 + 58 + static long at91sam9x5_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, 59 + unsigned long *parent_rate) 60 + { 61 + unsigned long div; 62 + unsigned long bestrate; 63 + unsigned long tmp; 64 + 65 + if (rate >= *parent_rate) 66 + return *parent_rate; 67 + 68 + div = *parent_rate / rate; 69 + if (div >= SAM9X5_USB_MAX_DIV) 70 + return *parent_rate / (SAM9X5_USB_MAX_DIV + 1); 71 + 72 + bestrate = *parent_rate / div; 73 + tmp = *parent_rate / (div + 1); 74 + if (bestrate - rate > rate - tmp) 75 + bestrate = tmp; 76 + 77 + return bestrate; 78 + } 79 + 80 + static int at91sam9x5_clk_usb_set_parent(struct clk_hw *hw, u8 index) 81 + { 82 + u32 tmp; 83 + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); 84 + struct at91_pmc *pmc = usb->pmc; 85 + 86 + if (index > 1) 87 + return -EINVAL; 88 + tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS; 89 + if (index) 90 + tmp |= AT91_PMC_USBS; 91 + pmc_write(pmc, AT91_PMC_USB, tmp); 92 + return 0; 93 + } 94 + 95 + static u8 at91sam9x5_clk_usb_get_parent(struct clk_hw *hw) 96 + { 97 + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); 98 + struct at91_pmc *pmc = usb->pmc; 99 + 100 + return pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS; 101 + } 102 + 103 + static int at91sam9x5_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, 104 + unsigned long parent_rate) 105 + { 106 + u32 tmp; 107 + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); 108 + struct at91_pmc *pmc = usb->pmc; 109 + unsigned long div = parent_rate / rate; 110 + 111 + if (parent_rate % rate || div < 1 || div >= SAM9X5_USB_MAX_DIV) 112 + return -EINVAL; 113 + 114 + tmp = pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_OHCIUSBDIV; 115 + tmp |= (div - 1) << SAM9X5_USB_DIV_SHIFT; 116 + pmc_write(pmc, AT91_PMC_USB, tmp); 117 + 118 + return 0; 119 + } 120 + 121 + static const struct clk_ops at91sam9x5_usb_ops = { 122 + .recalc_rate = at91sam9x5_clk_usb_recalc_rate, 123 + .round_rate = at91sam9x5_clk_usb_round_rate, 124 + .get_parent = at91sam9x5_clk_usb_get_parent, 125 + .set_parent = at91sam9x5_clk_usb_set_parent, 126 + .set_rate = at91sam9x5_clk_usb_set_rate, 127 + }; 128 + 129 + static int at91sam9n12_clk_usb_enable(struct clk_hw *hw) 130 + { 131 + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); 132 + struct at91_pmc *pmc = usb->pmc; 133 + 134 + pmc_write(pmc, AT91_PMC_USB, 135 + pmc_read(pmc, AT91_PMC_USB) | AT91_PMC_USBS); 136 + return 0; 137 + } 138 + 139 + static void at91sam9n12_clk_usb_disable(struct clk_hw *hw) 140 + { 141 + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); 142 + struct at91_pmc *pmc = usb->pmc; 143 + 144 + pmc_write(pmc, AT91_PMC_USB, 145 + pmc_read(pmc, AT91_PMC_USB) & ~AT91_PMC_USBS); 146 + } 147 + 148 + static int at91sam9n12_clk_usb_is_enabled(struct clk_hw *hw) 149 + { 150 + struct at91sam9x5_clk_usb *usb = to_at91sam9x5_clk_usb(hw); 151 + struct at91_pmc *pmc = usb->pmc; 152 + 153 + return !!(pmc_read(pmc, AT91_PMC_USB) & AT91_PMC_USBS); 154 + } 155 + 156 + static const struct clk_ops at91sam9n12_usb_ops = { 157 + .enable = at91sam9n12_clk_usb_enable, 158 + .disable = at91sam9n12_clk_usb_disable, 159 + .is_enabled = at91sam9n12_clk_usb_is_enabled, 160 + .recalc_rate = at91sam9x5_clk_usb_recalc_rate, 161 + .round_rate = at91sam9x5_clk_usb_round_rate, 162 + .set_rate = at91sam9x5_clk_usb_set_rate, 163 + }; 164 + 165 + static struct clk * __init 166 + at91sam9x5_clk_register_usb(struct at91_pmc *pmc, const char *name, 167 + const char **parent_names, u8 num_parents) 168 + { 169 + struct at91sam9x5_clk_usb *usb; 170 + struct clk *clk = NULL; 171 + struct clk_init_data init; 172 + 173 + usb = kzalloc(sizeof(*usb), GFP_KERNEL); 174 + if (!usb) 175 + return ERR_PTR(-ENOMEM); 176 + 177 + init.name = name; 178 + init.ops = &at91sam9x5_usb_ops; 179 + init.parent_names = parent_names; 180 + init.num_parents = num_parents; 181 + init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; 182 + 183 + usb->hw.init = &init; 184 + usb->pmc = pmc; 185 + 186 + clk = clk_register(NULL, &usb->hw); 187 + if (IS_ERR(clk)) 188 + kfree(usb); 189 + 190 + return clk; 191 + } 192 + 193 + static struct clk * __init 194 + at91sam9n12_clk_register_usb(struct at91_pmc *pmc, const char *name, 195 + const char *parent_name) 196 + { 197 + struct at91sam9x5_clk_usb *usb; 198 + struct clk *clk = NULL; 199 + struct clk_init_data init; 200 + 201 + usb = kzalloc(sizeof(*usb), GFP_KERNEL); 202 + if (!usb) 203 + return ERR_PTR(-ENOMEM); 204 + 205 + init.name = name; 206 + init.ops = &at91sam9n12_usb_ops; 207 + init.parent_names = &parent_name; 208 + init.num_parents = 1; 209 + init.flags = CLK_SET_RATE_GATE; 210 + 211 + usb->hw.init = &init; 212 + usb->pmc = pmc; 213 + 214 + clk = clk_register(NULL, &usb->hw); 215 + if (IS_ERR(clk)) 216 + kfree(usb); 217 + 218 + return clk; 219 + } 220 + 221 + static unsigned long at91rm9200_clk_usb_recalc_rate(struct clk_hw *hw, 222 + unsigned long parent_rate) 223 + { 224 + struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw); 225 + struct at91_pmc *pmc = usb->pmc; 226 + u32 tmp; 227 + u8 usbdiv; 228 + 229 + tmp = pmc_read(pmc, AT91_CKGR_PLLBR); 230 + usbdiv = (tmp & AT91_PMC_USBDIV) >> RM9200_USB_DIV_SHIFT; 231 + if (usb->divisors[usbdiv]) 232 + return parent_rate / usb->divisors[usbdiv]; 233 + 234 + return 0; 235 + } 236 + 237 + static long at91rm9200_clk_usb_round_rate(struct clk_hw *hw, unsigned long rate, 238 + unsigned long *parent_rate) 239 + { 240 + struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw); 241 + unsigned long bestrate = 0; 242 + int bestdiff = -1; 243 + unsigned long tmprate; 244 + int tmpdiff; 245 + int i = 0; 246 + 247 + for (i = 0; i < 4; i++) { 248 + if (!usb->divisors[i]) 249 + continue; 250 + tmprate = *parent_rate / usb->divisors[i]; 251 + if (tmprate < rate) 252 + tmpdiff = rate - tmprate; 253 + else 254 + tmpdiff = tmprate - rate; 255 + 256 + if (bestdiff < 0 || bestdiff > tmpdiff) { 257 + bestrate = tmprate; 258 + bestdiff = tmpdiff; 259 + } 260 + 261 + if (!bestdiff) 262 + break; 263 + } 264 + 265 + return bestrate; 266 + } 267 + 268 + static int at91rm9200_clk_usb_set_rate(struct clk_hw *hw, unsigned long rate, 269 + unsigned long parent_rate) 270 + { 271 + u32 tmp; 272 + int i; 273 + struct at91rm9200_clk_usb *usb = to_at91rm9200_clk_usb(hw); 274 + struct at91_pmc *pmc = usb->pmc; 275 + unsigned long div = parent_rate / rate; 276 + 277 + if (parent_rate % rate) 278 + return -EINVAL; 279 + for (i = 0; i < RM9200_USB_DIV_TAB_SIZE; i++) { 280 + if (usb->divisors[i] == div) { 281 + tmp = pmc_read(pmc, AT91_CKGR_PLLBR) & 282 + ~AT91_PMC_USBDIV; 283 + tmp |= i << RM9200_USB_DIV_SHIFT; 284 + pmc_write(pmc, AT91_CKGR_PLLBR, tmp); 285 + return 0; 286 + } 287 + } 288 + 289 + return -EINVAL; 290 + } 291 + 292 + static const struct clk_ops at91rm9200_usb_ops = { 293 + .recalc_rate = at91rm9200_clk_usb_recalc_rate, 294 + .round_rate = at91rm9200_clk_usb_round_rate, 295 + .set_rate = at91rm9200_clk_usb_set_rate, 296 + }; 297 + 298 + static struct clk * __init 299 + at91rm9200_clk_register_usb(struct at91_pmc *pmc, const char *name, 300 + const char *parent_name, const u32 *divisors) 301 + { 302 + struct at91rm9200_clk_usb *usb; 303 + struct clk *clk = NULL; 304 + struct clk_init_data init; 305 + 306 + usb = kzalloc(sizeof(*usb), GFP_KERNEL); 307 + if (!usb) 308 + return ERR_PTR(-ENOMEM); 309 + 310 + init.name = name; 311 + init.ops = &at91rm9200_usb_ops; 312 + init.parent_names = &parent_name; 313 + init.num_parents = 1; 314 + init.flags = 0; 315 + 316 + usb->hw.init = &init; 317 + usb->pmc = pmc; 318 + memcpy(usb->divisors, divisors, sizeof(usb->divisors)); 319 + 320 + clk = clk_register(NULL, &usb->hw); 321 + if (IS_ERR(clk)) 322 + kfree(usb); 323 + 324 + return clk; 325 + } 326 + 327 + void __init of_at91sam9x5_clk_usb_setup(struct device_node *np, 328 + struct at91_pmc *pmc) 329 + { 330 + struct clk *clk; 331 + int i; 332 + int num_parents; 333 + const char *parent_names[USB_SOURCE_MAX]; 334 + const char *name = np->name; 335 + 336 + num_parents = of_count_phandle_with_args(np, "clocks", "#clock-cells"); 337 + if (num_parents <= 0 || num_parents > USB_SOURCE_MAX) 338 + return; 339 + 340 + for (i = 0; i < num_parents; i++) { 341 + parent_names[i] = of_clk_get_parent_name(np, i); 342 + if (!parent_names[i]) 343 + return; 344 + } 345 + 346 + of_property_read_string(np, "clock-output-names", &name); 347 + 348 + clk = at91sam9x5_clk_register_usb(pmc, name, parent_names, num_parents); 349 + if (IS_ERR(clk)) 350 + return; 351 + 352 + of_clk_add_provider(np, of_clk_src_simple_get, clk); 353 + } 354 + 355 + void __init of_at91sam9n12_clk_usb_setup(struct device_node *np, 356 + struct at91_pmc *pmc) 357 + { 358 + struct clk *clk; 359 + const char *parent_name; 360 + const char *name = np->name; 361 + 362 + parent_name = of_clk_get_parent_name(np, 0); 363 + if (!parent_name) 364 + return; 365 + 366 + of_property_read_string(np, "clock-output-names", &name); 367 + 368 + clk = at91sam9n12_clk_register_usb(pmc, name, parent_name); 369 + if (IS_ERR(clk)) 370 + return; 371 + 372 + of_clk_add_provider(np, of_clk_src_simple_get, clk); 373 + } 374 + 375 + void __init of_at91rm9200_clk_usb_setup(struct device_node *np, 376 + struct at91_pmc *pmc) 377 + { 378 + struct clk *clk; 379 + const char *parent_name; 380 + const char *name = np->name; 381 + u32 divisors[4] = {0, 0, 0, 0}; 382 + 383 + parent_name = of_clk_get_parent_name(np, 0); 384 + if (!parent_name) 385 + return; 386 + 387 + of_property_read_u32_array(np, "atmel,clk-divisors", divisors, 4); 388 + if (!divisors[0]) 389 + return; 390 + 391 + of_property_read_string(np, "clock-output-names", &name); 392 + 393 + clk = at91rm9200_clk_register_usb(pmc, name, parent_name, divisors); 394 + if (IS_ERR(clk)) 395 + return; 396 + 397 + of_clk_add_provider(np, of_clk_src_simple_get, clk); 398 + }
+159
drivers/clk/at91/clk-utmi.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/interrupt.h> 15 + #include <linux/irq.h> 16 + #include <linux/of.h> 17 + #include <linux/of_address.h> 18 + #include <linux/of_irq.h> 19 + #include <linux/io.h> 20 + #include <linux/sched.h> 21 + #include <linux/wait.h> 22 + 23 + #include "pmc.h" 24 + 25 + #define UTMI_FIXED_MUL 40 26 + 27 + struct clk_utmi { 28 + struct clk_hw hw; 29 + struct at91_pmc *pmc; 30 + unsigned int irq; 31 + wait_queue_head_t wait; 32 + }; 33 + 34 + #define to_clk_utmi(hw) container_of(hw, struct clk_utmi, hw) 35 + 36 + static irqreturn_t clk_utmi_irq_handler(int irq, void *dev_id) 37 + { 38 + struct clk_utmi *utmi = (struct clk_utmi *)dev_id; 39 + 40 + wake_up(&utmi->wait); 41 + disable_irq_nosync(utmi->irq); 42 + 43 + return IRQ_HANDLED; 44 + } 45 + 46 + static int clk_utmi_prepare(struct clk_hw *hw) 47 + { 48 + struct clk_utmi *utmi = to_clk_utmi(hw); 49 + struct at91_pmc *pmc = utmi->pmc; 50 + u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) | AT91_PMC_UPLLEN | 51 + AT91_PMC_UPLLCOUNT | AT91_PMC_BIASEN; 52 + 53 + pmc_write(pmc, AT91_CKGR_UCKR, tmp); 54 + 55 + while (!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU)) { 56 + enable_irq(utmi->irq); 57 + wait_event(utmi->wait, 58 + pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU); 59 + } 60 + 61 + return 0; 62 + } 63 + 64 + static int clk_utmi_is_prepared(struct clk_hw *hw) 65 + { 66 + struct clk_utmi *utmi = to_clk_utmi(hw); 67 + struct at91_pmc *pmc = utmi->pmc; 68 + 69 + return !!(pmc_read(pmc, AT91_PMC_SR) & AT91_PMC_LOCKU); 70 + } 71 + 72 + static void clk_utmi_unprepare(struct clk_hw *hw) 73 + { 74 + struct clk_utmi *utmi = to_clk_utmi(hw); 75 + struct at91_pmc *pmc = utmi->pmc; 76 + u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) & ~AT91_PMC_UPLLEN; 77 + 78 + pmc_write(pmc, AT91_CKGR_UCKR, tmp); 79 + } 80 + 81 + static unsigned long clk_utmi_recalc_rate(struct clk_hw *hw, 82 + unsigned long parent_rate) 83 + { 84 + /* UTMI clk is a fixed clk multiplier */ 85 + return parent_rate * UTMI_FIXED_MUL; 86 + } 87 + 88 + static const struct clk_ops utmi_ops = { 89 + .prepare = clk_utmi_prepare, 90 + .unprepare = clk_utmi_unprepare, 91 + .is_prepared = clk_utmi_is_prepared, 92 + .recalc_rate = clk_utmi_recalc_rate, 93 + }; 94 + 95 + static struct clk * __init 96 + at91_clk_register_utmi(struct at91_pmc *pmc, unsigned int irq, 97 + const char *name, const char *parent_name) 98 + { 99 + int ret; 100 + struct clk_utmi *utmi; 101 + struct clk *clk = NULL; 102 + struct clk_init_data init; 103 + 104 + utmi = kzalloc(sizeof(*utmi), GFP_KERNEL); 105 + if (!utmi) 106 + return ERR_PTR(-ENOMEM); 107 + 108 + init.name = name; 109 + init.ops = &utmi_ops; 110 + init.parent_names = parent_name ? &parent_name : NULL; 111 + init.num_parents = parent_name ? 1 : 0; 112 + init.flags = CLK_SET_RATE_GATE; 113 + 114 + utmi->hw.init = &init; 115 + utmi->pmc = pmc; 116 + utmi->irq = irq; 117 + init_waitqueue_head(&utmi->wait); 118 + irq_set_status_flags(utmi->irq, IRQ_NOAUTOEN); 119 + ret = request_irq(utmi->irq, clk_utmi_irq_handler, 120 + IRQF_TRIGGER_HIGH, "clk-utmi", utmi); 121 + if (ret) 122 + return ERR_PTR(ret); 123 + 124 + clk = clk_register(NULL, &utmi->hw); 125 + if (IS_ERR(clk)) 126 + kfree(utmi); 127 + 128 + return clk; 129 + } 130 + 131 + static void __init 132 + of_at91_clk_utmi_setup(struct device_node *np, struct at91_pmc *pmc) 133 + { 134 + unsigned int irq; 135 + struct clk *clk; 136 + const char *parent_name; 137 + const char *name = np->name; 138 + 139 + parent_name = of_clk_get_parent_name(np, 0); 140 + 141 + of_property_read_string(np, "clock-output-names", &name); 142 + 143 + irq = irq_of_parse_and_map(np, 0); 144 + if (!irq) 145 + return; 146 + 147 + clk = at91_clk_register_utmi(pmc, irq, name, parent_name); 148 + if (IS_ERR(clk)) 149 + return; 150 + 151 + of_clk_add_provider(np, of_clk_src_simple_get, clk); 152 + return; 153 + } 154 + 155 + void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np, 156 + struct at91_pmc *pmc) 157 + { 158 + of_at91_clk_utmi_setup(np, pmc); 159 + }
+397
drivers/clk/at91/pmc.c
··· 1 + /* 2 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com> 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + */ 10 + 11 + #include <linux/clk-provider.h> 12 + #include <linux/clkdev.h> 13 + #include <linux/clk/at91_pmc.h> 14 + #include <linux/of.h> 15 + #include <linux/of_address.h> 16 + #include <linux/io.h> 17 + #include <linux/interrupt.h> 18 + #include <linux/irq.h> 19 + #include <linux/irqchip/chained_irq.h> 20 + #include <linux/irqdomain.h> 21 + #include <linux/of_irq.h> 22 + 23 + #include <asm/proc-fns.h> 24 + 25 + #include "pmc.h" 26 + 27 + void __iomem *at91_pmc_base; 28 + EXPORT_SYMBOL_GPL(at91_pmc_base); 29 + 30 + void at91sam9_idle(void) 31 + { 32 + at91_pmc_write(AT91_PMC_SCDR, AT91_PMC_PCK); 33 + cpu_do_idle(); 34 + } 35 + 36 + int of_at91_get_clk_range(struct device_node *np, const char *propname, 37 + struct clk_range *range) 38 + { 39 + u32 min, max; 40 + int ret; 41 + 42 + ret = of_property_read_u32_index(np, propname, 0, &min); 43 + if (ret) 44 + return ret; 45 + 46 + ret = of_property_read_u32_index(np, propname, 1, &max); 47 + if (ret) 48 + return ret; 49 + 50 + if (range) { 51 + range->min = min; 52 + range->max = max; 53 + } 54 + 55 + return 0; 56 + } 57 + EXPORT_SYMBOL_GPL(of_at91_get_clk_range); 58 + 59 + static void pmc_irq_mask(struct irq_data *d) 60 + { 61 + struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); 62 + 63 + pmc_write(pmc, AT91_PMC_IDR, 1 << d->hwirq); 64 + } 65 + 66 + static void pmc_irq_unmask(struct irq_data *d) 67 + { 68 + struct at91_pmc *pmc = irq_data_get_irq_chip_data(d); 69 + 70 + pmc_write(pmc, AT91_PMC_IER, 1 << d->hwirq); 71 + } 72 + 73 + static int pmc_irq_set_type(struct irq_data *d, unsigned type) 74 + { 75 + if (type != IRQ_TYPE_LEVEL_HIGH) { 76 + pr_warn("PMC: type not supported (support only IRQ_TYPE_LEVEL_HIGH type)\n"); 77 + return -EINVAL; 78 + } 79 + 80 + return 0; 81 + } 82 + 83 + static struct irq_chip pmc_irq = { 84 + .name = "PMC", 85 + .irq_disable = pmc_irq_mask, 86 + .irq_mask = pmc_irq_mask, 87 + .irq_unmask = pmc_irq_unmask, 88 + .irq_set_type = pmc_irq_set_type, 89 + }; 90 + 91 + static struct lock_class_key pmc_lock_class; 92 + 93 + static int pmc_irq_map(struct irq_domain *h, unsigned int virq, 94 + irq_hw_number_t hw) 95 + { 96 + struct at91_pmc *pmc = h->host_data; 97 + 98 + irq_set_lockdep_class(virq, &pmc_lock_class); 99 + 100 + irq_set_chip_and_handler(virq, &pmc_irq, 101 + handle_level_irq); 102 + set_irq_flags(virq, IRQF_VALID); 103 + irq_set_chip_data(virq, pmc); 104 + 105 + return 0; 106 + } 107 + 108 + static int pmc_irq_domain_xlate(struct irq_domain *d, 109 + struct device_node *ctrlr, 110 + const u32 *intspec, unsigned int intsize, 111 + irq_hw_number_t *out_hwirq, 112 + unsigned int *out_type) 113 + { 114 + struct at91_pmc *pmc = d->host_data; 115 + const struct at91_pmc_caps *caps = pmc->caps; 116 + 117 + if (WARN_ON(intsize < 1)) 118 + return -EINVAL; 119 + 120 + *out_hwirq = intspec[0]; 121 + 122 + if (!(caps->available_irqs & (1 << *out_hwirq))) 123 + return -EINVAL; 124 + 125 + *out_type = IRQ_TYPE_LEVEL_HIGH; 126 + 127 + return 0; 128 + } 129 + 130 + static struct irq_domain_ops pmc_irq_ops = { 131 + .map = pmc_irq_map, 132 + .xlate = pmc_irq_domain_xlate, 133 + }; 134 + 135 + static irqreturn_t pmc_irq_handler(int irq, void *data) 136 + { 137 + struct at91_pmc *pmc = (struct at91_pmc *)data; 138 + unsigned long sr; 139 + int n; 140 + 141 + sr = pmc_read(pmc, AT91_PMC_SR) & pmc_read(pmc, AT91_PMC_IMR); 142 + if (!sr) 143 + return IRQ_NONE; 144 + 145 + for_each_set_bit(n, &sr, BITS_PER_LONG) 146 + generic_handle_irq(irq_find_mapping(pmc->irqdomain, n)); 147 + 148 + return IRQ_HANDLED; 149 + } 150 + 151 + static const struct at91_pmc_caps at91rm9200_caps = { 152 + .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB | 153 + AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY | 154 + AT91_PMC_PCK1RDY | AT91_PMC_PCK2RDY | 155 + AT91_PMC_PCK3RDY, 156 + }; 157 + 158 + static const struct at91_pmc_caps at91sam9260_caps = { 159 + .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB | 160 + AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY | 161 + AT91_PMC_PCK1RDY, 162 + }; 163 + 164 + static const struct at91_pmc_caps at91sam9g45_caps = { 165 + .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | 166 + AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | 167 + AT91_PMC_PCK1RDY, 168 + }; 169 + 170 + static const struct at91_pmc_caps at91sam9n12_caps = { 171 + .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_LOCKB | 172 + AT91_PMC_MCKRDY | AT91_PMC_PCK0RDY | 173 + AT91_PMC_PCK1RDY | AT91_PMC_MOSCSELS | 174 + AT91_PMC_MOSCRCS | AT91_PMC_CFDEV, 175 + }; 176 + 177 + static const struct at91_pmc_caps at91sam9x5_caps = { 178 + .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | 179 + AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | 180 + AT91_PMC_PCK1RDY | AT91_PMC_MOSCSELS | 181 + AT91_PMC_MOSCRCS | AT91_PMC_CFDEV, 182 + }; 183 + 184 + static const struct at91_pmc_caps sama5d3_caps = { 185 + .available_irqs = AT91_PMC_MOSCS | AT91_PMC_LOCKA | AT91_PMC_MCKRDY | 186 + AT91_PMC_LOCKU | AT91_PMC_PCK0RDY | 187 + AT91_PMC_PCK1RDY | AT91_PMC_PCK2RDY | 188 + AT91_PMC_MOSCSELS | AT91_PMC_MOSCRCS | 189 + AT91_PMC_CFDEV, 190 + }; 191 + 192 + static struct at91_pmc *__init at91_pmc_init(struct device_node *np, 193 + void __iomem *regbase, int virq, 194 + const struct at91_pmc_caps *caps) 195 + { 196 + struct at91_pmc *pmc; 197 + 198 + if (!regbase || !virq || !caps) 199 + return NULL; 200 + 201 + at91_pmc_base = regbase; 202 + 203 + pmc = kzalloc(sizeof(*pmc), GFP_KERNEL); 204 + if (!pmc) 205 + return NULL; 206 + 207 + spin_lock_init(&pmc->lock); 208 + pmc->regbase = regbase; 209 + pmc->virq = virq; 210 + pmc->caps = caps; 211 + 212 + pmc->irqdomain = irq_domain_add_linear(np, 32, &pmc_irq_ops, pmc); 213 + 214 + if (!pmc->irqdomain) 215 + goto out_free_pmc; 216 + 217 + pmc_write(pmc, AT91_PMC_IDR, 0xffffffff); 218 + if (request_irq(pmc->virq, pmc_irq_handler, IRQF_SHARED, "pmc", pmc)) 219 + goto out_remove_irqdomain; 220 + 221 + return pmc; 222 + 223 + out_remove_irqdomain: 224 + irq_domain_remove(pmc->irqdomain); 225 + out_free_pmc: 226 + kfree(pmc); 227 + 228 + return NULL; 229 + } 230 + 231 + static const struct of_device_id pmc_clk_ids[] __initdata = { 232 + /* Main clock */ 233 + { 234 + .compatible = "atmel,at91rm9200-clk-main", 235 + .data = of_at91rm9200_clk_main_setup, 236 + }, 237 + /* PLL clocks */ 238 + { 239 + .compatible = "atmel,at91rm9200-clk-pll", 240 + .data = of_at91rm9200_clk_pll_setup, 241 + }, 242 + { 243 + .compatible = "atmel,at91sam9g45-clk-pll", 244 + .data = of_at91sam9g45_clk_pll_setup, 245 + }, 246 + { 247 + .compatible = "atmel,at91sam9g20-clk-pllb", 248 + .data = of_at91sam9g20_clk_pllb_setup, 249 + }, 250 + { 251 + .compatible = "atmel,sama5d3-clk-pll", 252 + .data = of_sama5d3_clk_pll_setup, 253 + }, 254 + { 255 + .compatible = "atmel,at91sam9x5-clk-plldiv", 256 + .data = of_at91sam9x5_clk_plldiv_setup, 257 + }, 258 + /* Master clock */ 259 + { 260 + .compatible = "atmel,at91rm9200-clk-master", 261 + .data = of_at91rm9200_clk_master_setup, 262 + }, 263 + { 264 + .compatible = "atmel,at91sam9x5-clk-master", 265 + .data = of_at91sam9x5_clk_master_setup, 266 + }, 267 + /* System clocks */ 268 + { 269 + .compatible = "atmel,at91rm9200-clk-system", 270 + .data = of_at91rm9200_clk_sys_setup, 271 + }, 272 + /* Peripheral clocks */ 273 + { 274 + .compatible = "atmel,at91rm9200-clk-peripheral", 275 + .data = of_at91rm9200_clk_periph_setup, 276 + }, 277 + { 278 + .compatible = "atmel,at91sam9x5-clk-peripheral", 279 + .data = of_at91sam9x5_clk_periph_setup, 280 + }, 281 + /* Programmable clocks */ 282 + #if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS) 283 + { 284 + .compatible = "atmel,at91rm9200-clk-programmable", 285 + .data = of_at91rm9200_clk_prog_setup, 286 + }, 287 + { 288 + .compatible = "atmel,at91sam9g45-clk-programmable", 289 + .data = of_at91sam9g45_clk_prog_setup, 290 + }, 291 + { 292 + .compatible = "atmel,at91sam9x5-clk-programmable", 293 + .data = of_at91sam9x5_clk_prog_setup, 294 + }, 295 + #endif 296 + /* UTMI clock */ 297 + #if defined(CONFIG_HAVE_AT91_UTMI) 298 + { 299 + .compatible = "atmel,at91sam9x5-clk-utmi", 300 + .data = of_at91sam9x5_clk_utmi_setup, 301 + }, 302 + #endif 303 + /* USB clock */ 304 + #if defined(CONFIG_HAVE_AT91_USB_CLK) 305 + { 306 + .compatible = "atmel,at91rm9200-clk-usb", 307 + .data = of_at91rm9200_clk_usb_setup, 308 + }, 309 + { 310 + .compatible = "atmel,at91sam9x5-clk-usb", 311 + .data = of_at91sam9x5_clk_usb_setup, 312 + }, 313 + { 314 + .compatible = "atmel,at91sam9n12-clk-usb", 315 + .data = of_at91sam9n12_clk_usb_setup, 316 + }, 317 + #endif 318 + /* SMD clock */ 319 + #if defined(CONFIG_HAVE_AT91_SMD) 320 + { 321 + .compatible = "atmel,at91sam9x5-clk-smd", 322 + .data = of_at91sam9x5_clk_smd_setup, 323 + }, 324 + #endif 325 + { /*sentinel*/ } 326 + }; 327 + 328 + static void __init of_at91_pmc_setup(struct device_node *np, 329 + const struct at91_pmc_caps *caps) 330 + { 331 + struct at91_pmc *pmc; 332 + struct device_node *childnp; 333 + void (*clk_setup)(struct device_node *, struct at91_pmc *); 334 + const struct of_device_id *clk_id; 335 + void __iomem *regbase = of_iomap(np, 0); 336 + int virq; 337 + 338 + if (!regbase) 339 + return; 340 + 341 + virq = irq_of_parse_and_map(np, 0); 342 + if (!virq) 343 + return; 344 + 345 + pmc = at91_pmc_init(np, regbase, virq, caps); 346 + if (!pmc) 347 + return; 348 + for_each_child_of_node(np, childnp) { 349 + clk_id = of_match_node(pmc_clk_ids, childnp); 350 + if (!clk_id) 351 + continue; 352 + clk_setup = clk_id->data; 353 + clk_setup(childnp, pmc); 354 + } 355 + } 356 + 357 + static void __init of_at91rm9200_pmc_setup(struct device_node *np) 358 + { 359 + of_at91_pmc_setup(np, &at91rm9200_caps); 360 + } 361 + CLK_OF_DECLARE(at91rm9200_clk_pmc, "atmel,at91rm9200-pmc", 362 + of_at91rm9200_pmc_setup); 363 + 364 + static void __init of_at91sam9260_pmc_setup(struct device_node *np) 365 + { 366 + of_at91_pmc_setup(np, &at91sam9260_caps); 367 + } 368 + CLK_OF_DECLARE(at91sam9260_clk_pmc, "atmel,at91sam9260-pmc", 369 + of_at91sam9260_pmc_setup); 370 + 371 + static void __init of_at91sam9g45_pmc_setup(struct device_node *np) 372 + { 373 + of_at91_pmc_setup(np, &at91sam9g45_caps); 374 + } 375 + CLK_OF_DECLARE(at91sam9g45_clk_pmc, "atmel,at91sam9g45-pmc", 376 + of_at91sam9g45_pmc_setup); 377 + 378 + static void __init of_at91sam9n12_pmc_setup(struct device_node *np) 379 + { 380 + of_at91_pmc_setup(np, &at91sam9n12_caps); 381 + } 382 + CLK_OF_DECLARE(at91sam9n12_clk_pmc, "atmel,at91sam9n12-pmc", 383 + of_at91sam9n12_pmc_setup); 384 + 385 + static void __init of_at91sam9x5_pmc_setup(struct device_node *np) 386 + { 387 + of_at91_pmc_setup(np, &at91sam9x5_caps); 388 + } 389 + CLK_OF_DECLARE(at91sam9x5_clk_pmc, "atmel,at91sam9x5-pmc", 390 + of_at91sam9x5_pmc_setup); 391 + 392 + static void __init of_sama5d3_pmc_setup(struct device_node *np) 393 + { 394 + of_at91_pmc_setup(np, &sama5d3_caps); 395 + } 396 + CLK_OF_DECLARE(sama5d3_clk_pmc, "atmel,sama5d3-pmc", 397 + of_sama5d3_pmc_setup);
+116
drivers/clk/at91/pmc.h
··· 1 + /* 2 + * drivers/clk/at91/pmc.h 3 + * 4 + * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.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 + 12 + #ifndef __PMC_H_ 13 + #define __PMC_H_ 14 + 15 + #include <linux/io.h> 16 + #include <linux/irqdomain.h> 17 + #include <linux/spinlock.h> 18 + 19 + struct clk_range { 20 + unsigned long min; 21 + unsigned long max; 22 + }; 23 + 24 + #define CLK_RANGE(MIN, MAX) {.min = MIN, .max = MAX,} 25 + 26 + struct at91_pmc_caps { 27 + u32 available_irqs; 28 + }; 29 + 30 + struct at91_pmc { 31 + void __iomem *regbase; 32 + int virq; 33 + spinlock_t lock; 34 + const struct at91_pmc_caps *caps; 35 + struct irq_domain *irqdomain; 36 + }; 37 + 38 + static inline void pmc_lock(struct at91_pmc *pmc) 39 + { 40 + spin_lock(&pmc->lock); 41 + } 42 + 43 + static inline void pmc_unlock(struct at91_pmc *pmc) 44 + { 45 + spin_unlock(&pmc->lock); 46 + } 47 + 48 + static inline u32 pmc_read(struct at91_pmc *pmc, int offset) 49 + { 50 + return readl(pmc->regbase + offset); 51 + } 52 + 53 + static inline void pmc_write(struct at91_pmc *pmc, int offset, u32 value) 54 + { 55 + writel(value, pmc->regbase + offset); 56 + } 57 + 58 + int of_at91_get_clk_range(struct device_node *np, const char *propname, 59 + struct clk_range *range); 60 + 61 + extern void __init of_at91rm9200_clk_main_setup(struct device_node *np, 62 + struct at91_pmc *pmc); 63 + 64 + extern void __init of_at91rm9200_clk_pll_setup(struct device_node *np, 65 + struct at91_pmc *pmc); 66 + extern void __init of_at91sam9g45_clk_pll_setup(struct device_node *np, 67 + struct at91_pmc *pmc); 68 + extern void __init of_at91sam9g20_clk_pllb_setup(struct device_node *np, 69 + struct at91_pmc *pmc); 70 + extern void __init of_sama5d3_clk_pll_setup(struct device_node *np, 71 + struct at91_pmc *pmc); 72 + extern void __init of_at91sam9x5_clk_plldiv_setup(struct device_node *np, 73 + struct at91_pmc *pmc); 74 + 75 + extern void __init of_at91rm9200_clk_master_setup(struct device_node *np, 76 + struct at91_pmc *pmc); 77 + extern void __init of_at91sam9x5_clk_master_setup(struct device_node *np, 78 + struct at91_pmc *pmc); 79 + 80 + extern void __init of_at91rm9200_clk_sys_setup(struct device_node *np, 81 + struct at91_pmc *pmc); 82 + 83 + extern void __init of_at91rm9200_clk_periph_setup(struct device_node *np, 84 + struct at91_pmc *pmc); 85 + extern void __init of_at91sam9x5_clk_periph_setup(struct device_node *np, 86 + struct at91_pmc *pmc); 87 + 88 + #if defined(CONFIG_AT91_PROGRAMMABLE_CLOCKS) 89 + extern void __init of_at91rm9200_clk_prog_setup(struct device_node *np, 90 + struct at91_pmc *pmc); 91 + extern void __init of_at91sam9g45_clk_prog_setup(struct device_node *np, 92 + struct at91_pmc *pmc); 93 + extern void __init of_at91sam9x5_clk_prog_setup(struct device_node *np, 94 + struct at91_pmc *pmc); 95 + #endif 96 + 97 + #if defined(CONFIG_HAVE_AT91_UTMI) 98 + extern void __init of_at91sam9x5_clk_utmi_setup(struct device_node *np, 99 + struct at91_pmc *pmc); 100 + #endif 101 + 102 + #if defined(CONFIG_HAVE_AT91_USB_CLK) 103 + extern void __init of_at91rm9200_clk_usb_setup(struct device_node *np, 104 + struct at91_pmc *pmc); 105 + extern void __init of_at91sam9x5_clk_usb_setup(struct device_node *np, 106 + struct at91_pmc *pmc); 107 + extern void __init of_at91sam9n12_clk_usb_setup(struct device_node *np, 108 + struct at91_pmc *pmc); 109 + #endif 110 + 111 + #if defined(CONFIG_HAVE_AT91_SMD) 112 + extern void __init of_at91sam9x5_clk_smd_setup(struct device_node *np, 113 + struct at91_pmc *pmc); 114 + #endif 115 + 116 + #endif /* __PMC_H_ */
+22 -23
drivers/mmc/host/omap.c
··· 22 22 #include <linux/delay.h> 23 23 #include <linux/spinlock.h> 24 24 #include <linux/timer.h> 25 + #include <linux/of.h> 25 26 #include <linux/omap-dma.h> 26 27 #include <linux/mmc/host.h> 27 28 #include <linux/mmc/card.h> ··· 90 89 #define OMAP_MMC_CMDTYPE_BCR 1 91 90 #define OMAP_MMC_CMDTYPE_AC 2 92 91 #define OMAP_MMC_CMDTYPE_ADTC 3 93 - 94 - #define OMAP_DMA_MMC_TX 21 95 - #define OMAP_DMA_MMC_RX 22 96 - #define OMAP_DMA_MMC2_TX 54 97 - #define OMAP_DMA_MMC2_RX 55 98 - 99 - #define OMAP24XX_DMA_MMC2_TX 47 100 - #define OMAP24XX_DMA_MMC2_RX 48 101 - #define OMAP24XX_DMA_MMC1_TX 61 102 - #define OMAP24XX_DMA_MMC1_RX 62 103 - 104 92 105 93 #define DRIVER_NAME "mmci-omap" 106 94 ··· 1320 1330 struct mmc_omap_host *host = NULL; 1321 1331 struct resource *res; 1322 1332 dma_cap_mask_t mask; 1323 - unsigned sig; 1333 + unsigned sig = 0; 1324 1334 int i, ret = 0; 1325 1335 int irq; 1326 1336 ··· 1330 1340 } 1331 1341 if (pdata->nr_slots == 0) { 1332 1342 dev_err(&pdev->dev, "no slots\n"); 1333 - return -ENXIO; 1343 + return -EPROBE_DEFER; 1334 1344 } 1335 1345 1336 1346 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 1397 1407 host->dma_tx_burst = -1; 1398 1408 host->dma_rx_burst = -1; 1399 1409 1400 - if (mmc_omap2()) 1401 - sig = host->id == 0 ? OMAP24XX_DMA_MMC1_TX : OMAP24XX_DMA_MMC2_TX; 1402 - else 1403 - sig = host->id == 0 ? OMAP_DMA_MMC_TX : OMAP_DMA_MMC2_TX; 1404 - host->dma_tx = dma_request_channel(mask, omap_dma_filter_fn, &sig); 1410 + res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx"); 1411 + if (res) 1412 + sig = res->start; 1413 + host->dma_tx = dma_request_slave_channel_compat(mask, 1414 + omap_dma_filter_fn, &sig, &pdev->dev, "tx"); 1405 1415 if (!host->dma_tx) 1406 1416 dev_warn(host->dev, "unable to obtain TX DMA engine channel %u\n", 1407 1417 sig); 1408 - if (mmc_omap2()) 1409 - sig = host->id == 0 ? OMAP24XX_DMA_MMC1_RX : OMAP24XX_DMA_MMC2_RX; 1410 - else 1411 - sig = host->id == 0 ? OMAP_DMA_MMC_RX : OMAP_DMA_MMC2_RX; 1412 - host->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); 1418 + 1419 + res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "rx"); 1420 + if (res) 1421 + sig = res->start; 1422 + host->dma_rx = dma_request_slave_channel_compat(mask, 1423 + omap_dma_filter_fn, &sig, &pdev->dev, "rx"); 1413 1424 if (!host->dma_rx) 1414 1425 dev_warn(host->dev, "unable to obtain RX DMA engine channel %u\n", 1415 1426 sig); ··· 1503 1512 return 0; 1504 1513 } 1505 1514 1515 + #if IS_BUILTIN(CONFIG_OF) 1516 + static const struct of_device_id mmc_omap_match[] = { 1517 + { .compatible = "ti,omap2420-mmc", }, 1518 + { }, 1519 + }; 1520 + #endif 1521 + 1506 1522 static struct platform_driver mmc_omap_driver = { 1507 1523 .probe = mmc_omap_probe, 1508 1524 .remove = mmc_omap_remove, 1509 1525 .driver = { 1510 1526 .name = DRIVER_NAME, 1511 1527 .owner = THIS_MODULE, 1528 + .of_match_table = of_match_ptr(mmc_omap_match), 1512 1529 }, 1513 1530 }; 1514 1531
+1 -1
drivers/usb/gadget/atmel_usba_udc.c
··· 326 326 327 327 #if defined(CONFIG_ARCH_AT91SAM9RL) 328 328 329 - #include <mach/at91_pmc.h> 329 + #include <linux/clk/at91_pmc.h> 330 330 331 331 static void toggle_bias(int is_on) 332 332 {
+22
include/dt-bindings/clk/at91.h
··· 1 + /* 2 + * This header provides constants for AT91 pmc status. 3 + * 4 + * The constants defined in this header are being used in dts. 5 + * 6 + * Licensed under GPLv2 or later. 7 + */ 8 + 9 + #ifndef _DT_BINDINGS_CLK_AT91_H 10 + #define _DT_BINDINGS_CLK_AT91_H 11 + 12 + #define AT91_PMC_MOSCS 0 /* MOSCS Flag */ 13 + #define AT91_PMC_LOCKA 1 /* PLLA Lock */ 14 + #define AT91_PMC_LOCKB 2 /* PLLB Lock */ 15 + #define AT91_PMC_MCKRDY 3 /* Master Clock */ 16 + #define AT91_PMC_LOCKU 6 /* UPLL Lock */ 17 + #define AT91_PMC_PCKRDY(id) (8 + (id)) /* Programmable Clock */ 18 + #define AT91_PMC_MOSCSELS 16 /* Main Oscillator Selection */ 19 + #define AT91_PMC_MOSCRCS 17 /* Main On-Chip RC */ 20 + #define AT91_PMC_CFDEV 18 /* Clock Failure Detector Event */ 21 + 22 + #endif